All checks were successful
continuous-integration/drone/push Build is passing
110 lines
2.4 KiB
Go
110 lines
2.4 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// InstanceV2Usage Usage data for this instance.
|
|
//
|
|
// swagger:model InstanceV2Usage
|
|
type InstanceV2Usage struct {
|
|
|
|
// users
|
|
Users *InstanceV2Users `json:"users,omitempty"`
|
|
}
|
|
|
|
// Validate validates this instance v2 usage
|
|
func (m *InstanceV2Usage) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateUsers(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *InstanceV2Usage) validateUsers(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Users) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Users != nil {
|
|
if err := m.Users.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("users")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("users")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this instance v2 usage based on the context it is used
|
|
func (m *InstanceV2Usage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateUsers(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *InstanceV2Usage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Users != nil {
|
|
|
|
if swag.IsZero(m.Users) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Users.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("users")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("users")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *InstanceV2Usage) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *InstanceV2Usage) UnmarshalBinary(b []byte) error {
|
|
var res InstanceV2Usage
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|