lib/api/sf-gate/sf_gate_models/tenant.go

182 lines
3.8 KiB
Go
Raw Permalink Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package sf_gate_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"`
// tenantusers
Tenantusers []*TenantUser `json:"tenantusers"`
// 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
}