github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/invoice_info.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  // InvoiceInfo invoice info
    18  //
    19  // swagger:model InvoiceInfo
    20  type InvoiceInfo struct {
    21  
    22  	// active runtimes
    23  	// Required: true
    24  	ActiveRuntimes *int64 `json:"activeRuntimes"`
    25  
    26  	// billing address
    27  	// Required: true
    28  	BillingAddress *AddressInfo `json:"billingAddress"`
    29  
    30  	// email
    31  	// Required: true
    32  	Email *string `json:"email"`
    33  
    34  	// is trial
    35  	// Required: true
    36  	IsTrial *bool `json:"isTrial"`
    37  
    38  	// shipping address
    39  	// Required: true
    40  	ShippingAddress *AddressInfo `json:"shippingAddress"`
    41  
    42  	// stripe token
    43  	// Required: true
    44  	StripeToken *string `json:"stripeToken"`
    45  
    46  	// tier name
    47  	// Required: true
    48  	TierName *string `json:"tierName"`
    49  }
    50  
    51  // Validate validates this invoice info
    52  func (m *InvoiceInfo) Validate(formats strfmt.Registry) error {
    53  	var res []error
    54  
    55  	if err := m.validateActiveRuntimes(formats); err != nil {
    56  		res = append(res, err)
    57  	}
    58  
    59  	if err := m.validateBillingAddress(formats); err != nil {
    60  		res = append(res, err)
    61  	}
    62  
    63  	if err := m.validateEmail(formats); err != nil {
    64  		res = append(res, err)
    65  	}
    66  
    67  	if err := m.validateIsTrial(formats); err != nil {
    68  		res = append(res, err)
    69  	}
    70  
    71  	if err := m.validateShippingAddress(formats); err != nil {
    72  		res = append(res, err)
    73  	}
    74  
    75  	if err := m.validateStripeToken(formats); err != nil {
    76  		res = append(res, err)
    77  	}
    78  
    79  	if err := m.validateTierName(formats); err != nil {
    80  		res = append(res, err)
    81  	}
    82  
    83  	if len(res) > 0 {
    84  		return errors.CompositeValidationError(res...)
    85  	}
    86  	return nil
    87  }
    88  
    89  func (m *InvoiceInfo) validateActiveRuntimes(formats strfmt.Registry) error {
    90  
    91  	if err := validate.Required("activeRuntimes", "body", m.ActiveRuntimes); err != nil {
    92  		return err
    93  	}
    94  
    95  	return nil
    96  }
    97  
    98  func (m *InvoiceInfo) validateBillingAddress(formats strfmt.Registry) error {
    99  
   100  	if err := validate.Required("billingAddress", "body", m.BillingAddress); err != nil {
   101  		return err
   102  	}
   103  
   104  	if m.BillingAddress != nil {
   105  		if err := m.BillingAddress.Validate(formats); err != nil {
   106  			if ve, ok := err.(*errors.Validation); ok {
   107  				return ve.ValidateName("billingAddress")
   108  			}
   109  			return err
   110  		}
   111  	}
   112  
   113  	return nil
   114  }
   115  
   116  func (m *InvoiceInfo) validateEmail(formats strfmt.Registry) error {
   117  
   118  	if err := validate.Required("email", "body", m.Email); err != nil {
   119  		return err
   120  	}
   121  
   122  	return nil
   123  }
   124  
   125  func (m *InvoiceInfo) validateIsTrial(formats strfmt.Registry) error {
   126  
   127  	if err := validate.Required("isTrial", "body", m.IsTrial); err != nil {
   128  		return err
   129  	}
   130  
   131  	return nil
   132  }
   133  
   134  func (m *InvoiceInfo) validateShippingAddress(formats strfmt.Registry) error {
   135  
   136  	if err := validate.Required("shippingAddress", "body", m.ShippingAddress); err != nil {
   137  		return err
   138  	}
   139  
   140  	if m.ShippingAddress != nil {
   141  		if err := m.ShippingAddress.Validate(formats); err != nil {
   142  			if ve, ok := err.(*errors.Validation); ok {
   143  				return ve.ValidateName("shippingAddress")
   144  			}
   145  			return err
   146  		}
   147  	}
   148  
   149  	return nil
   150  }
   151  
   152  func (m *InvoiceInfo) validateStripeToken(formats strfmt.Registry) error {
   153  
   154  	if err := validate.Required("stripeToken", "body", m.StripeToken); err != nil {
   155  		return err
   156  	}
   157  
   158  	return nil
   159  }
   160  
   161  func (m *InvoiceInfo) validateTierName(formats strfmt.Registry) error {
   162  
   163  	if err := validate.Required("tierName", "body", m.TierName); err != nil {
   164  		return err
   165  	}
   166  
   167  	return nil
   168  }
   169  
   170  // ContextValidate validate this invoice info based on the context it is used
   171  func (m *InvoiceInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   172  	var res []error
   173  
   174  	if err := m.contextValidateBillingAddress(ctx, formats); err != nil {
   175  		res = append(res, err)
   176  	}
   177  
   178  	if err := m.contextValidateShippingAddress(ctx, formats); err != nil {
   179  		res = append(res, err)
   180  	}
   181  
   182  	if len(res) > 0 {
   183  		return errors.CompositeValidationError(res...)
   184  	}
   185  	return nil
   186  }
   187  
   188  func (m *InvoiceInfo) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
   189  
   190  	if m.BillingAddress != nil {
   191  		if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
   192  			if ve, ok := err.(*errors.Validation); ok {
   193  				return ve.ValidateName("billingAddress")
   194  			}
   195  			return err
   196  		}
   197  	}
   198  
   199  	return nil
   200  }
   201  
   202  func (m *InvoiceInfo) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
   203  
   204  	if m.ShippingAddress != nil {
   205  		if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
   206  			if ve, ok := err.(*errors.Validation); ok {
   207  				return ve.ValidateName("shippingAddress")
   208  			}
   209  			return err
   210  		}
   211  	}
   212  
   213  	return nil
   214  }
   215  
   216  // MarshalBinary interface implementation
   217  func (m *InvoiceInfo) MarshalBinary() ([]byte, error) {
   218  	if m == nil {
   219  		return nil, nil
   220  	}
   221  	return swag.WriteJSON(m)
   222  }
   223  
   224  // UnmarshalBinary interface implementation
   225  func (m *InvoiceInfo) UnmarshalBinary(b []byte) error {
   226  	var res InvoiceInfo
   227  	if err := swag.ReadJSON(b, &res); err != nil {
   228  		return err
   229  	}
   230  	*m = res
   231  	return nil
   232  }