// 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" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Rule rule // // swagger:model Rule type Rule struct { // container Id ContainerID string `json:"containerId,omitempty"` // verb // Required: true Verb *Verb `json:"verb"` } // Validate validates this rule func (m *Rule) Validate(formats strfmt.Registry) error { var res []error if err := m.validateVerb(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Rule) validateVerb(formats strfmt.Registry) error { if err := validate.Required("verb", "body", m.Verb); err != nil { return err } if err := validate.Required("verb", "body", m.Verb); err != nil { return err } if m.Verb != nil { if err := m.Verb.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("verb") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("verb") } return err } } return nil } // ContextValidate validate this rule based on the context it is used func (m *Rule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateVerb(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Rule) contextValidateVerb(ctx context.Context, formats strfmt.Registry) error { if m.Verb != nil { if err := m.Verb.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("verb") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("verb") } return err } } return nil } // MarshalBinary interface implementation func (m *Rule) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Rule) UnmarshalBinary(b []byte) error { var res Rule if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }