// Code generated by go-swagger; DO NOT EDIT. // All Code Copyright(c) 2018-2021 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package devops_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" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Tenant Taxnexus Account Tenant // // swagger:model Tenant type Tenant struct { // The Account that owns this Tenant AccountID string `json:"AccountID,omitempty"` // Is this Tenant currently active? Active bool `json:"Active,omitempty"` // Created By CreatedByID string `json:"CreatedByID,omitempty"` // Created Date CreatedDate string `json:"CreatedDate,omitempty"` // databases Databases []*Database `json:"Databases"` // Record Id ID string `json:"ID,omitempty"` // Last Modified By LastModifiedByID string `json:"LastModifiedByID,omitempty"` // Last Modifed Date LastModifiedDate string `json:"LastModifiedDate,omitempty"` // roles Roles []*Role `json:"Roles"` // The current status of this Tenant Status string `json:"Status,omitempty"` // Name of the Tenant Resource TenantName string `json:"TenantName,omitempty"` // tenant users TenantUsers []*TenantUser `json:"TenantUsers"` // The type of Tenant Type string `json:"Type,omitempty"` // The version number of the Tenant Onboarding system used to create this tenant Version string `json:"Version,omitempty"` } // Validate validates this tenant func (m *Tenant) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDatabases(formats); err != nil { res = append(res, err) } if err := m.validateRoles(formats); err != nil { res = append(res, err) } if err := m.validateTenantUsers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tenant) validateDatabases(formats strfmt.Registry) error { if swag.IsZero(m.Databases) { // not required return nil } for i := 0; i < len(m.Databases); i++ { if swag.IsZero(m.Databases[i]) { // not required continue } if m.Databases[i] != nil { if err := m.Databases[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("Databases" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) validateRoles(formats strfmt.Registry) error { if swag.IsZero(m.Roles) { // not required return nil } for i := 0; i < len(m.Roles); i++ { if swag.IsZero(m.Roles[i]) { // not required continue } if m.Roles[i] != nil { if err := m.Roles[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("Roles" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) validateTenantUsers(formats strfmt.Registry) error { if swag.IsZero(m.TenantUsers) { // not required return nil } for i := 0; i < len(m.TenantUsers); i++ { if swag.IsZero(m.TenantUsers[i]) { // not required continue } if m.TenantUsers[i] != nil { if err := m.TenantUsers[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this tenant based on the context it is used func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateDatabases(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateRoles(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTenantUsers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tenant) contextValidateDatabases(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Databases); i++ { if m.Databases[i] != nil { if err := m.Databases[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("Databases" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) contextValidateRoles(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Roles); i++ { if m.Roles[i] != nil { if err := m.Roles[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("Roles" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.TenantUsers); i++ { if m.TenantUsers[i] != nil { if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Tenant) UnmarshalBinary(b []byte) error { var res Tenant if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }