frostfs-rest-gw/gen/models/action.go
Denis Kirillov 9f752cd756 [#1] Add basic structure and operations
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-04-29 10:20:37 +03:00

78 lines
1.6 KiB
Go

// 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 action
//
// 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
}