2021-08-05 19:37:53 +00:00
|
|
|
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
|
|
|
|
// (c) 2012-2020 by Taxnexus, Inc.
|
|
|
|
// All rights reserved worldwide.
|
|
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
|
|
|
|
package sfgate_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"
|
|
|
|
)
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
// Tenant Account Tenant
|
2021-08-05 19:37:53 +00:00
|
|
|
//
|
|
|
|
// swagger:model Tenant
|
|
|
|
type Tenant struct {
|
|
|
|
|
|
|
|
// The Account that owns this Tenant
|
2023-04-15 14:27:18 +00:00
|
|
|
AccountID *string `json:"AccountID,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Is this Tenant currently active?
|
2023-04-15 14:27:18 +00:00
|
|
|
Active *bool `json:"Active,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Created By
|
2023-04-15 14:27:18 +00:00
|
|
|
CreatedByID *string `json:"CreatedByID,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Created Date
|
2023-04-15 14:27:18 +00:00
|
|
|
CreatedDate *string `json:"CreatedDate,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
2021-08-14 22:34:08 +00:00
|
|
|
// databases
|
2023-03-28 17:47:34 +00:00
|
|
|
Databases []*Database `json:"Databases"`
|
2021-08-14 22:34:08 +00:00
|
|
|
|
2021-08-05 19:37:53 +00:00
|
|
|
// Record Id
|
2023-03-28 17:47:34 +00:00
|
|
|
ID string `json:"ID,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Last Modified By
|
2023-04-15 14:27:18 +00:00
|
|
|
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Last Modifed Date
|
2023-04-15 14:27:18 +00:00
|
|
|
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// roles
|
2023-03-28 17:47:34 +00:00
|
|
|
Roles []*Role `json:"Roles"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// The current status of this Tenant
|
2023-04-15 14:27:18 +00:00
|
|
|
Status *string `json:"Status,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Name of the Tenant Resource
|
2023-04-15 14:27:18 +00:00
|
|
|
TenantName *string `json:"TenantName,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
// tenant users
|
|
|
|
TenantUsers []*TenantUser `json:"TenantUsers"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// Type of tenant
|
2023-04-15 14:27:18 +00:00
|
|
|
Type *string `json:"Type,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
|
|
|
|
// The version number of the Tenant Onboarding system used to create this tenant
|
2023-04-15 14:27:18 +00:00
|
|
|
Version *string `json:"Version,omitempty"`
|
2021-08-05 19:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Validate validates this tenant
|
|
|
|
func (m *Tenant) Validate(formats strfmt.Registry) error {
|
|
|
|
var res []error
|
|
|
|
|
2021-08-14 22:34:08 +00:00
|
|
|
if err := m.validateDatabases(formats); err != nil {
|
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
2021-08-05 19:37:53 +00:00
|
|
|
if err := m.validateRoles(formats); err != nil {
|
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
if err := m.validateTenantUsers(formats); err != nil {
|
2021-08-05 19:37:53 +00:00
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(res) > 0 {
|
|
|
|
return errors.CompositeValidationError(res...)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-08-14 22:34:08 +00:00
|
|
|
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 {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("Databases" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("Databases" + "." + strconv.Itoa(i))
|
2021-08-14 22:34:08 +00:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-08-05 19:37:53 +00:00
|
|
|
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 {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("Roles" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("Roles" + "." + strconv.Itoa(i))
|
2021-08-05 19:37:53 +00:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
func (m *Tenant) validateTenantUsers(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.TenantUsers) { // not required
|
2021-08-05 19:37:53 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
for i := 0; i < len(m.TenantUsers); i++ {
|
|
|
|
if swag.IsZero(m.TenantUsers[i]) { // not required
|
2021-08-05 19:37:53 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
if m.TenantUsers[i] != nil {
|
|
|
|
if err := m.TenantUsers[i].Validate(formats); err != nil {
|
2021-08-05 19:37:53 +00:00
|
|
|
if ve, ok := err.(*errors.Validation); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
2021-08-05 19:37:53 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
|
|
2021-08-14 22:34:08 +00:00
|
|
|
if err := m.contextValidateDatabases(ctx, formats); err != nil {
|
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
2021-08-05 19:37:53 +00:00
|
|
|
if err := m.contextValidateRoles(ctx, formats); err != nil {
|
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
if err := m.contextValidateTenantUsers(ctx, formats); err != nil {
|
2021-08-05 19:37:53 +00:00
|
|
|
res = append(res, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(res) > 0 {
|
|
|
|
return errors.CompositeValidationError(res...)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-08-14 22:34:08 +00:00
|
|
|
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 {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("Databases" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("Databases" + "." + strconv.Itoa(i))
|
2021-08-14 22:34:08 +00:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-08-05 19:37:53 +00:00
|
|
|
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 {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("Roles" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("Roles" + "." + strconv.Itoa(i))
|
2021-08-05 19:37:53 +00:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
func (m *Tenant) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error {
|
2021-08-05 19:37:53 +00:00
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
for i := 0; i < len(m.TenantUsers); i++ {
|
2021-08-05 19:37:53 +00:00
|
|
|
|
2023-03-28 17:47:34 +00:00
|
|
|
if m.TenantUsers[i] != nil {
|
|
|
|
if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil {
|
2021-08-05 19:37:53 +00:00
|
|
|
if ve, ok := err.(*errors.Validation); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
2022-05-28 19:45:41 +00:00
|
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
2023-03-28 17:47:34 +00:00
|
|
|
return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
2021-08-05 19:37:53 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
|
}
|