-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
377 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
//nolint:revive | ||
package infra | ||
|
||
// The following file has been autogenerated. Please avoid any changes! | ||
import ( | ||
"errors" | ||
|
||
model0 "github.com/vmware/vsphere-automation-sdk-go/runtime/data" | ||
vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" | ||
client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" | ||
lrmodel1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" | ||
client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" | ||
lrmodel0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" | ||
client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra" | ||
|
||
utl "github.com/vmware/terraform-provider-nsxt/api/utl" | ||
) | ||
|
||
type StructValueClientContext utl.ClientContext | ||
|
||
func NewFloodProtectionProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StructValueClientContext { | ||
var client interface{} | ||
|
||
switch sessionContext.ClientType { | ||
|
||
case utl.Local: | ||
client = client0.NewFloodProtectionProfilesClient(connector) | ||
|
||
case utl.Global: | ||
client = client1.NewFloodProtectionProfilesClient(connector) | ||
|
||
case utl.Multitenancy: | ||
client = client2.NewFloodProtectionProfilesClient(connector) | ||
|
||
default: | ||
return nil | ||
} | ||
return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} | ||
} | ||
|
||
func (c StructValueClientContext) Get(floodProtectionProfileIdParam string) (*model0.StructValue, error) { | ||
var obj *model0.StructValue | ||
var err error | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.FloodProtectionProfilesClient) | ||
obj, err = client.Get(floodProtectionProfileIdParam) | ||
if err != nil { | ||
return obj, err | ||
} | ||
|
||
case utl.Global: | ||
client := c.Client.(client1.FloodProtectionProfilesClient) | ||
obj, err = client.Get(floodProtectionProfileIdParam) | ||
if err != nil { | ||
return obj, err | ||
} | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client2.FloodProtectionProfilesClient) | ||
obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, floodProtectionProfileIdParam) | ||
if err != nil { | ||
return obj, err | ||
} | ||
|
||
default: | ||
return obj, errors.New("invalid infrastructure for model") | ||
} | ||
return obj, err | ||
} | ||
|
||
func (c StructValueClientContext) Delete(floodProtectionProfileIdParam string, overrideParam *bool) error { | ||
var err error | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.FloodProtectionProfilesClient) | ||
err = client.Delete(floodProtectionProfileIdParam, overrideParam) | ||
|
||
case utl.Global: | ||
client := c.Client.(client1.FloodProtectionProfilesClient) | ||
err = client.Delete(floodProtectionProfileIdParam, overrideParam) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client2.FloodProtectionProfilesClient) | ||
err = client.Delete(utl.DefaultOrgID, c.ProjectID, floodProtectionProfileIdParam, overrideParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return err | ||
} | ||
|
||
func (c StructValueClientContext) Patch(floodProtectionProfileIdParam string, floodProtectionProfileParam *model0.StructValue, overrideParam *bool) error { | ||
var err error | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.FloodProtectionProfilesClient) | ||
err = client.Patch(floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
case utl.Global: | ||
client := c.Client.(client1.FloodProtectionProfilesClient) | ||
err = client.Patch(floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client2.FloodProtectionProfilesClient) | ||
err = client.Patch(utl.DefaultOrgID, c.ProjectID, floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return err | ||
} | ||
|
||
func (c StructValueClientContext) Update(floodProtectionProfileIdParam string, floodProtectionProfileParam *model0.StructValue, overrideParam *bool) (*model0.StructValue, error) { | ||
var err error | ||
var obj *model0.StructValue | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.FloodProtectionProfilesClient) | ||
obj, err = client.Update(floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
case utl.Global: | ||
client := c.Client.(client1.FloodProtectionProfilesClient) | ||
obj, err = client.Update(floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client2.FloodProtectionProfilesClient) | ||
obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, floodProtectionProfileIdParam, floodProtectionProfileParam, overrideParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return obj, err | ||
} | ||
|
||
func (c StructValueClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (lrmodel0.FloodProtectionProfileListResult, error) { | ||
var err error | ||
var obj lrmodel0.FloodProtectionProfileListResult | ||
|
||
switch c.ClientType { | ||
|
||
case utl.Local: | ||
client := c.Client.(client0.FloodProtectionProfilesClient) | ||
obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) | ||
|
||
case utl.Global: | ||
client := c.Client.(client1.FloodProtectionProfilesClient) | ||
gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) | ||
if err != nil { | ||
return obj, err | ||
} | ||
obj1, err1 := utl.ConvertModelBindingType(gmObj, lrmodel1.FloodProtectionProfileListResultBindingType(), lrmodel0.FloodProtectionProfileListResultBindingType()) | ||
if err1 != nil { | ||
return obj, err1 | ||
} | ||
obj = obj1.(lrmodel0.FloodProtectionProfileListResult) | ||
|
||
case utl.Multitenancy: | ||
client := c.Client.(client2.FloodProtectionProfilesClient) | ||
obj, err = client.List(utl.DefaultOrgID, c.ProjectID, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) | ||
|
||
default: | ||
err = errors.New("invalid infrastructure for model") | ||
} | ||
return obj, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.