github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/add_ons_meta_data.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package mono_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 "strconv" 11 12 "github.com/go-openapi/errors" 13 "github.com/go-openapi/strfmt" 14 "github.com/go-openapi/swag" 15 ) 16 17 // AddOnsMetaData add ons meta data 18 // 19 // swagger:model AddOnsMetaData 20 type AddOnsMetaData struct { 21 22 // add ons 23 AddOns []*AddOn `json:"addOns"` 24 25 // tier 26 Tier string `json:"tier,omitempty"` 27 } 28 29 // Validate validates this add ons meta data 30 func (m *AddOnsMetaData) Validate(formats strfmt.Registry) error { 31 var res []error 32 33 if err := m.validateAddOns(formats); err != nil { 34 res = append(res, err) 35 } 36 37 if len(res) > 0 { 38 return errors.CompositeValidationError(res...) 39 } 40 return nil 41 } 42 43 func (m *AddOnsMetaData) validateAddOns(formats strfmt.Registry) error { 44 if swag.IsZero(m.AddOns) { // not required 45 return nil 46 } 47 48 for i := 0; i < len(m.AddOns); i++ { 49 if swag.IsZero(m.AddOns[i]) { // not required 50 continue 51 } 52 53 if m.AddOns[i] != nil { 54 if err := m.AddOns[i].Validate(formats); err != nil { 55 if ve, ok := err.(*errors.Validation); ok { 56 return ve.ValidateName("addOns" + "." + strconv.Itoa(i)) 57 } 58 return err 59 } 60 } 61 62 } 63 64 return nil 65 } 66 67 // ContextValidate validate this add ons meta data based on the context it is used 68 func (m *AddOnsMetaData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 69 var res []error 70 71 if err := m.contextValidateAddOns(ctx, formats); err != nil { 72 res = append(res, err) 73 } 74 75 if len(res) > 0 { 76 return errors.CompositeValidationError(res...) 77 } 78 return nil 79 } 80 81 func (m *AddOnsMetaData) contextValidateAddOns(ctx context.Context, formats strfmt.Registry) error { 82 83 for i := 0; i < len(m.AddOns); i++ { 84 85 if m.AddOns[i] != nil { 86 if err := m.AddOns[i].ContextValidate(ctx, formats); err != nil { 87 if ve, ok := err.(*errors.Validation); ok { 88 return ve.ValidateName("addOns" + "." + strconv.Itoa(i)) 89 } 90 return err 91 } 92 } 93 94 } 95 96 return nil 97 } 98 99 // MarshalBinary interface implementation 100 func (m *AddOnsMetaData) MarshalBinary() ([]byte, error) { 101 if m == nil { 102 return nil, nil 103 } 104 return swag.WriteJSON(m) 105 } 106 107 // UnmarshalBinary interface implementation 108 func (m *AddOnsMetaData) UnmarshalBinary(b []byte) error { 109 var res AddOnsMetaData 110 if err := swag.ReadJSON(b, &res); err != nil { 111 return err 112 } 113 *m = res 114 return nil 115 }