// 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 ( "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ActionToBeSetup action to be setup // // swagger:model ActionToBeSetup type ActionToBeSetup struct { // action definition ActionDefinition ActionDefinition `json:"ActionDefinition,omitempty"` // action ID // Required: true // Maximum: 255 // Minimum: 0 ActionID *int64 `json:"ActionID"` // action type // Required: true // Enum: [insert policy report] ActionType *string `json:"ActionType"` // subsequent action SubsequentAction *SubsequentAction `json:"SubsequentAction,omitempty"` } // Validate validates this action to be setup func (m *ActionToBeSetup) Validate(formats strfmt.Registry) error { var res []error if err := m.validateActionDefinition(formats); err != nil { res = append(res, err) } if err := m.validateActionID(formats); err != nil { res = append(res, err) } if err := m.validateActionType(formats); err != nil { res = append(res, err) } if err := m.validateSubsequentAction(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ActionToBeSetup) validateActionDefinition(formats strfmt.Registry) error { if swag.IsZero(m.ActionDefinition) { // not required return nil } if err := m.ActionDefinition.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ActionDefinition") } return err } return nil } func (m *ActionToBeSetup) validateActionID(formats strfmt.Registry) error { if err := validate.Required("ActionID", "body", m.ActionID); err != nil { return err } if err := validate.MinimumInt("ActionID", "body", int64(*m.ActionID), 0, false); err != nil { return err } if err := validate.MaximumInt("ActionID", "body", int64(*m.ActionID), 255, false); err != nil { return err } return nil } var actionToBeSetupTypeActionTypePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["insert","policy","report"]`), &res); err != nil { panic(err) } for _, v := range res { actionToBeSetupTypeActionTypePropEnum = append(actionToBeSetupTypeActionTypePropEnum, v) } } const ( // ActionToBeSetupActionTypeInsert captures enum value "insert" ActionToBeSetupActionTypeInsert string = "insert" // ActionToBeSetupActionTypePolicy captures enum value "policy" ActionToBeSetupActionTypePolicy string = "policy" // ActionToBeSetupActionTypeReport captures enum value "report" ActionToBeSetupActionTypeReport string = "report" ) // prop value enum func (m *ActionToBeSetup) validateActionTypeEnum(path, location string, value string) error { if err := validate.Enum(path, location, value, actionToBeSetupTypeActionTypePropEnum); err != nil { return err } return nil } func (m *ActionToBeSetup) validateActionType(formats strfmt.Registry) error { if err := validate.Required("ActionType", "body", m.ActionType); err != nil { return err } // value enum if err := m.validateActionTypeEnum("ActionType", "body", *m.ActionType); err != nil { return err } return nil } func (m *ActionToBeSetup) validateSubsequentAction(formats strfmt.Registry) error { if swag.IsZero(m.SubsequentAction) { // not required return nil } if m.SubsequentAction != nil { if err := m.SubsequentAction.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("SubsequentAction") } return err } } return nil } // MarshalBinary interface implementation func (m *ActionToBeSetup) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ActionToBeSetup) UnmarshalBinary(b []byte) error { var res ActionToBeSetup if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }