github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/organization_mutation_editable.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  // OrganizationMutationEditable organization mutation editable
    18  //
    19  // swagger:model OrganizationMutationEditable
    20  type OrganizationMutationEditable struct {
    21  
    22  	// set the number of active runtimes to a specific value
    23  	ActiveRuntimes int64 `json:"activeRuntimes,omitempty"`
    24  
    25  	// add or subtract active runtimes
    26  	ActiveRuntimesDelta int64 `json:"activeRuntimesDelta,omitempty"`
    27  
    28  	// set the active runtimes override to a specific value
    29  	ActiveRuntimesOverride int64 `json:"activeRuntimesOverride,omitempty"`
    30  
    31  	// add or subtract from the active runtimes override
    32  	ActiveRuntimesOverrideDelta int64 `json:"activeRuntimesOverrideDelta,omitempty"`
    33  
    34  	// add ons delta
    35  	AddOnsDelta []*AddOnEditable `json:"addOnsDelta"`
    36  
    37  	// set the next billing date to a specific value
    38  	BillingDate string `json:"billingDate,omitempty"`
    39  
    40  	// add or subtract days from the next billing date; if there is no billing date currently, the delta is with respect to the epoch
    41  	BillingDateDelta int64 `json:"billingDateDelta,omitempty"`
    42  
    43  	// Invoiced customer ID newly associated with the org as of this mutation
    44  	CustomerID string `json:"customerID,omitempty"`
    45  
    46  	// the ID for the Invoiced event that caused this mutation, if any
    47  	EventID *int64 `json:"eventID,omitempty"`
    48  
    49  	// an external invoice identifier related to this mutation
    50  	InvoiceID string `json:"invoiceID,omitempty"`
    51  
    52  	// the ID this mutation is expected to have; the mutation will be rejected if the ID is invalid
    53  	MutationID string `json:"mutationID,omitempty"`
    54  
    55  	// set the number of nodes to a specific value
    56  	Nodes *int64 `json:"nodes,omitempty"`
    57  
    58  	// add or subtract production nodes
    59  	NodesDelta int64 `json:"nodesDelta,omitempty"`
    60  
    61  	// free-form notes relating to this mutation
    62  	Notes string `json:"notes,omitempty"`
    63  
    64  	// customer PO number for this mutation
    65  	PoNumber string `json:"poNumber,omitempty"`
    66  
    67  	// identifier for a reseller
    68  	ResellerID string `json:"resellerID,omitempty"`
    69  
    70  	// indicated whether customer org is managed by a reseller
    71  	ResellerManaged *bool `json:"resellerManaged,omitempty"`
    72  
    73  	// set the number of static runtimes to a specific value
    74  	StaticRuntimes int64 `json:"staticRuntimes,omitempty"`
    75  
    76  	// add or subtract static runtimes
    77  	StaticRuntimesDelta int64 `json:"staticRuntimesDelta,omitempty"`
    78  
    79  	// set the static runtimes override to a specific value
    80  	StaticRuntimesOverride int64 `json:"staticRuntimesOverride,omitempty"`
    81  
    82  	// add or subtract from the static runtimes override
    83  	StaticRuntimesOverrideDelta int64 `json:"staticRuntimesOverrideDelta,omitempty"`
    84  
    85  	// Invoiced subscription ID newly associated with the org as of this mutation
    86  	SubscriptionID string `json:"subscriptionID,omitempty"`
    87  
    88  	// new status of the organization's subscription
    89  	SubscriptionStatus string `json:"subscriptionStatus,omitempty"`
    90  
    91  	// name of new tier
    92  	TierName string `json:"tierName,omitempty"`
    93  
    94  	// set the number of users to a specific value
    95  	Users int64 `json:"users,omitempty"`
    96  
    97  	// add or subtract users
    98  	UsersDelta int64 `json:"usersDelta,omitempty"`
    99  }
   100  
   101  // Validate validates this organization mutation editable
   102  func (m *OrganizationMutationEditable) Validate(formats strfmt.Registry) error {
   103  	var res []error
   104  
   105  	if err := m.validateAddOnsDelta(formats); err != nil {
   106  		res = append(res, err)
   107  	}
   108  
   109  	if len(res) > 0 {
   110  		return errors.CompositeValidationError(res...)
   111  	}
   112  	return nil
   113  }
   114  
   115  func (m *OrganizationMutationEditable) validateAddOnsDelta(formats strfmt.Registry) error {
   116  	if swag.IsZero(m.AddOnsDelta) { // not required
   117  		return nil
   118  	}
   119  
   120  	for i := 0; i < len(m.AddOnsDelta); i++ {
   121  		if swag.IsZero(m.AddOnsDelta[i]) { // not required
   122  			continue
   123  		}
   124  
   125  		if m.AddOnsDelta[i] != nil {
   126  			if err := m.AddOnsDelta[i].Validate(formats); err != nil {
   127  				if ve, ok := err.(*errors.Validation); ok {
   128  					return ve.ValidateName("addOnsDelta" + "." + strconv.Itoa(i))
   129  				}
   130  				return err
   131  			}
   132  		}
   133  
   134  	}
   135  
   136  	return nil
   137  }
   138  
   139  // ContextValidate validate this organization mutation editable based on the context it is used
   140  func (m *OrganizationMutationEditable) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   141  	var res []error
   142  
   143  	if err := m.contextValidateAddOnsDelta(ctx, formats); err != nil {
   144  		res = append(res, err)
   145  	}
   146  
   147  	if len(res) > 0 {
   148  		return errors.CompositeValidationError(res...)
   149  	}
   150  	return nil
   151  }
   152  
   153  func (m *OrganizationMutationEditable) contextValidateAddOnsDelta(ctx context.Context, formats strfmt.Registry) error {
   154  
   155  	for i := 0; i < len(m.AddOnsDelta); i++ {
   156  
   157  		if m.AddOnsDelta[i] != nil {
   158  			if err := m.AddOnsDelta[i].ContextValidate(ctx, formats); err != nil {
   159  				if ve, ok := err.(*errors.Validation); ok {
   160  					return ve.ValidateName("addOnsDelta" + "." + strconv.Itoa(i))
   161  				}
   162  				return err
   163  			}
   164  		}
   165  
   166  	}
   167  
   168  	return nil
   169  }
   170  
   171  // MarshalBinary interface implementation
   172  func (m *OrganizationMutationEditable) MarshalBinary() ([]byte, error) {
   173  	if m == nil {
   174  		return nil, nil
   175  	}
   176  	return swag.WriteJSON(m)
   177  }
   178  
   179  // UnmarshalBinary interface implementation
   180  func (m *OrganizationMutationEditable) UnmarshalBinary(b []byte) error {
   181  	var res OrganizationMutationEditable
   182  	if err := swag.ReadJSON(b, &res); err != nil {
   183  		return err
   184  	}
   185  	*m = res
   186  	return nil
   187  }