github.com/percona/percona-xtradb-cluster-operator@v1.14.0/version/client/models/version_operator_version.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/strfmt" 13 "github.com/go-openapi/swag" 14 ) 15 16 // VersionOperatorVersion OperatorVersion represents operator version. 17 // 18 // swagger:model versionOperatorVersion 19 type VersionOperatorVersion struct { 20 21 // matrix 22 Matrix *VersionVersionMatrix `json:"matrix,omitempty"` 23 24 // operator 25 Operator string `json:"operator,omitempty"` 26 27 // product 28 Product string `json:"product,omitempty"` 29 } 30 31 // Validate validates this version operator version 32 func (m *VersionOperatorVersion) Validate(formats strfmt.Registry) error { 33 var res []error 34 35 if err := m.validateMatrix(formats); err != nil { 36 res = append(res, err) 37 } 38 39 if len(res) > 0 { 40 return errors.CompositeValidationError(res...) 41 } 42 return nil 43 } 44 45 func (m *VersionOperatorVersion) validateMatrix(formats strfmt.Registry) error { 46 if swag.IsZero(m.Matrix) { // not required 47 return nil 48 } 49 50 if m.Matrix != nil { 51 if err := m.Matrix.Validate(formats); err != nil { 52 if ve, ok := err.(*errors.Validation); ok { 53 return ve.ValidateName("matrix") 54 } else if ce, ok := err.(*errors.CompositeError); ok { 55 return ce.ValidateName("matrix") 56 } 57 return err 58 } 59 } 60 61 return nil 62 } 63 64 // ContextValidate validate this version operator version based on the context it is used 65 func (m *VersionOperatorVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 66 var res []error 67 68 if err := m.contextValidateMatrix(ctx, formats); err != nil { 69 res = append(res, err) 70 } 71 72 if len(res) > 0 { 73 return errors.CompositeValidationError(res...) 74 } 75 return nil 76 } 77 78 func (m *VersionOperatorVersion) contextValidateMatrix(ctx context.Context, formats strfmt.Registry) error { 79 80 if m.Matrix != nil { 81 if err := m.Matrix.ContextValidate(ctx, formats); err != nil { 82 if ve, ok := err.(*errors.Validation); ok { 83 return ve.ValidateName("matrix") 84 } else if ce, ok := err.(*errors.CompositeError); ok { 85 return ce.ValidateName("matrix") 86 } 87 return err 88 } 89 } 90 91 return nil 92 } 93 94 // MarshalBinary interface implementation 95 func (m *VersionOperatorVersion) MarshalBinary() ([]byte, error) { 96 if m == nil { 97 return nil, nil 98 } 99 return swag.WriteJSON(m) 100 } 101 102 // UnmarshalBinary interface implementation 103 func (m *VersionOperatorVersion) UnmarshalBinary(b []byte) error { 104 var res VersionOperatorVersion 105 if err := swag.ReadJSON(b, &res); err != nil { 106 return err 107 } 108 *m = res 109 return nil 110 }