// 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" ) // SentryBootstrapAgentSpec sentry bootstrap agent spec // // swagger:model sentryBootstrapAgentSpec type SentryBootstrapAgentSpec struct { // agent mode AgentMode *SentryBootstrapAgentMode `json:"agentMode,omitempty"` // template ref TemplateRef string `json:"templateRef,omitempty"` // token Token string `json:"token,omitempty"` } // Validate validates this sentry bootstrap agent spec func (m *SentryBootstrapAgentSpec) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAgentMode(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SentryBootstrapAgentSpec) validateAgentMode(formats strfmt.Registry) error { if swag.IsZero(m.AgentMode) { // not required return nil } if m.AgentMode != nil { if err := m.AgentMode.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("agentMode") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("agentMode") } return err } } return nil } // ContextValidate validate this sentry bootstrap agent spec based on the context it is used func (m *SentryBootstrapAgentSpec) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAgentMode(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SentryBootstrapAgentSpec) contextValidateAgentMode(ctx context.Context, formats strfmt.Registry) error { if m.AgentMode != nil { if err := m.AgentMode.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("agentMode") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("agentMode") } return err } } return nil } // MarshalBinary interface implementation func (m *SentryBootstrapAgentSpec) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SentryBootstrapAgentSpec) UnmarshalBinary(b []byte) error { var res SentryBootstrapAgentSpec if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }