Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement L7AccessProfile resource #1519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/api_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1127,3 +1127,18 @@
- Delete
- Patch
- Update
- api_packages:
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Local
- client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra
model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model
type: Multitenancy
model_name: L7AccessProfile
obj_name: L7AccessProfile
supported_method:
- New
- Get
- Delete
- Patch
- Update
118 changes: 118 additions & 0 deletions api/infra/l7_access_profile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//nolint:revive
package infra

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

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

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

type L7AccessProfileClientContext utl.ClientContext

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

switch sessionContext.ClientType {

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

case utl.Multitenancy:
client = client1.NewL7AccessProfilesClient(connector)

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

func (c L7AccessProfileClientContext) Get(l7AccessProfileIdParam string) (model0.L7AccessProfile, error) {
var obj model0.L7AccessProfile
var err error

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.L7AccessProfilesClient)
obj, err = client.Get(l7AccessProfileIdParam)
if err != nil {
return obj, err
}

case utl.Multitenancy:
client := c.Client.(client1.L7AccessProfilesClient)
obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, l7AccessProfileIdParam)
if err != nil {
return obj, err
}

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

func (c L7AccessProfileClientContext) Delete(l7AccessProfileIdParam string, overrideParam *bool) error {
var err error

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.L7AccessProfilesClient)
err = client.Delete(l7AccessProfileIdParam, overrideParam)

case utl.Multitenancy:
client := c.Client.(client1.L7AccessProfilesClient)
err = client.Delete(utl.DefaultOrgID, c.ProjectID, l7AccessProfileIdParam, overrideParam)

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

func (c L7AccessProfileClientContext) Patch(l7AccessProfileIdParam string, l7AccessProfileParam model0.L7AccessProfile, overrideParam *bool) (model0.L7AccessProfile, error) {
var err error
var obj model0.L7AccessProfile

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.L7AccessProfilesClient)
obj, err = client.Patch(l7AccessProfileIdParam, l7AccessProfileParam, overrideParam)

case utl.Multitenancy:
client := c.Client.(client1.L7AccessProfilesClient)
obj, err = client.Patch(utl.DefaultOrgID, c.ProjectID, l7AccessProfileIdParam, l7AccessProfileParam, overrideParam)

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

func (c L7AccessProfileClientContext) Update(l7AccessProfileIdParam string, l7AccessProfileParam model0.L7AccessProfile, overrideParam *bool) (model0.L7AccessProfile, error) {
var err error
var obj model0.L7AccessProfile

switch c.ClientType {

case utl.Local:
client := c.Client.(client0.L7AccessProfilesClient)
obj, err = client.Update(l7AccessProfileIdParam, l7AccessProfileParam, overrideParam)

case utl.Multitenancy:
client := c.Client.(client1.L7AccessProfilesClient)
obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, l7AccessProfileIdParam, l7AccessProfileParam, overrideParam)

default:
err = errors.New("invalid infrastructure for model")
}
return obj, err
}
1 change: 1 addition & 0 deletions nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ func Provider() *schema.Provider {
"nsxt_vpc_static_route": resourceNsxtVpcStaticRoutes(),
"nsxt_policy_project_ip_address_allocation": resourceNsxtPolicyProjectIpAddressAllocation(),
"nsxt_vpc_dhcp_v4_static_binding": resourceNsxtVpcSubnetDhcpV4StaticBindingConfig(),
"nsxt_policy_l7_access_profile": resourceNsxtPolicyL7AccessProfile(),
},

ConfigureFunc: providerConfigure,
Expand Down
Loading
Loading