github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/organization.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 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/strfmt" 13 "github.com/go-openapi/swag" 14 "github.com/go-openapi/validate" 15 ) 16 17 // Organization organization 18 // 19 // swagger:model Organization 20 type Organization struct { 21 22 // u r lname 23 URLname string `json:"URLname,omitempty"` 24 25 // add ons 26 AddOns map[string]AddOn `json:"addOns,omitempty"` 27 28 // added 29 // Format: date-time 30 Added strfmt.DateTime `json:"added,omitempty"` 31 32 // billing date 33 BillingDate *string `json:"billingDate,omitempty"` 34 35 // display name 36 DisplayName string `json:"displayName,omitempty"` 37 38 // has ever had trial 39 HasEverHadTrial bool `json:"hasEverHadTrial,omitempty"` 40 41 // member count 42 MemberCount int64 `json:"memberCount,omitempty"` 43 44 // Deprecated; use displayName instead. 45 Name *string `json:"name,omitempty"` 46 47 // organization ID 48 // Format: uuid 49 OrganizationID strfmt.UUID `json:"organizationID,omitempty"` 50 51 // owner 52 Owner bool `json:"owner,omitempty"` 53 54 // personal 55 Personal bool `json:"personal,omitempty"` 56 57 // role 58 Role *Role `json:"role,omitempty"` 59 60 // subscription status 61 SubscriptionStatus *string `json:"subscriptionStatus,omitempty"` 62 63 // tier 64 Tier string `json:"tier,omitempty"` 65 } 66 67 // Validate validates this organization 68 func (m *Organization) Validate(formats strfmt.Registry) error { 69 var res []error 70 71 if err := m.validateAddOns(formats); err != nil { 72 res = append(res, err) 73 } 74 75 if err := m.validateAdded(formats); err != nil { 76 res = append(res, err) 77 } 78 79 if err := m.validateOrganizationID(formats); err != nil { 80 res = append(res, err) 81 } 82 83 if err := m.validateRole(formats); err != nil { 84 res = append(res, err) 85 } 86 87 if len(res) > 0 { 88 return errors.CompositeValidationError(res...) 89 } 90 return nil 91 } 92 93 func (m *Organization) validateAddOns(formats strfmt.Registry) error { 94 if swag.IsZero(m.AddOns) { // not required 95 return nil 96 } 97 98 for k := range m.AddOns { 99 100 if err := validate.Required("addOns"+"."+k, "body", m.AddOns[k]); err != nil { 101 return err 102 } 103 if val, ok := m.AddOns[k]; ok { 104 if err := val.Validate(formats); err != nil { 105 return err 106 } 107 } 108 109 } 110 111 return nil 112 } 113 114 func (m *Organization) validateAdded(formats strfmt.Registry) error { 115 if swag.IsZero(m.Added) { // not required 116 return nil 117 } 118 119 if err := validate.FormatOf("added", "body", "date-time", m.Added.String(), formats); err != nil { 120 return err 121 } 122 123 return nil 124 } 125 126 func (m *Organization) validateOrganizationID(formats strfmt.Registry) error { 127 if swag.IsZero(m.OrganizationID) { // not required 128 return nil 129 } 130 131 if err := validate.FormatOf("organizationID", "body", "uuid", m.OrganizationID.String(), formats); err != nil { 132 return err 133 } 134 135 return nil 136 } 137 138 func (m *Organization) validateRole(formats strfmt.Registry) error { 139 if swag.IsZero(m.Role) { // not required 140 return nil 141 } 142 143 if m.Role != nil { 144 if err := m.Role.Validate(formats); err != nil { 145 if ve, ok := err.(*errors.Validation); ok { 146 return ve.ValidateName("role") 147 } 148 return err 149 } 150 } 151 152 return nil 153 } 154 155 // ContextValidate validate this organization based on the context it is used 156 func (m *Organization) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 157 var res []error 158 159 if err := m.contextValidateAddOns(ctx, formats); err != nil { 160 res = append(res, err) 161 } 162 163 if err := m.contextValidateRole(ctx, formats); err != nil { 164 res = append(res, err) 165 } 166 167 if len(res) > 0 { 168 return errors.CompositeValidationError(res...) 169 } 170 return nil 171 } 172 173 func (m *Organization) contextValidateAddOns(ctx context.Context, formats strfmt.Registry) error { 174 175 for k := range m.AddOns { 176 177 if val, ok := m.AddOns[k]; ok { 178 if err := val.ContextValidate(ctx, formats); err != nil { 179 return err 180 } 181 } 182 183 } 184 185 return nil 186 } 187 188 func (m *Organization) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { 189 190 if m.Role != nil { 191 if err := m.Role.ContextValidate(ctx, formats); err != nil { 192 if ve, ok := err.(*errors.Validation); ok { 193 return ve.ValidateName("role") 194 } 195 return err 196 } 197 } 198 199 return nil 200 } 201 202 // MarshalBinary interface implementation 203 func (m *Organization) MarshalBinary() ([]byte, error) { 204 if m == nil { 205 return nil, nil 206 } 207 return swag.WriteJSON(m) 208 } 209 210 // UnmarshalBinary interface implementation 211 func (m *Organization) UnmarshalBinary(b []byte) error { 212 var res Organization 213 if err := swag.ReadJSON(b, &res); err != nil { 214 return err 215 } 216 *m = res 217 return nil 218 }