Skip to content

Commit

Permalink
Add binding map
Browse files Browse the repository at this point in the history
Signed-off-by: graysonwu <wgrayson@vmware.com>
  • Loading branch information
GraysonWu committed Apr 4, 2024
1 parent d9b47ff commit b4eab88
Show file tree
Hide file tree
Showing 13 changed files with 2,312 additions and 162 deletions.
93 changes: 92 additions & 1 deletion api/api_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,4 +975,95 @@
- List
- Patch
- Update
- List
- List
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains/groups
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains/groups
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model
type: Global
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/groups
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Multitenancy
model_name: PolicyFirewallFloodProtectionProfileBindingMap
obj_name: PolicyFirewallFloodProtectionProfileBindingMap
client_name: FirewallFloodProtectionProfileBindingMapsClient
list_result_name: PolicyFirewallFloodProtectionProfileBindingMapListResult
supported_method:
- New
- Get
- Delete
- Patch
- Update
- List
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model
type: Global
model_name: FloodProtectionProfileBindingMap
obj_name: FloodProtectionProfileBindingMap
client_name: FloodProtectionProfileBindingsClient
supported_method:
- New
- Get
- Delete
- Patch
- Update
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s/locale_services
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model
type: Global
model_name: FloodProtectionProfileBindingMap
obj_name: FloodProtectionProfileBindingMap
client_name: FloodProtectionProfileBindingsClient
supported_method:
- New
- Get
- Delete
- Patch
- Update
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model
type: Global
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Multitenancy
model_name: FloodProtectionProfileBindingMap
obj_name: FloodProtectionProfileBindingMap
client_name: FloodProtectionProfileBindingsClient
supported_method:
- New
- Get
- Delete
- Patch
- Update
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s/locale_services
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model
type: Global
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Multitenancy
model_name: FloodProtectionProfileBindingMap
obj_name: FloodProtectionProfileBindingMap
client_name: FloodProtectionProfileBindingsClient
supported_method:
- New
- Get
- Delete
- Patch
- Update
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
//nolint:revive
package groups

// The following file has been autogenerated. Please avoid any changes!
import (
"errors"

vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains/groups"
model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model"
client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains/groups"
model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model"
client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/groups"

utl "github.com/vmware/terraform-provider-nsxt/api/utl"
)

type PolicyFirewallFloodProtectionProfileBindingMapClientContext utl.ClientContext

func NewFirewallFloodProtectionProfileBindingMapsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyFirewallFloodProtectionProfileBindingMapClientContext {
var client interface{}

switch sessionContext.ClientType {

case utl.Local:
client = client0.NewFirewallFloodProtectionProfileBindingMapsClient(connector)

case utl.Global:
client = client1.NewFirewallFloodProtectionProfileBindingMapsClient(connector)

case utl.Multitenancy:
client = client2.NewFirewallFloodProtectionProfileBindingMapsClient(connector)

default:
return nil
}
return &PolicyFirewallFloodProtectionProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID}
}

func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) Get(domainIdParam string, groupIdParam string, firewallFloodProtectionProfileBindingMapIdParam string) (model0.PolicyFirewallFloodProtectionProfileBindingMap, error) {
var obj model0.PolicyFirewallFloodProtectionProfileBindingMap
var err error

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.Get(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)
if err != nil {
return obj, err
}

case utl.Global:
client := c.Client.(client1.FirewallFloodProtectionProfileBindingMapsClient)
gmObj, err1 := client.Get(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)
if err1 != nil {
return obj, err1
}
var rawObj interface{}
rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyFirewallFloodProtectionProfileBindingMapBindingType(), model0.PolicyFirewallFloodProtectionProfileBindingMapBindingType())
obj = rawObj.(model0.PolicyFirewallFloodProtectionProfileBindingMap)

case utl.Multitenancy:
client := c.Client.(client2.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)
if err != nil {
return obj, err
}

default:
return obj, errors.New("invalid infrastructure for model")
}
return obj, err
}

func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) Delete(domainIdParam string, groupIdParam string, firewallFloodProtectionProfileBindingMapIdParam string) error {
var err error

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.FirewallFloodProtectionProfileBindingMapsClient)
err = client.Delete(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)

case utl.Global:
client := c.Client.(client1.FirewallFloodProtectionProfileBindingMapsClient)
err = client.Delete(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)

case utl.Multitenancy:
client := c.Client.(client2.FirewallFloodProtectionProfileBindingMapsClient)
err = client.Delete(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam)

default:
err = errors.New("invalid infrastructure for model")
}
return err
}

func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) Patch(domainIdParam string, groupIdParam string, firewallFloodProtectionProfileBindingMapIdParam string, policyFirewallFloodProtectionProfileBindingMapParam model0.PolicyFirewallFloodProtectionProfileBindingMap) error {
var err error

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.FirewallFloodProtectionProfileBindingMapsClient)
err = client.Patch(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, policyFirewallFloodProtectionProfileBindingMapParam)

case utl.Global:
client := c.Client.(client1.FirewallFloodProtectionProfileBindingMapsClient)
gmObj, err1 := utl.ConvertModelBindingType(policyFirewallFloodProtectionProfileBindingMapParam, model0.PolicyFirewallFloodProtectionProfileBindingMapBindingType(), model1.PolicyFirewallFloodProtectionProfileBindingMapBindingType())
if err1 != nil {
return err1
}
err = client.Patch(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, gmObj.(model1.PolicyFirewallFloodProtectionProfileBindingMap))

case utl.Multitenancy:
client := c.Client.(client2.FirewallFloodProtectionProfileBindingMapsClient)
err = client.Patch(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, policyFirewallFloodProtectionProfileBindingMapParam)

default:
err = errors.New("invalid infrastructure for model")
}
return err
}

func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) Update(domainIdParam string, groupIdParam string, firewallFloodProtectionProfileBindingMapIdParam string, policyFirewallFloodProtectionProfileBindingMapParam model0.PolicyFirewallFloodProtectionProfileBindingMap) (model0.PolicyFirewallFloodProtectionProfileBindingMap, error) {
var err error
var obj model0.PolicyFirewallFloodProtectionProfileBindingMap

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.Update(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, policyFirewallFloodProtectionProfileBindingMapParam)

case utl.Global:
client := c.Client.(client1.FirewallFloodProtectionProfileBindingMapsClient)
gmObj, err := utl.ConvertModelBindingType(policyFirewallFloodProtectionProfileBindingMapParam, model0.PolicyFirewallFloodProtectionProfileBindingMapBindingType(), model1.PolicyFirewallFloodProtectionProfileBindingMapBindingType())
if err != nil {
return obj, err
}
gmObj, err = client.Update(domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, gmObj.(model1.PolicyFirewallFloodProtectionProfileBindingMap))
if err != nil {
return obj, err
}
obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyFirewallFloodProtectionProfileBindingMapBindingType(), model0.PolicyFirewallFloodProtectionProfileBindingMapBindingType())
if err1 != nil {
return obj, err1
}
obj = obj1.(model0.PolicyFirewallFloodProtectionProfileBindingMap)

case utl.Multitenancy:
client := c.Client.(client2.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, firewallFloodProtectionProfileBindingMapIdParam, policyFirewallFloodProtectionProfileBindingMapParam)

default:
err = errors.New("invalid infrastructure for model")
}
return obj, err
}

func (c PolicyFirewallFloodProtectionProfileBindingMapClientContext) List(domainIdParam string, groupIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyFirewallFloodProtectionProfileBindingMapListResult, error) {
var err error
var obj model0.PolicyFirewallFloodProtectionProfileBindingMapListResult

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.List(domainIdParam, groupIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam)

case utl.Global:
client := c.Client.(client1.FirewallFloodProtectionProfileBindingMapsClient)
gmObj, err := client.List(domainIdParam, groupIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam)
if err != nil {
return obj, err
}
obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyFirewallFloodProtectionProfileBindingMapListResultBindingType(), model0.PolicyFirewallFloodProtectionProfileBindingMapListResultBindingType())
if err1 != nil {
return obj, err1
}
obj = obj1.(model0.PolicyFirewallFloodProtectionProfileBindingMapListResult)

case utl.Multitenancy:
client := c.Client.(client2.FirewallFloodProtectionProfileBindingMapsClient)
obj, err = client.List(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam)

default:
err = errors.New("invalid infrastructure for model")
}
return obj, err
}
Loading

0 comments on commit b4eab88

Please sign in to comment.