forked from TrueCloudLab/frostfs-rest-gw
47e061a440
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
84 lines
1.7 KiB
Go
84 lines
1.7 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"
|
|
)
|
|
|
|
// Role Role for target in EACL.
|
|
//
|
|
// swagger:model Role
|
|
type Role string
|
|
|
|
func NewRole(value Role) *Role {
|
|
return &value
|
|
}
|
|
|
|
// Pointer returns a pointer to a freshly-allocated Role.
|
|
func (m Role) Pointer() *Role {
|
|
return &m
|
|
}
|
|
|
|
const (
|
|
|
|
// RoleUSER captures enum value "USER"
|
|
RoleUSER Role = "USER"
|
|
|
|
// RoleSYSTEM captures enum value "SYSTEM"
|
|
RoleSYSTEM Role = "SYSTEM"
|
|
|
|
// RoleOTHERS captures enum value "OTHERS"
|
|
RoleOTHERS Role = "OTHERS"
|
|
|
|
// RoleKEYS captures enum value "KEYS"
|
|
RoleKEYS Role = "KEYS"
|
|
)
|
|
|
|
// for schema
|
|
var roleEnum []interface{}
|
|
|
|
func init() {
|
|
var res []Role
|
|
if err := json.Unmarshal([]byte(`["USER","SYSTEM","OTHERS","KEYS"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
roleEnum = append(roleEnum, v)
|
|
}
|
|
}
|
|
|
|
func (m Role) validateRoleEnum(path, location string, value Role) error {
|
|
if err := validate.EnumCase(path, location, value, roleEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Validate validates this role
|
|
func (m Role) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// value enum
|
|
if err := m.validateRoleEnum("", "body", m); err != nil {
|
|
return err
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this role based on context it is used
|
|
func (m Role) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|