lib/api/devops/devops_models/tenant.go

182 lines
3.8 KiB
Go
Raw Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2020 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 (
"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
}
// 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
}