This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
frostfs-rest-gw/gen/models/action.go

79 lines
1.7 KiB
Go
Raw Normal View History

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)
// Action Rule execution result action in FrostFS EACL. Either allows or denies access if the rule's filters match.
//
// swagger:model Action
type Action string
func NewAction(value Action) *Action {
return &value
}
// Pointer returns a pointer to a freshly-allocated Action.
func (m Action) Pointer() *Action {
return &m
}
const (
// ActionALLOW captures enum value "ALLOW"
ActionALLOW Action = "ALLOW"
// ActionDENY captures enum value "DENY"
ActionDENY Action = "DENY"
)
// for schema
var actionEnum []interface{}
func init() {
var res []Action
if err := json.Unmarshal([]byte(`["ALLOW","DENY"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
actionEnum = append(actionEnum, v)
}
}
func (m Action) validateActionEnum(path, location string, value Action) error {
if err := validate.EnumCase(path, location, value, actionEnum, true); err != nil {
return err
}
return nil
}
// Validate validates this action
func (m Action) Validate(formats strfmt.Registry) error {
var res []error
// value enum
if err := m.validateActionEnum("", "body", m); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// ContextValidate validates this action based on context it is used
func (m Action) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}