github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/organization_mutation.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 "github.com/go-openapi/validate" 16 ) 17 18 // OrganizationMutation organization mutation 19 // 20 // swagger:model OrganizationMutation 21 type OrganizationMutation struct { 22 23 // active runtimes added or subtracted 24 ActiveRuntimesDelta int64 `json:"activeRuntimesDelta,omitempty"` 25 26 // active runtimes added or subtracted from the override 27 ActiveRuntimesOverrideDelta int64 `json:"activeRuntimesOverrideDelta,omitempty"` 28 29 // add ons delta 30 AddOnsDelta []*AddOn `json:"addOnsDelta"` 31 32 // the date and time at which this mutation was created 33 // Format: date-time 34 Added strfmt.DateTime `json:"added,omitempty"` 35 36 // days added or subtracted from the next billing date 37 BillingDateDelta int64 `json:"billingDateDelta,omitempty"` 38 39 // Invoiced customer ID newly associated with the org as of this mutation 40 CustomerID string `json:"customerID,omitempty"` 41 42 // the ID for the Invoiced event that caused this mutation, if any 43 EventID *int64 `json:"eventID,omitempty"` 44 45 // change in an external invoice identifier 46 InvoiceID string `json:"invoiceID,omitempty"` 47 48 // production nodes added or subtracted 49 NodesDelta int64 `json:"nodesDelta,omitempty"` 50 51 // free-form notes relating to this mutation 52 Notes string `json:"notes,omitempty"` 53 54 // identifier for the mutated organization 55 // Format: uuid 56 OrganizationID strfmt.UUID `json:"organizationID,omitempty"` 57 58 // change in customer PO number 59 PoNumber string `json:"poNumber,omitempty"` 60 61 // change in identifier for a reseller 62 ResellerID string `json:"resellerID,omitempty"` 63 64 // indicated whether customer org is managed by a reseller 65 ResellerManaged *bool `json:"resellerManaged,omitempty"` 66 67 // static runtimes added or subtracted 68 StaticRuntimesDelta int64 `json:"staticRuntimesDelta,omitempty"` 69 70 // static runtimes added or subtracted from the override 71 StaticRuntimesOverrideDelta int64 `json:"staticRuntimesOverrideDelta,omitempty"` 72 73 // Invoiced subscription ID newly associated with the org as of this mutation 74 SubscriptionID string `json:"subscriptionID,omitempty"` 75 76 // change in status of the organization's subscription 77 SubscriptionStatus string `json:"subscriptionStatus,omitempty"` 78 79 // change of tier by name 80 TierName string `json:"tierName,omitempty"` 81 82 // identifier for the mutating user 83 UserName string `json:"userName,omitempty"` 84 85 // users added or subtracted 86 UsersDelta int64 `json:"usersDelta,omitempty"` 87 } 88 89 // Validate validates this organization mutation 90 func (m *OrganizationMutation) Validate(formats strfmt.Registry) error { 91 var res []error 92 93 if err := m.validateAddOnsDelta(formats); err != nil { 94 res = append(res, err) 95 } 96 97 if err := m.validateAdded(formats); err != nil { 98 res = append(res, err) 99 } 100 101 if err := m.validateOrganizationID(formats); err != nil { 102 res = append(res, err) 103 } 104 105 if len(res) > 0 { 106 return errors.CompositeValidationError(res...) 107 } 108 return nil 109 } 110 111 func (m *OrganizationMutation) validateAddOnsDelta(formats strfmt.Registry) error { 112 if swag.IsZero(m.AddOnsDelta) { // not required 113 return nil 114 } 115 116 for i := 0; i < len(m.AddOnsDelta); i++ { 117 if swag.IsZero(m.AddOnsDelta[i]) { // not required 118 continue 119 } 120 121 if m.AddOnsDelta[i] != nil { 122 if err := m.AddOnsDelta[i].Validate(formats); err != nil { 123 if ve, ok := err.(*errors.Validation); ok { 124 return ve.ValidateName("addOnsDelta" + "." + strconv.Itoa(i)) 125 } 126 return err 127 } 128 } 129 130 } 131 132 return nil 133 } 134 135 func (m *OrganizationMutation) validateAdded(formats strfmt.Registry) error { 136 if swag.IsZero(m.Added) { // not required 137 return nil 138 } 139 140 if err := validate.FormatOf("added", "body", "date-time", m.Added.String(), formats); err != nil { 141 return err 142 } 143 144 return nil 145 } 146 147 func (m *OrganizationMutation) validateOrganizationID(formats strfmt.Registry) error { 148 if swag.IsZero(m.OrganizationID) { // not required 149 return nil 150 } 151 152 if err := validate.FormatOf("organizationID", "body", "uuid", m.OrganizationID.String(), formats); err != nil { 153 return err 154 } 155 156 return nil 157 } 158 159 // ContextValidate validate this organization mutation based on the context it is used 160 func (m *OrganizationMutation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 161 var res []error 162 163 if err := m.contextValidateAddOnsDelta(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 *OrganizationMutation) contextValidateAddOnsDelta(ctx context.Context, formats strfmt.Registry) error { 174 175 for i := 0; i < len(m.AddOnsDelta); i++ { 176 177 if m.AddOnsDelta[i] != nil { 178 if err := m.AddOnsDelta[i].ContextValidate(ctx, formats); err != nil { 179 if ve, ok := err.(*errors.Validation); ok { 180 return ve.ValidateName("addOnsDelta" + "." + strconv.Itoa(i)) 181 } 182 return err 183 } 184 } 185 186 } 187 188 return nil 189 } 190 191 // MarshalBinary interface implementation 192 func (m *OrganizationMutation) MarshalBinary() ([]byte, error) { 193 if m == nil { 194 return nil, nil 195 } 196 return swag.WriteJSON(m) 197 } 198 199 // UnmarshalBinary interface implementation 200 func (m *OrganizationMutation) UnmarshalBinary(b []byte) error { 201 var res OrganizationMutation 202 if err := swag.ReadJSON(b, &res); err != nil { 203 return err 204 } 205 *m = res 206 return nil 207 }