|
| 1 | +//nolint:revive |
| 2 | +package transitgateways |
| 3 | + |
| 4 | +// The following file has been autogenerated. Please avoid any changes! |
| 5 | +import ( |
| 6 | + "errors" |
| 7 | + |
| 8 | + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" |
| 9 | + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" |
| 10 | + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/transit_gateways" |
| 11 | + |
| 12 | + utl "github.com/vmware/terraform-provider-nsxt/api/utl" |
| 13 | +) |
| 14 | + |
| 15 | +type CentralizedConfigsClientContext utl.ClientContext |
| 16 | + |
| 17 | +func NewCentralizedConfigsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *CentralizedConfigsClientContext { |
| 18 | + var client interface{} |
| 19 | + |
| 20 | + switch sessionContext.ClientType { |
| 21 | + |
| 22 | + case utl.Local, utl.Multitenancy, utl.VPC: |
| 23 | + client = client0.NewCentralizedConfigsClient(connector) |
| 24 | + |
| 25 | + default: |
| 26 | + return nil |
| 27 | + } |
| 28 | + return &CentralizedConfigsClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID, VPCID: sessionContext.VPCID} |
| 29 | +} |
| 30 | + |
| 31 | +func (c CentralizedConfigsClientContext) Get(orgIdParam string, projectIdParam string, transitGatewayIdParam string, centralizedConfigIdParam string) (model0.CentralizedConfig, error) { |
| 32 | + var obj model0.CentralizedConfig |
| 33 | + var err error |
| 34 | + |
| 35 | + switch c.ClientType { |
| 36 | + |
| 37 | + case utl.Multitenancy, utl.Local, utl.VPC: |
| 38 | + client := c.Client.(client0.CentralizedConfigsClient) |
| 39 | + obj, err = client.Get(orgIdParam, projectIdParam, transitGatewayIdParam, centralizedConfigIdParam) |
| 40 | + if err != nil { |
| 41 | + return obj, err |
| 42 | + } |
| 43 | + |
| 44 | + default: |
| 45 | + return obj, errors.New("invalid infrastructure for model") |
| 46 | + } |
| 47 | + return obj, err |
| 48 | +} |
| 49 | + |
| 50 | +func (c CentralizedConfigsClientContext) Patch(orgIdParam string, projectIdParam string, transitGatewayIdParam string, centralizedConfigIdParam string, centralizedConfigParam model0.CentralizedConfig) error { |
| 51 | + var err error |
| 52 | + |
| 53 | + switch c.ClientType { |
| 54 | + |
| 55 | + case utl.Multitenancy, utl.Local, utl.VPC: |
| 56 | + client := c.Client.(client0.CentralizedConfigsClient) |
| 57 | + err = client.Patch(orgIdParam, projectIdParam, transitGatewayIdParam, centralizedConfigIdParam, centralizedConfigParam) |
| 58 | + |
| 59 | + default: |
| 60 | + err = errors.New("invalid infrastructure for model") |
| 61 | + } |
| 62 | + return err |
| 63 | +} |
| 64 | + |
| 65 | +func (c CentralizedConfigsClientContext) Update(orgIdParam string, projectIdParam string, transitGatewayIdParam string, centralizedConfigIdParam string, centralizedConfigParam model0.CentralizedConfig) (model0.CentralizedConfig, error) { |
| 66 | + var obj model0.CentralizedConfig |
| 67 | + var err error |
| 68 | + |
| 69 | + switch c.ClientType { |
| 70 | + |
| 71 | + case utl.Multitenancy, utl.Local, utl.VPC: |
| 72 | + client := c.Client.(client0.CentralizedConfigsClient) |
| 73 | + obj, err = client.Update(orgIdParam, projectIdParam, transitGatewayIdParam, centralizedConfigIdParam, centralizedConfigParam) |
| 74 | + if err != nil { |
| 75 | + return obj, err |
| 76 | + } |
| 77 | + |
| 78 | + default: |
| 79 | + return obj, errors.New("invalid infrastructure for model") |
| 80 | + } |
| 81 | + return obj, err |
| 82 | +} |
| 83 | + |
| 84 | +func (c CentralizedConfigsClientContext) Delete(orgIdParam string, projectIdParam string, transitGatewayIdParam string, centralizedConfigIdParam string) error { |
| 85 | + var err error |
| 86 | + |
| 87 | + switch c.ClientType { |
| 88 | + |
| 89 | + case utl.Multitenancy, utl.Local, utl.VPC: |
| 90 | + client := c.Client.(client0.CentralizedConfigsClient) |
| 91 | + err = client.Delete(orgIdParam, projectIdParam, transitGatewayIdParam, centralizedConfigIdParam) |
| 92 | + |
| 93 | + default: |
| 94 | + err = errors.New("invalid infrastructure for model") |
| 95 | + } |
| 96 | + return err |
| 97 | +} |
0 commit comments