From ef8a6b039fbe1020f45c4580c38858d61c1e0839 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Thu, 4 May 2023 20:05:27 +0300 Subject: [PATCH 1/3] ultitenancy project data source Add a data source for multitenancy project object. Signed-off-by: Kobi Samoray --- nsxt/data_source_nsxt_policy_project.go | 128 +++++++ nsxt/data_source_nsxt_policy_project_test.go | 105 ++++++ nsxt/provider.go | 1 + nsxt/utils_test.go | 11 + .../services/nsxt/orgs/OrgsPackageTypes.go | 11 + .../services/nsxt/orgs/ProjectsClient.go | 283 ++++++++++++++ .../services/nsxt/orgs/ProjectsTypes.go | 349 ++++++++++++++++++ .../services/nsxt/orgs/SharedWithMeClient.go | 93 +++++ .../services/nsxt/orgs/SharedWithMeTypes.go | 75 ++++ vendor/modules.txt | 1 + website/docs/d/policy_project.html.markdown | 36 ++ 11 files changed, 1093 insertions(+) create mode 100644 nsxt/data_source_nsxt_policy_project.go create mode 100644 nsxt/data_source_nsxt_policy_project_test.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/OrgsPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeTypes.go create mode 100644 website/docs/d/policy_project.html.markdown diff --git a/nsxt/data_source_nsxt_policy_project.go b/nsxt/data_source_nsxt_policy_project.go new file mode 100644 index 000000000..2bc4a76d1 --- /dev/null +++ b/nsxt/data_source_nsxt_policy_project.go @@ -0,0 +1,128 @@ +/* Copyright © 2023 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: MPL-2.0 */ + +package nsxt + +import ( + "fmt" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs" +) + +const defaultOrgID = "default" + +func dataSourceNsxtPolicyProject() *schema.Resource { + return &schema.Resource{ + Read: dataSourceNsxtPolicyProjectRead, + + Schema: map[string]*schema.Schema{ + "id": getDataSourceIDSchema(), + "display_name": getDataSourceDisplayNameSchema(), + "description": getDataSourceDescriptionSchema(), + "path": getPathSchema(), + "short_id": { + Type: schema.TypeString, + Optional: true, + }, + "site_info": { + Type: schema.TypeList, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "edge_cluster_paths": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "site_path": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + Optional: true, + }, + "tier0_gateway_paths": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + }, + } +} + +func dataSourceNsxtPolicyProjectRead(d *schema.ResourceData, m interface{}) error { + connector := getPolicyConnector(m) + client := infra.NewProjectsClient(connector) + + // As Project resource type paths reside under project and not under /infra or /global_infra or such, and since + // this data source fetches extra attributes, e.g site_info and tier0_gateway_paths, it's simpler to implement using .List() + // instead of using search API. + + objID := d.Get("id").(string) + objName := d.Get("display_name").(string) + var obj model.Project + if objID != "" { + // Get by id + objGet, err := client.Get(defaultOrgID, objID) + if err != nil { + return handleDataSourceReadError(d, "Project", objID, err) + } + obj = objGet + } else if objName == "" { + return fmt.Errorf("Error obtaining Project ID or name during read") + } else { + // Get by full name/prefix + objList, err := client.List(defaultOrgID, nil, nil, nil, nil, nil, nil, nil) + if err != nil { + return handleListError("Project", err) + } + // go over the list to find the correct one (prefer a perfect match. If not - prefix match) + var perfectMatch []model.Project + var prefixMatch []model.Project + for _, objInList := range objList.Results { + if strings.HasPrefix(*objInList.DisplayName, objName) { + prefixMatch = append(prefixMatch, objInList) + } + if *objInList.DisplayName == objName { + perfectMatch = append(perfectMatch, objInList) + } + } + if len(perfectMatch) > 0 { + if len(perfectMatch) > 1 { + return fmt.Errorf("Found multiple Project with name '%s'", objName) + } + obj = perfectMatch[0] + } else if len(prefixMatch) > 0 { + if len(prefixMatch) > 1 { + return fmt.Errorf("Found multiple Projects with name starting with '%s'", objName) + } + obj = prefixMatch[0] + } else { + return fmt.Errorf("Project with name '%s' was not found", objName) + } + } + + d.SetId(*obj.Id) + d.Set("display_name", obj.DisplayName) + d.Set("description", obj.Description) + d.Set("path", obj.Path) + + var siteInfosList []map[string]interface{} + for _, item := range obj.SiteInfos { + data := make(map[string]interface{}) + data["edge_cluster_paths"] = item.EdgeClusterPaths + data["site_path"] = item.SitePath + siteInfosList = append(siteInfosList, data) + } + d.Set("site_info", siteInfosList) + d.Set("tier0_gateway_paths", obj.Tier0s) + + return nil +} diff --git a/nsxt/data_source_nsxt_policy_project_test.go b/nsxt/data_source_nsxt_policy_project_test.go new file mode 100644 index 000000000..c0b2a0d1c --- /dev/null +++ b/nsxt/data_source_nsxt_policy_project_test.go @@ -0,0 +1,105 @@ +/* Copyright © 2023 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: MPL-2.0 */ + +package nsxt + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + orgs "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs" +) + +func TestAccDataSourceNsxtPolicyProject_basic(t *testing.T) { + name := getAccTestDataSourceName() + testResourceName := "data.nsxt_policy_project.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccOnlyLocalManager(t) + testAccPreCheck(t) + testAccNSXVersion(t, "4.1.0") + }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccDataSourceNsxtPolicyProjectDeleteByName(name) + }, + Steps: []resource.TestStep{ + { + PreConfig: func() { + if err := testAccDataSourceNsxtPolicyProjectCreate(name); err != nil { + panic(err) + } + }, + Config: testAccNsxtPolicyProjectReadTemplate(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(testResourceName, "display_name", name), + resource.TestCheckResourceAttr(testResourceName, "description", name), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttr(testResourceName, "tier0_gateway_paths.#", "1"), + ), + }, + }, + }) +} + +func testAccDataSourceNsxtPolicyProjectCreate(name string) error { + connector, err := testAccGetPolicyConnector() + if err != nil { + return fmt.Errorf("Error during test client initialization: %v", err) + } + + var tier0s = []string{getTier0RouterPath(connector)} + client := orgs.NewProjectsClient(connector) + + displayName := name + description := name + obj := model.Project{ + Description: &description, + DisplayName: &displayName, + Tier0s: tier0s, + } + + // Generate a random ID for the resource + id := newUUID() + + err = client.Patch(defaultOrgID, id, obj) + if err != nil { + return handleCreateError("Project", id, err) + } + return nil +} + +func testAccDataSourceNsxtPolicyProjectDeleteByName(name string) error { + connector, err := testAccGetPolicyConnector() + if err != nil { + return fmt.Errorf("Error during test client initialization: %v", err) + } + client := orgs.NewProjectsClient(connector) + + // Find the object by name + objList, err := client.List(defaultOrgID, nil, nil, nil, nil, nil, nil, nil) + if err != nil { + return handleListError("Project", err) + } + for _, objInList := range objList.Results { + if *objInList.DisplayName == name { + err := client.Delete(defaultOrgID, *objInList.Id) + if err != nil { + return handleDeleteError("Project", *objInList.Id, err) + } + return nil + } + } + return fmt.Errorf("Error while deleting Project '%s': resource not found", name) +} + +func testAccNsxtPolicyProjectReadTemplate(name string) string { + return fmt.Sprintf(` +data "nsxt_policy_project" "test" { + display_name = "%s" +}`, name) +} diff --git a/nsxt/provider.go b/nsxt/provider.go index 767e54972..253b17af8 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -267,6 +267,7 @@ func Provider() *schema.Provider { "nsxt_policy_ipsec_vpn_service": dataSourceNsxtPolicyIPSecVpnService(), "nsxt_policy_l2_vpn_service": dataSourceNsxtPolicyL2VpnService(), "nsxt_policy_segment": dataSourceNsxtPolicySegment(), + "nsxt_policy_project": dataSourceNsxtPolicyProject(), }, ResourcesMap: map[string]*schema.Resource{ diff --git a/nsxt/utils_test.go b/nsxt/utils_test.go index a2470e7c6..5fbc664e8 100644 --- a/nsxt/utils_test.go +++ b/nsxt/utils_test.go @@ -12,6 +12,8 @@ import ( "testing" "time" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/vmware/go-vmware-nsxt/trust" @@ -89,6 +91,15 @@ func getTier0RouterName() string { return name } +func getTier0RouterPath(connector client.Connector) string { + // Retrieve Tier0 path + routerName := getTier0RouterName() + t0client := infra.NewTier0sClient(connector) + tier0, _ := t0client.Get(routerName) + + return *tier0.Path +} + func getEdgeClusterName() string { name := os.Getenv("NSXT_TEST_EDGE_CLUSTER") if name == "" { diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/OrgsPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/OrgsPackageTypes.go new file mode 100644 index 000000000..9eb5a76f4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/OrgsPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package orgs diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsClient.go new file mode 100644 index 000000000..e3017c1e9 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsClient.go @@ -0,0 +1,283 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Projects +// Used by client-side stubs. + +package orgs + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ProjectsClient interface { + + // Delete PROJECT. + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string) error + + // Get PROJECT + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // @return com.vmware.nsx_policy.model.Project + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string) (nsx_policyModel.Project, error) + + // Paginated list of Project. + // + // @param orgIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param instanceIdParam Instance id of PMaaS where to route this request to. (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.ProjectListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, instanceIdParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ProjectListResult, error) + + // If a Project with the project-id is not already present, create a new Project. If it already exists, update the Project. + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // @param projectParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, projectParam nsx_policyModel.Project) error + + // Update the Project. For local Project, local transport zone and edge clusters needs to be added. + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // @param projectParam (required) + // @return com.vmware.nsx_policy.model.Project + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, projectParam nsx_policyModel.Project) (nsx_policyModel.Project, error) +} + +type projectsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewProjectsClient(connector vapiProtocolClient_.Connector) *projectsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + pIface := projectsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &pIface +} + +func (pIface *projectsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := pIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (pIface *projectsClient) Delete(orgIdParam string, projectIdParam string) error { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := projectsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(projectsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (pIface *projectsClient) Get(orgIdParam string, projectIdParam string) (nsx_policyModel.Project, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := projectsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(projectsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Project + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Project + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ProjectsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Project), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (pIface *projectsClient) List(orgIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, instanceIdParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ProjectListResult, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := projectsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(projectsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("InstanceId", instanceIdParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ProjectListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ProjectListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ProjectsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ProjectListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (pIface *projectsClient) Patch(orgIdParam string, projectIdParam string, projectParam nsx_policyModel.Project) error { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := projectsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(projectsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Project", projectParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (pIface *projectsClient) Update(orgIdParam string, projectIdParam string, projectParam nsx_policyModel.Project) (nsx_policyModel.Project, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := projectsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(projectsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Project", projectParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Project + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Project + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ProjectsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Project), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsTypes.go new file mode 100644 index 000000000..0095d14dd --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/ProjectsTypes.go @@ -0,0 +1,349 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Projects. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package orgs + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func projectsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ProjectsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func projectsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func projectsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ProjectsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) +} + +func projectsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func projectsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["instance_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["instance_id"] = "InstanceId" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ProjectsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ProjectListResultBindingType) +} + +func projectsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["instance_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["instance_id"] = "InstanceId" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["instance_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["instance_id"] = "instance_id" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func projectsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["project"] = "Project" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ProjectsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func projectsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["project"] = "Project" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "project", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func projectsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["project"] = "Project" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ProjectsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) +} + +func projectsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["project"] = "Project" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project"] = vapiBindings_.NewReferenceType(nsx_policyModel.ProjectBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "project", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeClient.go new file mode 100644 index 000000000..8324cdfe9 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeClient.go @@ -0,0 +1,93 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SharedWithMe +// Used by client-side stubs. + +package orgs + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SharedWithMeClient interface { + + // Get the list of resource shared with a given org. + // + // @param orgIdParam (required) + // @param resourceTypeParam resource type (optional) + // @return com.vmware.nsx_policy.model.SharedResourceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, resourceTypeParam *string) (nsx_policyModel.SharedResourceListResult, error) +} + +type sharedWithMeClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSharedWithMeClient(connector vapiProtocolClient_.Connector) *sharedWithMeClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.shared_with_me") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := sharedWithMeClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sharedWithMeClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sharedWithMeClient) List(orgIdParam string, resourceTypeParam *string) (nsx_policyModel.SharedResourceListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sharedWithMeListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sharedWithMeListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ResourceType", resourceTypeParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SharedResourceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.shared_with_me", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SharedResourceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SharedWithMeListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SharedResourceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeTypes.go new file mode 100644 index 000000000..26eab3a72 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/SharedWithMeTypes.go @@ -0,0 +1,75 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SharedWithMe. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package orgs + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func sharedWithMeListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["resource_type"] = "ResourceType" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SharedWithMeListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SharedResourceListResultBindingType) +} + +func sharedWithMeListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["resource_type"] = "ResourceType" + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + pathParams["org_id"] = "orgId" + queryParams["resource_type"] = "resource_type" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/shared-with-me", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 239159eaf..04d9ead53 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -276,6 +276,7 @@ github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_s github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/nat github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs github.com/vmware/vsphere-automation-sdk-go/services/nsxt/search # github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm v0.8.0 ## explicit; go 1.17 diff --git a/website/docs/d/policy_project.html.markdown b/website/docs/d/policy_project.html.markdown new file mode 100644 index 000000000..77e0d7110 --- /dev/null +++ b/website/docs/d/policy_project.html.markdown @@ -0,0 +1,36 @@ +--- +subcategory: "Policy - Multi Tenancy" +layout: "nsxt" +page_title: "NSXT: policy_project" +description: Policy Project data source. +--- + +# nsxt_policy_segment + +This data source provides information about policy Project configured on NSX. +This data source is applicable to NSX Policy Manager and VMC. + +## Example Usage + +```hcl +data "nsxt_policy_project" "test" { + display_name = "project1" +} +``` + +## Argument Reference + +* `id` - (Optional) The ID of Project to retrieve. If ID is specified, no additional argument should be configured. +* `display_name` - (Optional) The Display Name prefix of the Project to retrieve. + +## Attributes Reference + +In addition to arguments listed above, the following attributes are exported: + +* `description` - The description of the resource. +* `path` - The NSX path of the policy resource. +* `short_id` - Defaults to id if id is less than equal to 8 characters or defaults to random generated id if not set. +* `site_info` - Information related to sites applicable for given Project. + * `edge_cluster_paths` - The edge cluster on which the networking elements for the Org will be created. + * `site_path` - This represents the path of the site which is managed by Global Manager. For the local manager, if set, this needs to point to 'default'. +* `tier0_gateway_paths` - The tier 0 has to be pre-created before Project is created. From 3940efe40024d21ca8a3d21eed4022ab98e3c071 Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Mon, 12 Jun 2023 17:39:52 +0000 Subject: [PATCH 2/3] Update VMC Guide with up to date info Signed-off-by: Anna Khmelnitsky --- website/docs/guides/vmc.html.markdown | 43 ++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/website/docs/guides/vmc.html.markdown b/website/docs/guides/vmc.html.markdown index c25adcb86..7bc8aebce 100644 --- a/website/docs/guides/vmc.html.markdown +++ b/website/docs/guides/vmc.html.markdown @@ -30,23 +30,58 @@ Note that `host` is the ProxyURL and `vmc_token` is the API Access Token The following Resources are available to use with VMConAWS: -* Flexible Segments: [nsxt_policy_segment](https://www.terraform.io/docs/providers/nsxt/r/policy_segment) +* Flexible Segment: [nsxt_policy_segment](https://www.terraform.io/docs/providers/nsxt/r/policy_segment) +* Fixed Segment: [nsxt_policy_fixed_segment](https://www.terraform.io/docs/providers/nsxt/r/policy_fixed_segment) +* Tier1 Gateway: [nsxt_policy_tier1_gateway](https://www.terraform.io/docs/providers/nsxt/r/policy_tier1_gateway) * Distributed Firewall Section: [nsxt_policy_security_policy](https://www.terraform.io/docs/providers/nsxt/r/policy_security_policy) +* Predefined Distributed Firewall Section: [nsxt_policy_predefined_security_policy](https://www.terraform.io/docs/providers/nsxt/r/policy_predefined_security_policy) +* Predefined Gateway Firewall Section: [nsxt_policy_predefined_gateway_policy](https://www.terraform.io/docs/providers/nsxt/r/policy_predefined_gateway_policy) * NAT: [nsxt_policy_nat_rule](https://www.terraform.io/docs/providers/nsxt/r/policy_nat_rule) -* Security Groups: [nsxt_policy_group](https://www.terraform.io/docs/providers/nsxt/r/policy_group) -* Services: [nsxt_policy_service](https://www.terraform.io/docs/providers/nsxt/r/policy_service) +* Security Group: [nsxt_policy_group](https://www.terraform.io/docs/providers/nsxt/r/policy_group) +* Service: [nsxt_policy_service](https://www.terraform.io/docs/providers/nsxt/r/policy_service) * DHCP Relay: [nsxt_policy_dhcp_relay](https://www.terraform.io/docs/providers/nsxt/r/policy_dhcp_relay) +* DHCP Service: [nsxt_policy_dhcp_service](https://www.terraform.io/docs/providers/nsxt/r/policy_dhcp_service) * Virtual Machine Tags: [nsxt_policy_vm_tag](https://www.terraform.io/docs/providers/nsxt/r/policy_vm_tags) +* Context Profile: [nsxt_policy_context_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_context_profile) +* Gateway QoS Profile: [nsxt_policy_gateway_qos_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_gateway_qos_profile) +* IDS Policy: [nsxt_policy_intrusion_service_policy](https://www.terraform.io/docs/providers/nsxt/r/policy_intrusion_service_policy) +* IDS Profile: [nsxt_policy_intrusion_service_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_intrusion_service_profile) +* DNS Forwarder Zone: [nsxt_policy_dns_porwarder_zone](https://www.terraform.io/docs/providers/nsxt/r/policy_dns_forwarder_zone) +* Gateway DNS Forwarder: [nsxt_policy_gateway_dns_forwarder](https://www.terraform.io/docs/providers/nsxt/r/policy_gateway_dns_forwarder) +* IPSec VPN DPD Profile: [nsxt_policy_ipsec_vpn_dpd_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_dpd_profile) +* IPSec VPN IKE Profile: [nsxt_policy_ipsec_vpn_ike_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_ike_profile) +* IPSec VPN Tunnel Profile: [nsxt_policy_ipsec_vpn_tunnel_profile](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_tunnel_profile) +* IPSec VPN Local Endpoint: [nsxt_policy_ipsec_vpn_local_endpoint](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_local_endpoint) +* IPSec VPN Service: [nsxt_policy_ipsec_vpn_service](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_service) +* IPSec VPN Session: [nsxt_policy_ipsec_vpn_session](https://www.terraform.io/docs/providers/nsxt/r/policy_ipsec_vpn_session) +* L2 VPN Service: [nsxt_policy_l2_vpn_service](https://www.terraform.io/docs/providers/nsxt/r/policy_l2_vpn_service) +* L2 VPN Session: [nsxt_policy_l2_vpn_session](https://www.terraform.io/docs/providers/nsxt/r/policy_l2_vpn_session) ## Available Data Sources for use with VMConAWS The following Data Sources are available to use with VMConAWS: -* Services: [nsxt_policy_service](https://www.terraform.io/docs/providers/nsxt/d/policy_service) +* Service: [nsxt_policy_service](https://www.terraform.io/docs/providers/nsxt/d/policy_service) +* Group: [nsxt_policy_group](https://www.terraform.io/docs/providers/nsxt/d/policy_group) * Edge Cluster: [nsxt_policy_edge_cluster](https://www.terraform.io/docs/providers/nsxt/d/policy_edge_cluster) * Transport Zone: [nsxt_policy_transport_zone](https://www.terraform.io/docs/providers/nsxt/d/policy_transport_zone) * Tier-0 Gateway: [nsxt_policy_tier0_gateway](https://www.terraform.io/docs/providers/nsxt/d/policy_tier0_gateway) * Tier-1 Gateway: [nsxt_policy_tier1_gateway](https://www.terraform.io/docs/providers/nsxt/d/policy_tier1_gateway) +* IPSec VPN Service: [nsxt_policy_ipsec_vpn_service](https://www.terraform.io/docs/providers/nsxt/d/policy_ipsec_vpn_service) +* IPSec VPN Local Endpoint: [nsxt_policy_ipsec_vpn_local_endpoint](https://www.terraform.io/docs/providers/nsxt/d/policy_ipsec_vpn_local_endpoint) +* L2 VPN Service: [nsxt_policy_l2_vpn_service](https://www.terraform.io/docs/providers/nsxt/d/policy_l2_vpn_service) +* Intrusion Service Profile: [nsxt_policy_intrusion_service_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_intrusion_service_profile) +* DHCP Server: [nsxt_policy_dhcp_server](https://www.terraform.io/docs/providers/nsxt/d/policy_dhcp_server) +* IP Discovery Segment Profile: [nsxt_policy_ip_discovery_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_ip_discovery_profile) +* MAC Discovery Segment Profile: [nsxt_policy_mac_discovery_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_mac_discovery_profile) +* QoS Segment Profile: [nsxt_policy_qos_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_qos_profile) +* Segment Security Profile: [nsxt_policy_segment_security_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_segment_security_profile) +* Spoofguard Segment Profile: [nsxt_policy_spoof_guard_profile](https://www.terraform.io/docs/providers/nsxt/d/policy_spoof_guard_profile) +* Certificate: [nsxt_policy_certificate](https://www.terraform.io/docs/providers/nsxt/d/policy_certificate) +* Virtual Machine: [nsxt_policy_vm](https://www.terraform.io/docs/providers/nsxt/d/policy_vm) +* Virtual Machines with filters: [nsxt_policy_vms](https://www.terraform.io/docs/providers/nsxt/d/policy_vms) +* Security Policy: [nsxt_policy_security_policy](https://www.terraform.io/docs/providers/nsxt/d/policy_security_policy) +* Gateway Policy: [nsxt_policy_gateway_policy](https://www.terraform.io/docs/providers/nsxt/d/policy_gateway_policy) Note that in relevant resources, a domain needs to be specified, since on VMC the domain is different from `default` domain. For example: From e07032c8f98f1a1a48da5f6adfcd5e6834965ab7 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Mon, 22 May 2023 12:55:11 +0300 Subject: [PATCH 3/3] Add multitenancy support using API wrappers Signed-off-by: Kobi Samoray --- GNUmakefile | 8 + api/api_file_template.yaml | 16 + api/api_list.yaml | 999 ++++++++++++++++++ api/api_templates.yaml | 200 ++++ api/infra.go | 78 ++ .../policy_custom_attributes.go | 124 +++ api/infra/dhcp_relay_config.go | 192 ++++ api/infra/dhcp_server_config.go | 192 ++++ api/infra/domains/gateway_policy.go | 192 ++++ api/infra/domains/group.go | 192 ++++ api/infra/domains/security_policy.go | 192 ++++ api/infra/gateway_qos_profile.go | 192 ++++ api/infra/ip_address_block.go | 137 +++ api/infra/ip_address_pool.go | 137 +++ api/infra/ip_discovery_profile.go | 192 ++++ api/infra/ip_pools/ip_address_allocation.go | 137 +++ api/infra/ip_pools/ip_subnets_client.go | 138 +++ api/infra/ipv6_dad_profile.go | 192 ++++ api/infra/ipv6_ndra_profile.go | 192 ++++ api/infra/mac_discovery_profile.go | 192 ++++ api/infra/policy_context_profile.go | 192 ++++ api/infra/policy_dns_forwarder_zone.go | 192 ++++ api/infra/qos_profile.go | 192 ++++ api/infra/realized_state/realized_entity.go | 70 ++ api/infra/realized_state/virtual_machine.go | 53 + api/infra/segment.go | 192 ++++ api/infra/segment_security_profile.go | 192 ++++ .../segments/dhcp_static_binding_config.go | 174 +++ .../segments/segment_configuration_state.go | 106 ++ .../segment_discovery_profile_binding_map.go | 137 +++ api/infra/segments/segment_port.go | 137 +++ .../segment_qos_profile_binding_map.go | 137 +++ .../segment_security_profile_binding_map.go | 137 +++ api/infra/service.go | 192 ++++ api/infra/spoof_guard_profile.go | 156 +++ api/infra/tier0.go | 165 +++ api/infra/tier1.go | 192 ++++ api/infra/tier_0s/locale_services.go | 165 +++ api/infra/tier_0s/nat/policy_nat_rule.go | 165 +++ api/infra/tier_0s/policy_dns_forwarder.go | 137 +++ api/infra/tier_0s/static_routes.go | 165 +++ api/infra/tier_1s/locale_services.go | 192 ++++ .../locale_services/tier1_interface.go | 192 ++++ api/infra/tier_1s/nat/policy_nat_rule.go | 192 ++++ api/infra/tier_1s/policy_dns_forwarder.go | 160 +++ api/infra/tier_1s/segment.go | 192 ++++ .../segments/dhcp_static_binding_config.go | 111 ++ api/infra/tier_1s/static_routes.go | 192 ++++ api/utl/api_util.go | 39 + api/utl_file_template.yaml | 38 + nsxt/data_source_nsxt_policy_bfd_profile.go | 2 +- .../data_source_nsxt_policy_bridge_profile.go | 2 +- nsxt/data_source_nsxt_policy_certificate.go | 2 +- ...data_source_nsxt_policy_context_profile.go | 70 +- nsxt/data_source_nsxt_policy_dhcp_server.go | 3 +- nsxt/data_source_nsxt_policy_edge_cluster.go | 2 +- nsxt/data_source_nsxt_policy_edge_node.go | 2 +- ...urce_nsxt_policy_gateway_locale_service.go | 3 +- .../data_source_nsxt_policy_gateway_policy.go | 16 +- ..._source_nsxt_policy_gateway_qos_profile.go | 67 +- nsxt/data_source_nsxt_policy_group.go | 100 +- ...e_nsxt_policy_intrusion_service_profile.go | 2 +- nsxt/data_source_nsxt_policy_ip_block.go | 6 +- ...source_nsxt_policy_ip_discovery_profile.go | 68 +- nsxt/data_source_nsxt_policy_ip_pool.go | 6 +- ...ce_nsxt_policy_ipsec_vpn_local_endpoint.go | 2 +- ...ta_source_nsxt_policy_ipsec_vpn_service.go | 2 +- ...ata_source_nsxt_policy_ipv6_dad_profile.go | 67 +- ...ta_source_nsxt_policy_ipv6_ndra_profile.go | 68 +- .../data_source_nsxt_policy_l2_vpn_service.go | 2 +- nsxt/data_source_nsxt_policy_lb_service.go | 2 +- ...ource_nsxt_policy_mac_discovery_profile.go | 70 +- nsxt/data_source_nsxt_policy_qos_profile.go | 68 +- ...ata_source_nsxt_policy_realization_info.go | 21 +- ...data_source_nsxt_policy_security_policy.go | 39 +- nsxt/data_source_nsxt_policy_segment.go | 3 +- ..._source_nsxt_policy_segment_realization.go | 13 +- ...ce_nsxt_policy_segment_security_profile.go | 69 +- nsxt/data_source_nsxt_policy_service.go | 93 +- nsxt/data_source_nsxt_policy_site.go | 2 +- ...a_source_nsxt_policy_spoofguard_profile.go | 69 +- nsxt/data_source_nsxt_policy_tier0_gateway.go | 4 +- nsxt/data_source_nsxt_policy_tier1_gateway.go | 106 +- ...a_source_nsxt_policy_tier1_gateway_test.go | 7 +- .../data_source_nsxt_policy_transport_zone.go | 2 +- nsxt/data_source_nsxt_policy_vm.go | 5 +- nsxt/data_source_nsxt_policy_vms.go | 2 +- nsxt/gateway_common.go | 25 +- nsxt/policy_common.go | 8 +- nsxt/policy_search.go | 75 +- nsxt/policy_utils.go | 26 +- nsxt/provider.go | 28 + nsxt/resource_nsxt_policy_bgp_config.go | 5 +- nsxt/resource_nsxt_policy_context_profile.go | 79 +- ...policy_context_profile_custom_attribute.go | 60 +- ...y_context_profile_custom_attribute_test.go | 4 +- nsxt/resource_nsxt_policy_dhcp_relay.go | 92 +- nsxt/resource_nsxt_policy_dhcp_relay_test.go | 4 +- nsxt/resource_nsxt_policy_dhcp_server.go | 85 +- nsxt/resource_nsxt_policy_dhcp_server_test.go | 4 +- ...urce_nsxt_policy_dhcp_v4_static_binding.go | 96 +- ...nsxt_policy_dhcp_v4_static_binding_test.go | 4 +- ...urce_nsxt_policy_dhcp_v6_static_binding.go | 47 +- ...nsxt_policy_dhcp_v6_static_binding_test.go | 4 +- ...resource_nsxt_policy_dns_forwarder_zone.go | 72 +- ...rce_nsxt_policy_dns_forwarder_zone_test.go | 4 +- nsxt/resource_nsxt_policy_domain.go | 4 +- ...resource_nsxt_policy_fixed_segment_test.go | 6 +- ...ource_nsxt_policy_gateway_dns_forwarder.go | 106 +- ..._nsxt_policy_gateway_dns_forwarder_test.go | 4 +- nsxt/resource_nsxt_policy_gateway_policy.go | 48 +- ...esource_nsxt_policy_gateway_policy_test.go | 4 +- ...xt_policy_gateway_redistribution_config.go | 73 +- nsxt/resource_nsxt_policy_group.go | 88 +- nsxt/resource_nsxt_policy_group_test.go | 2 +- ...ce_nsxt_policy_intrusion_service_policy.go | 10 +- ...ource_nsxt_policy_ip_address_allocation.go | 24 +- nsxt/resource_nsxt_policy_ip_block.go | 19 +- ...source_nsxt_policy_ip_discovery_profile.go | 85 +- ...e_nsxt_policy_ip_discovery_profile_test.go | 4 +- nsxt/resource_nsxt_policy_ip_pool.go | 19 +- ...source_nsxt_policy_ip_pool_block_subnet.go | 25 +- ...ource_nsxt_policy_ip_pool_static_subnet.go | 11 +- ...ource_nsxt_policy_mac_discovery_profile.go | 81 +- ..._nsxt_policy_mac_discovery_profile_test.go | 4 +- nsxt/resource_nsxt_policy_nat_rule.go | 123 +-- nsxt/resource_nsxt_policy_nat_rule_test.go | 4 +- nsxt/resource_nsxt_policy_ospf_config.go | 2 +- ...e_nsxt_policy_predefined_gateway_policy.go | 44 +- ..._nsxt_policy_predefined_security_policy.go | 48 +- nsxt/resource_nsxt_policy_qos_profile.go | 85 +- nsxt/resource_nsxt_policy_qos_profile_test.go | 4 +- nsxt/resource_nsxt_policy_security_policy.go | 79 +- ...source_nsxt_policy_security_policy_test.go | 6 +- ...ce_nsxt_policy_segment_security_profile.go | 66 +- ...xt_policy_segment_security_profile_test.go | 4 +- nsxt/resource_nsxt_policy_segment_test.go | 6 +- nsxt/resource_nsxt_policy_service.go | 80 +- ...esource_nsxt_policy_spoof_guard_profile.go | 66 +- ...ce_nsxt_policy_spoof_guard_profile_test.go | 4 +- nsxt/resource_nsxt_policy_static_route.go | 41 +- .../resource_nsxt_policy_static_route_test.go | 4 +- nsxt/resource_nsxt_policy_tier0_gateway.go | 45 +- ...rce_nsxt_policy_tier0_gateway_interface.go | 5 +- ...sxt_policy_tier0_gateway_interface_test.go | 2 +- nsxt/resource_nsxt_policy_tier1_gateway.go | 114 +- ...rce_nsxt_policy_tier1_gateway_interface.go | 82 +- ...resource_nsxt_policy_tier1_gateway_test.go | 4 +- .../resource_nsxt_policy_vlan_segment_test.go | 7 +- nsxt/resource_nsxt_policy_vm_tags.go | 44 +- nsxt/resource_nsxt_policy_vm_tags_test.go | 4 +- nsxt/segment_common.go | 92 +- nsxt/utils.go | 19 + nsxt/utils_test.go | 26 +- tools/api-wrapper-generator.py | 326 ++++++ .../nsxt/orgs/projects/InfraClient.go | 143 +++ .../services/nsxt/orgs/projects/InfraTypes.go | 162 +++ .../orgs/projects/ProjectsPackageTypes.go | 11 + .../nsxt/orgs/projects/QuotaStatsClient.go | 97 ++ .../nsxt/orgs/projects/QuotaStatsTypes.go | 88 ++ .../nsxt/orgs/projects/SharedWithMeClient.go | 95 ++ .../nsxt/orgs/projects/SharedWithMeTypes.go | 82 ++ .../orgs/projects/infra/ConstraintsClient.go | 291 +++++ .../orgs/projects/infra/ConstraintsTypes.go | 378 +++++++ .../projects/infra/ContextProfilesClient.go | 299 ++++++ .../projects/infra/ContextProfilesTypes.go | 402 +++++++ .../projects/infra/DhcpRelayConfigsClient.go | 291 +++++ .../projects/infra/DhcpRelayConfigsTypes.go | 378 +++++++ .../projects/infra/DhcpServerConfigsClient.go | 291 +++++ .../projects/infra/DhcpServerConfigsTypes.go | 378 +++++++ .../projects/infra/DnsForwarderZonesClient.go | 291 +++++ .../projects/infra/DnsForwarderZonesTypes.go | 378 +++++++ .../infra/DnsSecurityProfilesClient.go | 297 ++++++ .../infra/DnsSecurityProfilesTypes.go | 396 +++++++ .../nsxt/orgs/projects/infra/DomainsClient.go | 154 +++ .../nsxt/orgs/projects/infra/DomainsTypes.go | 176 +++ .../FirewallSessionTimerProfilesClient.go | 297 ++++++ .../FirewallSessionTimerProfilesTypes.go | 396 +++++++ .../infra/FloodProtectionProfilesClient.go | 302 ++++++ .../infra/FloodProtectionProfilesTypes.go | 396 +++++++ .../infra/GatewayQosProfilesClient.go | 297 ++++++ .../projects/infra/GatewayQosProfilesTypes.go | 396 +++++++ .../projects/infra/GroupAssociationsClient.go | 109 ++ .../projects/infra/GroupAssociationsTypes.go | 124 +++ .../infra/GroupServiceAssociationsClient.go | 107 ++ .../infra/GroupServiceAssociationsTypes.go | 118 +++ .../orgs/projects/infra/InfraPackageTypes.go | 11 + .../infra/IpAddressGroupAssociationsClient.go | 109 ++ .../infra/IpAddressGroupAssociationsTypes.go | 124 +++ .../orgs/projects/infra/IpBlocksClient.go | 291 +++++ .../nsxt/orgs/projects/infra/IpBlocksTypes.go | 378 +++++++ .../infra/IpDiscoveryProfilesClient.go | 297 ++++++ .../infra/IpDiscoveryProfilesTypes.go | 396 +++++++ .../nsxt/orgs/projects/infra/IpPoolsClient.go | 291 +++++ .../nsxt/orgs/projects/infra/IpPoolsTypes.go | 378 +++++++ .../projects/infra/Ipv6DadProfilesClient.go | 297 ++++++ .../projects/infra/Ipv6DadProfilesTypes.go | 396 +++++++ .../projects/infra/Ipv6NdraProfilesClient.go | 297 ++++++ .../projects/infra/Ipv6NdraProfilesTypes.go | 396 +++++++ .../projects/infra/L7AccessProfilesClient.go | 306 ++++++ .../projects/infra/L7AccessProfilesTypes.go | 402 +++++++ .../nsxt/orgs/projects/infra/LabelsClient.go | 291 +++++ .../nsxt/orgs/projects/infra/LabelsTypes.go | 378 +++++++ .../infra/MacDiscoveryProfilesClient.go | 297 ++++++ .../infra/MacDiscoveryProfilesTypes.go | 396 +++++++ .../orgs/projects/infra/QosProfilesClient.go | 295 ++++++ .../orgs/projects/infra/QosProfilesTypes.go | 390 +++++++ .../infra/SegmentSecurityProfilesClient.go | 297 ++++++ .../infra/SegmentSecurityProfilesTypes.go | 396 +++++++ .../orgs/projects/infra/SegmentsClient.go | 478 +++++++++ .../nsxt/orgs/projects/infra/SegmentsTypes.go | 673 ++++++++++++ .../orgs/projects/infra/ServicesClient.go | 293 +++++ .../nsxt/orgs/projects/infra/ServicesTypes.go | 384 +++++++ .../infra/SpoofguardProfilesClient.go | 297 ++++++ .../projects/infra/SpoofguardProfilesTypes.go | 396 +++++++ .../nsxt/orgs/projects/infra/TagsClient.go | 113 ++ .../nsxt/orgs/projects/infra/TagsTypes.go | 148 +++ .../nsxt/orgs/projects/infra/Tier1sClient.go | 335 ++++++ .../nsxt/orgs/projects/infra/Tier1sTypes.go | 448 ++++++++ .../orgs/projects/infra/TraceflowsClient.go | 346 ++++++ .../orgs/projects/infra/TraceflowsTypes.go | 460 ++++++++ .../VirtualMachineGroupAssociationsClient.go | 109 ++ .../VirtualMachineGroupAssociationsTypes.go | 124 +++ ...NetworkInterfaceGroupAssociationsClient.go | 109 ++ ...lNetworkInterfaceGroupAssociationsTypes.go | 124 +++ .../CustomAttributesPackageTypes.go | 11 + .../custom_attributes/DefaultClient.go | 195 ++++ .../custom_attributes/DefaultTypes.go | 269 +++++ .../infra/domains/DomainsPackageTypes.go | 11 + ...FloodProtectionProfileBindingMapsClient.go | 105 ++ ...lFloodProtectionProfileBindingMapsTypes.go | 112 ++ ...allSessionTimerProfileBindingMapsClient.go | 105 ++ ...wallSessionTimerProfileBindingMapsTypes.go | 112 ++ .../infra/domains/GatewayPoliciesClient.go | 360 +++++++ .../infra/domains/GatewayPoliciesTypes.go | 519 +++++++++ .../projects/infra/domains/GroupsClient.go | 307 ++++++ .../projects/infra/domains/GroupsTypes.go | 431 ++++++++ .../infra/domains/SecurityPoliciesClient.go | 360 +++++++ .../infra/domains/SecurityPoliciesTypes.go | 519 +++++++++ .../infra/ip_pools/IpAllocationsClient.go | 301 ++++++ .../infra/ip_pools/IpAllocationsTypes.go | 413 ++++++++ .../infra/ip_pools/IpPoolsPackageTypes.go | 11 + .../infra/ip_pools/IpSubnetsClient.go | 306 ++++++ .../projects/infra/ip_pools/IpSubnetsTypes.go | 413 ++++++++ .../realized_state/RealizedEntitiesClient.go | 97 ++ .../realized_state/RealizedEntitiesTypes.go | 88 ++ .../realized_state/RealizedEntityClient.go | 89 ++ .../realized_state/RealizedEntityTypes.go | 87 ++ .../RealizedStatePackageTypes.go | 11 + .../infra/realized_state/StatusClient.go | 99 ++ .../infra/realized_state/StatusTypes.go | 94 ++ .../realized_state/VirtualMachinesClient.go | 107 ++ .../realized_state/VirtualMachinesTypes.go | 118 +++ .../projects/infra/segments/ArpProxyClient.go | 111 ++ .../projects/infra/segments/ArpProxyTypes.go | 137 +++ .../projects/infra/segments/ArpTableClient.go | 111 ++ .../projects/infra/segments/ArpTableTypes.go | 131 +++ .../DhcpStaticBindingConfigsClient.go | 306 ++++++ .../segments/DhcpStaticBindingConfigsTypes.go | 413 ++++++++ .../infra/segments/EffectiveProfilesClient.go | 97 ++ .../infra/segments/EffectiveProfilesTypes.go | 89 ++ .../GatewayInterfaceArpTableClient.go | 114 ++ .../segments/GatewayInterfaceArpTableTypes.go | 131 +++ .../GatewayInterfaceDadStateClient.go | 99 ++ .../segments/GatewayInterfaceDadStateTypes.go | 101 ++ .../GatewayInterfaceStatisticsClient.go | 111 ++ .../GatewayInterfaceStatisticsTypes.go | 131 +++ .../projects/infra/segments/MacTableClient.go | 111 ++ .../projects/infra/segments/MacTableTypes.go | 137 +++ .../projects/infra/segments/PortsClient.go | 301 ++++++ .../projects/infra/segments/PortsTypes.go | 413 ++++++++ ...egmentDiscoveryProfileBindingMapsClient.go | 301 ++++++ ...SegmentDiscoveryProfileBindingMapsTypes.go | 413 ++++++++ .../SegmentQosProfileBindingMapsClient.go | 299 ++++++ .../SegmentQosProfileBindingMapsTypes.go | 407 +++++++ ...SegmentSecurityProfileBindingMapsClient.go | 299 ++++++ .../SegmentSecurityProfileBindingMapsTypes.go | 407 +++++++ .../infra/segments/SegmentsPackageTypes.go | 11 + .../projects/infra/segments/StateClient.go | 164 +++ .../projects/infra/segments/StateTypes.go | 233 ++++ .../infra/segments/StatisticsClient.go | 111 ++ .../infra/segments/StatisticsTypes.go | 131 +++ .../projects/infra/segments/TepTableClient.go | 111 ++ .../projects/infra/segments/TepTableTypes.go | 137 +++ .../infra/tier_1s/ArpProxiesClient.go | 111 ++ .../projects/infra/tier_1s/ArpProxiesTypes.go | 137 +++ .../infra/tier_1s/DnsForwarderClient.go | 278 +++++ .../infra/tier_1s/DnsForwarderTypes.go | 364 +++++++ .../FloodProtectionProfileBindingsClient.go | 240 +++++ .../FloodProtectionProfileBindingsTypes.go | 313 ++++++ .../infra/tier_1s/ForwardingTableClient.go | 115 ++ .../infra/tier_1s/ForwardingTableTypes.go | 155 +++ .../infra/tier_1s/GatewayFirewallClient.go | 95 ++ .../infra/tier_1s/GatewayFirewallTypes.go | 83 ++ .../infra/tier_1s/LocaleServicesClient.go | 301 ++++++ .../infra/tier_1s/LocaleServicesTypes.go | 413 ++++++++ .../orgs/projects/infra/tier_1s/NatClient.go | 107 ++ .../orgs/projects/infra/tier_1s/NatTypes.go | 119 +++ .../infra/tier_1s/SecurityConfigClient.go | 209 ++++ .../infra/tier_1s/SecurityConfigTypes.go | 269 +++++ .../projects/infra/tier_1s/SegmentsClient.go | 395 +++++++ .../projects/infra/tier_1s/SegmentsTypes.go | 578 ++++++++++ .../SessionTimerProfileBindingsClient.go | 240 +++++ .../SessionTimerProfileBindingsTypes.go | 313 ++++++ .../projects/infra/tier_1s/StateClient.go | 111 ++ .../orgs/projects/infra/tier_1s/StateTypes.go | 140 +++ .../infra/tier_1s/StaticRoutesClient.go | 301 ++++++ .../infra/tier_1s/StaticRoutesTypes.go | 413 ++++++++ .../infra/tier_1s/Tier1sPackageTypes.go | 11 + .../locale_services/ArpProxiesClient.go | 116 ++ .../locale_services/ArpProxiesTypes.go | 144 +++ .../FloodProtectionProfileBindingsClient.go | 248 +++++ .../FloodProtectionProfileBindingsTypes.go | 341 ++++++ .../locale_services/GatewayFirewallClient.go | 97 ++ .../locale_services/GatewayFirewallTypes.go | 90 ++ .../locale_services/InterfaceGroupsClient.go | 311 ++++++ .../locale_services/InterfaceGroupsTypes.go | 448 ++++++++ .../locale_services/InterfacesClient.go | 311 ++++++ .../locale_services/InterfacesTypes.go | 448 ++++++++ .../LocaleServicesPackageTypes.go | 11 + .../ServiceInterfacesClient.go | 311 ++++++ .../locale_services/ServiceInterfacesTypes.go | 448 ++++++++ .../SessionTimerProfileBindingsClient.go | 248 +++++ .../SessionTimerProfileBindingsTypes.go | 341 ++++++ .../infra/tier_1s/nat/NatPackageTypes.go | 11 + .../infra/tier_1s/nat/NatRulesClient.go | 311 ++++++ .../infra/tier_1s/nat/NatRulesTypes.go | 448 ++++++++ .../infra/tier_1s/nat/StatisticsClient.go | 109 ++ .../infra/tier_1s/nat/StatisticsTypes.go | 125 +++ vendor/modules.txt | 10 + .../d/policy_context_profile.html.markdown | 17 + .../docs/d/policy_dhcp_server.html.markdown | 17 + ...olicy_gateway_locale_service.html.markdown | 18 + .../d/policy_gateway_policy.html.markdown | 17 + .../policy_gateway_qos_profile.html.markdown | 17 + website/docs/d/policy_group.html.markdown | 17 + website/docs/d/policy_ip_block.html.markdown | 17 + .../policy_ip_discovery_profile.html.markdown | 17 + website/docs/d/policy_ip_pool.html.markdown | 17 + .../d/policy_ipv6_dad_profile.html.markdown | 17 + .../d/policy_ipv6_ndra_profile.html.markdown | 17 + ...policy_mac_discovery_profile.html.markdown | 17 + .../docs/d/policy_qos_profile.html.markdown | 17 + .../d/policy_realization_info.html.markdown | 23 + .../d/policy_security_policy.html.markdown | 19 + website/docs/d/policy_segment.html.markdown | 17 + .../policy_segment_realization.html.markdown | 30 + ...icy_segment_security_profile.html.markdown | 17 + website/docs/d/policy_service.html.markdown | 17 + .../d/policy_spoofguard_profile.html.markdown | 17 + .../docs/d/policy_tier1_gateway.html.markdown | 17 + .../r/policy_context_profile.html.markdown | 30 +- ...ext_profile_custom_attribute.html.markdown | 18 + .../docs/r/policy_dhcp_relay.html.markdown | 19 + .../docs/r/policy_dhcp_server.html.markdown | 21 + .../r/policy_dns_forwarder_zone.html.markdown | 20 + .../docs/r/policy_fixed_segment.html.markdown | 39 + ...policy_gateway_dns_forwarder.html.markdown | 26 + .../r/policy_gateway_policy.html.markdown | 41 + website/docs/r/policy_group.html.markdown | 34 + ...policy_ip_address_allocation.html.markdown | 20 + website/docs/r/policy_ip_block.html.markdown | 28 + .../policy_ip_discovery_profile.html.markdown | 37 + website/docs/r/policy_ip_pool.html.markdown | 27 + .../policy_ip_pool_block_subnet.html.markdown | 31 + ...policy_ip_pool_static_subnet.html.markdown | 39 + ...policy_mac_discovery_profile.html.markdown | 24 + website/docs/r/policy_nat_rule.html.markdown | 29 + ...cy_predefined_gateway_policy.html.markdown | 33 + ...y_predefined_security_policy.html.markdown | 50 + .../docs/r/policy_qos_profile.html.markdown | 47 + .../r/policy_security_policy.html.markdown | 47 + website/docs/r/policy_segment.html.markdown | 32 +- ...icy_segment_security_profile.html.markdown | 31 + website/docs/r/policy_service.html.markdown | 28 + .../policy_spoof_guard_profile.html.markdown | 19 + .../docs/r/policy_static_route.html.markdown | 34 + .../docs/r/policy_tier1_gateway.html.markdown | 32 + ...licy_tier1_gateway_interface.html.markdown | 23 + .../docs/r/policy_vlan_segment.html.markdown | 43 + website/docs/r/policy_vm_tags.html.markdown | 32 + 381 files changed, 53092 insertions(+), 2535 deletions(-) create mode 100644 api/api_file_template.yaml create mode 100644 api/api_list.yaml create mode 100644 api/api_templates.yaml create mode 100644 api/infra.go create mode 100644 api/infra/context_profiles/custom_attributes/policy_custom_attributes.go create mode 100644 api/infra/dhcp_relay_config.go create mode 100644 api/infra/dhcp_server_config.go create mode 100644 api/infra/domains/gateway_policy.go create mode 100644 api/infra/domains/group.go create mode 100644 api/infra/domains/security_policy.go create mode 100644 api/infra/gateway_qos_profile.go create mode 100644 api/infra/ip_address_block.go create mode 100644 api/infra/ip_address_pool.go create mode 100644 api/infra/ip_discovery_profile.go create mode 100644 api/infra/ip_pools/ip_address_allocation.go create mode 100644 api/infra/ip_pools/ip_subnets_client.go create mode 100644 api/infra/ipv6_dad_profile.go create mode 100644 api/infra/ipv6_ndra_profile.go create mode 100644 api/infra/mac_discovery_profile.go create mode 100644 api/infra/policy_context_profile.go create mode 100644 api/infra/policy_dns_forwarder_zone.go create mode 100644 api/infra/qos_profile.go create mode 100644 api/infra/realized_state/realized_entity.go create mode 100644 api/infra/realized_state/virtual_machine.go create mode 100644 api/infra/segment.go create mode 100644 api/infra/segment_security_profile.go create mode 100644 api/infra/segments/dhcp_static_binding_config.go create mode 100644 api/infra/segments/segment_configuration_state.go create mode 100644 api/infra/segments/segment_discovery_profile_binding_map.go create mode 100644 api/infra/segments/segment_port.go create mode 100644 api/infra/segments/segment_qos_profile_binding_map.go create mode 100644 api/infra/segments/segment_security_profile_binding_map.go create mode 100644 api/infra/service.go create mode 100644 api/infra/spoof_guard_profile.go create mode 100644 api/infra/tier0.go create mode 100644 api/infra/tier1.go create mode 100644 api/infra/tier_0s/locale_services.go create mode 100644 api/infra/tier_0s/nat/policy_nat_rule.go create mode 100644 api/infra/tier_0s/policy_dns_forwarder.go create mode 100644 api/infra/tier_0s/static_routes.go create mode 100644 api/infra/tier_1s/locale_services.go create mode 100644 api/infra/tier_1s/locale_services/tier1_interface.go create mode 100644 api/infra/tier_1s/nat/policy_nat_rule.go create mode 100644 api/infra/tier_1s/policy_dns_forwarder.go create mode 100644 api/infra/tier_1s/segment.go create mode 100644 api/infra/tier_1s/segments/dhcp_static_binding_config.go create mode 100644 api/infra/tier_1s/static_routes.go create mode 100644 api/utl/api_util.go create mode 100644 api/utl_file_template.yaml create mode 100644 tools/api-wrapper-generator.py create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/ProjectsPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/InfraPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/CustomAttributesPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/DomainsPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpPoolsPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedStatePackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentsPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/Tier1sPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/LocaleServicesPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsTypes.go diff --git a/GNUmakefile b/GNUmakefile index b7a83b2c7..b70098974 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -71,3 +71,11 @@ website-list-category: .PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website-lint website-lint-fix tools +api-wrapper: + @echo "==> Generating API wrappers..." + /usr/bin/python3 $(CURDIR)/tools/api-wrapper-generator.py \ + --api_list $(CURDIR)/api/api_list.yaml \ + --api_template $(CURDIR)/api/api_templates.yaml \ + --api_file_template $(CURDIR)/api/api_file_template.yaml \ + --utl_file_template $(CURDIR)/api/utl_file_template.yaml \ + --out_dir $(CURDIR)/api diff --git a/api/api_file_template.yaml b/api/api_file_template.yaml new file mode 100644 index 000000000..9f49ff221 --- /dev/null +++ b/api/api_file_template.yaml @@ -0,0 +1,16 @@ +|2+ + //nolint:revive + package $pkg_name + + // The following file has been autogenerated. Please avoid any changes! + import ( + "errors" + + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + $imports + + $utl_pkg_import + ) + + type $context_type + diff --git a/api/api_list.yaml b/api/api_list.yaml new file mode 100644 index 000000000..8d70e23e6 --- /dev/null +++ b/api/api_list.yaml @@ -0,0 +1,999 @@ +################### +### API implementations: +# - api_packages: +### API client package path +# - client: +### API model path +# model: +### API type (Local/Global/Multitenancy) +# type: +### List results Model path +# list_result_model: +### Name of model within model path package (should be same in all implementations) +# model_name: +### Used to create client name, variable names etc. +# obj_name: +### List of methods which are supported by API +# supported_method: +### Variable name (for cases when variable isn't compliant with ${obj_name}Param template +# var_name: +### List API results type (for cases when results struct isn't compliant with ${model_name}ListResult template +# list_result_name: +### Prefix for model type in API code +# model_prefix: +### Model value is passed as pointer (true/false, defaults to false) +# model_pass_ptr: +### File name for API wrapper output +# file_name: +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: IPDiscoveryProfile + obj_name: IpDiscoveryProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - 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: CommunityList +# obj_name: CommunityList +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +#- 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: Tier0Interface +# obj_name: Interface +# var_name: tier0InterfaceParam +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +#- 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: BgpRoutingConfig +# obj_name: BgpRoutingConfig +# client_name: BgpClient +# supported_method: +# - New +# - Get +# - Patch +# - Update +#- api_packages: +# - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services/bgp +# 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/bgp +# model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model +# type: Global +# model_name: BgpNeighborConfig +# obj_name: BgpNeighborConfig +# client_name: NeighborsClient +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: PolicyContextProfile + obj_name: ContextProfile + var_name: policyContextProfileParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/context_profiles/custom_attributes + 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/context_profiles/custom_attributes + 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/context_profiles/custom_attributes + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + client_name: DefaultClient + model_name: PolicyCustomAttributes + obj_name: ContextProfileCustomAttribute + var_name: policyCustomAttributesParam + list_result_name: PolicyContextProfileListResult + supported_method: + - New + - Create + - List + - Patch +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: DhcpRelayConfig + obj_name: DhcpRelayConfig + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: DhcpServerConfig + obj_name: DhcpServerConfig + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: PolicyDnsForwarderZone + obj_name: DnsForwarderZone + var_name: policyDnsForwarderZoneParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - 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: PolicyDnsForwarder + obj_name: DnsForwarder + client_name: DnsForwarderClient + var_name: policyDnsForwarderParam + supported_method: + - New + - Get + - Patch + - Update + - Delete +- 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: PolicyDnsForwarder + obj_name: DnsForwarder + client_name: DnsForwarderClient + var_name: policyDnsForwarderParam + supported_method: + - New + - Get + - Patch + - Update + - Delete +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains + 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 + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: GatewayPolicy + obj_name: GatewayPolicy + client_name: GatewayPoliciesClient + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model + type: Global + model_name: Tier0 + obj_name: Tier0 + supported_method: + - New + - Get + - Patch + - Update + - Delete + - 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: PrefixList +# obj_name: PrefixList +# list_result_name: PrefixListResult +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - 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: LocaleServices + obj_name: LocaleService + var_name: localeServicesParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - 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: Tier0RouteMap +# obj_name: RouteMap +# var_name: tier0RouteMapParam +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains + 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 + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Group + obj_name: Group + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +#- api_packages: +# - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains +# model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model +# type: Local +# model_name: IdsSecurityPolicy +# obj_name: IntrusionServicePolicy +# client_name: IntrusionServicePoliciesClient +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +#- api_packages: +# - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/settings/firewall/security/intrusion_services +# model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model +# type: Local +# model_name: IdsProfile +# obj_name: Profile +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +- 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: IpAddressPool + obj_name: IpPool + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools + 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/ip_pools + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: IpAddressAllocation + obj_name: IpAllocation + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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: IpAddressBlock + obj_name: IpBlock + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state + 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/realized_state + 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/realized_state + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: RealizedEntity + obj_name: RealizedEntity + client_name: RealizedEntitiesClient + list_result_name: GenericPolicyRealizedResourceListResult + supported_method: + - New + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_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/ip_pools + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: StructValue + obj_name: IpSubnets + client_name: IpSubnetsClient + list_result_name: IpAddressPoolSubnetListResult + model_prefix: vapiData_ + model_pass_ptr: true + file_name: IpSubnetsClient + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_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/segments + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_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/segments + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: StructValue + obj_name: DhcpStaticBindingConfig + client_name: DhcpStaticBindingConfigsClient + list_result_name: DhcpStaticBindingConfigListResult + model_prefix: vapiData_ + model_pass_ptr: true + file_name: DhcpStaticBindingConfig + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: MacDiscoveryProfile + obj_name: MacDiscoveryProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Tier1 + obj_name: Tier1 + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List + +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/nat + 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/nat + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model + type: Global + model_name: PolicyNatRule + obj_name: NatRule + var_name: policyNatRuleParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/nat + 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/nat + 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/nat + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: PolicyNatRule + obj_name: NatRule + var_name: policyNatRuleParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains + 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 + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SecurityPolicy + obj_name: SecurityPolicy + client_name: SecurityPoliciesClient + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: QosProfile + obj_name: QosProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Service + obj_name: Service + supported_method: + - New + - Get + - Patch + - Update + - Delete + - 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: StaticRoutes + obj_name: StaticRoute + var_name: staticRoutesParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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: StaticRoutes + obj_name: StaticRoute + var_name: staticRoutesParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +#- api_packages: +# - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/static_routes +# 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/static_routes +# model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model +# type: Global +# model_name: StaticRouteBfdPeer +# obj_name: BfdPeer +# var_name: staticRouteBfdPeerParam +# supported_method: +# - New +# - Get +# - Patch +# - Update +# - Delete +# - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: GatewayQosProfile + obj_name: GatewayQosProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Ipv6DadProfile + obj_name: Ipv6DadProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Ipv6NdraProfile + obj_name: Ipv6NdraProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Segment + obj_name: Segment + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentConfigurationState + obj_name: State + client_name: StateClient + supported_method: + - New + - Get + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentSecurityProfile + obj_name: SegmentSecurityProfile + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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-gm/global_infra + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SpoofGuardProfile + obj_name: SpoofguardProfile + var_name: spoofGuardProfileParam + supported_method: + - New + - Get + - Patch + - Delete + - List +- 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: LocaleServices + obj_name: LocaleService + var_name: localeServicesParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state + 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/realized_state + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: VirtualMachine + obj_name: VirtualMachine + supported_method: + - New + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentPort + obj_name: Port + var_name: segmentPortParam + supported_method: + - New + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentPort + obj_name: Port + var_name: segmentPortParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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: Tier1Interface + obj_name: Interface + var_name: tier1InterfaceParam + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- 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: Segment + obj_name: Segment + supported_method: + - New + - Get + - Patch + - Update + - Delete + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments + model: github.com/vmware/vsphere-automation-sdk-go/runtime/data + list_result_model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Local + model_name: StructValue + obj_name: DhcpStaticBindingConfig + client_name: DhcpStaticBindingConfigsClient + list_result_name: DhcpStaticBindingConfigListResult + model_prefix: vapiData_ + model_pass_ptr: true + file_name: DhcpStaticBindingConfig + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt + 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 + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: Infra + obj_name: Infra + client_name: InfraClient + supported_method: + - New + - Get + - Patch +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentDiscoveryProfileBindingMap + obj_name: SegmentDiscoveryProfileBindingMap + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentQosProfileBindingMap + obj_name: SegmentQosProfileBindingMap + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List + +- api_packages: + - client: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments + 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/segments + model: github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model + type: Multitenancy + model_name: SegmentSecurityProfileBindingMap + obj_name: SegmentSecurityProfileBindingMap + supported_method: + - New + - Get + - Delete + - Patch + - Update + - List diff --git a/api/api_templates.yaml b/api/api_templates.yaml new file mode 100644 index 000000000..e5cac2249 --- /dev/null +++ b/api/api_templates.yaml @@ -0,0 +1,200 @@ +New: + Convert: |2 + + case utl.${type}: + client = ${client_import}.${api_func_call} + NoConvert: |2 + + case utl.${type}: + client = ${client_import}.${api_func_call} + main: |2 + + func ${api_func_def} { + var client interface{} + + switch sessionContext.ClientType { + ${case_items} + default: + return nil + } + return &${model_name}ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} + } +Get: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + gmObj, err1 := client.${api_func_call} + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, ${model_import}.${model_name}BindingType(), ${main_model_import}.${model_name}BindingType()) + obj = rawObj.(${main_model_import}.${model_name}) + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + obj, err = client.${api_func_call} + if err != nil { + return obj, err + } + main: |2 + + func ${api_func_def} { + var obj ${ptr_prefix}${main_model_import}.${model_name} + var err error + + switch c.ClientType { + ${case_items} + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err + } +Patch: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + gmObj, err1 := utl.ConvertModelBindingType(${var_name}, ${main_model_import}.${model_name}BindingType(), ${model_import}.${model_name}BindingType()) + if err1 != nil { + return err1 + } + err = client.${api_func_call} + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + err = client.${api_func_call} + main: |2 + + func ${api_func_def} { + var err error + + switch c.ClientType { + ${case_items} + default: + err = errors.New("invalid infrastructure for model") + } + return err + } +Update: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + gmObj, err := utl.ConvertModelBindingType(${var_name}, ${main_model_import}.${model_name}BindingType(), ${model_import}.${model_name}BindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.${api_func_call} + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, ${model_import}.${model_name}BindingType(), ${main_model_import}.${model_name}BindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(${main_model_import}.${model_name}) + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + obj, err = client.${api_func_call} + main: |2 + + func ${api_func_def} { + var err error + var obj ${ptr_prefix}${main_model_import}.${model_name} + + switch c.ClientType { + ${case_items} + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err + } +Delete: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + err = client.${api_func_call} + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + err = client.${api_func_call} + main: |2 + + func ${api_func_def} { + var err error + + switch c.ClientType { + ${case_items} + default: + err = errors.New("invalid infrastructure for model") + } + return err + } +List: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + gmObj, err := client.${api_func_call} + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, ${list_model_import}.${list_result_name}BindingType(), ${list_main_model_import}.${list_result_name}BindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(${list_main_model_import}.${list_result_name}) + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + obj, err = client.${api_func_call} + main: |2 + + func ${api_func_def} { + var err error + var obj ${list_main_model_import}.${list_result_name} + + switch c.ClientType { + ${case_items} + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err + } + +Create: + Convert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + gmObj, err1 := utl.ConvertModelBindingType(${var_name}, ${main_model_import}.${model_name}BindingType(), ${model_import}.${model_name}BindingType()) + if err1 != nil { + return err1 + } + err = client.${api_func_call} + NoConvert: |2 + + case utl.${type}: + client := c.Client.(${client_import}.${client_name}) + err = client.${api_func_call} + main: |2 + + func ${api_func_def} { + var err error + + switch c.ClientType { + ${case_items} + default: + err = errors.New("invalid infrastructure for model") + } + return err + } diff --git a/api/infra.go b/api/infra.go new file mode 100644 index 000000000..1adbdf962 --- /dev/null +++ b/api/infra.go @@ -0,0 +1,78 @@ +//nolint:revive +package nsxt + +// 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" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type InfraClientContext utl.ClientContext + +func NewInfraClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *InfraClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewInfraClient(connector) + + case utl.Multitenancy: + client = client1.NewInfraClient(connector) + + default: + return nil + } + return &InfraClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c InfraClientContext) Get(basePathParam *string, filterParam *string, typeFilterParam *string) (model0.Infra, error) { + var obj model0.Infra + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InfraClient) + obj, err = client.Get(basePathParam, filterParam, typeFilterParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.InfraClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, basePathParam, filterParam, typeFilterParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c InfraClientContext) Patch(infraParam model0.Infra, enforceRevisionCheckParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InfraClient) + err = client.Patch(infraParam, enforceRevisionCheckParam) + + case utl.Multitenancy: + client := c.Client.(client1.InfraClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, infraParam, enforceRevisionCheckParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} diff --git a/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go b/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go new file mode 100644 index 000000000..3f1876f1e --- /dev/null +++ b/api/infra/context_profiles/custom_attributes/policy_custom_attributes.go @@ -0,0 +1,124 @@ +//nolint:revive +package customattributes + +// 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/context_profiles/custom_attributes" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/context_profiles/custom_attributes" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type PolicyCustomAttributesClientContext utl.ClientContext + +func NewDefaultClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyCustomAttributesClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDefaultClient(connector) + + case utl.Global: + client = client1.NewDefaultClient(connector) + + case utl.Multitenancy: + client = client2.NewDefaultClient(connector) + + default: + return nil + } + return &PolicyCustomAttributesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyCustomAttributesClientContext) Create(policyCustomAttributesParam model0.PolicyCustomAttributes, actionParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DefaultClient) + err = client.Create(policyCustomAttributesParam, actionParam) + + case utl.Global: + client := c.Client.(client1.DefaultClient) + gmObj, err1 := utl.ConvertModelBindingType(policyCustomAttributesParam, model0.PolicyCustomAttributesBindingType(), model1.PolicyCustomAttributesBindingType()) + if err1 != nil { + return err1 + } + err = client.Create(gmObj.(model1.PolicyCustomAttributes), actionParam) + + case utl.Multitenancy: + client := c.Client.(client2.DefaultClient) + err = client.Create(utl.DefaultOrgID, c.ProjectID, policyCustomAttributesParam, actionParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyCustomAttributesClientContext) List(attributeKeyParam *string, attributeSourceParam *string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyContextProfileListResult, error) { + var err error + var obj model0.PolicyContextProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DefaultClient) + obj, err = client.List(attributeKeyParam, attributeSourceParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.DefaultClient) + gmObj, err := client.List(attributeKeyParam, attributeSourceParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyContextProfileListResultBindingType(), model0.PolicyContextProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyContextProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.DefaultClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, attributeKeyParam, attributeSourceParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyCustomAttributesClientContext) Patch(policyCustomAttributesParam model0.PolicyCustomAttributes) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DefaultClient) + err = client.Patch(policyCustomAttributesParam) + + case utl.Global: + client := c.Client.(client1.DefaultClient) + gmObj, err1 := utl.ConvertModelBindingType(policyCustomAttributesParam, model0.PolicyCustomAttributesBindingType(), model1.PolicyCustomAttributesBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(gmObj.(model1.PolicyCustomAttributes)) + + case utl.Multitenancy: + client := c.Client.(client2.DefaultClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, policyCustomAttributesParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} diff --git a/api/infra/dhcp_relay_config.go b/api/infra/dhcp_relay_config.go new file mode 100644 index 000000000..a8c70cc6b --- /dev/null +++ b/api/infra/dhcp_relay_config.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 DhcpRelayConfigClientContext utl.ClientContext + +func NewDhcpRelayConfigsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *DhcpRelayConfigClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDhcpRelayConfigsClient(connector) + + case utl.Global: + client = client1.NewDhcpRelayConfigsClient(connector) + + case utl.Multitenancy: + client = client2.NewDhcpRelayConfigsClient(connector) + + default: + return nil + } + return &DhcpRelayConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c DhcpRelayConfigClientContext) Get(dhcpRelayConfigIdParam string) (model0.DhcpRelayConfig, error) { + var obj model0.DhcpRelayConfig + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpRelayConfigsClient) + obj, err = client.Get(dhcpRelayConfigIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DhcpRelayConfigsClient) + gmObj, err1 := client.Get(dhcpRelayConfigIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.DhcpRelayConfigBindingType(), model0.DhcpRelayConfigBindingType()) + obj = rawObj.(model0.DhcpRelayConfig) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpRelayConfigsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, dhcpRelayConfigIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c DhcpRelayConfigClientContext) Patch(dhcpRelayConfigIdParam string, dhcpRelayConfigParam model0.DhcpRelayConfig) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpRelayConfigsClient) + err = client.Patch(dhcpRelayConfigIdParam, dhcpRelayConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpRelayConfigsClient) + gmObj, err1 := utl.ConvertModelBindingType(dhcpRelayConfigParam, model0.DhcpRelayConfigBindingType(), model1.DhcpRelayConfigBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(dhcpRelayConfigIdParam, gmObj.(model1.DhcpRelayConfig)) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpRelayConfigsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, dhcpRelayConfigIdParam, dhcpRelayConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c DhcpRelayConfigClientContext) Update(dhcpRelayConfigIdParam string, dhcpRelayConfigParam model0.DhcpRelayConfig) (model0.DhcpRelayConfig, error) { + var err error + var obj model0.DhcpRelayConfig + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpRelayConfigsClient) + obj, err = client.Update(dhcpRelayConfigIdParam, dhcpRelayConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpRelayConfigsClient) + gmObj, err := utl.ConvertModelBindingType(dhcpRelayConfigParam, model0.DhcpRelayConfigBindingType(), model1.DhcpRelayConfigBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(dhcpRelayConfigIdParam, gmObj.(model1.DhcpRelayConfig)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.DhcpRelayConfigBindingType(), model0.DhcpRelayConfigBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.DhcpRelayConfig) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpRelayConfigsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, dhcpRelayConfigIdParam, dhcpRelayConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c DhcpRelayConfigClientContext) Delete(dhcpRelayConfigIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpRelayConfigsClient) + err = client.Delete(dhcpRelayConfigIdParam) + + case utl.Global: + client := c.Client.(client1.DhcpRelayConfigsClient) + err = client.Delete(dhcpRelayConfigIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpRelayConfigsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, dhcpRelayConfigIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c DhcpRelayConfigClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.DhcpRelayConfigListResult, error) { + var err error + var obj model0.DhcpRelayConfigListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpRelayConfigsClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.DhcpRelayConfigsClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.DhcpRelayConfigListResultBindingType(), model0.DhcpRelayConfigListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.DhcpRelayConfigListResult) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpRelayConfigsClient) + 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 +} diff --git a/api/infra/dhcp_server_config.go b/api/infra/dhcp_server_config.go new file mode 100644 index 000000000..76f573bc5 --- /dev/null +++ b/api/infra/dhcp_server_config.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 DhcpServerConfigClientContext utl.ClientContext + +func NewDhcpServerConfigsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *DhcpServerConfigClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDhcpServerConfigsClient(connector) + + case utl.Global: + client = client1.NewDhcpServerConfigsClient(connector) + + case utl.Multitenancy: + client = client2.NewDhcpServerConfigsClient(connector) + + default: + return nil + } + return &DhcpServerConfigClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c DhcpServerConfigClientContext) Get(dhcpServerConfigIdParam string) (model0.DhcpServerConfig, error) { + var obj model0.DhcpServerConfig + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpServerConfigsClient) + obj, err = client.Get(dhcpServerConfigIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DhcpServerConfigsClient) + gmObj, err1 := client.Get(dhcpServerConfigIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.DhcpServerConfigBindingType(), model0.DhcpServerConfigBindingType()) + obj = rawObj.(model0.DhcpServerConfig) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpServerConfigsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, dhcpServerConfigIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c DhcpServerConfigClientContext) Patch(dhcpServerConfigIdParam string, dhcpServerConfigParam model0.DhcpServerConfig) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpServerConfigsClient) + err = client.Patch(dhcpServerConfigIdParam, dhcpServerConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpServerConfigsClient) + gmObj, err1 := utl.ConvertModelBindingType(dhcpServerConfigParam, model0.DhcpServerConfigBindingType(), model1.DhcpServerConfigBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(dhcpServerConfigIdParam, gmObj.(model1.DhcpServerConfig)) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpServerConfigsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, dhcpServerConfigIdParam, dhcpServerConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c DhcpServerConfigClientContext) Update(dhcpServerConfigIdParam string, dhcpServerConfigParam model0.DhcpServerConfig) (model0.DhcpServerConfig, error) { + var err error + var obj model0.DhcpServerConfig + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpServerConfigsClient) + obj, err = client.Update(dhcpServerConfigIdParam, dhcpServerConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpServerConfigsClient) + gmObj, err := utl.ConvertModelBindingType(dhcpServerConfigParam, model0.DhcpServerConfigBindingType(), model1.DhcpServerConfigBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(dhcpServerConfigIdParam, gmObj.(model1.DhcpServerConfig)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.DhcpServerConfigBindingType(), model0.DhcpServerConfigBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.DhcpServerConfig) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpServerConfigsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, dhcpServerConfigIdParam, dhcpServerConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c DhcpServerConfigClientContext) Delete(dhcpServerConfigIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpServerConfigsClient) + err = client.Delete(dhcpServerConfigIdParam) + + case utl.Global: + client := c.Client.(client1.DhcpServerConfigsClient) + err = client.Delete(dhcpServerConfigIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpServerConfigsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, dhcpServerConfigIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c DhcpServerConfigClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.DhcpServerConfigListResult, error) { + var err error + var obj model0.DhcpServerConfigListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpServerConfigsClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.DhcpServerConfigsClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.DhcpServerConfigListResultBindingType(), model0.DhcpServerConfigListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.DhcpServerConfigListResult) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpServerConfigsClient) + 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 +} diff --git a/api/infra/domains/gateway_policy.go b/api/infra/domains/gateway_policy.go new file mode 100644 index 000000000..14c23b068 --- /dev/null +++ b/api/infra/domains/gateway_policy.go @@ -0,0 +1,192 @@ +//nolint:revive +package domains + +// 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" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" + 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" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type GatewayPolicyClientContext utl.ClientContext + +func NewGatewayPoliciesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *GatewayPolicyClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewGatewayPoliciesClient(connector) + + case utl.Global: + client = client1.NewGatewayPoliciesClient(connector) + + case utl.Multitenancy: + client = client2.NewGatewayPoliciesClient(connector) + + default: + return nil + } + return &GatewayPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c GatewayPolicyClientContext) Get(domainIdParam string, gatewayPolicyIdParam string) (model0.GatewayPolicy, error) { + var obj model0.GatewayPolicy + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayPoliciesClient) + obj, err = client.Get(domainIdParam, gatewayPolicyIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.GatewayPoliciesClient) + gmObj, err1 := client.Get(domainIdParam, gatewayPolicyIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.GatewayPolicyBindingType(), model0.GatewayPolicyBindingType()) + obj = rawObj.(model0.GatewayPolicy) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayPoliciesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, domainIdParam, gatewayPolicyIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GatewayPolicyClientContext) Patch(domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam model0.GatewayPolicy) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayPoliciesClient) + err = client.Patch(domainIdParam, gatewayPolicyIdParam, gatewayPolicyParam) + + case utl.Global: + client := c.Client.(client1.GatewayPoliciesClient) + gmObj, err1 := utl.ConvertModelBindingType(gatewayPolicyParam, model0.GatewayPolicyBindingType(), model1.GatewayPolicyBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(domainIdParam, gatewayPolicyIdParam, gmObj.(model1.GatewayPolicy)) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayPoliciesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, domainIdParam, gatewayPolicyIdParam, gatewayPolicyParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GatewayPolicyClientContext) Update(domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam model0.GatewayPolicy) (model0.GatewayPolicy, error) { + var err error + var obj model0.GatewayPolicy + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayPoliciesClient) + obj, err = client.Update(domainIdParam, gatewayPolicyIdParam, gatewayPolicyParam) + + case utl.Global: + client := c.Client.(client1.GatewayPoliciesClient) + gmObj, err := utl.ConvertModelBindingType(gatewayPolicyParam, model0.GatewayPolicyBindingType(), model1.GatewayPolicyBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(domainIdParam, gatewayPolicyIdParam, gmObj.(model1.GatewayPolicy)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GatewayPolicyBindingType(), model0.GatewayPolicyBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GatewayPolicy) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayPoliciesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, domainIdParam, gatewayPolicyIdParam, gatewayPolicyParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GatewayPolicyClientContext) Delete(domainIdParam string, gatewayPolicyIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayPoliciesClient) + err = client.Delete(domainIdParam, gatewayPolicyIdParam) + + case utl.Global: + client := c.Client.(client1.GatewayPoliciesClient) + err = client.Delete(domainIdParam, gatewayPolicyIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayPoliciesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, domainIdParam, gatewayPolicyIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GatewayPolicyClientContext) List(domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.GatewayPolicyListResult, error) { + var err error + var obj model0.GatewayPolicyListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayPoliciesClient) + obj, err = client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.GatewayPoliciesClient) + gmObj, err := client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GatewayPolicyListResultBindingType(), model0.GatewayPolicyListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GatewayPolicyListResult) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayPoliciesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/domains/group.go b/api/infra/domains/group.go new file mode 100644 index 000000000..980707cd3 --- /dev/null +++ b/api/infra/domains/group.go @@ -0,0 +1,192 @@ +//nolint:revive +package domains + +// 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" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" + 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" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type GroupClientContext utl.ClientContext + +func NewGroupsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *GroupClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewGroupsClient(connector) + + case utl.Global: + client = client1.NewGroupsClient(connector) + + case utl.Multitenancy: + client = client2.NewGroupsClient(connector) + + default: + return nil + } + return &GroupClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c GroupClientContext) Get(domainIdParam string, groupIdParam string) (model0.Group, error) { + var obj model0.Group + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GroupsClient) + obj, err = client.Get(domainIdParam, groupIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.GroupsClient) + gmObj, err1 := client.Get(domainIdParam, groupIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.GroupBindingType(), model0.GroupBindingType()) + obj = rawObj.(model0.Group) + + case utl.Multitenancy: + client := c.Client.(client2.GroupsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GroupClientContext) Patch(domainIdParam string, groupIdParam string, groupParam model0.Group) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GroupsClient) + err = client.Patch(domainIdParam, groupIdParam, groupParam) + + case utl.Global: + client := c.Client.(client1.GroupsClient) + gmObj, err1 := utl.ConvertModelBindingType(groupParam, model0.GroupBindingType(), model1.GroupBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(domainIdParam, groupIdParam, gmObj.(model1.Group)) + + case utl.Multitenancy: + client := c.Client.(client2.GroupsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, groupParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GroupClientContext) Update(domainIdParam string, groupIdParam string, groupParam model0.Group) (model0.Group, error) { + var err error + var obj model0.Group + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GroupsClient) + obj, err = client.Update(domainIdParam, groupIdParam, groupParam) + + case utl.Global: + client := c.Client.(client1.GroupsClient) + gmObj, err := utl.ConvertModelBindingType(groupParam, model0.GroupBindingType(), model1.GroupBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(domainIdParam, groupIdParam, gmObj.(model1.Group)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GroupBindingType(), model0.GroupBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Group) + + case utl.Multitenancy: + client := c.Client.(client2.GroupsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, groupParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GroupClientContext) Delete(domainIdParam string, groupIdParam string, failIfSubtreeExistsParam *bool, forceParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GroupsClient) + err = client.Delete(domainIdParam, groupIdParam, failIfSubtreeExistsParam, forceParam) + + case utl.Global: + client := c.Client.(client1.GroupsClient) + err = client.Delete(domainIdParam, groupIdParam, failIfSubtreeExistsParam, forceParam) + + case utl.Multitenancy: + client := c.Client.(client2.GroupsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, domainIdParam, groupIdParam, failIfSubtreeExistsParam, forceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GroupClientContext) List(domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, memberTypesParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.GroupListResult, error) { + var err error + var obj model0.GroupListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GroupsClient) + obj, err = client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, memberTypesParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.GroupsClient) + gmObj, err := client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, memberTypesParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GroupListResultBindingType(), model0.GroupListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GroupListResult) + + case utl.Multitenancy: + client := c.Client.(client2.GroupsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, memberTypesParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/domains/security_policy.go b/api/infra/domains/security_policy.go new file mode 100644 index 000000000..32cbaf7cd --- /dev/null +++ b/api/infra/domains/security_policy.go @@ -0,0 +1,192 @@ +//nolint:revive +package domains + +// 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" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" + 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" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SecurityPolicyClientContext utl.ClientContext + +func NewSecurityPoliciesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SecurityPolicyClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSecurityPoliciesClient(connector) + + case utl.Global: + client = client1.NewSecurityPoliciesClient(connector) + + case utl.Multitenancy: + client = client2.NewSecurityPoliciesClient(connector) + + default: + return nil + } + return &SecurityPolicyClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SecurityPolicyClientContext) Get(domainIdParam string, securityPolicyIdParam string) (model0.SecurityPolicy, error) { + var obj model0.SecurityPolicy + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SecurityPoliciesClient) + obj, err = client.Get(domainIdParam, securityPolicyIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.SecurityPoliciesClient) + gmObj, err1 := client.Get(domainIdParam, securityPolicyIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SecurityPolicyBindingType(), model0.SecurityPolicyBindingType()) + obj = rawObj.(model0.SecurityPolicy) + + case utl.Multitenancy: + client := c.Client.(client2.SecurityPoliciesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SecurityPolicyClientContext) Patch(domainIdParam string, securityPolicyIdParam string, securityPolicyParam model0.SecurityPolicy) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SecurityPoliciesClient) + err = client.Patch(domainIdParam, securityPolicyIdParam, securityPolicyParam) + + case utl.Global: + client := c.Client.(client1.SecurityPoliciesClient) + gmObj, err1 := utl.ConvertModelBindingType(securityPolicyParam, model0.SecurityPolicyBindingType(), model1.SecurityPolicyBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(domainIdParam, securityPolicyIdParam, gmObj.(model1.SecurityPolicy)) + + case utl.Multitenancy: + client := c.Client.(client2.SecurityPoliciesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam, securityPolicyParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SecurityPolicyClientContext) Update(domainIdParam string, securityPolicyIdParam string, securityPolicyParam model0.SecurityPolicy) (model0.SecurityPolicy, error) { + var err error + var obj model0.SecurityPolicy + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SecurityPoliciesClient) + obj, err = client.Update(domainIdParam, securityPolicyIdParam, securityPolicyParam) + + case utl.Global: + client := c.Client.(client1.SecurityPoliciesClient) + gmObj, err := utl.ConvertModelBindingType(securityPolicyParam, model0.SecurityPolicyBindingType(), model1.SecurityPolicyBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(domainIdParam, securityPolicyIdParam, gmObj.(model1.SecurityPolicy)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SecurityPolicyBindingType(), model0.SecurityPolicyBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SecurityPolicy) + + case utl.Multitenancy: + client := c.Client.(client2.SecurityPoliciesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam, securityPolicyParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SecurityPolicyClientContext) Delete(domainIdParam string, securityPolicyIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SecurityPoliciesClient) + err = client.Delete(domainIdParam, securityPolicyIdParam) + + case utl.Global: + client := c.Client.(client1.SecurityPoliciesClient) + err = client.Delete(domainIdParam, securityPolicyIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.SecurityPoliciesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, domainIdParam, securityPolicyIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SecurityPolicyClientContext) List(domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SecurityPolicyListResult, error) { + var err error + var obj model0.SecurityPolicyListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SecurityPoliciesClient) + obj, err = client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.SecurityPoliciesClient) + gmObj, err := client.List(domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SecurityPolicyListResultBindingType(), model0.SecurityPolicyListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SecurityPolicyListResult) + + case utl.Multitenancy: + client := c.Client.(client2.SecurityPoliciesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, domainIdParam, cursorParam, includeMarkForDeleteObjectsParam, includeRuleCountParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/gateway_qos_profile.go b/api/infra/gateway_qos_profile.go new file mode 100644 index 000000000..0c3686cfe --- /dev/null +++ b/api/infra/gateway_qos_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 GatewayQosProfileClientContext utl.ClientContext + +func NewGatewayQosProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *GatewayQosProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewGatewayQosProfilesClient(connector) + + case utl.Global: + client = client1.NewGatewayQosProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewGatewayQosProfilesClient(connector) + + default: + return nil + } + return &GatewayQosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c GatewayQosProfileClientContext) Get(qosProfileIdParam string) (model0.GatewayQosProfile, error) { + var obj model0.GatewayQosProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayQosProfilesClient) + obj, err = client.Get(qosProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.GatewayQosProfilesClient) + gmObj, err1 := client.Get(qosProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.GatewayQosProfileBindingType(), model0.GatewayQosProfileBindingType()) + obj = rawObj.(model0.GatewayQosProfile) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayQosProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GatewayQosProfileClientContext) Patch(qosProfileIdParam string, gatewayQosProfileParam model0.GatewayQosProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayQosProfilesClient) + err = client.Patch(qosProfileIdParam, gatewayQosProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.GatewayQosProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(gatewayQosProfileParam, model0.GatewayQosProfileBindingType(), model1.GatewayQosProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(qosProfileIdParam, gmObj.(model1.GatewayQosProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayQosProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, gatewayQosProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GatewayQosProfileClientContext) Update(qosProfileIdParam string, gatewayQosProfileParam model0.GatewayQosProfile, overrideParam *bool) (model0.GatewayQosProfile, error) { + var err error + var obj model0.GatewayQosProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayQosProfilesClient) + obj, err = client.Update(qosProfileIdParam, gatewayQosProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.GatewayQosProfilesClient) + gmObj, err := utl.ConvertModelBindingType(gatewayQosProfileParam, model0.GatewayQosProfileBindingType(), model1.GatewayQosProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(qosProfileIdParam, gmObj.(model1.GatewayQosProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GatewayQosProfileBindingType(), model0.GatewayQosProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GatewayQosProfile) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayQosProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, gatewayQosProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c GatewayQosProfileClientContext) Delete(qosProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayQosProfilesClient) + err = client.Delete(qosProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.GatewayQosProfilesClient) + err = client.Delete(qosProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayQosProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c GatewayQosProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.GatewayQosProfileListResult, error) { + var err error + var obj model0.GatewayQosProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.GatewayQosProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.GatewayQosProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GatewayQosProfileListResultBindingType(), model0.GatewayQosProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GatewayQosProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.GatewayQosProfilesClient) + 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 +} diff --git a/api/infra/ip_address_block.go b/api/infra/ip_address_block.go new file mode 100644 index 000000000..dcc8389ef --- /dev/null +++ b/api/infra/ip_address_block.go @@ -0,0 +1,137 @@ +//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 IpAddressBlockClientContext utl.ClientContext + +func NewIpBlocksClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *IpAddressBlockClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpBlocksClient(connector) + + case utl.Multitenancy: + client = client1.NewIpBlocksClient(connector) + + default: + return nil + } + return &IpAddressBlockClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c IpAddressBlockClientContext) Get(ipBlockIdParam string) (model0.IpAddressBlock, error) { + var obj model0.IpAddressBlock + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpBlocksClient) + obj, err = client.Get(ipBlockIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.IpBlocksClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ipBlockIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressBlockClientContext) Patch(ipBlockIdParam string, ipAddressBlockParam model0.IpAddressBlock) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpBlocksClient) + err = client.Patch(ipBlockIdParam, ipAddressBlockParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpBlocksClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ipBlockIdParam, ipAddressBlockParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressBlockClientContext) Update(ipBlockIdParam string, ipAddressBlockParam model0.IpAddressBlock) (model0.IpAddressBlock, error) { + var err error + var obj model0.IpAddressBlock + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpBlocksClient) + obj, err = client.Update(ipBlockIdParam, ipAddressBlockParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpBlocksClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ipBlockIdParam, ipAddressBlockParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressBlockClientContext) Delete(ipBlockIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpBlocksClient) + err = client.Delete(ipBlockIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpBlocksClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ipBlockIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressBlockClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.IpAddressBlockListResult, error) { + var err error + var obj model0.IpAddressBlockListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpBlocksClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpBlocksClient) + 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 +} diff --git a/api/infra/ip_address_pool.go b/api/infra/ip_address_pool.go new file mode 100644 index 000000000..82deae791 --- /dev/null +++ b/api/infra/ip_address_pool.go @@ -0,0 +1,137 @@ +//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 IpAddressPoolClientContext utl.ClientContext + +func NewIpPoolsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *IpAddressPoolClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpPoolsClient(connector) + + case utl.Multitenancy: + client = client1.NewIpPoolsClient(connector) + + default: + return nil + } + return &IpAddressPoolClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c IpAddressPoolClientContext) Get(ipPoolIdParam string) (model0.IpAddressPool, error) { + var obj model0.IpAddressPool + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpPoolsClient) + obj, err = client.Get(ipPoolIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.IpPoolsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressPoolClientContext) Patch(ipPoolIdParam string, ipAddressPoolParam model0.IpAddressPool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpPoolsClient) + err = client.Patch(ipPoolIdParam, ipAddressPoolParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpPoolsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAddressPoolParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressPoolClientContext) Update(ipPoolIdParam string, ipAddressPoolParam model0.IpAddressPool) (model0.IpAddressPool, error) { + var err error + var obj model0.IpAddressPool + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpPoolsClient) + obj, err = client.Update(ipPoolIdParam, ipAddressPoolParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpPoolsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAddressPoolParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressPoolClientContext) Delete(ipPoolIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpPoolsClient) + err = client.Delete(ipPoolIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpPoolsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressPoolClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.IpAddressPoolListResult, error) { + var err error + var obj model0.IpAddressPoolListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpPoolsClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpPoolsClient) + 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 +} diff --git a/api/infra/ip_discovery_profile.go b/api/infra/ip_discovery_profile.go new file mode 100644 index 000000000..3e0e34403 --- /dev/null +++ b/api/infra/ip_discovery_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 IPDiscoveryProfileClientContext utl.ClientContext + +func NewIpDiscoveryProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *IPDiscoveryProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpDiscoveryProfilesClient(connector) + + case utl.Global: + client = client1.NewIpDiscoveryProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewIpDiscoveryProfilesClient(connector) + + default: + return nil + } + return &IPDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c IPDiscoveryProfileClientContext) Get(ipDiscoveryProfileIdParam string) (model0.IPDiscoveryProfile, error) { + var obj model0.IPDiscoveryProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpDiscoveryProfilesClient) + obj, err = client.Get(ipDiscoveryProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.IpDiscoveryProfilesClient) + gmObj, err1 := client.Get(ipDiscoveryProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.IPDiscoveryProfileBindingType(), model0.IPDiscoveryProfileBindingType()) + obj = rawObj.(model0.IPDiscoveryProfile) + + case utl.Multitenancy: + client := c.Client.(client2.IpDiscoveryProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ipDiscoveryProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IPDiscoveryProfileClientContext) Patch(ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam model0.IPDiscoveryProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpDiscoveryProfilesClient) + err = client.Patch(ipDiscoveryProfileIdParam, ipDiscoveryProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.IpDiscoveryProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(ipDiscoveryProfileParam, model0.IPDiscoveryProfileBindingType(), model1.IPDiscoveryProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(ipDiscoveryProfileIdParam, gmObj.(model1.IPDiscoveryProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.IpDiscoveryProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ipDiscoveryProfileIdParam, ipDiscoveryProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IPDiscoveryProfileClientContext) Update(ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam model0.IPDiscoveryProfile, overrideParam *bool) (model0.IPDiscoveryProfile, error) { + var err error + var obj model0.IPDiscoveryProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpDiscoveryProfilesClient) + obj, err = client.Update(ipDiscoveryProfileIdParam, ipDiscoveryProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.IpDiscoveryProfilesClient) + gmObj, err := utl.ConvertModelBindingType(ipDiscoveryProfileParam, model0.IPDiscoveryProfileBindingType(), model1.IPDiscoveryProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(ipDiscoveryProfileIdParam, gmObj.(model1.IPDiscoveryProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.IPDiscoveryProfileBindingType(), model0.IPDiscoveryProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.IPDiscoveryProfile) + + case utl.Multitenancy: + client := c.Client.(client2.IpDiscoveryProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ipDiscoveryProfileIdParam, ipDiscoveryProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IPDiscoveryProfileClientContext) Delete(ipDiscoveryProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpDiscoveryProfilesClient) + err = client.Delete(ipDiscoveryProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.IpDiscoveryProfilesClient) + err = client.Delete(ipDiscoveryProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.IpDiscoveryProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ipDiscoveryProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IPDiscoveryProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.IPDiscoveryProfileListResult, error) { + var err error + var obj model0.IPDiscoveryProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpDiscoveryProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.IpDiscoveryProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.IPDiscoveryProfileListResultBindingType(), model0.IPDiscoveryProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.IPDiscoveryProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.IpDiscoveryProfilesClient) + 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 +} diff --git a/api/infra/ip_pools/ip_address_allocation.go b/api/infra/ip_pools/ip_address_allocation.go new file mode 100644 index 000000000..ff2acf141 --- /dev/null +++ b/api/infra/ip_pools/ip_address_allocation.go @@ -0,0 +1,137 @@ +//nolint:revive +package ippools + +// 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/ip_pools" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type IpAddressAllocationClientContext utl.ClientContext + +func NewIpAllocationsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *IpAddressAllocationClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpAllocationsClient(connector) + + case utl.Multitenancy: + client = client1.NewIpAllocationsClient(connector) + + default: + return nil + } + return &IpAddressAllocationClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c IpAddressAllocationClientContext) Get(ipPoolIdParam string, ipAllocationIdParam string) (model0.IpAddressAllocation, error) { + var obj model0.IpAddressAllocation + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpAllocationsClient) + obj, err = client.Get(ipPoolIdParam, ipAllocationIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.IpAllocationsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAllocationIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressAllocationClientContext) Patch(ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam model0.IpAddressAllocation) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpAllocationsClient) + err = client.Patch(ipPoolIdParam, ipAllocationIdParam, ipAddressAllocationParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpAllocationsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAllocationIdParam, ipAddressAllocationParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressAllocationClientContext) Update(ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam model0.IpAddressAllocation) (model0.IpAddressAllocation, error) { + var err error + var obj model0.IpAddressAllocation + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpAllocationsClient) + obj, err = client.Update(ipPoolIdParam, ipAllocationIdParam, ipAddressAllocationParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpAllocationsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAllocationIdParam, ipAddressAllocationParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c IpAddressAllocationClientContext) Delete(ipPoolIdParam string, ipAllocationIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpAllocationsClient) + err = client.Delete(ipPoolIdParam, ipAllocationIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpAllocationsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipAllocationIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c IpAddressAllocationClientContext) List(ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.IpAddressAllocationListResult, error) { + var err error + var obj model0.IpAddressAllocationListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpAllocationsClient) + obj, err = client.List(ipPoolIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpAllocationsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/ip_pools/ip_subnets_client.go b/api/infra/ip_pools/ip_subnets_client.go new file mode 100644 index 000000000..d17a6aead --- /dev/null +++ b/api/infra/ip_pools/ip_subnets_client.go @@ -0,0 +1,138 @@ +//nolint:revive +package ippools + +// 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" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools" + lrmodel0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type StructValueClientContext utl.ClientContext + +func NewIpSubnetsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StructValueClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpSubnetsClient(connector) + + case utl.Multitenancy: + client = client1.NewIpSubnetsClient(connector) + + default: + return nil + } + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c StructValueClientContext) Get(ipPoolIdParam string, ipSubnetIdParam string) (*model0.StructValue, error) { + var obj *model0.StructValue + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpSubnetsClient) + obj, err = client.Get(ipPoolIdParam, ipSubnetIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.IpSubnetsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipSubnetIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) Delete(ipPoolIdParam string, ipSubnetIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpSubnetsClient) + err = client.Delete(ipPoolIdParam, ipSubnetIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpSubnetsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipSubnetIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Patch(ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *model0.StructValue) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpSubnetsClient) + err = client.Patch(ipPoolIdParam, ipSubnetIdParam, ipAddressPoolSubnetParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpSubnetsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipSubnetIdParam, ipAddressPoolSubnetParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Update(ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *model0.StructValue) (*model0.StructValue, error) { + var err error + var obj *model0.StructValue + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpSubnetsClient) + obj, err = client.Update(ipPoolIdParam, ipSubnetIdParam, ipAddressPoolSubnetParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpSubnetsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, ipSubnetIdParam, ipAddressPoolSubnetParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) List(ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (lrmodel0.IpAddressPoolSubnetListResult, error) { + var err error + var obj lrmodel0.IpAddressPoolSubnetListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.IpSubnetsClient) + obj, err = client.List(ipPoolIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.IpSubnetsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, ipPoolIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/ipv6_dad_profile.go b/api/infra/ipv6_dad_profile.go new file mode 100644 index 000000000..019411027 --- /dev/null +++ b/api/infra/ipv6_dad_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 Ipv6DadProfileClientContext utl.ClientContext + +func NewIpv6DadProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *Ipv6DadProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpv6DadProfilesClient(connector) + + case utl.Global: + client = client1.NewIpv6DadProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewIpv6DadProfilesClient(connector) + + default: + return nil + } + return &Ipv6DadProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c Ipv6DadProfileClientContext) Get(dadProfileIdParam string) (model0.Ipv6DadProfile, error) { + var obj model0.Ipv6DadProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6DadProfilesClient) + obj, err = client.Get(dadProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.Ipv6DadProfilesClient) + gmObj, err1 := client.Get(dadProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.Ipv6DadProfileBindingType(), model0.Ipv6DadProfileBindingType()) + obj = rawObj.(model0.Ipv6DadProfile) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6DadProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, dadProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Ipv6DadProfileClientContext) Patch(dadProfileIdParam string, ipv6DadProfileParam model0.Ipv6DadProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6DadProfilesClient) + err = client.Patch(dadProfileIdParam, ipv6DadProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6DadProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(ipv6DadProfileParam, model0.Ipv6DadProfileBindingType(), model1.Ipv6DadProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(dadProfileIdParam, gmObj.(model1.Ipv6DadProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6DadProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, dadProfileIdParam, ipv6DadProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Ipv6DadProfileClientContext) Update(dadProfileIdParam string, ipv6DadProfileParam model0.Ipv6DadProfile, overrideParam *bool) (model0.Ipv6DadProfile, error) { + var err error + var obj model0.Ipv6DadProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6DadProfilesClient) + obj, err = client.Update(dadProfileIdParam, ipv6DadProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6DadProfilesClient) + gmObj, err := utl.ConvertModelBindingType(ipv6DadProfileParam, model0.Ipv6DadProfileBindingType(), model1.Ipv6DadProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(dadProfileIdParam, gmObj.(model1.Ipv6DadProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Ipv6DadProfileBindingType(), model0.Ipv6DadProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Ipv6DadProfile) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6DadProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, dadProfileIdParam, ipv6DadProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Ipv6DadProfileClientContext) Delete(dadProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6DadProfilesClient) + err = client.Delete(dadProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6DadProfilesClient) + err = client.Delete(dadProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6DadProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, dadProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Ipv6DadProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.Ipv6DadProfileListResult, error) { + var err error + var obj model0.Ipv6DadProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6DadProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.Ipv6DadProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Ipv6DadProfileListResultBindingType(), model0.Ipv6DadProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Ipv6DadProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6DadProfilesClient) + 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 +} diff --git a/api/infra/ipv6_ndra_profile.go b/api/infra/ipv6_ndra_profile.go new file mode 100644 index 000000000..87545a120 --- /dev/null +++ b/api/infra/ipv6_ndra_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 Ipv6NdraProfileClientContext utl.ClientContext + +func NewIpv6NdraProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *Ipv6NdraProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewIpv6NdraProfilesClient(connector) + + case utl.Global: + client = client1.NewIpv6NdraProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewIpv6NdraProfilesClient(connector) + + default: + return nil + } + return &Ipv6NdraProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c Ipv6NdraProfileClientContext) Get(ndraProfileIdParam string) (model0.Ipv6NdraProfile, error) { + var obj model0.Ipv6NdraProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6NdraProfilesClient) + obj, err = client.Get(ndraProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.Ipv6NdraProfilesClient) + gmObj, err1 := client.Get(ndraProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.Ipv6NdraProfileBindingType(), model0.Ipv6NdraProfileBindingType()) + obj = rawObj.(model0.Ipv6NdraProfile) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6NdraProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, ndraProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Ipv6NdraProfileClientContext) Patch(ndraProfileIdParam string, ipv6NdraProfileParam model0.Ipv6NdraProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6NdraProfilesClient) + err = client.Patch(ndraProfileIdParam, ipv6NdraProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6NdraProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(ipv6NdraProfileParam, model0.Ipv6NdraProfileBindingType(), model1.Ipv6NdraProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(ndraProfileIdParam, gmObj.(model1.Ipv6NdraProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6NdraProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, ndraProfileIdParam, ipv6NdraProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Ipv6NdraProfileClientContext) Update(ndraProfileIdParam string, ipv6NdraProfileParam model0.Ipv6NdraProfile, overrideParam *bool) (model0.Ipv6NdraProfile, error) { + var err error + var obj model0.Ipv6NdraProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6NdraProfilesClient) + obj, err = client.Update(ndraProfileIdParam, ipv6NdraProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6NdraProfilesClient) + gmObj, err := utl.ConvertModelBindingType(ipv6NdraProfileParam, model0.Ipv6NdraProfileBindingType(), model1.Ipv6NdraProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(ndraProfileIdParam, gmObj.(model1.Ipv6NdraProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Ipv6NdraProfileBindingType(), model0.Ipv6NdraProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Ipv6NdraProfile) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6NdraProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, ndraProfileIdParam, ipv6NdraProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Ipv6NdraProfileClientContext) Delete(ndraProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6NdraProfilesClient) + err = client.Delete(ndraProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.Ipv6NdraProfilesClient) + err = client.Delete(ndraProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6NdraProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, ndraProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Ipv6NdraProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.Ipv6NdraProfileListResult, error) { + var err error + var obj model0.Ipv6NdraProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Ipv6NdraProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.Ipv6NdraProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Ipv6NdraProfileListResultBindingType(), model0.Ipv6NdraProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Ipv6NdraProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.Ipv6NdraProfilesClient) + 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 +} diff --git a/api/infra/mac_discovery_profile.go b/api/infra/mac_discovery_profile.go new file mode 100644 index 000000000..4339db3dc --- /dev/null +++ b/api/infra/mac_discovery_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 MacDiscoveryProfileClientContext utl.ClientContext + +func NewMacDiscoveryProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *MacDiscoveryProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewMacDiscoveryProfilesClient(connector) + + case utl.Global: + client = client1.NewMacDiscoveryProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewMacDiscoveryProfilesClient(connector) + + default: + return nil + } + return &MacDiscoveryProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c MacDiscoveryProfileClientContext) Get(macDiscoveryProfileIdParam string) (model0.MacDiscoveryProfile, error) { + var obj model0.MacDiscoveryProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.MacDiscoveryProfilesClient) + obj, err = client.Get(macDiscoveryProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.MacDiscoveryProfilesClient) + gmObj, err1 := client.Get(macDiscoveryProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.MacDiscoveryProfileBindingType(), model0.MacDiscoveryProfileBindingType()) + obj = rawObj.(model0.MacDiscoveryProfile) + + case utl.Multitenancy: + client := c.Client.(client2.MacDiscoveryProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, macDiscoveryProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c MacDiscoveryProfileClientContext) Patch(macDiscoveryProfileIdParam string, macDiscoveryProfileParam model0.MacDiscoveryProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.MacDiscoveryProfilesClient) + err = client.Patch(macDiscoveryProfileIdParam, macDiscoveryProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.MacDiscoveryProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(macDiscoveryProfileParam, model0.MacDiscoveryProfileBindingType(), model1.MacDiscoveryProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(macDiscoveryProfileIdParam, gmObj.(model1.MacDiscoveryProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.MacDiscoveryProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, macDiscoveryProfileIdParam, macDiscoveryProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c MacDiscoveryProfileClientContext) Update(macDiscoveryProfileIdParam string, macDiscoveryProfileParam model0.MacDiscoveryProfile, overrideParam *bool) (model0.MacDiscoveryProfile, error) { + var err error + var obj model0.MacDiscoveryProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.MacDiscoveryProfilesClient) + obj, err = client.Update(macDiscoveryProfileIdParam, macDiscoveryProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.MacDiscoveryProfilesClient) + gmObj, err := utl.ConvertModelBindingType(macDiscoveryProfileParam, model0.MacDiscoveryProfileBindingType(), model1.MacDiscoveryProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(macDiscoveryProfileIdParam, gmObj.(model1.MacDiscoveryProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.MacDiscoveryProfileBindingType(), model0.MacDiscoveryProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.MacDiscoveryProfile) + + case utl.Multitenancy: + client := c.Client.(client2.MacDiscoveryProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, macDiscoveryProfileIdParam, macDiscoveryProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c MacDiscoveryProfileClientContext) Delete(macDiscoveryProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.MacDiscoveryProfilesClient) + err = client.Delete(macDiscoveryProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.MacDiscoveryProfilesClient) + err = client.Delete(macDiscoveryProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.MacDiscoveryProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, macDiscoveryProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c MacDiscoveryProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.MacDiscoveryProfileListResult, error) { + var err error + var obj model0.MacDiscoveryProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.MacDiscoveryProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.MacDiscoveryProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.MacDiscoveryProfileListResultBindingType(), model0.MacDiscoveryProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.MacDiscoveryProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.MacDiscoveryProfilesClient) + 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 +} diff --git a/api/infra/policy_context_profile.go b/api/infra/policy_context_profile.go new file mode 100644 index 000000000..67d8a1a2f --- /dev/null +++ b/api/infra/policy_context_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 PolicyContextProfileClientContext utl.ClientContext + +func NewContextProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyContextProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewContextProfilesClient(connector) + + case utl.Global: + client = client1.NewContextProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewContextProfilesClient(connector) + + default: + return nil + } + return &PolicyContextProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyContextProfileClientContext) Get(contextProfileIdParam string) (model0.PolicyContextProfile, error) { + var obj model0.PolicyContextProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ContextProfilesClient) + obj, err = client.Get(contextProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.ContextProfilesClient) + gmObj, err1 := client.Get(contextProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyContextProfileBindingType(), model0.PolicyContextProfileBindingType()) + obj = rawObj.(model0.PolicyContextProfile) + + case utl.Multitenancy: + client := c.Client.(client2.ContextProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, contextProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyContextProfileClientContext) Patch(contextProfileIdParam string, policyContextProfileParam model0.PolicyContextProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ContextProfilesClient) + err = client.Patch(contextProfileIdParam, policyContextProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.ContextProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(policyContextProfileParam, model0.PolicyContextProfileBindingType(), model1.PolicyContextProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(contextProfileIdParam, gmObj.(model1.PolicyContextProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.ContextProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, contextProfileIdParam, policyContextProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyContextProfileClientContext) Update(contextProfileIdParam string, policyContextProfileParam model0.PolicyContextProfile, overrideParam *bool) (model0.PolicyContextProfile, error) { + var err error + var obj model0.PolicyContextProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ContextProfilesClient) + obj, err = client.Update(contextProfileIdParam, policyContextProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.ContextProfilesClient) + gmObj, err := utl.ConvertModelBindingType(policyContextProfileParam, model0.PolicyContextProfileBindingType(), model1.PolicyContextProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(contextProfileIdParam, gmObj.(model1.PolicyContextProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyContextProfileBindingType(), model0.PolicyContextProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyContextProfile) + + case utl.Multitenancy: + client := c.Client.(client2.ContextProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, contextProfileIdParam, policyContextProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyContextProfileClientContext) Delete(contextProfileIdParam string, forceParam *bool, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ContextProfilesClient) + err = client.Delete(contextProfileIdParam, forceParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.ContextProfilesClient) + err = client.Delete(contextProfileIdParam, forceParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.ContextProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, contextProfileIdParam, forceParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyContextProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyContextProfileListResult, error) { + var err error + var obj model0.PolicyContextProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ContextProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.ContextProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyContextProfileListResultBindingType(), model0.PolicyContextProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyContextProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.ContextProfilesClient) + 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 +} diff --git a/api/infra/policy_dns_forwarder_zone.go b/api/infra/policy_dns_forwarder_zone.go new file mode 100644 index 000000000..e83d7afde --- /dev/null +++ b/api/infra/policy_dns_forwarder_zone.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 PolicyDnsForwarderZoneClientContext utl.ClientContext + +func NewDnsForwarderZonesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyDnsForwarderZoneClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDnsForwarderZonesClient(connector) + + case utl.Global: + client = client1.NewDnsForwarderZonesClient(connector) + + case utl.Multitenancy: + client = client2.NewDnsForwarderZonesClient(connector) + + default: + return nil + } + return &PolicyDnsForwarderZoneClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyDnsForwarderZoneClientContext) Get(dnsForwarderZoneIdParam string) (model0.PolicyDnsForwarderZone, error) { + var obj model0.PolicyDnsForwarderZone + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderZonesClient) + obj, err = client.Get(dnsForwarderZoneIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DnsForwarderZonesClient) + gmObj, err1 := client.Get(dnsForwarderZoneIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderZoneBindingType(), model0.PolicyDnsForwarderZoneBindingType()) + obj = rawObj.(model0.PolicyDnsForwarderZone) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderZonesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, dnsForwarderZoneIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderZoneClientContext) Patch(dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam model0.PolicyDnsForwarderZone) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderZonesClient) + err = client.Patch(dnsForwarderZoneIdParam, policyDnsForwarderZoneParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderZonesClient) + gmObj, err1 := utl.ConvertModelBindingType(policyDnsForwarderZoneParam, model0.PolicyDnsForwarderZoneBindingType(), model1.PolicyDnsForwarderZoneBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(dnsForwarderZoneIdParam, gmObj.(model1.PolicyDnsForwarderZone)) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderZonesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, dnsForwarderZoneIdParam, policyDnsForwarderZoneParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyDnsForwarderZoneClientContext) Update(dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam model0.PolicyDnsForwarderZone) (model0.PolicyDnsForwarderZone, error) { + var err error + var obj model0.PolicyDnsForwarderZone + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderZonesClient) + obj, err = client.Update(dnsForwarderZoneIdParam, policyDnsForwarderZoneParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderZonesClient) + gmObj, err := utl.ConvertModelBindingType(policyDnsForwarderZoneParam, model0.PolicyDnsForwarderZoneBindingType(), model1.PolicyDnsForwarderZoneBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(dnsForwarderZoneIdParam, gmObj.(model1.PolicyDnsForwarderZone)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderZoneBindingType(), model0.PolicyDnsForwarderZoneBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyDnsForwarderZone) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderZonesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, dnsForwarderZoneIdParam, policyDnsForwarderZoneParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderZoneClientContext) Delete(dnsForwarderZoneIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderZonesClient) + err = client.Delete(dnsForwarderZoneIdParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderZonesClient) + err = client.Delete(dnsForwarderZoneIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderZonesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, dnsForwarderZoneIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyDnsForwarderZoneClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyDnsForwarderZoneListResult, error) { + var err error + var obj model0.PolicyDnsForwarderZoneListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderZonesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderZonesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderZoneListResultBindingType(), model0.PolicyDnsForwarderZoneListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyDnsForwarderZoneListResult) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderZonesClient) + 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 +} diff --git a/api/infra/qos_profile.go b/api/infra/qos_profile.go new file mode 100644 index 000000000..91876b623 --- /dev/null +++ b/api/infra/qos_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 QosProfileClientContext utl.ClientContext + +func NewQosProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *QosProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewQosProfilesClient(connector) + + case utl.Global: + client = client1.NewQosProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewQosProfilesClient(connector) + + default: + return nil + } + return &QosProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c QosProfileClientContext) Get(qosProfileIdParam string) (model0.QosProfile, error) { + var obj model0.QosProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.QosProfilesClient) + obj, err = client.Get(qosProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.QosProfilesClient) + gmObj, err1 := client.Get(qosProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.QosProfileBindingType(), model0.QosProfileBindingType()) + obj = rawObj.(model0.QosProfile) + + case utl.Multitenancy: + client := c.Client.(client2.QosProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c QosProfileClientContext) Patch(qosProfileIdParam string, qosProfileParam model0.QosProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.QosProfilesClient) + err = client.Patch(qosProfileIdParam, qosProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.QosProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(qosProfileParam, model0.QosProfileBindingType(), model1.QosProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(qosProfileIdParam, gmObj.(model1.QosProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.QosProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, qosProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c QosProfileClientContext) Update(qosProfileIdParam string, qosProfileParam model0.QosProfile, overrideParam *bool) (model0.QosProfile, error) { + var err error + var obj model0.QosProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.QosProfilesClient) + obj, err = client.Update(qosProfileIdParam, qosProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.QosProfilesClient) + gmObj, err := utl.ConvertModelBindingType(qosProfileParam, model0.QosProfileBindingType(), model1.QosProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(qosProfileIdParam, gmObj.(model1.QosProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.QosProfileBindingType(), model0.QosProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.QosProfile) + + case utl.Multitenancy: + client := c.Client.(client2.QosProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, qosProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c QosProfileClientContext) Delete(qosProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.QosProfilesClient) + err = client.Delete(qosProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.QosProfilesClient) + err = client.Delete(qosProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.QosProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, qosProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c QosProfileClientContext) List(cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.QosProfileListResult, error) { + var err error + var obj model0.QosProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.QosProfilesClient) + obj, err = client.List(cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.QosProfilesClient) + gmObj, err := client.List(cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.QosProfileListResultBindingType(), model0.QosProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.QosProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.QosProfilesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/realized_state/realized_entity.go b/api/infra/realized_state/realized_entity.go new file mode 100644 index 000000000..3e4ccc2c7 --- /dev/null +++ b/api/infra/realized_state/realized_entity.go @@ -0,0 +1,70 @@ +//nolint:revive +package realizedstate + +// 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/realized_state" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type RealizedEntityClientContext utl.ClientContext + +func NewRealizedEntitiesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *RealizedEntityClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewRealizedEntitiesClient(connector) + + case utl.Global: + client = client1.NewRealizedEntitiesClient(connector) + + case utl.Multitenancy: + client = client2.NewRealizedEntitiesClient(connector) + + default: + return nil + } + return &RealizedEntityClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c RealizedEntityClientContext) List(intentPathParam string, sitePathParam *string) (model0.GenericPolicyRealizedResourceListResult, error) { + var err error + var obj model0.GenericPolicyRealizedResourceListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.RealizedEntitiesClient) + obj, err = client.List(intentPathParam, sitePathParam) + + case utl.Global: + client := c.Client.(client1.RealizedEntitiesClient) + gmObj, err := client.List(intentPathParam, sitePathParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.GenericPolicyRealizedResourceListResultBindingType(), model0.GenericPolicyRealizedResourceListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.GenericPolicyRealizedResourceListResult) + + case utl.Multitenancy: + client := c.Client.(client2.RealizedEntitiesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, intentPathParam, sitePathParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/realized_state/virtual_machine.go b/api/infra/realized_state/virtual_machine.go new file mode 100644 index 000000000..6a4ef88d0 --- /dev/null +++ b/api/infra/realized_state/virtual_machine.go @@ -0,0 +1,53 @@ +//nolint:revive +package realizedstate + +// 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/realized_state" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type VirtualMachineClientContext utl.ClientContext + +func NewVirtualMachinesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *VirtualMachineClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewVirtualMachinesClient(connector) + + case utl.Multitenancy: + client = client1.NewVirtualMachinesClient(connector) + + default: + return nil + } + return &VirtualMachineClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c VirtualMachineClientContext) List(cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.VirtualMachineListResult, error) { + var err error + var obj model0.VirtualMachineListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.VirtualMachinesClient) + obj, err = client.List(cursorParam, enforcementPointPathParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.VirtualMachinesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, cursorParam, enforcementPointPathParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segment.go b/api/infra/segment.go new file mode 100644 index 000000000..4539d3394 --- /dev/null +++ b/api/infra/segment.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 SegmentClientContext utl.ClientContext + +func NewSegmentsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentsClient(connector) + + case utl.Global: + client = client1.NewSegmentsClient(connector) + + case utl.Multitenancy: + client = client2.NewSegmentsClient(connector) + + default: + return nil + } + return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentClientContext) Get(segmentIdParam string) (model0.Segment, error) { + var obj model0.Segment + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.Get(segmentIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err1 := client.Get(segmentIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SegmentBindingType(), model0.SegmentBindingType()) + obj = rawObj.(model0.Segment) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentClientContext) Patch(segmentIdParam string, segmentParam model0.Segment) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + err = client.Patch(segmentIdParam, segmentParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err1 := utl.ConvertModelBindingType(segmentParam, model0.SegmentBindingType(), model1.SegmentBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(segmentIdParam, gmObj.(model1.Segment)) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentClientContext) Update(segmentIdParam string, segmentParam model0.Segment) (model0.Segment, error) { + var err error + var obj model0.Segment + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.Update(segmentIdParam, segmentParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err := utl.ConvertModelBindingType(segmentParam, model0.SegmentBindingType(), model1.SegmentBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(segmentIdParam, gmObj.(model1.Segment)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentBindingType(), model0.SegmentBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Segment) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentClientContext) Delete(segmentIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + err = client.Delete(segmentIdParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + err = client.Delete(segmentIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (model0.SegmentListResult, error) { + var err error + var obj model0.SegmentListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentListResultBindingType(), model0.SegmentListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SegmentListResult) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segment_security_profile.go b/api/infra/segment_security_profile.go new file mode 100644 index 000000000..a453a461a --- /dev/null +++ b/api/infra/segment_security_profile.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 SegmentSecurityProfileClientContext utl.ClientContext + +func NewSegmentSecurityProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentSecurityProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentSecurityProfilesClient(connector) + + case utl.Global: + client = client1.NewSegmentSecurityProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewSegmentSecurityProfilesClient(connector) + + default: + return nil + } + return &SegmentSecurityProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentSecurityProfileClientContext) Get(segmentSecurityProfileIdParam string) (model0.SegmentSecurityProfile, error) { + var obj model0.SegmentSecurityProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfilesClient) + obj, err = client.Get(segmentSecurityProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.SegmentSecurityProfilesClient) + gmObj, err1 := client.Get(segmentSecurityProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SegmentSecurityProfileBindingType(), model0.SegmentSecurityProfileBindingType()) + obj = rawObj.(model0.SegmentSecurityProfile) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentSecurityProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentSecurityProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentSecurityProfileClientContext) Patch(segmentSecurityProfileIdParam string, segmentSecurityProfileParam model0.SegmentSecurityProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfilesClient) + err = client.Patch(segmentSecurityProfileIdParam, segmentSecurityProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.SegmentSecurityProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(segmentSecurityProfileParam, model0.SegmentSecurityProfileBindingType(), model1.SegmentSecurityProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(segmentSecurityProfileIdParam, gmObj.(model1.SegmentSecurityProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentSecurityProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentSecurityProfileIdParam, segmentSecurityProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentSecurityProfileClientContext) Update(segmentSecurityProfileIdParam string, segmentSecurityProfileParam model0.SegmentSecurityProfile, overrideParam *bool) (model0.SegmentSecurityProfile, error) { + var err error + var obj model0.SegmentSecurityProfile + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfilesClient) + obj, err = client.Update(segmentSecurityProfileIdParam, segmentSecurityProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.SegmentSecurityProfilesClient) + gmObj, err := utl.ConvertModelBindingType(segmentSecurityProfileParam, model0.SegmentSecurityProfileBindingType(), model1.SegmentSecurityProfileBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(segmentSecurityProfileIdParam, gmObj.(model1.SegmentSecurityProfile), overrideParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentSecurityProfileBindingType(), model0.SegmentSecurityProfileBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SegmentSecurityProfile) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentSecurityProfilesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentSecurityProfileIdParam, segmentSecurityProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentSecurityProfileClientContext) Delete(segmentSecurityProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfilesClient) + err = client.Delete(segmentSecurityProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.SegmentSecurityProfilesClient) + err = client.Delete(segmentSecurityProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentSecurityProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentSecurityProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentSecurityProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentSecurityProfileListResult, error) { + var err error + var obj model0.SegmentSecurityProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.SegmentSecurityProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentSecurityProfileListResultBindingType(), model0.SegmentSecurityProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SegmentSecurityProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentSecurityProfilesClient) + 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 +} diff --git a/api/infra/segments/dhcp_static_binding_config.go b/api/infra/segments/dhcp_static_binding_config.go new file mode 100644 index 000000000..01715eb80 --- /dev/null +++ b/api/infra/segments/dhcp_static_binding_config.go @@ -0,0 +1,174 @@ +//nolint:revive +package segments + +// 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/segments" + lrmodel1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" + lrmodel0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type StructValueClientContext utl.ClientContext + +func NewDhcpStaticBindingConfigsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StructValueClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDhcpStaticBindingConfigsClient(connector) + + case utl.Global: + client = client1.NewDhcpStaticBindingConfigsClient(connector) + + case utl.Multitenancy: + client = client2.NewDhcpStaticBindingConfigsClient(connector) + + default: + return nil + } + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c StructValueClientContext) Get(segmentIdParam string, bindingIdParam string) (*model0.StructValue, error) { + var obj *model0.StructValue + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.Get(segmentIdParam, bindingIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DhcpStaticBindingConfigsClient) + obj, err = client.Get(segmentIdParam, bindingIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client2.DhcpStaticBindingConfigsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentIdParam, bindingIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) Delete(segmentIdParam string, bindingIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + err = client.Delete(segmentIdParam, bindingIdParam) + + case utl.Global: + client := c.Client.(client1.DhcpStaticBindingConfigsClient) + err = client.Delete(segmentIdParam, bindingIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpStaticBindingConfigsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentIdParam, bindingIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Patch(segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *model0.StructValue) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + err = client.Patch(segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpStaticBindingConfigsClient) + err = client.Patch(segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpStaticBindingConfigsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Update(segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *model0.StructValue) (*model0.StructValue, error) { + var err error + var obj *model0.StructValue + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.Update(segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + case utl.Global: + client := c.Client.(client1.DhcpStaticBindingConfigsClient) + obj, err = client.Update(segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpStaticBindingConfigsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) List(segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (lrmodel0.DhcpStaticBindingConfigListResult, error) { + var err error + var obj lrmodel0.DhcpStaticBindingConfigListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.List(segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.DhcpStaticBindingConfigsClient) + gmObj, err := client.List(segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, lrmodel1.DhcpStaticBindingConfigListResultBindingType(), lrmodel0.DhcpStaticBindingConfigListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(lrmodel0.DhcpStaticBindingConfigListResult) + + case utl.Multitenancy: + client := c.Client.(client2.DhcpStaticBindingConfigsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segments/segment_configuration_state.go b/api/infra/segments/segment_configuration_state.go new file mode 100644 index 000000000..db9d4a4c6 --- /dev/null +++ b/api/infra/segments/segment_configuration_state.go @@ -0,0 +1,106 @@ +//nolint:revive +package segments + +// 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/segments" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentConfigurationStateClientContext utl.ClientContext + +func NewStateClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentConfigurationStateClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewStateClient(connector) + + case utl.Global: + client = client1.NewStateClient(connector) + + case utl.Multitenancy: + client = client2.NewStateClient(connector) + + default: + return nil + } + return &SegmentConfigurationStateClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentConfigurationStateClientContext) Get(segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentConfigurationState, error) { + var obj model0.SegmentConfigurationState + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StateClient) + obj, err = client.Get(segmentsIdParam, cursorParam, edgePathParam, enforcementPointPathParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.StateClient) + gmObj, err1 := client.Get(segmentsIdParam, cursorParam, edgePathParam, enforcementPointPathParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SegmentConfigurationStateBindingType(), model0.SegmentConfigurationStateBindingType()) + obj = rawObj.(model0.SegmentConfigurationState) + + case utl.Multitenancy: + client := c.Client.(client2.StateClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentsIdParam, cursorParam, edgePathParam, enforcementPointPathParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentConfigurationStateClientContext) List(configurationStateParam *string, enforcementPointPathParam *string, sourceParam *string) (model0.SegmentConfigurationStateListResult, error) { + var err error + var obj model0.SegmentConfigurationStateListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StateClient) + obj, err = client.List(configurationStateParam, enforcementPointPathParam, sourceParam) + + case utl.Global: + client := c.Client.(client1.StateClient) + gmObj, err := client.List(configurationStateParam, enforcementPointPathParam, sourceParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentConfigurationStateListResultBindingType(), model0.SegmentConfigurationStateListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SegmentConfigurationStateListResult) + + case utl.Multitenancy: + client := c.Client.(client2.StateClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, configurationStateParam, enforcementPointPathParam, sourceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segments/segment_discovery_profile_binding_map.go b/api/infra/segments/segment_discovery_profile_binding_map.go new file mode 100644 index 000000000..7c56fdd4b --- /dev/null +++ b/api/infra/segments/segment_discovery_profile_binding_map.go @@ -0,0 +1,137 @@ +//nolint:revive +package segments + +// 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/segments" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentDiscoveryProfileBindingMapClientContext utl.ClientContext + +func NewSegmentDiscoveryProfileBindingMapsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentDiscoveryProfileBindingMapClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentDiscoveryProfileBindingMapsClient(connector) + + case utl.Multitenancy: + client = client1.NewSegmentDiscoveryProfileBindingMapsClient(connector) + + default: + return nil + } + return &SegmentDiscoveryProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentDiscoveryProfileBindingMapClientContext) Get(infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) (model0.SegmentDiscoveryProfileBindingMap, error) { + var obj model0.SegmentDiscoveryProfileBindingMap + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.Get(infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentDiscoveryProfileBindingMapClientContext) Delete(infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentDiscoveryProfileBindingMapsClient) + err = client.Delete(infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentDiscoveryProfileBindingMapsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentDiscoveryProfileBindingMapClientContext) Patch(infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam model0.SegmentDiscoveryProfileBindingMap) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentDiscoveryProfileBindingMapsClient) + err = client.Patch(infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam, segmentDiscoveryProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentDiscoveryProfileBindingMapsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam, segmentDiscoveryProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentDiscoveryProfileBindingMapClientContext) Update(infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam model0.SegmentDiscoveryProfileBindingMap) (model0.SegmentDiscoveryProfileBindingMap, error) { + var err error + var obj model0.SegmentDiscoveryProfileBindingMap + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.Update(infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam, segmentDiscoveryProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, infraSegmentIdParam, segmentDiscoveryProfileBindingMapIdParam, segmentDiscoveryProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentDiscoveryProfileBindingMapClientContext) List(infraSegmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentDiscoveryProfileBindingMapListResult, error) { + var err error + var obj model0.SegmentDiscoveryProfileBindingMapListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.List(infraSegmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentDiscoveryProfileBindingMapsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, infraSegmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segments/segment_port.go b/api/infra/segments/segment_port.go new file mode 100644 index 000000000..d3686282e --- /dev/null +++ b/api/infra/segments/segment_port.go @@ -0,0 +1,137 @@ +//nolint:revive +package segments + +// 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/segments" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentPortClientContext utl.ClientContext + +func NewPortsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentPortClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewPortsClient(connector) + + case utl.Multitenancy: + client = client1.NewPortsClient(connector) + + default: + return nil + } + return &SegmentPortClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentPortClientContext) Get(segmentIdParam string, portIdParam string) (model0.SegmentPort, error) { + var obj model0.SegmentPort + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.PortsClient) + obj, err = client.Get(segmentIdParam, portIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.PortsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentIdParam, portIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentPortClientContext) Patch(segmentIdParam string, portIdParam string, segmentPortParam model0.SegmentPort) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.PortsClient) + err = client.Patch(segmentIdParam, portIdParam, segmentPortParam) + + case utl.Multitenancy: + client := c.Client.(client1.PortsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentIdParam, portIdParam, segmentPortParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentPortClientContext) Update(segmentIdParam string, portIdParam string, segmentPortParam model0.SegmentPort) (model0.SegmentPort, error) { + var err error + var obj model0.SegmentPort + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.PortsClient) + obj, err = client.Update(segmentIdParam, portIdParam, segmentPortParam) + + case utl.Multitenancy: + client := c.Client.(client1.PortsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentIdParam, portIdParam, segmentPortParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentPortClientContext) Delete(segmentIdParam string, portIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.PortsClient) + err = client.Delete(segmentIdParam, portIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.PortsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentIdParam, portIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentPortClientContext) List(segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentPortListResult, error) { + var err error + var obj model0.SegmentPortListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.PortsClient) + obj, err = client.List(segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.PortsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segments/segment_qos_profile_binding_map.go b/api/infra/segments/segment_qos_profile_binding_map.go new file mode 100644 index 000000000..aa8910155 --- /dev/null +++ b/api/infra/segments/segment_qos_profile_binding_map.go @@ -0,0 +1,137 @@ +//nolint:revive +package segments + +// 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/segments" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentQosProfileBindingMapClientContext utl.ClientContext + +func NewSegmentQosProfileBindingMapsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentQosProfileBindingMapClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentQosProfileBindingMapsClient(connector) + + case utl.Multitenancy: + client = client1.NewSegmentQosProfileBindingMapsClient(connector) + + default: + return nil + } + return &SegmentQosProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentQosProfileBindingMapClientContext) Get(segmentIdParam string, segmentQosProfileBindingMapIdParam string) (model0.SegmentQosProfileBindingMap, error) { + var obj model0.SegmentQosProfileBindingMap + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentQosProfileBindingMapsClient) + obj, err = client.Get(segmentIdParam, segmentQosProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.SegmentQosProfileBindingMapsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentQosProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentQosProfileBindingMapClientContext) Delete(segmentIdParam string, segmentQosProfileBindingMapIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentQosProfileBindingMapsClient) + err = client.Delete(segmentIdParam, segmentQosProfileBindingMapIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentQosProfileBindingMapsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentQosProfileBindingMapIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentQosProfileBindingMapClientContext) Patch(segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam model0.SegmentQosProfileBindingMap) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentQosProfileBindingMapsClient) + err = client.Patch(segmentIdParam, segmentQosProfileBindingMapIdParam, segmentQosProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentQosProfileBindingMapsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentQosProfileBindingMapIdParam, segmentQosProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentQosProfileBindingMapClientContext) Update(segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam model0.SegmentQosProfileBindingMap) (model0.SegmentQosProfileBindingMap, error) { + var err error + var obj model0.SegmentQosProfileBindingMap + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentQosProfileBindingMapsClient) + obj, err = client.Update(segmentIdParam, segmentQosProfileBindingMapIdParam, segmentQosProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentQosProfileBindingMapsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentQosProfileBindingMapIdParam, segmentQosProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentQosProfileBindingMapClientContext) List(segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentQosProfileBindingMapListResult, error) { + var err error + var obj model0.SegmentQosProfileBindingMapListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentQosProfileBindingMapsClient) + obj, err = client.List(segmentIdParam, cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentQosProfileBindingMapsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, segmentIdParam, cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/segments/segment_security_profile_binding_map.go b/api/infra/segments/segment_security_profile_binding_map.go new file mode 100644 index 000000000..c844cb244 --- /dev/null +++ b/api/infra/segments/segment_security_profile_binding_map.go @@ -0,0 +1,137 @@ +//nolint:revive +package segments + +// 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/segments" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentSecurityProfileBindingMapClientContext utl.ClientContext + +func NewSegmentSecurityProfileBindingMapsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentSecurityProfileBindingMapClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentSecurityProfileBindingMapsClient(connector) + + case utl.Multitenancy: + client = client1.NewSegmentSecurityProfileBindingMapsClient(connector) + + default: + return nil + } + return &SegmentSecurityProfileBindingMapClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentSecurityProfileBindingMapClientContext) Get(segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) (model0.SegmentSecurityProfileBindingMap, error) { + var obj model0.SegmentSecurityProfileBindingMap + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfileBindingMapsClient) + obj, err = client.Get(segmentIdParam, segmentSecurityProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + case utl.Multitenancy: + client := c.Client.(client1.SegmentSecurityProfileBindingMapsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentSecurityProfileBindingMapIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentSecurityProfileBindingMapClientContext) Delete(segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfileBindingMapsClient) + err = client.Delete(segmentIdParam, segmentSecurityProfileBindingMapIdParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentSecurityProfileBindingMapsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentSecurityProfileBindingMapIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentSecurityProfileBindingMapClientContext) Patch(segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam model0.SegmentSecurityProfileBindingMap) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfileBindingMapsClient) + err = client.Patch(segmentIdParam, segmentSecurityProfileBindingMapIdParam, segmentSecurityProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentSecurityProfileBindingMapsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentSecurityProfileBindingMapIdParam, segmentSecurityProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentSecurityProfileBindingMapClientContext) Update(segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam model0.SegmentSecurityProfileBindingMap) (model0.SegmentSecurityProfileBindingMap, error) { + var err error + var obj model0.SegmentSecurityProfileBindingMap + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfileBindingMapsClient) + obj, err = client.Update(segmentIdParam, segmentSecurityProfileBindingMapIdParam, segmentSecurityProfileBindingMapParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentSecurityProfileBindingMapsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, segmentIdParam, segmentSecurityProfileBindingMapIdParam, segmentSecurityProfileBindingMapParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentSecurityProfileBindingMapClientContext) List(segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SegmentSecurityProfileBindingMapListResult, error) { + var err error + var obj model0.SegmentSecurityProfileBindingMapListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentSecurityProfileBindingMapsClient) + obj, err = client.List(segmentIdParam, cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Multitenancy: + client := c.Client.(client1.SegmentSecurityProfileBindingMapsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, segmentIdParam, cursorParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/service.go b/api/infra/service.go new file mode 100644 index 000000000..5ec75a02f --- /dev/null +++ b/api/infra/service.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 ServiceClientContext utl.ClientContext + +func NewServicesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *ServiceClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewServicesClient(connector) + + case utl.Global: + client = client1.NewServicesClient(connector) + + case utl.Multitenancy: + client = client2.NewServicesClient(connector) + + default: + return nil + } + return &ServiceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c ServiceClientContext) Get(serviceIdParam string) (model0.Service, error) { + var obj model0.Service + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ServicesClient) + obj, err = client.Get(serviceIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.ServicesClient) + gmObj, err1 := client.Get(serviceIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.ServiceBindingType(), model0.ServiceBindingType()) + obj = rawObj.(model0.Service) + + case utl.Multitenancy: + client := c.Client.(client2.ServicesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, serviceIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c ServiceClientContext) Patch(serviceIdParam string, serviceParam model0.Service) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ServicesClient) + err = client.Patch(serviceIdParam, serviceParam) + + case utl.Global: + client := c.Client.(client1.ServicesClient) + gmObj, err1 := utl.ConvertModelBindingType(serviceParam, model0.ServiceBindingType(), model1.ServiceBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(serviceIdParam, gmObj.(model1.Service)) + + case utl.Multitenancy: + client := c.Client.(client2.ServicesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, serviceIdParam, serviceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c ServiceClientContext) Update(serviceIdParam string, serviceParam model0.Service) (model0.Service, error) { + var err error + var obj model0.Service + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ServicesClient) + obj, err = client.Update(serviceIdParam, serviceParam) + + case utl.Global: + client := c.Client.(client1.ServicesClient) + gmObj, err := utl.ConvertModelBindingType(serviceParam, model0.ServiceBindingType(), model1.ServiceBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(serviceIdParam, gmObj.(model1.Service)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.ServiceBindingType(), model0.ServiceBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Service) + + case utl.Multitenancy: + client := c.Client.(client2.ServicesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, serviceIdParam, serviceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c ServiceClientContext) Delete(serviceIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ServicesClient) + err = client.Delete(serviceIdParam) + + case utl.Global: + client := c.Client.(client1.ServicesClient) + err = client.Delete(serviceIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.ServicesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, serviceIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c ServiceClientContext) List(cursorParam *string, defaultServiceParam *bool, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.ServiceListResult, error) { + var err error + var obj model0.ServiceListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.ServicesClient) + obj, err = client.List(cursorParam, defaultServiceParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.ServicesClient) + gmObj, err := client.List(cursorParam, defaultServiceParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.ServiceListResultBindingType(), model0.ServiceListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.ServiceListResult) + + case utl.Multitenancy: + client := c.Client.(client2.ServicesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, cursorParam, defaultServiceParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/spoof_guard_profile.go b/api/infra/spoof_guard_profile.go new file mode 100644 index 000000000..386ebb56a --- /dev/null +++ b/api/infra/spoof_guard_profile.go @@ -0,0 +1,156 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 SpoofGuardProfileClientContext utl.ClientContext + +func NewSpoofguardProfilesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SpoofGuardProfileClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSpoofguardProfilesClient(connector) + + case utl.Global: + client = client1.NewSpoofguardProfilesClient(connector) + + case utl.Multitenancy: + client = client2.NewSpoofguardProfilesClient(connector) + + default: + return nil + } + return &SpoofGuardProfileClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SpoofGuardProfileClientContext) Get(spoofguardProfileIdParam string) (model0.SpoofGuardProfile, error) { + var obj model0.SpoofGuardProfile + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SpoofguardProfilesClient) + obj, err = client.Get(spoofguardProfileIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.SpoofguardProfilesClient) + gmObj, err1 := client.Get(spoofguardProfileIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SpoofGuardProfileBindingType(), model0.SpoofGuardProfileBindingType()) + obj = rawObj.(model0.SpoofGuardProfile) + + case utl.Multitenancy: + client := c.Client.(client2.SpoofguardProfilesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, spoofguardProfileIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SpoofGuardProfileClientContext) Patch(spoofguardProfileIdParam string, spoofGuardProfileParam model0.SpoofGuardProfile, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SpoofguardProfilesClient) + err = client.Patch(spoofguardProfileIdParam, spoofGuardProfileParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.SpoofguardProfilesClient) + gmObj, err1 := utl.ConvertModelBindingType(spoofGuardProfileParam, model0.SpoofGuardProfileBindingType(), model1.SpoofGuardProfileBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(spoofguardProfileIdParam, gmObj.(model1.SpoofGuardProfile), overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.SpoofguardProfilesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, spoofguardProfileIdParam, spoofGuardProfileParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SpoofGuardProfileClientContext) Delete(spoofguardProfileIdParam string, overrideParam *bool) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SpoofguardProfilesClient) + err = client.Delete(spoofguardProfileIdParam, overrideParam) + + case utl.Global: + client := c.Client.(client1.SpoofguardProfilesClient) + err = client.Delete(spoofguardProfileIdParam, overrideParam) + + case utl.Multitenancy: + client := c.Client.(client2.SpoofguardProfilesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, spoofguardProfileIdParam, overrideParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SpoofGuardProfileClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.SpoofGuardProfileListResult, error) { + var err error + var obj model0.SpoofGuardProfileListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SpoofguardProfilesClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.SpoofguardProfilesClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SpoofGuardProfileListResultBindingType(), model0.SpoofGuardProfileListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SpoofGuardProfileListResult) + + case utl.Multitenancy: + client := c.Client.(client2.SpoofguardProfilesClient) + 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 +} diff --git a/api/infra/tier0.go b/api/infra/tier0.go new file mode 100644 index 000000000..5ed714881 --- /dev/null +++ b/api/infra/tier0.go @@ -0,0 +1,165 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type Tier0ClientContext utl.ClientContext + +func NewTier0sClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *Tier0ClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewTier0sClient(connector) + + case utl.Global: + client = client1.NewTier0sClient(connector) + + default: + return nil + } + return &Tier0ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c Tier0ClientContext) Get(tier0IdParam string) (model0.Tier0, error) { + var obj model0.Tier0 + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier0sClient) + obj, err = client.Get(tier0IdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.Tier0sClient) + gmObj, err1 := client.Get(tier0IdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.Tier0BindingType(), model0.Tier0BindingType()) + obj = rawObj.(model0.Tier0) + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier0ClientContext) Patch(tier0IdParam string, tier0Param model0.Tier0) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier0sClient) + err = client.Patch(tier0IdParam, tier0Param) + + case utl.Global: + client := c.Client.(client1.Tier0sClient) + gmObj, err1 := utl.ConvertModelBindingType(tier0Param, model0.Tier0BindingType(), model1.Tier0BindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier0IdParam, gmObj.(model1.Tier0)) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier0ClientContext) Update(tier0IdParam string, tier0Param model0.Tier0) (model0.Tier0, error) { + var err error + var obj model0.Tier0 + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier0sClient) + obj, err = client.Update(tier0IdParam, tier0Param) + + case utl.Global: + client := c.Client.(client1.Tier0sClient) + gmObj, err := utl.ConvertModelBindingType(tier0Param, model0.Tier0BindingType(), model1.Tier0BindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier0IdParam, gmObj.(model1.Tier0)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier0BindingType(), model0.Tier0BindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier0) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier0ClientContext) Delete(tier0IdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier0sClient) + err = client.Delete(tier0IdParam) + + case utl.Global: + client := c.Client.(client1.Tier0sClient) + err = client.Delete(tier0IdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier0ClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.Tier0ListResult, error) { + var err error + var obj model0.Tier0ListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier0sClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.Tier0sClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier0ListResultBindingType(), model0.Tier0ListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier0ListResult) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier1.go b/api/infra/tier1.go new file mode 100644 index 000000000..9622353c6 --- /dev/null +++ b/api/infra/tier1.go @@ -0,0 +1,192 @@ +//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" + client1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + model0 "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 Tier1ClientContext utl.ClientContext + +func NewTier1sClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *Tier1ClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewTier1sClient(connector) + + case utl.Global: + client = client1.NewTier1sClient(connector) + + case utl.Multitenancy: + client = client2.NewTier1sClient(connector) + + default: + return nil + } + return &Tier1ClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c Tier1ClientContext) Get(tier1IdParam string) (model0.Tier1, error) { + var obj model0.Tier1 + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier1sClient) + obj, err = client.Get(tier1IdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.Tier1sClient) + gmObj, err1 := client.Get(tier1IdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.Tier1BindingType(), model0.Tier1BindingType()) + obj = rawObj.(model0.Tier1) + + case utl.Multitenancy: + client := c.Client.(client2.Tier1sClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier1ClientContext) Patch(tier1IdParam string, tier1Param model0.Tier1) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier1sClient) + err = client.Patch(tier1IdParam, tier1Param) + + case utl.Global: + client := c.Client.(client1.Tier1sClient) + gmObj, err1 := utl.ConvertModelBindingType(tier1Param, model0.Tier1BindingType(), model1.Tier1BindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, gmObj.(model1.Tier1)) + + case utl.Multitenancy: + client := c.Client.(client2.Tier1sClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, tier1Param) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier1ClientContext) Update(tier1IdParam string, tier1Param model0.Tier1) (model0.Tier1, error) { + var err error + var obj model0.Tier1 + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier1sClient) + obj, err = client.Update(tier1IdParam, tier1Param) + + case utl.Global: + client := c.Client.(client1.Tier1sClient) + gmObj, err := utl.ConvertModelBindingType(tier1Param, model0.Tier1BindingType(), model1.Tier1BindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, gmObj.(model1.Tier1)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier1BindingType(), model0.Tier1BindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier1) + + case utl.Multitenancy: + client := c.Client.(client2.Tier1sClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, tier1Param) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier1ClientContext) Delete(tier1IdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier1sClient) + err = client.Delete(tier1IdParam) + + case utl.Global: + client := c.Client.(client1.Tier1sClient) + err = client.Delete(tier1IdParam) + + case utl.Multitenancy: + client := c.Client.(client2.Tier1sClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier1ClientContext) List(cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.Tier1ListResult, error) { + var err error + var obj model0.Tier1ListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.Tier1sClient) + obj, err = client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.Tier1sClient) + gmObj, err := client.List(cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier1ListResultBindingType(), model0.Tier1ListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier1ListResult) + + case utl.Multitenancy: + client := c.Client.(client2.Tier1sClient) + 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 +} diff --git a/api/infra/tier_0s/locale_services.go b/api/infra/tier_0s/locale_services.go new file mode 100644 index 000000000..b04e2c42e --- /dev/null +++ b/api/infra/tier_0s/locale_services.go @@ -0,0 +1,165 @@ +//nolint:revive +package tier0s + +// 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/tier_0s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type LocaleServicesClientContext utl.ClientContext + +func NewLocaleServicesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *LocaleServicesClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewLocaleServicesClient(connector) + + case utl.Global: + client = client1.NewLocaleServicesClient(connector) + + default: + return nil + } + return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c LocaleServicesClientContext) Get(tier0IdParam string, localeServicesIdParam string) (model0.LocaleServices, error) { + var obj model0.LocaleServices + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.Get(tier0IdParam, localeServicesIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err1 := client.Get(tier0IdParam, localeServicesIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.LocaleServicesBindingType(), model0.LocaleServicesBindingType()) + obj = rawObj.(model0.LocaleServices) + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c LocaleServicesClientContext) Patch(tier0IdParam string, localeServicesIdParam string, localeServicesParam model0.LocaleServices) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + err = client.Patch(tier0IdParam, localeServicesIdParam, localeServicesParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err1 := utl.ConvertModelBindingType(localeServicesParam, model0.LocaleServicesBindingType(), model1.LocaleServicesBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier0IdParam, localeServicesIdParam, gmObj.(model1.LocaleServices)) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c LocaleServicesClientContext) Update(tier0IdParam string, localeServicesIdParam string, localeServicesParam model0.LocaleServices) (model0.LocaleServices, error) { + var err error + var obj model0.LocaleServices + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.Update(tier0IdParam, localeServicesIdParam, localeServicesParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err := utl.ConvertModelBindingType(localeServicesParam, model0.LocaleServicesBindingType(), model1.LocaleServicesBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier0IdParam, localeServicesIdParam, gmObj.(model1.LocaleServices)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.LocaleServicesBindingType(), model0.LocaleServicesBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.LocaleServices) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c LocaleServicesClientContext) Delete(tier0IdParam string, localeServicesIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + err = client.Delete(tier0IdParam, localeServicesIdParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + err = client.Delete(tier0IdParam, localeServicesIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c LocaleServicesClientContext) List(tier0IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.LocaleServicesListResult, error) { + var err error + var obj model0.LocaleServicesListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.List(tier0IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err := client.List(tier0IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.LocaleServicesListResultBindingType(), model0.LocaleServicesListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.LocaleServicesListResult) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_0s/nat/policy_nat_rule.go b/api/infra/tier_0s/nat/policy_nat_rule.go new file mode 100644 index 000000000..964df0482 --- /dev/null +++ b/api/infra/tier_0s/nat/policy_nat_rule.go @@ -0,0 +1,165 @@ +//nolint:revive +package nat + +// 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/tier_0s/nat" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/nat" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type PolicyNatRuleClientContext utl.ClientContext + +func NewNatRulesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyNatRuleClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewNatRulesClient(connector) + + case utl.Global: + client = client1.NewNatRulesClient(connector) + + default: + return nil + } + return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyNatRuleClientContext) Get(tier0IdParam string, natIdParam string, natRuleIdParam string) (model0.PolicyNatRule, error) { + var obj model0.PolicyNatRule + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.Get(tier0IdParam, natIdParam, natRuleIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err1 := client.Get(tier0IdParam, natIdParam, natRuleIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleBindingType(), model0.PolicyNatRuleBindingType()) + obj = rawObj.(model0.PolicyNatRule) + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyNatRuleClientContext) Patch(tier0IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam model0.PolicyNatRule) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + err = client.Patch(tier0IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err1 := utl.ConvertModelBindingType(policyNatRuleParam, model0.PolicyNatRuleBindingType(), model1.PolicyNatRuleBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier0IdParam, natIdParam, natRuleIdParam, gmObj.(model1.PolicyNatRule)) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyNatRuleClientContext) Update(tier0IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam model0.PolicyNatRule) (model0.PolicyNatRule, error) { + var err error + var obj model0.PolicyNatRule + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.Update(tier0IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err := utl.ConvertModelBindingType(policyNatRuleParam, model0.PolicyNatRuleBindingType(), model1.PolicyNatRuleBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier0IdParam, natIdParam, natRuleIdParam, gmObj.(model1.PolicyNatRule)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleBindingType(), model0.PolicyNatRuleBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyNatRule) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyNatRuleClientContext) Delete(tier0IdParam string, natIdParam string, natRuleIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + err = client.Delete(tier0IdParam, natIdParam, natRuleIdParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + err = client.Delete(tier0IdParam, natIdParam, natRuleIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyNatRuleClientContext) List(tier0IdParam string, natIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyNatRuleListResult, error) { + var err error + var obj model0.PolicyNatRuleListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.List(tier0IdParam, natIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err := client.List(tier0IdParam, natIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleListResultBindingType(), model0.PolicyNatRuleListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyNatRuleListResult) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_0s/policy_dns_forwarder.go b/api/infra/tier_0s/policy_dns_forwarder.go new file mode 100644 index 000000000..2cfa9224d --- /dev/null +++ b/api/infra/tier_0s/policy_dns_forwarder.go @@ -0,0 +1,137 @@ +//nolint:revive +package tier0s + +// 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/tier_0s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type PolicyDnsForwarderClientContext utl.ClientContext + +func NewDnsForwarderClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyDnsForwarderClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDnsForwarderClient(connector) + + case utl.Global: + client = client1.NewDnsForwarderClient(connector) + + default: + return nil + } + return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyDnsForwarderClientContext) Get(tier0IdParam string) (model0.PolicyDnsForwarder, error) { + var obj model0.PolicyDnsForwarder + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + obj, err = client.Get(tier0IdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err1 := client.Get(tier0IdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderBindingType(), model0.PolicyDnsForwarderBindingType()) + obj = rawObj.(model0.PolicyDnsForwarder) + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderClientContext) Patch(tier0IdParam string, policyDnsForwarderParam model0.PolicyDnsForwarder) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + err = client.Patch(tier0IdParam, policyDnsForwarderParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err1 := utl.ConvertModelBindingType(policyDnsForwarderParam, model0.PolicyDnsForwarderBindingType(), model1.PolicyDnsForwarderBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier0IdParam, gmObj.(model1.PolicyDnsForwarder)) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyDnsForwarderClientContext) Update(tier0IdParam string, policyDnsForwarderParam model0.PolicyDnsForwarder) (model0.PolicyDnsForwarder, error) { + var err error + var obj model0.PolicyDnsForwarder + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + obj, err = client.Update(tier0IdParam, policyDnsForwarderParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err := utl.ConvertModelBindingType(policyDnsForwarderParam, model0.PolicyDnsForwarderBindingType(), model1.PolicyDnsForwarderBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier0IdParam, gmObj.(model1.PolicyDnsForwarder)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderBindingType(), model0.PolicyDnsForwarderBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyDnsForwarder) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderClientContext) Delete(tier0IdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + err = client.Delete(tier0IdParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + err = client.Delete(tier0IdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} diff --git a/api/infra/tier_0s/static_routes.go b/api/infra/tier_0s/static_routes.go new file mode 100644 index 000000000..248a3c53c --- /dev/null +++ b/api/infra/tier_0s/static_routes.go @@ -0,0 +1,165 @@ +//nolint:revive +package tier0s + +// 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/tier_0s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type StaticRoutesClientContext utl.ClientContext + +func NewStaticRoutesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StaticRoutesClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewStaticRoutesClient(connector) + + case utl.Global: + client = client1.NewStaticRoutesClient(connector) + + default: + return nil + } + return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c StaticRoutesClientContext) Get(tier0IdParam string, routeIdParam string) (model0.StaticRoutes, error) { + var obj model0.StaticRoutes + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.Get(tier0IdParam, routeIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err1 := client.Get(tier0IdParam, routeIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.StaticRoutesBindingType(), model0.StaticRoutesBindingType()) + obj = rawObj.(model0.StaticRoutes) + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StaticRoutesClientContext) Patch(tier0IdParam string, routeIdParam string, staticRoutesParam model0.StaticRoutes) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + err = client.Patch(tier0IdParam, routeIdParam, staticRoutesParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err1 := utl.ConvertModelBindingType(staticRoutesParam, model0.StaticRoutesBindingType(), model1.StaticRoutesBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier0IdParam, routeIdParam, gmObj.(model1.StaticRoutes)) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StaticRoutesClientContext) Update(tier0IdParam string, routeIdParam string, staticRoutesParam model0.StaticRoutes) (model0.StaticRoutes, error) { + var err error + var obj model0.StaticRoutes + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.Update(tier0IdParam, routeIdParam, staticRoutesParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err := utl.ConvertModelBindingType(staticRoutesParam, model0.StaticRoutesBindingType(), model1.StaticRoutesBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier0IdParam, routeIdParam, gmObj.(model1.StaticRoutes)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.StaticRoutesBindingType(), model0.StaticRoutesBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.StaticRoutes) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StaticRoutesClientContext) Delete(tier0IdParam string, routeIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + err = client.Delete(tier0IdParam, routeIdParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + err = client.Delete(tier0IdParam, routeIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StaticRoutesClientContext) List(tier0IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.StaticRoutesListResult, error) { + var err error + var obj model0.StaticRoutesListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.List(tier0IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err := client.List(tier0IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.StaticRoutesListResultBindingType(), model0.StaticRoutesListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.StaticRoutesListResult) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/locale_services.go b/api/infra/tier_1s/locale_services.go new file mode 100644 index 000000000..e00173082 --- /dev/null +++ b/api/infra/tier_1s/locale_services.go @@ -0,0 +1,192 @@ +//nolint:revive +package tier1s + +// 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/tier_1s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type LocaleServicesClientContext utl.ClientContext + +func NewLocaleServicesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *LocaleServicesClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewLocaleServicesClient(connector) + + case utl.Global: + client = client1.NewLocaleServicesClient(connector) + + case utl.Multitenancy: + client = client2.NewLocaleServicesClient(connector) + + default: + return nil + } + return &LocaleServicesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c LocaleServicesClientContext) Get(tier1IdParam string, localeServicesIdParam string) (model0.LocaleServices, error) { + var obj model0.LocaleServices + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.Get(tier1IdParam, localeServicesIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err1 := client.Get(tier1IdParam, localeServicesIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.LocaleServicesBindingType(), model0.LocaleServicesBindingType()) + obj = rawObj.(model0.LocaleServices) + + case utl.Multitenancy: + client := c.Client.(client2.LocaleServicesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c LocaleServicesClientContext) Patch(tier1IdParam string, localeServicesIdParam string, localeServicesParam model0.LocaleServices) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + err = client.Patch(tier1IdParam, localeServicesIdParam, localeServicesParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err1 := utl.ConvertModelBindingType(localeServicesParam, model0.LocaleServicesBindingType(), model1.LocaleServicesBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, localeServicesIdParam, gmObj.(model1.LocaleServices)) + + case utl.Multitenancy: + client := c.Client.(client2.LocaleServicesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, localeServicesParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c LocaleServicesClientContext) Update(tier1IdParam string, localeServicesIdParam string, localeServicesParam model0.LocaleServices) (model0.LocaleServices, error) { + var err error + var obj model0.LocaleServices + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.Update(tier1IdParam, localeServicesIdParam, localeServicesParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err := utl.ConvertModelBindingType(localeServicesParam, model0.LocaleServicesBindingType(), model1.LocaleServicesBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, localeServicesIdParam, gmObj.(model1.LocaleServices)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.LocaleServicesBindingType(), model0.LocaleServicesBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.LocaleServices) + + case utl.Multitenancy: + client := c.Client.(client2.LocaleServicesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, localeServicesParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c LocaleServicesClientContext) Delete(tier1IdParam string, localeServicesIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + err = client.Delete(tier1IdParam, localeServicesIdParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + err = client.Delete(tier1IdParam, localeServicesIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.LocaleServicesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c LocaleServicesClientContext) List(tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.LocaleServicesListResult, error) { + var err error + var obj model0.LocaleServicesListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.LocaleServicesClient) + obj, err = client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.LocaleServicesClient) + gmObj, err := client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.LocaleServicesListResultBindingType(), model0.LocaleServicesListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.LocaleServicesListResult) + + case utl.Multitenancy: + client := c.Client.(client2.LocaleServicesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/locale_services/tier1_interface.go b/api/infra/tier_1s/locale_services/tier1_interface.go new file mode 100644 index 000000000..85514dab0 --- /dev/null +++ b/api/infra/tier_1s/locale_services/tier1_interface.go @@ -0,0 +1,192 @@ +//nolint:revive +package localeservices + +// 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/tier_1s/locale_services" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type Tier1InterfaceClientContext utl.ClientContext + +func NewInterfacesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *Tier1InterfaceClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewInterfacesClient(connector) + + case utl.Global: + client = client1.NewInterfacesClient(connector) + + case utl.Multitenancy: + client = client2.NewInterfacesClient(connector) + + default: + return nil + } + return &Tier1InterfaceClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c Tier1InterfaceClientContext) Get(tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) (model0.Tier1Interface, error) { + var obj model0.Tier1Interface + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InterfacesClient) + obj, err = client.Get(tier1IdParam, localeServicesIdParam, interfaceIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.InterfacesClient) + gmObj, err1 := client.Get(tier1IdParam, localeServicesIdParam, interfaceIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.Tier1InterfaceBindingType(), model0.Tier1InterfaceBindingType()) + obj = rawObj.(model0.Tier1Interface) + + case utl.Multitenancy: + client := c.Client.(client2.InterfacesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, interfaceIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier1InterfaceClientContext) Patch(tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam model0.Tier1Interface) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InterfacesClient) + err = client.Patch(tier1IdParam, localeServicesIdParam, interfaceIdParam, tier1InterfaceParam) + + case utl.Global: + client := c.Client.(client1.InterfacesClient) + gmObj, err1 := utl.ConvertModelBindingType(tier1InterfaceParam, model0.Tier1InterfaceBindingType(), model1.Tier1InterfaceBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, localeServicesIdParam, interfaceIdParam, gmObj.(model1.Tier1Interface)) + + case utl.Multitenancy: + client := c.Client.(client2.InterfacesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, interfaceIdParam, tier1InterfaceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier1InterfaceClientContext) Update(tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam model0.Tier1Interface) (model0.Tier1Interface, error) { + var err error + var obj model0.Tier1Interface + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InterfacesClient) + obj, err = client.Update(tier1IdParam, localeServicesIdParam, interfaceIdParam, tier1InterfaceParam) + + case utl.Global: + client := c.Client.(client1.InterfacesClient) + gmObj, err := utl.ConvertModelBindingType(tier1InterfaceParam, model0.Tier1InterfaceBindingType(), model1.Tier1InterfaceBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, localeServicesIdParam, interfaceIdParam, gmObj.(model1.Tier1Interface)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier1InterfaceBindingType(), model0.Tier1InterfaceBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier1Interface) + + case utl.Multitenancy: + client := c.Client.(client2.InterfacesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, interfaceIdParam, tier1InterfaceParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c Tier1InterfaceClientContext) Delete(tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InterfacesClient) + err = client.Delete(tier1IdParam, localeServicesIdParam, interfaceIdParam) + + case utl.Global: + client := c.Client.(client1.InterfacesClient) + err = client.Delete(tier1IdParam, localeServicesIdParam, interfaceIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.InterfacesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, interfaceIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c Tier1InterfaceClientContext) List(tier1IdParam string, localeServicesIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.Tier1InterfaceListResult, error) { + var err error + var obj model0.Tier1InterfaceListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.InterfacesClient) + obj, err = client.List(tier1IdParam, localeServicesIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.InterfacesClient) + gmObj, err := client.List(tier1IdParam, localeServicesIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.Tier1InterfaceListResultBindingType(), model0.Tier1InterfaceListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Tier1InterfaceListResult) + + case utl.Multitenancy: + client := c.Client.(client2.InterfacesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, localeServicesIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/nat/policy_nat_rule.go b/api/infra/tier_1s/nat/policy_nat_rule.go new file mode 100644 index 000000000..041473ab7 --- /dev/null +++ b/api/infra/tier_1s/nat/policy_nat_rule.go @@ -0,0 +1,192 @@ +//nolint:revive +package nat + +// 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/tier_1s/nat" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/nat" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type PolicyNatRuleClientContext utl.ClientContext + +func NewNatRulesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyNatRuleClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewNatRulesClient(connector) + + case utl.Global: + client = client1.NewNatRulesClient(connector) + + case utl.Multitenancy: + client = client2.NewNatRulesClient(connector) + + default: + return nil + } + return &PolicyNatRuleClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyNatRuleClientContext) Get(tier1IdParam string, natIdParam string, natRuleIdParam string) (model0.PolicyNatRule, error) { + var obj model0.PolicyNatRule + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.Get(tier1IdParam, natIdParam, natRuleIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err1 := client.Get(tier1IdParam, natIdParam, natRuleIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleBindingType(), model0.PolicyNatRuleBindingType()) + obj = rawObj.(model0.PolicyNatRule) + + case utl.Multitenancy: + client := c.Client.(client2.NatRulesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam, natIdParam, natRuleIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyNatRuleClientContext) Patch(tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam model0.PolicyNatRule) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + err = client.Patch(tier1IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err1 := utl.ConvertModelBindingType(policyNatRuleParam, model0.PolicyNatRuleBindingType(), model1.PolicyNatRuleBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, natIdParam, natRuleIdParam, gmObj.(model1.PolicyNatRule)) + + case utl.Multitenancy: + client := c.Client.(client2.NatRulesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyNatRuleClientContext) Update(tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam model0.PolicyNatRule) (model0.PolicyNatRule, error) { + var err error + var obj model0.PolicyNatRule + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.Update(tier1IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err := utl.ConvertModelBindingType(policyNatRuleParam, model0.PolicyNatRuleBindingType(), model1.PolicyNatRuleBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, natIdParam, natRuleIdParam, gmObj.(model1.PolicyNatRule)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleBindingType(), model0.PolicyNatRuleBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyNatRule) + + case utl.Multitenancy: + client := c.Client.(client2.NatRulesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, natIdParam, natRuleIdParam, policyNatRuleParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyNatRuleClientContext) Delete(tier1IdParam string, natIdParam string, natRuleIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + err = client.Delete(tier1IdParam, natIdParam, natRuleIdParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + err = client.Delete(tier1IdParam, natIdParam, natRuleIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.NatRulesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam, natIdParam, natRuleIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyNatRuleClientContext) List(tier1IdParam string, natIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.PolicyNatRuleListResult, error) { + var err error + var obj model0.PolicyNatRuleListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.NatRulesClient) + obj, err = client.List(tier1IdParam, natIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.NatRulesClient) + gmObj, err := client.List(tier1IdParam, natIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyNatRuleListResultBindingType(), model0.PolicyNatRuleListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyNatRuleListResult) + + case utl.Multitenancy: + client := c.Client.(client2.NatRulesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, natIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/policy_dns_forwarder.go b/api/infra/tier_1s/policy_dns_forwarder.go new file mode 100644 index 000000000..fc528f055 --- /dev/null +++ b/api/infra/tier_1s/policy_dns_forwarder.go @@ -0,0 +1,160 @@ +//nolint:revive +package tier1s + +// 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/tier_1s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type PolicyDnsForwarderClientContext utl.ClientContext + +func NewDnsForwarderClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *PolicyDnsForwarderClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDnsForwarderClient(connector) + + case utl.Global: + client = client1.NewDnsForwarderClient(connector) + + case utl.Multitenancy: + client = client2.NewDnsForwarderClient(connector) + + default: + return nil + } + return &PolicyDnsForwarderClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c PolicyDnsForwarderClientContext) Get(tier1IdParam string) (model0.PolicyDnsForwarder, error) { + var obj model0.PolicyDnsForwarder + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + obj, err = client.Get(tier1IdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err1 := client.Get(tier1IdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderBindingType(), model0.PolicyDnsForwarderBindingType()) + obj = rawObj.(model0.PolicyDnsForwarder) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderClientContext) Patch(tier1IdParam string, policyDnsForwarderParam model0.PolicyDnsForwarder) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + err = client.Patch(tier1IdParam, policyDnsForwarderParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err1 := utl.ConvertModelBindingType(policyDnsForwarderParam, model0.PolicyDnsForwarderBindingType(), model1.PolicyDnsForwarderBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, gmObj.(model1.PolicyDnsForwarder)) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, policyDnsForwarderParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c PolicyDnsForwarderClientContext) Update(tier1IdParam string, policyDnsForwarderParam model0.PolicyDnsForwarder) (model0.PolicyDnsForwarder, error) { + var err error + var obj model0.PolicyDnsForwarder + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + obj, err = client.Update(tier1IdParam, policyDnsForwarderParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + gmObj, err := utl.ConvertModelBindingType(policyDnsForwarderParam, model0.PolicyDnsForwarderBindingType(), model1.PolicyDnsForwarderBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, gmObj.(model1.PolicyDnsForwarder)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.PolicyDnsForwarderBindingType(), model0.PolicyDnsForwarderBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.PolicyDnsForwarder) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, policyDnsForwarderParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c PolicyDnsForwarderClientContext) Delete(tier1IdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DnsForwarderClient) + err = client.Delete(tier1IdParam) + + case utl.Global: + client := c.Client.(client1.DnsForwarderClient) + err = client.Delete(tier1IdParam) + + case utl.Multitenancy: + client := c.Client.(client2.DnsForwarderClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} diff --git a/api/infra/tier_1s/segment.go b/api/infra/tier_1s/segment.go new file mode 100644 index 000000000..8bbb60c7e --- /dev/null +++ b/api/infra/tier_1s/segment.go @@ -0,0 +1,192 @@ +//nolint:revive +package tier1s + +// 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/tier_1s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type SegmentClientContext utl.ClientContext + +func NewSegmentsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *SegmentClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewSegmentsClient(connector) + + case utl.Global: + client = client1.NewSegmentsClient(connector) + + case utl.Multitenancy: + client = client2.NewSegmentsClient(connector) + + default: + return nil + } + return &SegmentClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c SegmentClientContext) Get(tier1IdParam string, segmentIdParam string) (model0.Segment, error) { + var obj model0.Segment + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.Get(tier1IdParam, segmentIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err1 := client.Get(tier1IdParam, segmentIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.SegmentBindingType(), model0.SegmentBindingType()) + obj = rawObj.(model0.Segment) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentClientContext) Patch(tier1IdParam string, segmentIdParam string, segmentParam model0.Segment) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + err = client.Patch(tier1IdParam, segmentIdParam, segmentParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err1 := utl.ConvertModelBindingType(segmentParam, model0.SegmentBindingType(), model1.SegmentBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, segmentIdParam, gmObj.(model1.Segment)) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam, segmentParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentClientContext) Update(tier1IdParam string, segmentIdParam string, segmentParam model0.Segment) (model0.Segment, error) { + var err error + var obj model0.Segment + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.Update(tier1IdParam, segmentIdParam, segmentParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err := utl.ConvertModelBindingType(segmentParam, model0.SegmentBindingType(), model1.SegmentBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, segmentIdParam, gmObj.(model1.Segment)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentBindingType(), model0.SegmentBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.Segment) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam, segmentParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c SegmentClientContext) Delete(tier1IdParam string, segmentIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + err = client.Delete(tier1IdParam, segmentIdParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + err = client.Delete(tier1IdParam, segmentIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam, segmentIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c SegmentClientContext) List(tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (model0.SegmentListResult, error) { + var err error + var obj model0.SegmentListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.SegmentsClient) + obj, err = client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.SegmentsClient) + gmObj, err := client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.SegmentListResultBindingType(), model0.SegmentListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.SegmentListResult) + + case utl.Multitenancy: + client := c.Client.(client2.SegmentsClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, segmentTypeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/segments/dhcp_static_binding_config.go b/api/infra/tier_1s/segments/dhcp_static_binding_config.go new file mode 100644 index 000000000..5fdcbd29f --- /dev/null +++ b/api/infra/tier_1s/segments/dhcp_static_binding_config.go @@ -0,0 +1,111 @@ +//nolint:revive +package segments + +// 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" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments" + lrmodel0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type StructValueClientContext utl.ClientContext + +func NewDhcpStaticBindingConfigsClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StructValueClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewDhcpStaticBindingConfigsClient(connector) + + default: + return nil + } + return &StructValueClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c StructValueClientContext) Get(tier1IdParam string, segmentIdParam string, bindingIdParam string) (*model0.StructValue, error) { + var obj *model0.StructValue + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.Get(tier1IdParam, segmentIdParam, bindingIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) Delete(tier1IdParam string, segmentIdParam string, bindingIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + err = client.Delete(tier1IdParam, segmentIdParam, bindingIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Patch(tier1IdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *model0.StructValue) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + err = client.Patch(tier1IdParam, segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StructValueClientContext) Update(tier1IdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *model0.StructValue) (*model0.StructValue, error) { + var err error + var obj *model0.StructValue + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.Update(tier1IdParam, segmentIdParam, bindingIdParam, dhcpStaticBindingConfigParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StructValueClientContext) List(tier1IdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (lrmodel0.DhcpStaticBindingConfigListResult, error) { + var err error + var obj lrmodel0.DhcpStaticBindingConfigListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.DhcpStaticBindingConfigsClient) + obj, err = client.List(tier1IdParam, segmentIdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/infra/tier_1s/static_routes.go b/api/infra/tier_1s/static_routes.go new file mode 100644 index 000000000..b17b1118a --- /dev/null +++ b/api/infra/tier_1s/static_routes.go @@ -0,0 +1,192 @@ +//nolint:revive +package tier1s + +// 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/tier_1s" + model1 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + client0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" + model0 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + client2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" +) + +type StaticRoutesClientContext utl.ClientContext + +func NewStaticRoutesClient(sessionContext utl.SessionContext, connector vapiProtocolClient_.Connector) *StaticRoutesClientContext { + var client interface{} + + switch sessionContext.ClientType { + + case utl.Local: + client = client0.NewStaticRoutesClient(connector) + + case utl.Global: + client = client1.NewStaticRoutesClient(connector) + + case utl.Multitenancy: + client = client2.NewStaticRoutesClient(connector) + + default: + return nil + } + return &StaticRoutesClientContext{Client: client, ClientType: sessionContext.ClientType, ProjectID: sessionContext.ProjectID} +} + +func (c StaticRoutesClientContext) Get(tier1IdParam string, routeIdParam string) (model0.StaticRoutes, error) { + var obj model0.StaticRoutes + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.Get(tier1IdParam, routeIdParam) + if err != nil { + return obj, err + } + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err1 := client.Get(tier1IdParam, routeIdParam) + if err1 != nil { + return obj, err1 + } + var rawObj interface{} + rawObj, err = utl.ConvertModelBindingType(gmObj, model1.StaticRoutesBindingType(), model0.StaticRoutesBindingType()) + obj = rawObj.(model0.StaticRoutes) + + case utl.Multitenancy: + client := c.Client.(client2.StaticRoutesClient) + obj, err = client.Get(utl.DefaultOrgID, c.ProjectID, tier1IdParam, routeIdParam) + if err != nil { + return obj, err + } + + default: + return obj, errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StaticRoutesClientContext) Patch(tier1IdParam string, routeIdParam string, staticRoutesParam model0.StaticRoutes) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + err = client.Patch(tier1IdParam, routeIdParam, staticRoutesParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err1 := utl.ConvertModelBindingType(staticRoutesParam, model0.StaticRoutesBindingType(), model1.StaticRoutesBindingType()) + if err1 != nil { + return err1 + } + err = client.Patch(tier1IdParam, routeIdParam, gmObj.(model1.StaticRoutes)) + + case utl.Multitenancy: + client := c.Client.(client2.StaticRoutesClient) + err = client.Patch(utl.DefaultOrgID, c.ProjectID, tier1IdParam, routeIdParam, staticRoutesParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StaticRoutesClientContext) Update(tier1IdParam string, routeIdParam string, staticRoutesParam model0.StaticRoutes) (model0.StaticRoutes, error) { + var err error + var obj model0.StaticRoutes + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.Update(tier1IdParam, routeIdParam, staticRoutesParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err := utl.ConvertModelBindingType(staticRoutesParam, model0.StaticRoutesBindingType(), model1.StaticRoutesBindingType()) + if err != nil { + return obj, err + } + gmObj, err = client.Update(tier1IdParam, routeIdParam, gmObj.(model1.StaticRoutes)) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.StaticRoutesBindingType(), model0.StaticRoutesBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.StaticRoutes) + + case utl.Multitenancy: + client := c.Client.(client2.StaticRoutesClient) + obj, err = client.Update(utl.DefaultOrgID, c.ProjectID, tier1IdParam, routeIdParam, staticRoutesParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} + +func (c StaticRoutesClientContext) Delete(tier1IdParam string, routeIdParam string) error { + var err error + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + err = client.Delete(tier1IdParam, routeIdParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + err = client.Delete(tier1IdParam, routeIdParam) + + case utl.Multitenancy: + client := c.Client.(client2.StaticRoutesClient) + err = client.Delete(utl.DefaultOrgID, c.ProjectID, tier1IdParam, routeIdParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return err +} + +func (c StaticRoutesClientContext) List(tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (model0.StaticRoutesListResult, error) { + var err error + var obj model0.StaticRoutesListResult + + switch c.ClientType { + + case utl.Local: + client := c.Client.(client0.StaticRoutesClient) + obj, err = client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + case utl.Global: + client := c.Client.(client1.StaticRoutesClient) + gmObj, err := client.List(tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + if err != nil { + return obj, err + } + obj1, err1 := utl.ConvertModelBindingType(gmObj, model1.StaticRoutesListResultBindingType(), model0.StaticRoutesListResultBindingType()) + if err1 != nil { + return obj, err1 + } + obj = obj1.(model0.StaticRoutesListResult) + + case utl.Multitenancy: + client := c.Client.(client2.StaticRoutesClient) + obj, err = client.List(utl.DefaultOrgID, c.ProjectID, tier1IdParam, cursorParam, includeMarkForDeleteObjectsParam, includedFieldsParam, pageSizeParam, sortAscendingParam, sortByParam) + + default: + err = errors.New("invalid infrastructure for model") + } + return obj, err +} diff --git a/api/utl/api_util.go b/api/utl/api_util.go new file mode 100644 index 000000000..1dbd217a2 --- /dev/null +++ b/api/utl/api_util.go @@ -0,0 +1,39 @@ +//nolint:revive +package api + +// The following file has been autogenerated. Please avoid any changes! +import "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + +type ClientType int + +const ( + DefaultOrgID = "default" + Global = 0 + Local = 1 + Multitenancy = 2 +) + +type SessionContext struct { + ClientType ClientType + ProjectID string +} +type ClientContext struct { + Client interface{} + ClientType ClientType + ProjectID string +} + +func ConvertModelBindingType(obj interface{}, sourceType bindings.BindingType, destType bindings.BindingType) (interface{}, error) { + converter := bindings.NewTypeConverter() + dataValue, err := converter.ConvertToVapi(obj, sourceType) + if err != nil { + return nil, err[0] + } + + gmObj, err := converter.ConvertToGolang(dataValue, destType) + if err != nil { + return nil, err[0] + } + + return gmObj, nil +} diff --git a/api/utl_file_template.yaml b/api/utl_file_template.yaml new file mode 100644 index 000000000..f60be64a7 --- /dev/null +++ b/api/utl_file_template.yaml @@ -0,0 +1,38 @@ +|2+ + //nolint:revive + package $pkg_name + + // The following file has been autogenerated. Please avoid any changes! + import "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + + type ClientType int + + const ( + DefaultOrgID = "default" + $const + ) + + type SessionContext struct { + ClientType ClientType + ProjectID string + } + type ClientContext struct { + Client interface{} + ClientType ClientType + ProjectID string + } + + func ConvertModelBindingType(obj interface{}, sourceType bindings.BindingType, destType bindings.BindingType) (interface{}, error) { + converter := bindings.NewTypeConverter() + dataValue, err := converter.ConvertToVapi(obj, sourceType) + if err != nil { + return nil, err[0] + } + + gmObj, err := converter.ConvertToGolang(dataValue, destType) + if err != nil { + return nil, err[0] + } + + return gmObj, nil + } diff --git a/nsxt/data_source_nsxt_policy_bfd_profile.go b/nsxt/data_source_nsxt_policy_bfd_profile.go index 7b7319282..64e68a238 100644 --- a/nsxt/data_source_nsxt_policy_bfd_profile.go +++ b/nsxt/data_source_nsxt_policy_bfd_profile.go @@ -23,7 +23,7 @@ func dataSourceNsxtPolicyBfdProfile() *schema.Resource { func dataSourceNsxtPolicyBfdProfileRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "BfdProfile", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "BfdProfile", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_bridge_profile.go b/nsxt/data_source_nsxt_policy_bridge_profile.go index c88a166c1..b0fc49b71 100644 --- a/nsxt/data_source_nsxt_policy_bridge_profile.go +++ b/nsxt/data_source_nsxt_policy_bridge_profile.go @@ -23,7 +23,7 @@ func dataSourceNsxtPolicyBridgeProfile() *schema.Resource { func dataSourceNsxtPolicyBridgeProfileRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "L2BridgeEndpointProfile", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "L2BridgeEndpointProfile", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_certificate.go b/nsxt/data_source_nsxt_policy_certificate.go index de9d60e9e..0c90279c2 100644 --- a/nsxt/data_source_nsxt_policy_certificate.go +++ b/nsxt/data_source_nsxt_policy_certificate.go @@ -23,7 +23,7 @@ func dataSourceNsxtPolicyCertificate() *schema.Resource { func dataSourceNsxtPolicyCertificateRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "TlsCertificate", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "TlsCertificate", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_context_profile.go b/nsxt/data_source_nsxt_policy_context_profile.go index 876eb2d2b..c2e95a0e6 100644 --- a/nsxt/data_source_nsxt_policy_context_profile.go +++ b/nsxt/data_source_nsxt_policy_context_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyContextProfile() *schema.Resource { @@ -21,72 +16,15 @@ func dataSourceNsxtPolicyContextProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyContextProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "PolicyContextProfile", nil) - if err != nil { - return err - } - return nil - } - - // Local manager support: - connector := getPolicyConnector(m) - client := infra.NewContextProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.PolicyContextProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "PolicyContextProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining Context Profile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("ContextProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.PolicyContextProfile - var prefixMatch []model.PolicyContextProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple ContextProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple ContextProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("ContextProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyContextProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_dhcp_server.go b/nsxt/data_source_nsxt_policy_dhcp_server.go index d07526058..f99011aaf 100644 --- a/nsxt/data_source_nsxt_policy_dhcp_server.go +++ b/nsxt/data_source_nsxt_policy_dhcp_server.go @@ -16,6 +16,7 @@ func dataSourceNsxtPolicyDhcpServer() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } @@ -23,7 +24,7 @@ func dataSourceNsxtPolicyDhcpServer() *schema.Resource { func dataSourceNsxtPolicyDhcpServerRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "DhcpServerConfig", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "DhcpServerConfig", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_edge_cluster.go b/nsxt/data_source_nsxt_policy_edge_cluster.go index ac19571be..72e1275e8 100644 --- a/nsxt/data_source_nsxt_policy_edge_cluster.go +++ b/nsxt/data_source_nsxt_policy_edge_cluster.go @@ -49,7 +49,7 @@ func dataSourceNsxtPolicyEdgeClusterRead(d *schema.ResourceData, m interface{}) query := make(map[string]string) globalPolicyEnforcementPointPath := getGlobalPolicyEnforcementPointPath(m, &objSitePath) query["parent_path"] = globalPolicyEnforcementPointPath - _, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), true, "PolicyEdgeCluster", query, false) + _, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyEdgeCluster", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_edge_node.go b/nsxt/data_source_nsxt_policy_edge_node.go index f27619e82..b0169ac60 100644 --- a/nsxt/data_source_nsxt_policy_edge_node.go +++ b/nsxt/data_source_nsxt_policy_edge_node.go @@ -47,7 +47,7 @@ func dataSourceNsxtPolicyEdgeNodeRead(d *schema.ResourceData, m interface{}) err if memberIndexSet { query["member_index"] = strconv.Itoa(memberIndex.(int)) } - _, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), isPolicyGlobalManager(m), "PolicyEdgeNode", query, false) + _, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyEdgeNode", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_gateway_locale_service.go b/nsxt/data_source_nsxt_policy_gateway_locale_service.go index 0a947a1a0..47cf7ed36 100644 --- a/nsxt/data_source_nsxt_policy_gateway_locale_service.go +++ b/nsxt/data_source_nsxt_policy_gateway_locale_service.go @@ -28,6 +28,7 @@ func dataSourceNsxtPolicyGatewayLocaleService() *schema.Resource { Optional: true, Computed: true, }, + "context": getContextSchema(), }, } } @@ -38,7 +39,7 @@ func dataSourceNsxtPolicyGatewayLocaleServiceRead(d *schema.ResourceData, m inte gwPath := d.Get("gateway_path").(string) query := make(map[string]string) query["parent_path"] = gwPath - obj, err := policyDataSourceResourceReadWithValidation(d, connector, isPolicyGlobalManager(m), "LocaleServices", query, false) + obj, err := policyDataSourceResourceReadWithValidation(d, connector, getSessionContext(d, m), "LocaleServices", query, false) if err != nil { return err diff --git a/nsxt/data_source_nsxt_policy_gateway_policy.go b/nsxt/data_source_nsxt_policy_gateway_policy.go index fc286e981..93f3dae0a 100644 --- a/nsxt/data_source_nsxt_policy_gateway_policy.go +++ b/nsxt/data_source_nsxt_policy_gateway_policy.go @@ -12,8 +12,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var gatewayPolicyCategoryValues = []string{"Emergency", "SystemRules", "SharedPreRules", "LocalGatewayRules", "AutoServiceRules", "Default"} @@ -28,6 +30,7 @@ func dataSourceNsxtPolicyGatewayPolicy() *schema.Resource { "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), "domain": getDataSourceDomainNameSchema(), + "context": getContextSchema(), "category": { Type: schema.TypeString, Description: "Category", @@ -40,8 +43,8 @@ func dataSourceNsxtPolicyGatewayPolicy() *schema.Resource { } // Local Manager Only -func listGatewayPolicies(domain string, connector client.Connector) ([]model.GatewayPolicy, error) { - client := domains.NewGatewayPoliciesClient(connector) +func listGatewayPolicies(context utl.SessionContext, domain string, connector client.Connector) ([]model.GatewayPolicy, error) { + client := domains.NewGatewayPoliciesClient(context, connector) var results []model.GatewayPolicy boolFalse := false @@ -71,13 +74,14 @@ func dataSourceNsxtPolicyGatewayPolicyRead(d *schema.ResourceData, m interface{} category := d.Get("category").(string) domain := d.Get("domain").(string) + context := getSessionContext(d, m) if isPolicyGlobalManager(m) { query := make(map[string]string) query["parent_path"] = "*/" + domain if category != "" { query["category"] = category } - obj, err := policyDataSourceResourceReadWithValidation(d, connector, true, "GatewayPolicy", query, false) + obj, err := policyDataSourceResourceReadWithValidation(d, connector, context, "GatewayPolicy", query, false) if err != nil { return err } @@ -99,7 +103,7 @@ func dataSourceNsxtPolicyGatewayPolicyRead(d *schema.ResourceData, m interface{} var obj model.GatewayPolicy if objID != "" { // Get by id - client := domains.NewGatewayPoliciesClient(connector) + client := domains.NewGatewayPoliciesClient(context, connector) objGet, err := client.Get(domain, objID) if isNotFoundError(err) { return fmt.Errorf("Gateway Policy with ID %s was not found", objID) @@ -112,7 +116,7 @@ func dataSourceNsxtPolicyGatewayPolicyRead(d *schema.ResourceData, m interface{} } else if objName == "" && category == "" { return fmt.Errorf("Gateway Policy id, display name or category must be specified") } else { - objList, err := listGatewayPolicies(domain, connector) + objList, err := listGatewayPolicies(context, domain, connector) if err != nil { return fmt.Errorf("Error while reading Gateway Policies: %v", err) } diff --git a/nsxt/data_source_nsxt_policy_gateway_qos_profile.go b/nsxt/data_source_nsxt_policy_gateway_qos_profile.go index d52d5ff27..929590c20 100644 --- a/nsxt/data_source_nsxt_policy_gateway_qos_profile.go +++ b/nsxt/data_source_nsxt_policy_gateway_qos_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyGatewayQosProfile() *schema.Resource { @@ -21,69 +16,15 @@ func dataSourceNsxtPolicyGatewayQosProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyGatewayQosProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "GatewayQosProfile", nil) - if err != nil { - return err - } - return nil - } - connector := getPolicyConnector(m) - client := infra.NewGatewayQosProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.GatewayQosProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - if err != nil { - return handleDataSourceReadError(d, "GatewayQosProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining GatewayQosProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("GatewayQosProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.GatewayQosProfile - var prefixMatch []model.GatewayQosProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple GatewayQosProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple GatewayQosProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("GatewayQosProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "GatewayQosProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_group.go b/nsxt/data_source_nsxt_policy_group.go index 4acc80987..981723785 100644 --- a/nsxt/data_source_nsxt_policy_group.go +++ b/nsxt/data_source_nsxt_policy_group.go @@ -4,13 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyGroup() *schema.Resource { @@ -23,100 +17,18 @@ func dataSourceNsxtPolicyGroup() *schema.Resource { "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), "domain": getDomainNameSchema(), + "context": getContextSchema(), }, } } -func listPolicyGroups(domain string, connector client.Connector) ([]model.Group, error) { - // Local Manager only - client := domains.NewGroupsClient(connector) - - var results []model.Group - var cursor *string - total := 0 - - for { - groups, err := client.List(domain, cursor, nil, nil, nil, nil, nil, nil) - if err != nil { - return results, err - } - results = append(results, groups.Results...) - if total == 0 && groups.ResultCount != nil { - // first response - total = int(*groups.ResultCount) - } - - cursor = groups.Cursor - if len(results) >= total { - return results, nil - } - } -} - func dataSourceNsxtPolicyGroupRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - domain := d.Get("domain").(string) - query := make(map[string]string) - query["parent_path"] = "*/" + domain - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "Group", query) - if err != nil { - return err - } - return nil - } - - connector := getPolicyConnector(m) - client := domains.NewGroupsClient(connector) domain := d.Get("domain").(string) - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.Group - if objID != "" { - // Get by id - objGet, err := client.Get(domain, objID) - - if err != nil { - return handleDataSourceReadError(d, "Group", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining Group ID or name during read") - } else { - // Get by full name/prefix - objList, err := listPolicyGroups(domain, connector) - if err != nil { - return handleListError("Group", err) - } - - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.Group - var prefixMatch []model.Group - for _, objInList := range objList { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple Groups with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple Groups with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("Group with name '%s' was not found", objName) - } + query := make(map[string]string) + query["parent_path"] = "*/" + domain + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Group", query) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_intrusion_service_profile.go b/nsxt/data_source_nsxt_policy_intrusion_service_profile.go index 8ea1c8abc..a44dc8594 100644 --- a/nsxt/data_source_nsxt_policy_intrusion_service_profile.go +++ b/nsxt/data_source_nsxt_policy_intrusion_service_profile.go @@ -27,7 +27,7 @@ func dataSourceNsxtPolicyIntrusionServiceProfileRead(d *schema.ResourceData, m i return localManagerOnlyError() } - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "IdsProfile", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "IdsProfile", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_ip_block.go b/nsxt/data_source_nsxt_policy_ip_block.go index 0f0985156..a25d83185 100644 --- a/nsxt/data_source_nsxt_policy_ip_block.go +++ b/nsxt/data_source_nsxt_policy_ip_block.go @@ -8,8 +8,9 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" ) func dataSourceNsxtPolicyIPBlock() *schema.Resource { @@ -21,13 +22,14 @@ func dataSourceNsxtPolicyIPBlock() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyIPBlockRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpBlocksClient(connector) + client := infra.NewIpBlocksClient(getSessionContext(d, m), connector) objID := d.Get("id").(string) objName := d.Get("display_name").(string) diff --git a/nsxt/data_source_nsxt_policy_ip_discovery_profile.go b/nsxt/data_source_nsxt_policy_ip_discovery_profile.go index 6c888ff9e..ed320ce21 100644 --- a/nsxt/data_source_nsxt_policy_ip_discovery_profile.go +++ b/nsxt/data_source_nsxt_policy_ip_discovery_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { @@ -21,70 +16,15 @@ func dataSourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyIPDiscoveryProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "IPDiscoveryProfile", nil) - if err != nil { - return err - } - return nil + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "IPDiscoveryProfile", nil) + if err != nil { + return err } - connector := getPolicyConnector(m) - client := infra.NewIpDiscoveryProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.IPDiscoveryProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "IPDiscoveryProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining IPDiscoveryProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("IPDiscoveryProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.IPDiscoveryProfile - var prefixMatch []model.IPDiscoveryProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple IPDiscoveryProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple IPDiscoveryProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("IPDiscoveryProfile with name '%s' was not found", objName) - } - } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_ip_pool.go b/nsxt/data_source_nsxt_policy_ip_pool.go index fc3ff4c12..8016dbf25 100644 --- a/nsxt/data_source_nsxt_policy_ip_pool.go +++ b/nsxt/data_source_nsxt_policy_ip_pool.go @@ -8,8 +8,9 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" ) func dataSourceNsxtPolicyIPPool() *schema.Resource { @@ -21,13 +22,14 @@ func dataSourceNsxtPolicyIPPool() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyIPPoolRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) objID := d.Get("id").(string) objName := d.Get("display_name").(string) diff --git a/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go b/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go index e7ed4f2da..014d6e75d 100644 --- a/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go +++ b/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go @@ -49,7 +49,7 @@ func dataSourceNsxtPolicyIPSecVpnLocalEndpointRead(d *schema.ResourceData, m int } query["parent_path"] = fmt.Sprintf("%s*", servicePath) } - objInt, err := policyDataSourceResourceReadWithValidation(d, connector, isPolicyGlobalManager(m), "IPSecVpnLocalEndpoint", query, false) + objInt, err := policyDataSourceResourceReadWithValidation(d, connector, getSessionContext(d, m), "IPSecVpnLocalEndpoint", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_ipsec_vpn_service.go b/nsxt/data_source_nsxt_policy_ipsec_vpn_service.go index cf5f763b2..183887e1c 100644 --- a/nsxt/data_source_nsxt_policy_ipsec_vpn_service.go +++ b/nsxt/data_source_nsxt_policy_ipsec_vpn_service.go @@ -31,7 +31,7 @@ func dataSourceNsxtPolicyIPSecVpnServiceRead(d *schema.ResourceData, m interface if len(gwPath) > 0 { query["parent_path"] = fmt.Sprintf("%s*", gwPath) } - _, err := policyDataSourceResourceReadWithValidation(d, connector, isPolicyGlobalManager(m), "IPSecVpnService", query, false) + _, err := policyDataSourceResourceReadWithValidation(d, connector, getSessionContext(d, m), "IPSecVpnService", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go b/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go index 0c21137e2..d9302f02e 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go +++ b/nsxt/data_source_nsxt_policy_ipv6_dad_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyIpv6DadProfile() *schema.Resource { @@ -21,69 +16,15 @@ func dataSourceNsxtPolicyIpv6DadProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyIpv6DadProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "Ipv6DadProfile", nil) - if err != nil { - return err - } - return nil - } - connector := getPolicyConnector(m) - client := infra.NewIpv6DadProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.Ipv6DadProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - if err != nil { - return handleDataSourceReadError(d, "IPv6DadProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining Ipv6DadProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("IPv6DadProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.Ipv6DadProfile - var prefixMatch []model.Ipv6DadProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple Ipv6DadProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple Ipv6DadProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("Ipv6DadProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Ipv6DadProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go index 8972e0a79..0bb066b3c 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go +++ b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyIpv6NdraProfile() *schema.Resource { @@ -21,70 +16,15 @@ func dataSourceNsxtPolicyIpv6NdraProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyIpv6NdraProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "Ipv6NdraProfile", nil) - if err != nil { - return err - } - return nil + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Ipv6NdraProfile", nil) + if err != nil { + return err } - - connector := getPolicyConnector(m) - client := infra.NewIpv6NdraProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.Ipv6NdraProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - if err != nil { - return handleDataSourceReadError(d, "IPv6NdraProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining Ipv6NdraProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("IPv6NdraProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.Ipv6NdraProfile - var prefixMatch []model.Ipv6NdraProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple Ipv6NdraProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple Ipv6NdraProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("Ipv6NdraProfile with name '%s' was not found", objName) - } - } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_l2_vpn_service.go b/nsxt/data_source_nsxt_policy_l2_vpn_service.go index 5db8ffc3a..5598d050d 100644 --- a/nsxt/data_source_nsxt_policy_l2_vpn_service.go +++ b/nsxt/data_source_nsxt_policy_l2_vpn_service.go @@ -31,7 +31,7 @@ func dataSourceNsxtPolicyL2VpnServiceRead(d *schema.ResourceData, m interface{}) if len(gwPath) > 0 { query["parent_path"] = fmt.Sprintf("%s*", gwPath) } - _, err := policyDataSourceResourceReadWithValidation(d, connector, isPolicyGlobalManager(m), "L2VPNService", query, false) + _, err := policyDataSourceResourceReadWithValidation(d, connector, getSessionContext(d, m), "L2VPNService", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_lb_service.go b/nsxt/data_source_nsxt_policy_lb_service.go index 0447f0009..003e2a861 100644 --- a/nsxt/data_source_nsxt_policy_lb_service.go +++ b/nsxt/data_source_nsxt_policy_lb_service.go @@ -23,7 +23,7 @@ func dataSourceNsxtPolicyLbService() *schema.Resource { func dataSourceNsxtPolicyLbServiceRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "LBService", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "LBService", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_mac_discovery_profile.go b/nsxt/data_source_nsxt_policy_mac_discovery_profile.go index 0e49b5a0a..ecfaaeccb 100644 --- a/nsxt/data_source_nsxt_policy_mac_discovery_profile.go +++ b/nsxt/data_source_nsxt_policy_mac_discovery_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyMacDiscoveryProfile() *schema.Resource { @@ -21,72 +16,15 @@ func dataSourceNsxtPolicyMacDiscoveryProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyMacDiscoveryProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "MacDiscoveryProfile", nil) - if err != nil { - return err - } - return nil - } - - // Local manager support: - connector := getPolicyConnector(m) - client := infra.NewMacDiscoveryProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.MacDiscoveryProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "MacDiscoveryProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining MacDiscoveryProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("MacDiscoveryProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.MacDiscoveryProfile - var prefixMatch []model.MacDiscoveryProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple MacDiscoveryProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple MacDiscoveryProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("MacDiscoveryProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "MacDiscoveryProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_qos_profile.go b/nsxt/data_source_nsxt_policy_qos_profile.go index 954cb5a48..94f5a01c0 100644 --- a/nsxt/data_source_nsxt_policy_qos_profile.go +++ b/nsxt/data_source_nsxt_policy_qos_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyQosProfile() *schema.Resource { @@ -21,70 +16,15 @@ func dataSourceNsxtPolicyQosProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicyQosProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "QoSProfile", nil) - if err != nil { - return err - } - return nil - } - - connector := getPolicyConnector(m) - client := infra.NewQosProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.QosProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "QosProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining QosProfile ID or name during read") - } else { - // Get by full name/prefix - objList, err := client.List(nil, nil, nil, nil, nil) - if err != nil { - return handleListError("QosProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.QosProfile - var prefixMatch []model.QosProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple QosProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple QosProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("QosProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "QoSProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_realization_info.go b/nsxt/data_source_nsxt_policy_realization_info.go index 64f625195..f07263c00 100644 --- a/nsxt/data_source_nsxt_policy_realization_info.go +++ b/nsxt/data_source_nsxt_policy_realization_info.go @@ -10,10 +10,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - gm_realized_state "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/realized_state" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + realizedstate "github.com/vmware/terraform-provider-nsxt/api/infra/realized_state" ) func dataSourceNsxtPolicyRealizationInfo() *schema.Resource { @@ -28,6 +27,7 @@ func dataSourceNsxtPolicyRealizationInfo() *schema.Resource { Required: true, ValidateFunc: validatePolicyPath(), }, + "context": getContextSchema(), "entity_type": { Type: schema.TypeString, Description: "The entity type of the realized resource", @@ -104,19 +104,8 @@ func dataSourceNsxtPolicyRealizationInfoRead(d *schema.ResourceData, m interface var realizationError error var realizationResult model.GenericPolicyRealizedResourceListResult - if isPolicyGlobalManager(m) { - client := gm_realized_state.NewRealizedEntitiesClient(connector) - var gmResults gm_model.GenericPolicyRealizedResourceListResult - gmResults, realizationError = client.List(path, &objSitePath) - if realizationError == nil { - var lmResults interface{} - lmResults, realizationError = convertModelBindingType(gmResults, gm_model.GenericPolicyRealizedResourceListResultBindingType(), model.GenericPolicyRealizedResourceListResultBindingType()) - realizationResult = lmResults.(model.GenericPolicyRealizedResourceListResult) - } - } else { - client := realized_state.NewRealizedEntitiesClient(connector) - realizationResult, realizationError = client.List(path, nil) - } + client := realizedstate.NewRealizedEntitiesClient(getSessionContext(d, m), connector) + realizationResult, realizationError = client.List(path, nil) state := "UNKNOWN" if realizationError == nil { // Find the right entry diff --git a/nsxt/data_source_nsxt_policy_security_policy.go b/nsxt/data_source_nsxt_policy_security_policy.go index 97c8677ac..42acaa1b3 100644 --- a/nsxt/data_source_nsxt_policy_security_policy.go +++ b/nsxt/data_source_nsxt_policy_security_policy.go @@ -9,11 +9,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func dataSourceNsxtPolicySecurityPolicy() *schema.Resource { @@ -25,6 +25,7 @@ func dataSourceNsxtPolicySecurityPolicy() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), "domain": getDataSourceDomainNameSchema(), "is_default": { Type: schema.TypeBool, @@ -44,8 +45,8 @@ func dataSourceNsxtPolicySecurityPolicy() *schema.Resource { } // Local Manager Only -func listSecurityPolicies(domain string, connector client.Connector) ([]model.SecurityPolicy, error) { - client := domains.NewSecurityPoliciesClient(connector) +func listSecurityPolicies(context utl.SessionContext, domain string, connector client.Connector) ([]model.SecurityPolicy, error) { + client := domains.NewSecurityPoliciesClient(context, connector) var results []model.SecurityPolicy boolFalse := false @@ -76,37 +77,15 @@ func dataSourceNsxtPolicySecurityPolicyRead(d *schema.ResourceData, m interface{ category := d.Get("category").(string) domain := d.Get("domain").(string) isDefault := d.Get("is_default").(bool) - if isPolicyGlobalManager(m) { - query := make(map[string]string) - query["parent_path"] = "*/" + domain - if category != "" { - query["category"] = category - } - query["is_default"] = fmt.Sprintf("%v", isDefault) - obj, err := policyDataSourceResourceReadWithValidation(d, connector, true, "SecurityPolicy", query, false) - if err != nil { - return err - } - - converter := bindings.NewTypeConverter() - dataValue, errors := converter.ConvertToGolang(obj, gm_model.SecurityPolicyBindingType()) - if len(errors) > 0 { - return errors[0] - } - - policy := dataValue.(gm_model.SecurityPolicy) - d.Set("category", policy.Category) - d.Set("is_default", policy.IsDefault) - return nil - } objID := d.Get("id").(string) objName := d.Get("display_name").(string) var obj model.SecurityPolicy + context := getSessionContext(d, m) if objID != "" { // Get by id - client := domains.NewSecurityPoliciesClient(connector) + client := domains.NewSecurityPoliciesClient(context, connector) objGet, err := client.Get(domain, objID) if isNotFoundError(err) { return fmt.Errorf("Security Policy with ID %s was not found", objID) @@ -119,7 +98,7 @@ func dataSourceNsxtPolicySecurityPolicyRead(d *schema.ResourceData, m interface{ } else if objName == "" && category == "" { return fmt.Errorf("Security Policy id, display name or category must be specified") } else { - objList, err := listSecurityPolicies(domain, connector) + objList, err := listSecurityPolicies(context, domain, connector) if err != nil { return fmt.Errorf("Error while reading Security Policies: %v", err) } diff --git a/nsxt/data_source_nsxt_policy_segment.go b/nsxt/data_source_nsxt_policy_segment.go index 6fc67a721..05077817f 100644 --- a/nsxt/data_source_nsxt_policy_segment.go +++ b/nsxt/data_source_nsxt_policy_segment.go @@ -16,6 +16,7 @@ func dataSourceNsxtPolicySegment() *schema.Resource { "display_name": getDataSourceExtendedDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } @@ -23,7 +24,7 @@ func dataSourceNsxtPolicySegment() *schema.Resource { func dataSourceNsxtPolicySegmentRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, isPolicyGlobalManager(m), "Segment", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "Segment", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_segment_realization.go b/nsxt/data_source_nsxt_policy_segment_realization.go index ba72ae392..6f9aafb3c 100644 --- a/nsxt/data_source_nsxt_policy_segment_realization.go +++ b/nsxt/data_source_nsxt_policy_segment_realization.go @@ -10,9 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + "github.com/vmware/terraform-provider-nsxt/api/infra/segments" ) func dataSourceNsxtPolicySegmentRealization() *schema.Resource { @@ -20,7 +21,8 @@ func dataSourceNsxtPolicySegmentRealization() *schema.Resource { Read: dataSourceNsxtPolicySegmentRealizationRead, Schema: map[string]*schema.Schema{ - "id": getDataSourceIDSchema(), + "id": getDataSourceIDSchema(), + "context": getContextSchema(), "path": { Type: schema.TypeString, Description: "The path for the policy segment", @@ -44,6 +46,7 @@ func dataSourceNsxtPolicySegmentRealization() *schema.Resource { func dataSourceNsxtPolicySegmentRealizationRead(d *schema.ResourceData, m interface{}) error { // Read the realization info by the path, and wait till it is valid connector := getPolicyConnector(m) + context := getSessionContext(d, m) commonProviderConfig := getCommonProviderConfig(m) // Get the realization info of this resource @@ -58,7 +61,7 @@ func dataSourceNsxtPolicySegmentRealizationRead(d *schema.ResourceData, m interf // verifying segment realization on hypervisor segmentID := getPolicyIDFromPath(path) enforcementPointPath := getPolicyEnforcementPointPath(m) - client := segments.NewStateClient(connector) + client := segments.NewStateClient(context, connector) pendingStates := []string{model.SegmentConfigurationState_STATE_PENDING, model.SegmentConfigurationState_STATE_IN_PROGRESS, model.SegmentConfigurationState_STATE_IN_SYNC, @@ -100,7 +103,7 @@ func dataSourceNsxtPolicySegmentRealizationRead(d *schema.ResourceData, m interf // We need to fetch network name to use in vpshere provider. However, state API does not // return it in details yet. For now, we'll use segment display name, since its always // translates to network name - segClient := infra.NewSegmentsClient(connector) + segClient := infra.NewSegmentsClient(context, connector) obj, err := segClient.Get(segmentID) if err != nil { return handleReadError(d, "Segment", segmentID, err) diff --git a/nsxt/data_source_nsxt_policy_segment_security_profile.go b/nsxt/data_source_nsxt_policy_segment_security_profile.go index 83e4c3768..41c85802a 100644 --- a/nsxt/data_source_nsxt_policy_segment_security_profile.go +++ b/nsxt/data_source_nsxt_policy_segment_security_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicySegmentSecurityProfile() *schema.Resource { @@ -21,71 +16,15 @@ func dataSourceNsxtPolicySegmentSecurityProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicySegmentSecurityProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "SegmentSecurityProfile", nil) - if err != nil { - return err - } - return nil - } - - connector := getPolicyConnector(m) - client := infra.NewSegmentSecurityProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.SegmentSecurityProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "SegmentSecurityProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining SegmentSecurityProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("SegmentSecurityProfile", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.SegmentSecurityProfile - var prefixMatch []model.SegmentSecurityProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple SegmentSecurityProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple SegmentSecurityProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("SegmentSecurityProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "SegmentSecurityProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_service.go b/nsxt/data_source_nsxt_policy_service.go index ab156d490..a421b37dd 100644 --- a/nsxt/data_source_nsxt_policy_service.go +++ b/nsxt/data_source_nsxt_policy_service.go @@ -4,13 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicyService() *schema.Resource { @@ -22,94 +16,15 @@ func dataSourceNsxtPolicyService() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } -func dataSourceNsxtPolicyServiceReadAllServices(connector client.Connector) ([]model.Service, error) { - var results []model.Service - client := infra.NewServicesClient(connector) - boolFalse := false - var cursor *string - total := 0 - - for { - services, err := client.List(cursor, nil, &boolFalse, nil, nil, &boolFalse, nil) - if err != nil { - return results, err - } - results = append(results, services.Results...) - if total == 0 && services.ResultCount != nil { - // first response - total = int(*services.ResultCount) - } - cursor = services.Cursor - if len(results) >= total { - return results, nil - } - } -} - func dataSourceNsxtPolicyServiceRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "Service", nil) - if err != nil { - return err - } - return nil + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Service", nil) + if err != nil { + return err } - // Read a service by name or id - connector := getPolicyConnector(m) - client := infra.NewServicesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.Service - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "Service", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining service ID or name during read") - } else { - // Get by full name/prefix - objList, err := dataSourceNsxtPolicyServiceReadAllServices(connector) - if err != nil { - return handleListError("Service", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.Service - var prefixMatch []model.Service - for _, objInList := range objList { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple services with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple services with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("Service '%s' was not found", objName) - } - } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_site.go b/nsxt/data_source_nsxt_policy_site.go index 97c80e5fe..5ef2468bc 100644 --- a/nsxt/data_source_nsxt_policy_site.go +++ b/nsxt/data_source_nsxt_policy_site.go @@ -25,7 +25,7 @@ func dataSourceNsxtPolicySiteRead(d *schema.ResourceData, m interface{}) error { return globalManagerOnlyError() } - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "Site", nil) + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Site", nil) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_spoofguard_profile.go b/nsxt/data_source_nsxt_policy_spoofguard_profile.go index 56cc5bfc5..a29b3fe3f 100644 --- a/nsxt/data_source_nsxt_policy_spoofguard_profile.go +++ b/nsxt/data_source_nsxt_policy_spoofguard_profile.go @@ -4,12 +4,7 @@ package nsxt import ( - "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) func dataSourceNsxtPolicySpoofGuardProfile() *schema.Resource { @@ -21,71 +16,15 @@ func dataSourceNsxtPolicySpoofGuardProfile() *schema.Resource { "display_name": getDataSourceDisplayNameSchema(), "description": getDataSourceDescriptionSchema(), "path": getPathSchema(), + "context": getContextSchema(), }, } } func dataSourceNsxtPolicySpoofGuardProfileRead(d *schema.ResourceData, m interface{}) error { - if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), true, "SpoofGuardProfile", nil) - if err != nil { - return err - } - return nil - } - - connector := getPolicyConnector(m) - client := infra.NewSpoofguardProfilesClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.SpoofGuardProfile - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "SpoofguardProfile", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining SpoofGuardProfile ID or name during read") - } else { - // Get by full name/prefix - includeMarkForDeleteObjectsParam := false - objList, err := client.List(nil, &includeMarkForDeleteObjectsParam, nil, nil, nil, nil) - if err != nil { - return handleListError("SpoofGuardProfiles", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.SpoofGuardProfile - var prefixMatch []model.SpoofGuardProfile - for _, objInList := range objList.Results { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } - } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple SpoofGuardProfiles with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple SpoofGuardProfiles with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("SpoofGuardProfile with name '%s' was not found", objName) - } + _, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "SpoofGuardProfile", nil) + if err != nil { + return err } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) return nil } diff --git a/nsxt/data_source_nsxt_policy_tier0_gateway.go b/nsxt/data_source_nsxt_policy_tier0_gateway.go index 95fd79453..458a90629 100644 --- a/nsxt/data_source_nsxt_policy_tier0_gateway.go +++ b/nsxt/data_source_nsxt_policy_tier0_gateway.go @@ -35,7 +35,7 @@ func dataSourceNsxtPolicyTier0GatewayRead(d *schema.ResourceData, m interface{}) connector := getPolicyConnector(m) if isPolicyGlobalManager(m) { - _, err := policyDataSourceResourceRead(d, connector, true, "Tier0", nil) + _, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "Tier0", nil) if err != nil { return err } @@ -100,7 +100,7 @@ func dataSourceNsxtPolicyTier0GatewayRead(d *schema.ResourceData, m interface{}) d.Set("description", obj.Description) d.Set("path", obj.Path) - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, *obj.Id, false) + localeServices, err := listPolicyTier0GatewayLocaleServices(getSessionContext(d, m), connector, *obj.Id) if err != nil { return fmt.Errorf("Failed to read locale services for '%s'", objName) } diff --git a/nsxt/data_source_nsxt_policy_tier1_gateway.go b/nsxt/data_source_nsxt_policy_tier1_gateway.go index b8953ccd5..dc71aa43d 100644 --- a/nsxt/data_source_nsxt_policy_tier1_gateway.go +++ b/nsxt/data_source_nsxt_policy_tier1_gateway.go @@ -5,11 +5,8 @@ package nsxt import ( "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" + "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) @@ -28,103 +25,32 @@ func dataSourceNsxtPolicyTier1Gateway() *schema.Resource { Optional: true, Computed: true, }, + "context": getContextSchema(), }, } } -func dataSourceNsxtPolicyTier1GatewayReadAllTier1(connector client.Connector) ([]model.Tier1, error) { - var results []model.Tier1 - client := infra.NewTier1sClient(connector) - boolFalse := false - var cursor *string - total := 0 - - for { - gateways, err := client.List(cursor, &boolFalse, nil, nil, &boolFalse, nil) - if err != nil { - return results, err - } - results = append(results, gateways.Results...) - if total == 0 && gateways.ResultCount != nil { - // first response - total = int(*gateways.ResultCount) - } - cursor = gateways.Cursor - if len(results) >= total { - return results, nil - } +func dataSourceNsxtPolicyTier1GatewayRead(d *schema.ResourceData, m interface{}) error { + connector := getPolicyConnector(m) + obj, err := policyDataSourceResourceRead(d, connector, getSessionContext(d, m), "Tier1", nil) + if err != nil { + return err } -} -func dataSourceNsxtPolicyTier1GatewayRead(d *schema.ResourceData, m interface{}) error { + // Single edge cluster is not informative for global manager if isPolicyGlobalManager(m) { - connector := getPolicyConnector(m) - _, err := policyDataSourceResourceRead(d, connector, true, "Tier1", nil) - if err != nil { - return err - } - - // Single edge cluster is not informative for global manager d.Set("edge_cluster_path", "") - return nil - } - - // Read a tier1 by name or id - connector := getPolicyConnector(m) - client := infra.NewTier1sClient(connector) - - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - var obj model.Tier1 - if objID != "" { - // Get by id - objGet, err := client.Get(objID) - - if err != nil { - return handleDataSourceReadError(d, "Tier1", objID, err) - } - obj = objGet - } else if objName == "" { - return fmt.Errorf("Error obtaining Tier1 ID or name during read") } else { - // Get by full name/prefix - objList, err := dataSourceNsxtPolicyTier1GatewayReadAllTier1(connector) - if err != nil { - return handleListError("Tier1", err) - } - // go over the list to find the correct one (prefer a perfect match. If not - prefix match) - var perfectMatch []model.Tier1 - var prefixMatch []model.Tier1 - for _, objInList := range objList { - if strings.HasPrefix(*objInList.DisplayName, objName) { - prefixMatch = append(prefixMatch, objInList) - } - if *objInList.DisplayName == objName { - perfectMatch = append(perfectMatch, objInList) - } + converter := bindings.NewTypeConverter() + dataValue, errors := converter.ConvertToGolang(obj, model.Tier1BindingType()) + if len(errors) > 0 { + return errors[0] } - if len(perfectMatch) > 0 { - if len(perfectMatch) > 1 { - return fmt.Errorf("Found multiple Tier1s with name '%s'", objName) - } - obj = perfectMatch[0] - } else if len(prefixMatch) > 0 { - if len(prefixMatch) > 1 { - return fmt.Errorf("Found multiple Tier1s with name starting with '%s'", objName) - } - obj = prefixMatch[0] - } else { - return fmt.Errorf("Tier1 router '%s' was not found", objName) + tier1 := dataValue.(model.Tier1) + err := resourceNsxtPolicyTier1GatewayReadEdgeCluster(getSessionContext(d, m), d, connector) + if err != nil { + return fmt.Errorf("failed to get Tier1 %s locale-services: %v", *tier1.Id, err) } } - - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) - err := resourceNsxtPolicyTier1GatewayReadEdgeCluster(d, connector) - if err != nil { - return fmt.Errorf("Failed to get Tier1 %s locale-services: %v", *obj.Id, err) - } return nil } diff --git a/nsxt/data_source_nsxt_policy_tier1_gateway_test.go b/nsxt/data_source_nsxt_policy_tier1_gateway_test.go index 9b50c7a4b..d2ce9dc47 100644 --- a/nsxt/data_source_nsxt_policy_tier1_gateway_test.go +++ b/nsxt/data_source_nsxt_policy_tier1_gateway_test.go @@ -11,8 +11,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" ) func TestAccDataSourceNsxtPolicyTier1Gateway_basic(t *testing.T) { @@ -68,7 +69,7 @@ func testAccDataSourceNsxtPolicyTier1GatewayCreate(routerName string) error { err = client.Patch(id, gmObj.(gm_model.Tier1)) } else { - client := infra.NewTier1sClient(connector) + client := infra.NewTier1sClient(testAccGetSessionContext(), connector) err = client.Patch(id, obj) } if err != nil { @@ -95,7 +96,7 @@ func testAccDataSourceNsxtPolicyTier1GatewayDeleteByName(routerName string) erro return nil } } else { - client := infra.NewTier1sClient(connector) + client := infra.NewTier1sClient(testAccGetSessionContext(), connector) // Find the object by name objList, err := client.List(nil, nil, nil, nil, nil, nil) diff --git a/nsxt/data_source_nsxt_policy_transport_zone.go b/nsxt/data_source_nsxt_policy_transport_zone.go index fb0e48e53..00758242e 100644 --- a/nsxt/data_source_nsxt_policy_transport_zone.go +++ b/nsxt/data_source_nsxt_policy_transport_zone.go @@ -75,7 +75,7 @@ func dataSourceNsxtPolicyTransportZoneRead(d *schema.ResourceData, m interface{} if isDefault { query["is_default"] = "true" } - obj, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), true, "PolicyTransportZone", query, false) + obj, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyTransportZone", query, false) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_vm.go b/nsxt/data_source_nsxt_policy_vm.go index 599fd8166..2e5c3bf2a 100644 --- a/nsxt/data_source_nsxt_policy_vm.go +++ b/nsxt/data_source_nsxt_policy_vm.go @@ -46,8 +46,9 @@ func dataSourceNsxtPolicyVMIDRead(d *schema.ResourceData, m interface{}) error { // TODO: test with KVM based VM objID := getNsxtPolicyVMIDFromSchema(d) + context := getSessionContext(d, m) if objID != "" { - vmObj, err := findNsxtPolicyVMByID(connector, objID, m) + vmObj, err := findNsxtPolicyVMByID(context, connector, objID, m) if err != nil { return fmt.Errorf("Error while reading Virtual Machine %s: %v", objID, err) } @@ -55,7 +56,7 @@ func dataSourceNsxtPolicyVMIDRead(d *schema.ResourceData, m interface{}) error { } else { displayName := d.Get("display_name").(string) - perfectMatch, prefixMatch, err := findNsxtPolicyVMByNamePrefix(connector, displayName, m) + perfectMatch, prefixMatch, err := findNsxtPolicyVMByNamePrefix(context, connector, displayName, m) if err != nil { return err } diff --git a/nsxt/data_source_nsxt_policy_vms.go b/nsxt/data_source_nsxt_policy_vms.go index b71d46bfa..198813c57 100644 --- a/nsxt/data_source_nsxt_policy_vms.go +++ b/nsxt/data_source_nsxt_policy_vms.go @@ -70,7 +70,7 @@ func dataSourceNsxtPolicyVMsRead(d *schema.ResourceData, m interface{}) error { osPrefix := d.Get("guest_os").(string) vmMap := make(map[string]interface{}) - allVMs, err := listAllPolicyVirtualMachines(connector, m) + allVMs, err := listAllPolicyVirtualMachines(getSessionContext(d, m), connector, m) if err != nil { return fmt.Errorf("Error reading Virtual Machines: %v", err) } diff --git a/nsxt/gateway_common.go b/nsxt/gateway_common.go index c064bcb81..2dd896d87 100644 --- a/nsxt/gateway_common.go +++ b/nsxt/gateway_common.go @@ -10,13 +10,14 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - nsx_policy "github.com/vmware/vsphere-automation-sdk-go/services/nsxt" + global_policy "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm" gm_tier0s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s" + gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" - global_policy "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + nsx_policy "github.com/vmware/terraform-provider-nsxt/api" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var nsxtPolicyTier0GatewayRedistributionRuleTypes = []string{ @@ -222,14 +223,14 @@ func getGatewayIntersiteConfigSchema() *schema.Schema { } } -func listPolicyGatewayLocaleServices(connector client.Connector, gwID string, listLocaleServicesFunc func(client.Connector, string, *string) (model.LocaleServicesListResult, error)) ([]model.LocaleServices, error) { +func listPolicyGatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string, listLocaleServicesFunc func(utl.SessionContext, client.Connector, string, *string) (model.LocaleServicesListResult, error)) ([]model.LocaleServices, error) { var results []model.LocaleServices var cursor *string var count int64 total := int64(0) for { - listResponse, err := listLocaleServicesFunc(connector, gwID, cursor) + listResponse, err := listLocaleServicesFunc(context, connector, gwID, cursor) if err != nil { return results, err } @@ -278,7 +279,7 @@ func initChildLocaleService(serviceStruct *model.LocaleServices, markForDelete b return dataValue.(*data.StructValue), nil } -func initGatewayLocaleServices(d *schema.ResourceData, connector client.Connector, isGlobalManager bool, listLocaleServicesFunc func(client.Connector, string, bool) ([]model.LocaleServices, error)) ([]*data.StructValue, error) { +func initGatewayLocaleServices(context utl.SessionContext, d *schema.ResourceData, connector client.Connector, listLocaleServicesFunc func(utl.SessionContext, client.Connector, string) ([]model.LocaleServices, error)) ([]*data.StructValue, error) { var localeServices []*data.StructValue services := d.Get("locale_service").(*schema.Set).List() @@ -286,7 +287,7 @@ func initGatewayLocaleServices(d *schema.ResourceData, connector client.Connecto existingServices := make(map[string]model.LocaleServices) if len(d.Id()) > 0 { // This is an update - we might need to delete locale services - existingServiceObjects, errList := listLocaleServicesFunc(connector, d.Id(), isGlobalManager) + existingServiceObjects, errList := listLocaleServicesFunc(context, connector, d.Id()) if errList != nil { return nil, errList } @@ -409,8 +410,8 @@ func setPolicyGatewayIntersiteConfigInSchema(d *schema.ResourceData, config *mod return d.Set("intersite_config", result) } -func policyInfraPatch(obj model.Infra, isGlobalManager bool, connector client.Connector, enforceRevision bool) error { - if isGlobalManager { +func policyInfraPatch(context utl.SessionContext, obj model.Infra, connector client.Connector, enforceRevision bool) error { + if context.ClientType == utl.Global { infraClient := global_policy.NewGlobalInfraClient(connector) gmObj, err := convertModelBindingType(obj, model.InfraBindingType(), gm_model.InfraBindingType()) if err != nil { @@ -420,7 +421,7 @@ func policyInfraPatch(obj model.Infra, isGlobalManager bool, connector client.Co return infraClient.Patch(gmObj.(gm_model.Infra), &enforceRevision) } - infraClient := nsx_policy.NewInfraClient(connector) + infraClient := nsx_policy.NewInfraClient(context, connector) return infraClient.Patch(obj, &enforceRevision) } @@ -599,8 +600,8 @@ func getLocaleServiceRedistributionConfig(serviceStruct *model.LocaleServices) [ return redistributionConfigs } -func findTier0LocaleServiceForSite(connector client.Connector, gwID string, sitePath string) (string, error) { - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, gwID, true) +func findTier0LocaleServiceForSite(context utl.SessionContext, connector client.Connector, gwID string, sitePath string) (string, error) { + localeServices, err := listPolicyTier0GatewayLocaleServices(context, connector, gwID) if err != nil { return "", err } diff --git a/nsxt/policy_common.go b/nsxt/policy_common.go index 9091d0e98..22cf9ce50 100644 --- a/nsxt/policy_common.go +++ b/nsxt/policy_common.go @@ -285,7 +285,7 @@ func getSecurityPolicyAndGatewayRulesSchema(scopeRequired bool, isIds bool, nsxI } func getPolicyGatewayPolicySchema() map[string]*schema.Schema { - secPolicy := getPolicySecurityPolicySchema(false) + secPolicy := getPolicySecurityPolicySchema(false, true) // GW Policies don't support scope delete(secPolicy, "scope") secPolicy["category"].ValidateFunc = validation.StringInSlice(gatewayPolicyCategoryWritableValues, false) @@ -294,7 +294,7 @@ func getPolicyGatewayPolicySchema() map[string]*schema.Schema { return secPolicy } -func getPolicySecurityPolicySchema(isIds bool) map[string]*schema.Schema { +func getPolicySecurityPolicySchema(isIds bool, withContext bool) map[string]*schema.Schema { result := map[string]*schema.Schema{ "nsx_id": getNsxIDSchema(), "path": getPathSchema(), @@ -302,6 +302,7 @@ func getPolicySecurityPolicySchema(isIds bool) map[string]*schema.Schema { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "domain": getDomainNameSchema(), "category": { Type: schema.TypeString, @@ -358,6 +359,9 @@ func getPolicySecurityPolicySchema(isIds bool) map[string]*schema.Schema { delete(result, "tcp_strict") } + if !withContext { + delete(result, "context") + } return result } diff --git a/nsxt/policy_search.go b/nsxt/policy_search.go index cf2b14e87..1f5033c9e 100644 --- a/nsxt/policy_search.go +++ b/nsxt/policy_search.go @@ -4,6 +4,7 @@ package nsxt import ( + "errors" "fmt" "strings" @@ -14,6 +15,8 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/search" lm_search "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/search" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) type policySearchDataValue struct { @@ -79,11 +82,11 @@ func policyDataSourceResourceFilterAndSet(d *schema.ResourceData, resultValues [ return obj.StructValue, nil } -func policyDataSourceResourceRead(d *schema.ResourceData, connector client.Connector, isGlobalManager bool, resourceType string, additionalQuery map[string]string) (*data.StructValue, error) { - return policyDataSourceResourceReadWithValidation(d, connector, isGlobalManager, resourceType, additionalQuery, true) +func policyDataSourceResourceRead(d *schema.ResourceData, connector client.Connector, context utl.SessionContext, resourceType string, additionalQuery map[string]string) (*data.StructValue, error) { + return policyDataSourceResourceReadWithValidation(d, connector, context, resourceType, additionalQuery, true) } -func policyDataSourceResourceReadWithValidation(d *schema.ResourceData, connector client.Connector, isGlobalManager bool, resourceType string, additionalQuery map[string]string, paramsValidation bool) (*data.StructValue, error) { +func policyDataSourceResourceReadWithValidation(d *schema.ResourceData, connector client.Connector, context utl.SessionContext, resourceType string, additionalQuery map[string]string, paramsValidation bool) (*data.StructValue, error) { objName := d.Get("display_name").(string) objID := d.Get("id").(string) var err error @@ -96,12 +99,12 @@ func policyDataSourceResourceReadWithValidation(d *schema.ResourceData, connecto if resourceType == "PolicyEdgeNode" { // Edge Node is a special case where id != nsx_id // TODO: consider switching all searches to nsx id - resultValues, err = listPolicyResourcesByNsxID(connector, isGlobalManager, &objID, &additionalQueryString) + resultValues, err = listPolicyResourcesByNsxID(connector, context, &objID, &additionalQueryString) } else { - resultValues, err = listPolicyResourcesByID(connector, isGlobalManager, &objID, &additionalQueryString) + resultValues, err = listPolicyResourcesByID(connector, context, &objID, &additionalQueryString) } } else { - resultValues, err = listPolicyResourcesByNameAndType(connector, isGlobalManager, objName, resourceType, &additionalQueryString) + resultValues, err = listPolicyResourcesByNameAndType(connector, context, objName, resourceType, &additionalQueryString) } if err != nil { return nil, err @@ -110,12 +113,18 @@ func policyDataSourceResourceReadWithValidation(d *schema.ResourceData, connecto return policyDataSourceResourceFilterAndSet(d, resultValues, resourceType) } -func listPolicyResourcesByNameAndType(connector client.Connector, isGlobalManager bool, displayName string, resourceType string, additionalQuery *string) ([]*data.StructValue, error) { +func listPolicyResourcesByNameAndType(connector client.Connector, context utl.SessionContext, displayName string, resourceType string, additionalQuery *string) ([]*data.StructValue, error) { query := fmt.Sprintf("resource_type:%s AND display_name:%s* AND marked_for_delete:false", resourceType, displayName) - if isGlobalManager { + switch context.ClientType { + case utl.Local: + return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Global: return searchGMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Multitenancy: + return searchMultitenancyPolicyResources(connector, utl.DefaultOrgID, context.ProjectID, *buildPolicyResourcesQuery(&query, additionalQuery)) } - return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + + return nil, errors.New("invalid ClientType %d") } func escapeSpecialCharacters(str string) string { @@ -132,20 +141,31 @@ func escapeSpecialCharacters(str string) string { return str } -func listPolicyResourcesByID(connector client.Connector, isGlobalManager bool, resourceID *string, additionalQuery *string) ([]*data.StructValue, error) { +func listPolicyResourcesByID(connector client.Connector, context utl.SessionContext, resourceID *string, additionalQuery *string) ([]*data.StructValue, error) { query := fmt.Sprintf("id:%s AND marked_for_delete:false", escapeSpecialCharacters(*resourceID)) - if isGlobalManager { + switch context.ClientType { + case utl.Local: + return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Global: return searchGMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Multitenancy: + return searchMultitenancyPolicyResources(connector, utl.DefaultOrgID, context.ProjectID, *buildPolicyResourcesQuery(&query, additionalQuery)) } - return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + + return nil, errors.New("invalid ClientType %d") } -func listPolicyResourcesByNsxID(connector client.Connector, isGlobalManager bool, resourceID *string, additionalQuery *string) ([]*data.StructValue, error) { +func listPolicyResourcesByNsxID(connector client.Connector, context utl.SessionContext, resourceID *string, additionalQuery *string) ([]*data.StructValue, error) { query := fmt.Sprintf("nsx_id:%s AND marked_for_delete:false", escapeSpecialCharacters(*resourceID)) - if isGlobalManager { + switch context.ClientType { + case utl.Local: + return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Global: return searchGMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + case utl.Multitenancy: + return searchMultitenancyPolicyResources(connector, utl.DefaultOrgID, context.ProjectID, *buildPolicyResourcesQuery(&query, additionalQuery)) } - return searchLMPolicyResources(connector, *buildPolicyResourcesQuery(&query, additionalQuery)) + return nil, errors.New("invalid ClientType %d") } func buildPolicyResourcesQuery(query *string, additionalQuery *string) *string { @@ -206,3 +226,28 @@ func searchLMPolicyResources(connector client.Connector, query string) ([]*data. } } } + +func searchMultitenancyPolicyResources(connector client.Connector, org string, project string, query string) ([]*data.StructValue, error) { + client := lm_search.NewQueryClient(connector) + var results []*data.StructValue + var cursor *string + total := 0 + + query = query + fmt.Sprintf(" AND path:\\/orgs\\/%s\\/projects\\/%s*", org, project) + + for { + searchResponse, err := client.List(query, cursor, nil, nil, nil, nil) + if err != nil { + return results, err + } + results = append(results, searchResponse.Results...) + if total == 0 { + // first response + total = int(*searchResponse.ResultCount) + } + cursor = searchResponse.Cursor + if len(results) >= total { + return results, nil + } + } +} diff --git a/nsxt/policy_utils.go b/nsxt/policy_utils.go index f322183ba..2750e8fd2 100644 --- a/nsxt/policy_utils.go +++ b/nsxt/policy_utils.go @@ -17,8 +17,30 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) +func getOrGenerateID2(d *schema.ResourceData, m interface{}, presenceChecker func(utl.SessionContext, string, client.Connector) (bool, error)) (string, error) { + connector := getPolicyConnector(m) + + id := d.Get("nsx_id").(string) + if id == "" { + return newUUID(), nil + } + + exists, err := presenceChecker(getSessionContext(d, m), id, connector) + if err != nil { + return "", err + } + + if exists { + return "", fmt.Errorf("Resource with id %s already exists", id) + } + + return id, nil +} + func getOrGenerateID(d *schema.ResourceData, m interface{}, presenceChecker func(string, client.Connector, bool) (bool, error)) (string, error) { connector := getPolicyConnector(m) isGlobalManager := isPolicyGlobalManager(m) @@ -164,8 +186,8 @@ func isPolicyPath(policyPath string) bool { return false } else if pathSegs[0] != "" || pathSegs[len(pathSegs)-1] == "" { return false - } else if !strings.Contains(pathSegs[1], "infra") { - // must be infra or global-infra as of now + } else if !strings.Contains(pathSegs[1], "infra") && pathSegs[1] != "orgs" { + // must be infra, global-infra or orgs as of now return false } return true diff --git a/nsxt/provider.go b/nsxt/provider.go index 253b17af8..70a1a3256 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -24,6 +24,8 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client/middleware/retry" "github.com/vmware/vsphere-automation-sdk-go/runtime/security" + + tf_api "github.com/vmware/terraform-provider-nsxt/api/utl" ) var defaultRetryOnStatusCodes = []int{400, 409, 429, 500, 503, 504} @@ -887,3 +889,29 @@ func getCommonProviderConfig(clients interface{}) commonProviderConfig { func getGlobalPolicyEnforcementPointPath(m interface{}, sitePath *string) string { return fmt.Sprintf("%s/enforcement-points/%s", *sitePath, getPolicyEnforcementPoint(m)) } + +func getProjectIDFromSchema(d *schema.ResourceData) string { + ctxPtr := d.Get("context") + if ctxPtr != nil { + contexts := ctxPtr.([]interface{}) + for _, context := range contexts { + data := context.(map[string]interface{}) + + return data["project_id"].(string) + } + } + return "" +} + +func getSessionContext(d *schema.ResourceData, m interface{}) tf_api.SessionContext { + var clientType tf_api.ClientType + projectID := getProjectIDFromSchema(d) + if projectID != "" { + clientType = tf_api.Multitenancy + } else if isPolicyGlobalManager(m) { + clientType = tf_api.Global + } else { + clientType = tf_api.Local + } + return tf_api.SessionContext{ProjectID: projectID, ClientType: clientType} +} diff --git a/nsxt/resource_nsxt_policy_bgp_config.go b/nsxt/resource_nsxt_policy_bgp_config.go index dc10f9569..804a7b671 100644 --- a/nsxt/resource_nsxt_policy_bgp_config.go +++ b/nsxt/resource_nsxt_policy_bgp_config.go @@ -141,6 +141,7 @@ func resourceNsxtPolicyBgpConfigToStruct(d *schema.ResourceData, isVRF bool) (*m func resourceNsxtPolicyBgpConfigCreate(d *schema.ResourceData, m interface{}) error { // This is not a create operation on NSX, since BGP config us auto created connector := getPolicyConnector(m) + context := getSessionContext(d, m) gwPath := d.Get("gateway_path").(string) isT0, gwID := parseGatewayPolicyPath(gwPath) @@ -160,7 +161,7 @@ func resourceNsxtPolicyBgpConfigCreate(d *schema.ResourceData, m interface{}) er var localeServiceID string if isPolicyGlobalManager(m) { - serviceID, err1 := findTier0LocaleServiceForSite(connector, gwID, sitePath) + serviceID, err1 := findTier0LocaleServiceForSite(context, connector, gwID, sitePath) if err1 != nil { return handleCreateError("BgpRoutingConfig", gwID, err1) } @@ -176,7 +177,7 @@ func resourceNsxtPolicyBgpConfigCreate(d *schema.ResourceData, m interface{}) er client := gm_locale_services.NewBgpClient(connector) err = client.Patch(gwID, serviceID, gmRoutingConfig, nil) } else { - localeService, err1 := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(gwID, connector) + localeService, err1 := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(context, gwID, connector) if err1 != nil { return fmt.Errorf("Tier0 Gateway path with configured edge cluster expected, got %s", gwPath) } diff --git a/nsxt/resource_nsxt_policy_context_profile.go b/nsxt/resource_nsxt_policy_context_profile.go index c3360f1c3..72050a7be 100644 --- a/nsxt/resource_nsxt_policy_context_profile.go +++ b/nsxt/resource_nsxt_policy_context_profile.go @@ -9,14 +9,15 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" gm_cont_prof "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/context_profiles" gm_custom_attr "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/context_profiles/custom_attributes" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" cont_prof "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/context_profiles" custom_attr "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/context_profiles/custom_attributes" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var attributeKeyMap = map[string]string{ @@ -62,6 +63,7 @@ func resourceNsxtPolicyContextProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "app_id": getContextProfilePolicyAppIDAttributesSchema(), "custom_url": getContextProfilePolicyCustomURLAttributesSchema(), "domain_name": getContextProfilePolicyOtherAttributesSchema(), @@ -170,15 +172,9 @@ func getPolicyAttributeSubAttributeValueSchema(subAttributeKey string) *schema.S } } -func resourceNsxtPolicyContextProfileExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewContextProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewContextProfilesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyContextProfileExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewContextProfilesClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil @@ -195,7 +191,7 @@ func resourceNsxtPolicyContextProfileCreate(d *schema.ResourceData, m interface{ connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyContextProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyContextProfileExists) if err != nil { return err } @@ -232,17 +228,8 @@ func resourceNsxtPolicyContextProfileCreate(d *schema.ResourceData, m interface{ // Create the resource using PATCH log.Printf("[INFO] Creating ContextProfile with ID %s", id) - if isPolicyGlobalManager(m) { - client := gm_infra.NewContextProfilesClient(connector) - gmObj, err1 := convertModelBindingType(obj, model.PolicyContextProfileBindingType(), gm_model.PolicyContextProfileBindingType()) - if err1 != nil { - return err1 - } - err = client.Patch(id, gmObj.(gm_model.PolicyContextProfile), nil) - } else { - client := infra.NewContextProfilesClient(connector) - err = client.Patch(id, obj, nil) - } + client := infra.NewContextProfilesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj, nil) if err != nil { return handleCreateError("ContextProfile", id, err) } @@ -260,25 +247,10 @@ func resourceNsxtPolicyContextProfileRead(d *schema.ResourceData, m interface{}) return fmt.Errorf("Error obtaining ContextProfile ID") } - var obj model.PolicyContextProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewContextProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "ContextProfile", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.PolicyContextProfileBindingType(), model.PolicyContextProfileBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.PolicyContextProfile) - } else { - var err error - client := infra.NewContextProfilesClient(connector) - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "ContextProfile", id, err) - } + client := infra.NewContextProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "ContextProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -326,18 +298,8 @@ func resourceNsxtPolicyContextProfileUpdate(d *schema.ResourceData, m interface{ } // Update the resource using PATCH - if isPolicyGlobalManager(m) { - rawObj, err1 := convertModelBindingType(obj, model.PolicyContextProfileBindingType(), gm_model.PolicyContextProfileBindingType()) - if err1 != nil { - return err1 - } - gmObj := rawObj.(gm_model.PolicyContextProfile) - client := gm_infra.NewContextProfilesClient(connector) - err = client.Patch(id, gmObj, nil) - } else { - client := infra.NewContextProfilesClient(connector) - err = client.Patch(id, obj, nil) - } + client := infra.NewContextProfilesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj, nil) if err != nil { return handleUpdateError("ContextProfile", id, err) @@ -355,13 +317,8 @@ func resourceNsxtPolicyContextProfileDelete(d *schema.ResourceData, m interface{ connector := getPolicyConnector(m) var err error force := true - if isPolicyGlobalManager(m) { - client := gm_infra.NewContextProfilesClient(connector) - err = client.Delete(id, &force, nil) - } else { - client := infra.NewContextProfilesClient(connector) - err = client.Delete(id, &force, nil) - } + client := infra.NewContextProfilesClient(getSessionContext(d, m), connector) + err = client.Delete(id, &force, nil) if err != nil { return handleDeleteError("ContextProfile", id, err) } diff --git a/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go b/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go index a008a1c3e..658077607 100644 --- a/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go +++ b/nsxt/resource_nsxt_policy_context_profile_custom_attribute.go @@ -12,10 +12,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/context_profiles/custom_attributes" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/context_profiles/custom_attributes" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + infra "github.com/vmware/terraform-provider-nsxt/api/infra/context_profiles/custom_attributes" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var customAttributeKeys = []string{ @@ -42,6 +42,7 @@ func resourceNsxtPolicyContextProfileCustomAttribute() *schema.Resource { }, Schema: map[string]*schema.Schema{ + "context": getContextSchema(), "key": { Type: schema.TypeString, Description: "Key for attribute", @@ -59,29 +60,16 @@ func resourceNsxtPolicyContextProfileCustomAttribute() *schema.Resource { } } -func resourceNsxtPolicyContextProfileCustomAttributeExists(id string, connector client.Connector, isGlobalmodel bool) (bool, error) { +func resourceNsxtPolicyContextProfileCustomAttributeExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { var err error var attrList model.PolicyContextProfileListResult key, attribute := splitCustomAttributeID(id) source := model.PolicyCustomAttributes_ATTRIBUTE_SOURCE_CUSTOM - if isGlobalmodel { - var gmAttrList gm_model.PolicyContextProfileListResult - client := gm_infra.NewDefaultClient(connector) - gmAttrList, err = client.List(&key, &source, nil, nil, nil, nil, nil, nil) - - al, err1 := convertModelBindingType(gmAttrList, gm_model.PolicyContextProfileListResultBindingType(), model.PolicyContextProfileListResultBindingType()) - if err1 != nil { - return false, err1 - } - - attrList = al.(model.PolicyContextProfileListResult) - } else { - client := infra.NewDefaultClient(connector) - attrList, err = client.List(&key, &source, nil, nil, nil, nil, nil, nil) - if err != nil { - return false, err - } + client := infra.NewDefaultClient(sessionContext, connector) + attrList, err = client.List(&key, &source, nil, nil, nil, nil, nil, nil) + if err != nil { + return false, err } if *attrList.ResultCount == 0 { @@ -115,7 +103,7 @@ func resourceNsxtPolicyContextProfileCustomAttributeRead(d *schema.ResourceData, log.Printf("[INFO] Reading ContextProfileCustomAttribute with ID %s", d.Id()) connector := getPolicyConnector(m) - exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(id, connector, isPolicyGlobalManager(m)) + exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(getSessionContext(d, m), id, connector) if err != nil { return err } @@ -144,18 +132,8 @@ func resourceNsxtPolicyContextProfileCustomAttributeCreate(d *schema.ResourceDat } // PATCH the resource - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.PolicyCustomAttributesBindingType(), gm_model.PolicyCustomAttributesBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDefaultClient(connector) - err = client.Create(gmObj.(gm_model.PolicyCustomAttributes), "add") - } else { - client := infra.NewDefaultClient(connector) - err = client.Create(obj, "add") - } + client := infra.NewDefaultClient(getSessionContext(d, m), connector) + err = client.Create(obj, "add") if err != nil { return handleCreateError("ContextProfileCustomAttribute", attribute, err) } @@ -187,18 +165,8 @@ func resourceNsxtPolicyContextProfileCustomAttributeDelete(d *schema.ResourceDat } // PATCH the resource - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.PolicyCustomAttributesBindingType(), gm_model.PolicyCustomAttributesBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDefaultClient(connector) - err = client.Create(gmObj.(gm_model.PolicyCustomAttributes), "remove") - } else { - client := infra.NewDefaultClient(connector) - err = client.Create(obj, "remove") - } + client := infra.NewDefaultClient(getSessionContext(d, m), connector) + err = client.Create(obj, "remove") if err != nil { return handleDeleteError("ContextProfileCustomAttribute", attribute, err) diff --git a/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go b/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go index f5763f63b..f8cfd1b1e 100644 --- a/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go +++ b/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go @@ -77,7 +77,7 @@ func testAccNsxtPolicyContextProfileCustomAttributeExists(displayName string, re return fmt.Errorf("Policy ContextProfileCustomAttribute resource ID not set in resources") } - exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -98,7 +98,7 @@ func testAccNsxtPolicyContextProfileCustomAttributeCheckDestroy(state *terraform } resourceID := makeCustomAttributeID(model.PolicyCustomAttributes_KEY_DOMAIN_NAME, rs.Primary.Attributes["attribute"]) - exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyContextProfileCustomAttributeExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_dhcp_relay.go b/nsxt/resource_nsxt_policy_dhcp_relay.go index dee3018a9..c1d1a972c 100644 --- a/nsxt/resource_nsxt_policy_dhcp_relay.go +++ b/nsxt/resource_nsxt_policy_dhcp_relay.go @@ -9,10 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyDhcpRelayConfig() *schema.Resource { @@ -32,6 +32,7 @@ func resourceNsxtPolicyDhcpRelayConfig() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "server_addresses": { Type: schema.TypeList, Required: true, @@ -44,16 +45,10 @@ func resourceNsxtPolicyDhcpRelayConfig() *schema.Resource { } } -func resourceNsxtPolicyDhcpRelayConfigExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewDhcpRelayConfigsClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewDhcpRelayConfigsClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyDhcpRelayConfigExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewDhcpRelayConfigsClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -67,9 +62,14 @@ func resourceNsxtPolicyDhcpRelayConfigExists(id string, connector client.Connect func resourceNsxtPolicyDhcpRelayConfigCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) + client := infra.NewDhcpRelayConfigsClient(getSessionContext(d, m), connector) + + if client == nil { + return policyResourceNotSupportedError() + } // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyDhcpRelayConfigExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyDhcpRelayConfigExists) if err != nil { return err } @@ -88,18 +88,7 @@ func resourceNsxtPolicyDhcpRelayConfigCreate(d *schema.ResourceData, m interface // Create the resource using PATCH log.Printf("[INFO] Creating DhcpRelayConfig with ID %s", id) - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.DhcpRelayConfigBindingType(), gm_model.DhcpRelayConfigBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDhcpRelayConfigsClient(connector) - err = client.Patch(id, gmObj.(gm_model.DhcpRelayConfig)) - } else { - client := infra.NewDhcpRelayConfigsClient(connector) - err = client.Patch(id, obj) - } + err = client.Patch(id, obj) if err != nil { return handleCreateError("DhcpRelayConfig", id, err) } @@ -112,7 +101,7 @@ func resourceNsxtPolicyDhcpRelayConfigCreate(d *schema.ResourceData, m interface func resourceNsxtPolicyDhcpRelayConfigRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewDhcpRelayConfigsClient(connector) + client := infra.NewDhcpRelayConfigsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() @@ -122,25 +111,10 @@ func resourceNsxtPolicyDhcpRelayConfigRead(d *schema.ResourceData, m interface{} if id == "" { return fmt.Errorf("Error obtaining DhcpRelayConfig ID") } - var obj model.DhcpRelayConfig - if isPolicyGlobalManager(m) { - client := gm_infra.NewDhcpRelayConfigsClient(connector) - gmObj, err1 := client.Get(id) - if err1 != nil { - return handleReadError(d, "DhcpRelayConfig", id, err1) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.DhcpRelayConfigBindingType(), model.DhcpRelayConfigBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.DhcpRelayConfig) - } else { - var err error - client := infra.NewDhcpRelayConfigsClient(connector) - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "DhcpRelayConfig", id, err) - } + + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "DhcpRelayConfig", id, err) } d.Set("display_name", obj.DisplayName) @@ -157,7 +131,7 @@ func resourceNsxtPolicyDhcpRelayConfigRead(d *schema.ResourceData, m interface{} func resourceNsxtPolicyDhcpRelayConfigUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewDhcpRelayConfigsClient(connector) + client := infra.NewDhcpRelayConfigsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } @@ -183,19 +157,7 @@ func resourceNsxtPolicyDhcpRelayConfigUpdate(d *schema.ResourceData, m interface Revision: &revision, } - var err error - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.DhcpRelayConfigBindingType(), gm_model.DhcpRelayConfigBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDhcpRelayConfigsClient(connector) - _, err = client.Update(id, gmObj.(gm_model.DhcpRelayConfig)) - } else { - client := infra.NewDhcpRelayConfigsClient(connector) - _, err = client.Update(id, obj) - } + _, err := client.Update(id, obj) if err != nil { return handleUpdateError("DhcpRelayConfig", id, err) } @@ -210,20 +172,12 @@ func resourceNsxtPolicyDhcpRelayConfigDelete(d *schema.ResourceData, m interface } connector := getPolicyConnector(m) - client := infra.NewDhcpRelayConfigsClient(connector) + client := infra.NewDhcpRelayConfigsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } - var err error - if isPolicyGlobalManager(m) { - client := gm_infra.NewDhcpRelayConfigsClient(connector) - err = client.Delete(id) - } else { - client := infra.NewDhcpRelayConfigsClient(connector) - err = client.Delete(id) - } - + err := client.Delete(id) if err != nil { return handleDeleteError("DhcpRelayConfig", id, err) } diff --git a/nsxt/resource_nsxt_policy_dhcp_relay_test.go b/nsxt/resource_nsxt_policy_dhcp_relay_test.go index 6bf8ffc7b..840513cc8 100644 --- a/nsxt/resource_nsxt_policy_dhcp_relay_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_relay_test.go @@ -115,7 +115,7 @@ func testAccNsxtPolicyDhcpRelayConfigExists(resourceName string) resource.TestCh return fmt.Errorf("Policy DhcpRelayConfig resource ID not set in resources") } - exists, err := resourceNsxtPolicyDhcpRelayConfigExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpRelayConfigExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -136,7 +136,7 @@ func testAccNsxtPolicyDhcpRelayConfigCheckDestroy(state *terraform.State, displa } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyDhcpRelayConfigExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpRelayConfigExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_dhcp_server.go b/nsxt/resource_nsxt_policy_dhcp_server.go index eb0bc55a7..ea8288b33 100644 --- a/nsxt/resource_nsxt_policy_dhcp_server.go +++ b/nsxt/resource_nsxt_policy_dhcp_server.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyDhcpServer() *schema.Resource { @@ -33,6 +33,7 @@ func resourceNsxtPolicyDhcpServer() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "edge_cluster_path": getPolicyPathSchema(false, false, "Edge Cluster path"), "lease_time": { Type: schema.TypeInt, @@ -66,16 +67,10 @@ func resourceNsxtPolicyDhcpServer() *schema.Resource { } } -func resourceNsxtPolicyDhcpServerExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { +func resourceNsxtPolicyDhcpServerExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewDhcpServerConfigsClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewDhcpServerConfigsClient(connector) - _, err = client.Get(id) - } + client := infra.NewDhcpServerConfigsClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -122,26 +117,15 @@ func resourceNsxtPolicyDhcpServerCreate(d *schema.ResourceData, m interface{}) e connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyDhcpServerExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyDhcpServerExists) if err != nil { return err } // Create the resource using PATCH log.Printf("[INFO] Creating DhcpServer with ID %s", id) - if isPolicyGlobalManager(m) { - obj := resourceNsxtPolicyDhcpServerSchemaToModel(d) - gmObj, err1 := convertModelBindingType(obj, model.DhcpServerConfigBindingType(), gm_model.DhcpServerConfigBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDhcpServerConfigsClient(connector) - err = client.Patch(id, gmObj.(gm_model.DhcpServerConfig)) - } else { - client := infra.NewDhcpServerConfigsClient(connector) - err = client.Patch(id, resourceNsxtPolicyDhcpServerSchemaToModel(d)) - } + client := infra.NewDhcpServerConfigsClient(getSessionContext(d, m), connector) + err = client.Patch(id, resourceNsxtPolicyDhcpServerSchemaToModel(d)) if err != nil { return handleCreateError("DhcpServer", id, err) } @@ -160,25 +144,10 @@ func resourceNsxtPolicyDhcpServerRead(d *schema.ResourceData, m interface{}) err return fmt.Errorf("Error obtaining DhcpServer ID") } - var obj model.DhcpServerConfig - if isPolicyGlobalManager(m) { - client := gm_infra.NewDhcpServerConfigsClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "DhcpServer", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.DhcpServerConfigBindingType(), model.DhcpServerConfigBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.DhcpServerConfig) - } else { - var err error - client := infra.NewDhcpServerConfigsClient(connector) - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "DhcpServer", id, err) - } + client := infra.NewDhcpServerConfigsClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "DhcpServer", id, err) } d.Set("display_name", obj.DisplayName) @@ -198,7 +167,7 @@ func resourceNsxtPolicyDhcpServerRead(d *schema.ResourceData, m interface{}) err func resourceNsxtPolicyDhcpServerUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewDhcpServerConfigsClient(connector) + client := infra.NewDhcpServerConfigsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } @@ -209,20 +178,7 @@ func resourceNsxtPolicyDhcpServerUpdate(d *schema.ResourceData, m interface{}) e } // Update the resource using PATCH - var err error - if isPolicyGlobalManager(m) { - obj := resourceNsxtPolicyDhcpServerSchemaToModel(d) - gmObj, err1 := convertModelBindingType(obj, model.DhcpServerConfigBindingType(), gm_model.DhcpServerConfigBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewDhcpServerConfigsClient(connector) - err = client.Patch(id, gmObj.(gm_model.DhcpServerConfig)) - } else { - client := infra.NewDhcpServerConfigsClient(connector) - err = client.Patch(id, resourceNsxtPolicyDhcpServerSchemaToModel(d)) - } + err := client.Patch(id, resourceNsxtPolicyDhcpServerSchemaToModel(d)) if err != nil { return handleUpdateError("DhcpServer", id, err) } @@ -238,13 +194,8 @@ func resourceNsxtPolicyDhcpServerDelete(d *schema.ResourceData, m interface{}) e var err error connector := getPolicyConnector(m) - if isPolicyGlobalManager(m) { - client := gm_infra.NewDhcpServerConfigsClient(connector) - err = client.Delete(id) - } else { - client := infra.NewDhcpServerConfigsClient(connector) - err = client.Delete(id) - } + client := infra.NewDhcpServerConfigsClient(getSessionContext(d, m), connector) + err = client.Delete(id) if err != nil { return handleDeleteError("DhcpServer", id, err) diff --git a/nsxt/resource_nsxt_policy_dhcp_server_test.go b/nsxt/resource_nsxt_policy_dhcp_server_test.go index f4d7598b0..6e396de02 100644 --- a/nsxt/resource_nsxt_policy_dhcp_server_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_server_test.go @@ -122,7 +122,7 @@ func testAccNsxtPolicyDhcpServerExists(resourceName string) resource.TestCheckFu return fmt.Errorf("Policy DhcpServer resource ID not set in resources") } - exists, err := resourceNsxtPolicyDhcpServerExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpServerExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -143,7 +143,7 @@ func testAccNsxtPolicyDhcpServerCheckDestroy(state *terraform.State, displayName } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyDhcpServerExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpServerExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go index 04eb0e0dd..4f8a47d0a 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go +++ b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding.go @@ -13,11 +13,11 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_segments "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/segments" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" - t1_segments "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/segments" + t1_segments "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s/segments" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyDhcpV4StaticBinding() *schema.Resource { @@ -68,24 +68,19 @@ func resourceNsxtPolicyDhcpV4StaticBinding() *schema.Resource { } } -func getPolicyDchpStaticBindingOnSegment(id string, segmentPath string, connector client.Connector, isGlobalManager bool) (*data.StructValue, error) { +func getPolicyDchpStaticBindingOnSegment(context utl.SessionContext, id string, segmentPath string, connector client.Connector) (*data.StructValue, error) { _, gwID, segmentID := parseSegmentPolicyPath(segmentPath) - if isGlobalManager { - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) - return client.Get(segmentID, id) - } - if gwID == "" { - // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) + if context.ClientType == utl.Global || gwID == "" { + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Get(segmentID, id) } - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Get(gwID, segmentID, id) } -func resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(id string, segmentPath string, connector client.Connector, isGlobalManager bool) (bool, error) { - _, err := getPolicyDchpStaticBindingOnSegment(id, segmentPath, connector, isGlobalManager) +func resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(context utl.SessionContext, id string, segmentPath string, connector client.Connector) (bool, error) { + _, err := getPolicyDchpStaticBindingOnSegment(context, id, segmentPath, connector) if err == nil { return true, nil } @@ -97,9 +92,9 @@ func resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(id string, segmentPath s return false, logAPIError("Error retrieving resource", err) } -func resourceNsxtPolicyDhcpStaticBindingExists(segmentPath string) func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(id, segmentPath, connector, isGlobalManager) +func resourceNsxtPolicyDhcpStaticBindingExists(segmentPath string) func(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + return func(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + return resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(context, id, segmentPath, connector) } } @@ -132,6 +127,7 @@ func policyDhcpV4StaticBindingConvertAndPatch(d *schema.ResourceData, segmentPat } connector := getPolicyConnector(m) + context := getSessionContext(d, m) converter := bindings.NewTypeConverter() @@ -140,16 +136,8 @@ func policyDhcpV4StaticBindingConvertAndPatch(d *schema.ResourceData, segmentPat return fmt.Errorf("This resource is not applicable to segment %s", segmentPath) } - if isPolicyGlobalManager(m) { - if gwID != "" { - return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) - } - convObj, convErrs := converter.ConvertToVapi(obj, gm_model.DhcpV4StaticBindingConfigBindingType()) - if convErrs != nil { - return convErrs[0] - } - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) - return client.Patch(segmentID, id, convObj.(*data.StructValue)) + if context.ClientType == utl.Global && gwID != "" { + return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) } convObj, convErrs := converter.ConvertToVapi(obj, model.DhcpV4StaticBindingConfigBindingType()) @@ -159,12 +147,12 @@ func policyDhcpV4StaticBindingConvertAndPatch(d *schema.ResourceData, segmentPat if gwID == "" { // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Patch(segmentID, id, convObj.(*data.StructValue)) } // fixed segment - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Patch(gwID, segmentID, id, convObj.(*data.StructValue)) } @@ -195,7 +183,7 @@ func resourceNsxtPolicyDhcpV4StaticBindingCreate(d *schema.ResourceData, m inter segmentPath := d.Get("segment_path").(string) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyDhcpStaticBindingExists(segmentPath)) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyDhcpStaticBindingExists(segmentPath)) if err != nil { return err } @@ -231,24 +219,22 @@ func resourceNsxtPolicyDhcpV4StaticBindingRead(d *schema.ResourceData, m interfa if isT0 { return fmt.Errorf("This resource is not applicable to segment %s", segmentPath) } - if isPolicyGlobalManager(m) { - if gwID != "" { - return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) - } - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(segmentID, id) + context := getSessionContext(d, m) + if context.ClientType == utl.Global && gwID != "" { + return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) + } + + if gwID == "" { + // infra segment + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) + dhcpObj, err = client.Get(segmentID, id) } else { - if gwID == "" { - // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(segmentID, id) - } else { - // fixed segment - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(gwID, segmentID, id) - } + // fixed segment + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) + dhcpObj, err = client.Get(gwID, segmentID, id) } + if err != nil { return handleReadError(d, "DhcpV4 Static Binding Config", id, err) } @@ -314,20 +300,16 @@ func resourceNsxtPolicyDhcpStaticBindingDelete(d *schema.ResourceData, m interfa _, gwID, segmentID := parseSegmentPolicyPath(segmentPath) connector := getPolicyConnector(m) + context := getSessionContext(d, m) var err error - if isPolicyGlobalManager(m) { - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) + if gwID == "" { + // infra segment + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) err = client.Delete(segmentID, id) } else { - if gwID == "" { - // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) - err = client.Delete(segmentID, id) - } else { - // fixed segment - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) - err = client.Delete(gwID, segmentID, id) - } + // fixed segment + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) + err = client.Delete(gwID, segmentID, id) } if err != nil { diff --git a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go index bd180349a..855972a02 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go @@ -157,7 +157,7 @@ func testAccNsxtPolicyDhcpV4StaticBindingExists(displayName string, resourceName return fmt.Errorf("Policy DhcpV4StaticBinding resource ID not set in resources") } - exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(resourceID, segmentPath, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(testAccGetSessionContext(), resourceID, segmentPath, connector) if err != nil { return err } @@ -179,7 +179,7 @@ func testAccNsxtPolicyDhcpV4StaticBindingCheckDestroy(state *terraform.State, di resourceID := rs.Primary.Attributes["id"] segmentPath := rs.Primary.Attributes["segment_path"] - exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(resourceID, segmentPath, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(testAccGetSessionContext(), resourceID, segmentPath, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go index 21602f44f..13eb0ea0a 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go +++ b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding.go @@ -11,11 +11,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" - gm_segments "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/segments" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" - t1_segments "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/segments" + t1_segments "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s/segments" ) func resourceNsxtPolicyDhcpV6StaticBinding() *schema.Resource { @@ -125,16 +124,10 @@ func policyDhcpV6StaticBindingConvertAndPatch(d *schema.ResourceData, segmentPat if isT0 { return fmt.Errorf("This resource is not applicable to segment %s", segmentPath) } - if isPolicyGlobalManager(m) { - if gwID != "" { - return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) - } - convObj, convErrs := converter.ConvertToVapi(obj, gm_model.DhcpV6StaticBindingConfigBindingType()) - if convErrs != nil { - return convErrs[0] - } - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) - return client.Patch(segmentID, id, convObj.(*data.StructValue)) + context := getSessionContext(d, m) + + if isPolicyGlobalManager(m) && gwID != "" { + return fmt.Errorf("This resource is not applicable to segment on Global Manager %s", segmentPath) } convObj, convErrs := converter.ConvertToVapi(obj, model.DhcpV6StaticBindingConfigBindingType()) if convErrs != nil { @@ -142,12 +135,12 @@ func policyDhcpV6StaticBindingConvertAndPatch(d *schema.ResourceData, segmentPat } if gwID == "" { // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Patch(segmentID, id, convObj.(*data.StructValue)) } // fixed segment - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) return client.Patch(gwID, segmentID, id, convObj.(*data.StructValue)) } @@ -156,7 +149,7 @@ func resourceNsxtPolicyDhcpV6StaticBindingCreate(d *schema.ResourceData, m inter segmentPath := d.Get("segment_path").(string) segmentID := getPolicyIDFromPath(segmentPath) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyDhcpStaticBindingExists(segmentID)) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyDhcpStaticBindingExists(segmentID)) if err != nil { return err } @@ -192,20 +185,16 @@ func resourceNsxtPolicyDhcpV6StaticBindingRead(d *schema.ResourceData, m interfa converter := bindings.NewTypeConverter() var err error var dhcpObj *data.StructValue - if isPolicyGlobalManager(m) { - client := gm_segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(segmentID, id) + context := getSessionContext(d, m) + if gwID == "" { + // infra segment + client := segments.NewDhcpStaticBindingConfigsClient(context, connector) + dhcpObj, err = client.Get(segmentID, id) } else { - if gwID == "" { - // infra segment - client := segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(segmentID, id) - } else { - // fixed segment - client := t1_segments.NewDhcpStaticBindingConfigsClient(connector) - dhcpObj, err = client.Get(gwID, segmentID, id) - } + // fixed segment + client := t1_segments.NewDhcpStaticBindingConfigsClient(context, connector) + dhcpObj, err = client.Get(gwID, segmentID, id) } if err != nil { return handleReadError(d, "DhcpV6 Static Binding Config", id, err) diff --git a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go index 144d45e2e..c5eda2521 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go @@ -164,7 +164,7 @@ func testAccNsxtPolicyDhcpV6StaticBindingExists(displayName string, resourceName return fmt.Errorf("Policy DhcpV6StaticBinding resource ID not set in resources") } - exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(resourceID, segmentPath, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(testAccGetSessionContext(), resourceID, segmentPath, connector) if err != nil { return err } @@ -186,7 +186,7 @@ func testAccNsxtPolicyDhcpV6StaticBindingCheckDestroy(state *terraform.State, di resourceID := rs.Primary.Attributes["id"] segmentPath := rs.Primary.Attributes["segment_path"] - exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(resourceID, segmentPath, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDhcpStaticBindingExistsOnSegment(testAccGetSessionContext(), resourceID, segmentPath, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_dns_forwarder_zone.go b/nsxt/resource_nsxt_policy_dns_forwarder_zone.go index b3d74aba2..7cb1ffaed 100644 --- a/nsxt/resource_nsxt_policy_dns_forwarder_zone.go +++ b/nsxt/resource_nsxt_policy_dns_forwarder_zone.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + infra "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyDNSForwarderZone() *schema.Resource { @@ -33,6 +33,7 @@ func resourceNsxtPolicyDNSForwarderZone() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "dns_domain_names": getDomainNamesSchema(), "source_ip": { Type: schema.TypeString, @@ -54,15 +55,9 @@ func resourceNsxtPolicyDNSForwarderZone() *schema.Resource { } } -func resourceNsxtPolicyDNSForwarderZoneExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewDnsForwarderZonesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewDnsForwarderZonesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyDNSForwarderZoneExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewDnsForwarderZonesClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -74,7 +69,7 @@ func resourceNsxtPolicyDNSForwarderZoneExists(id string, connector client.Connec return false, logAPIError("Error retrieving resource", err) } -func policyDNSForwarderZonePatch(id string, d *schema.ResourceData, connector client.Connector, isGlobalManager bool) error { +func policyDNSForwarderZonePatch(id string, d *schema.ResourceData, m interface{}, connector client.Connector) error { displayName := d.Get("display_name").(string) description := d.Get("description").(string) tags := getPolicyTagsFromSchema(d) @@ -98,16 +93,7 @@ func policyDNSForwarderZonePatch(id string, d *schema.ResourceData, connector cl } // Create the resource using PATCH - if isGlobalManager { - gmObj, convErr := convertModelBindingType(obj, model.PolicyDnsForwarderZoneBindingType(), gm_model.PolicyDnsForwarderZoneBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewDnsForwarderZonesClient(connector) - return client.Patch(id, gmObj.(gm_model.PolicyDnsForwarderZone)) - } - - client := infra.NewDnsForwarderZonesClient(connector) + client := infra.NewDnsForwarderZonesClient(getSessionContext(d, m), connector) return client.Patch(id, obj) } @@ -115,13 +101,13 @@ func resourceNsxtPolicyDNSForwarderZoneCreate(d *schema.ResourceData, m interfac connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyDNSForwarderZoneExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyDNSForwarderZoneExists) if err != nil { return err } log.Printf("[INFO] Creating Dns Forwarder Zone with ID %s", id) - err = policyDNSForwarderZonePatch(id, d, connector, isPolicyGlobalManager(m)) + err = policyDNSForwarderZonePatch(id, d, m, connector) if err != nil { return handleCreateError("Dns Forwarder Zone", id, err) @@ -141,26 +127,10 @@ func resourceNsxtPolicyDNSForwarderZoneRead(d *schema.ResourceData, m interface{ return fmt.Errorf("Error obtaining Dns Forwarder Zone ID") } - var obj model.PolicyDnsForwarderZone - if isPolicyGlobalManager(m) { - client := gm_infra.NewDnsForwarderZonesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "Dns Forwarder Zone", id, err) - } - - lmObj, err := convertModelBindingType(gmObj, gm_model.PolicyDnsForwarderZoneBindingType(), model.PolicyDnsForwarderZoneBindingType()) - if err != nil { - return err - } - obj = lmObj.(model.PolicyDnsForwarderZone) - } else { - client := infra.NewDnsForwarderZonesClient(connector) - var err error - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "Dns Forwarder Zone", id, err) - } + client := infra.NewDnsForwarderZonesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "Dns Forwarder Zone", id, err) } d.Set("display_name", obj.DisplayName) @@ -186,7 +156,7 @@ func resourceNsxtPolicyDNSForwarderZoneUpdate(d *schema.ResourceData, m interfac } log.Printf("[INFO] Updating Dns Forwarder Zone with ID %s", id) - err := policyDNSForwarderZonePatch(id, d, connector, isPolicyGlobalManager(m)) + err := policyDNSForwarderZonePatch(id, d, m, connector) if err != nil { return handleUpdateError("Dns Forwarder Zone", id, err) } @@ -201,14 +171,8 @@ func resourceNsxtPolicyDNSForwarderZoneDelete(d *schema.ResourceData, m interfac } connector := getPolicyConnector(m) - var err error - if isPolicyGlobalManager(m) { - client := gm_infra.NewDnsForwarderZonesClient(connector) - err = client.Delete(id) - } else { - client := infra.NewDnsForwarderZonesClient(connector) - err = client.Delete(id) - } + client := infra.NewDnsForwarderZonesClient(getSessionContext(d, m), connector) + err := client.Delete(id) if err != nil { return handleDeleteError("Dns Forwarder Zone", id, err) diff --git a/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go b/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go index 73a20e3ed..9502749b4 100644 --- a/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go +++ b/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go @@ -128,7 +128,7 @@ func testAccNsxtPolicyDNSForwarderZoneExists(displayName string, resourceName st return fmt.Errorf("Policy PolicyDNSForwarderZone resource ID not set in resources") } - exists, err := resourceNsxtPolicyDNSForwarderZoneExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDNSForwarderZoneExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -149,7 +149,7 @@ func testAccNsxtPolicyDNSForwarderZoneCheckDestroy(state *terraform.State, displ } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyDNSForwarderZoneExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyDNSForwarderZoneExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_domain.go b/nsxt/resource_nsxt_policy_domain.go index b06adec01..dbf2852bf 100644 --- a/nsxt/resource_nsxt_policy_domain.go +++ b/nsxt/resource_nsxt_policy_domain.go @@ -200,7 +200,7 @@ func resourceNsxtPolicyDomainCreate(d *schema.ResourceData, m interface{}) error // Create the resource using PATCH log.Printf("[INFO] Creating Domain with ID %s", id) - err = policyInfraPatch(infraStruct, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err = policyInfraPatch(getSessionContext(d, m), infraStruct, getPolicyConnector(m), false) if err != nil { return handleCreateError("Domain", id, err) } @@ -297,7 +297,7 @@ func resourceNsxtPolicyDomainUpdate(d *schema.ResourceData, m interface{}) error ResourceType: &infraType, } - err = policyInfraPatch(infraStruct, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err = policyInfraPatch(getSessionContext(d, m), infraStruct, getPolicyConnector(m), false) if err != nil { return handleUpdateError("Domain", id, err) } diff --git a/nsxt/resource_nsxt_policy_fixed_segment_test.go b/nsxt/resource_nsxt_policy_fixed_segment_test.go index b3c1dc1e8..372d30e0d 100644 --- a/nsxt/resource_nsxt_policy_fixed_segment_test.go +++ b/nsxt/resource_nsxt_policy_fixed_segment_test.go @@ -261,7 +261,8 @@ func testAccNsxtPolicyFixedSegmentExists(resourceName string) resource.TestCheck return fmt.Errorf("Policy resource ID not set in resources") } gwPath := rs.Primary.Attributes["connectivity_path"] - exists, err := resourceNsxtPolicySegmentExists(gwPath, true)(resourceID, connector, testAccIsGlobalManager()) + context := testAccGetSessionContext() + exists, err := resourceNsxtPolicySegmentExists(context, gwPath, true)(context, resourceID, connector) if err != nil { return err } @@ -287,7 +288,8 @@ func testAccNsxtPolicyFixedSegmentCheckDestroy(state *terraform.State, displayNa return fmt.Errorf("Policy resource ID not set in resources") } gwPath := rs.Primary.Attributes["connectivity_path"] - exists, err := resourceNsxtPolicySegmentExists(gwPath, true)(resourceID, connector, testAccIsGlobalManager()) + context := testAccGetSessionContext() + exists, err := resourceNsxtPolicySegmentExists(context, gwPath, true)(context, resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go b/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go index 371a2a088..59eb43d1c 100644 --- a/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go +++ b/nsxt/resource_nsxt_policy_gateway_dns_forwarder.go @@ -10,12 +10,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_tier_0s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s" - gm_tier_1s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + tier0s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_0s" + tier1s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var gatewayDNSForwarderLogLevelTypeValues = []string{ @@ -42,6 +41,7 @@ func resourceNsxtPolicyGatewayDNSForwarder() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "gateway_path": getPolicyPathSchema(true, true, "Policy path for the Gateway"), "listener_ip": { Type: schema.TypeString, @@ -79,32 +79,12 @@ func resourceNsxtPolicyGatewayDNSForwarder() *schema.Resource { } } -func policyGatewayDNSForwarderGet(connector client.Connector, gwID string, isT0 bool, isGlobalManager bool) (model.PolicyDnsForwarder, error) { - var obj model.PolicyDnsForwarder - var err error - if isGlobalManager { - var gmObj gm_model.PolicyDnsForwarder - if isT0 { - client := gm_tier_0s.NewDnsForwarderClient(connector) - gmObj, err = client.Get(gwID) - } else { - client := gm_tier_1s.NewDnsForwarderClient(connector) - gmObj, err = client.Get(gwID) - } - if err != nil { - return obj, err - } - rawObj, convErr := convertModelBindingType(gmObj, gm_model.PolicyDnsForwarderBindingType(), model.PolicyDnsForwarderBindingType()) - if convErr != nil { - return obj, convErr - } - return rawObj.(model.PolicyDnsForwarder), nil - } +func policyGatewayDNSForwarderGet(sessionContext utl.SessionContext, connector client.Connector, gwID string, isT0 bool) (model.PolicyDnsForwarder, error) { if isT0 { - client := tier_0s.NewDnsForwarderClient(connector) + client := tier0s.NewDnsForwarderClient(sessionContext, connector) return client.Get(gwID) } - client := tier_1s.NewDnsForwarderClient(connector) + client := tier1s.NewDnsForwarderClient(sessionContext, connector) return client.Get(gwID) } @@ -117,7 +97,7 @@ func resourceNsxtPolicyGatewayDNSForwarderRead(d *schema.ResourceData, m interfa return fmt.Errorf("gateway_path is not valid") } - obj, err := policyGatewayDNSForwarderGet(connector, gwID, isT0, isPolicyGlobalManager(m)) + obj, err := policyGatewayDNSForwarderGet(getSessionContext(d, m), connector, gwID, isT0) if err != nil { return handleReadError(d, "Gateway Dns Forwarder", gwID, err) @@ -138,7 +118,7 @@ func resourceNsxtPolicyGatewayDNSForwarderRead(d *schema.ResourceData, m interfa return nil } -func patchNsxtPolicyGatewayDNSForwarder(connector client.Connector, d *schema.ResourceData, gwID string, isT0 bool, isGlobalManager bool) error { +func patchNsxtPolicyGatewayDNSForwarder(sessionContext utl.SessionContext, connector client.Connector, d *schema.ResourceData, gwID string, isT0 bool) error { displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -168,25 +148,11 @@ func patchNsxtPolicyGatewayDNSForwarder(connector client.Connector, d *schema.Re obj.CacheSize = &cacheSize } - if isGlobalManager { - rawObj, err := convertModelBindingType(obj, model.PolicyDnsForwarderBindingType(), gm_model.PolicyDnsForwarderBindingType()) - if err != nil { - return err - } - if isT0 { - client := gm_tier_0s.NewDnsForwarderClient(connector) - return client.Patch(gwID, rawObj.(gm_model.PolicyDnsForwarder)) - } - - client := gm_tier_1s.NewDnsForwarderClient(connector) - return client.Patch(gwID, rawObj.(gm_model.PolicyDnsForwarder)) - - } if isT0 { - client := tier_0s.NewDnsForwarderClient(connector) + client := tier0s.NewDnsForwarderClient(sessionContext, connector) return client.Patch(gwID, obj) } - client := tier_1s.NewDnsForwarderClient(connector) + client := tier1s.NewDnsForwarderClient(sessionContext, connector) return client.Patch(gwID, obj) } @@ -198,26 +164,16 @@ func resourceNsxtPolicyGatewayDNSForwarderCreate(d *schema.ResourceData, m inter if gwID == "" { return fmt.Errorf("gateway_path is not valid") } - isGlobalManager := isPolicyGlobalManager(m) // Verify DNS forwarder is not yet defined for this Gateway var err error - if isGlobalManager { - if isT0 { - client := gm_tier_0s.NewDnsForwarderClient(connector) - _, err = client.Get(gwID) - } else { - client := gm_tier_1s.NewDnsForwarderClient(connector) - _, err = client.Get(gwID) - } + sessionContext := getSessionContext(d, m) + if isT0 { + client := tier0s.NewDnsForwarderClient(sessionContext, connector) + _, err = client.Get(gwID) } else { - if isT0 { - client := tier_0s.NewDnsForwarderClient(connector) - _, err = client.Get(gwID) - } else { - client := tier_1s.NewDnsForwarderClient(connector) - _, err = client.Get(gwID) - } + client := tier1s.NewDnsForwarderClient(sessionContext, connector) + _, err = client.Get(gwID) } if err == nil { return fmt.Errorf("Gateway Dns Forwarder already exists for Gateway '%s'", gwID) @@ -227,7 +183,7 @@ func resourceNsxtPolicyGatewayDNSForwarderCreate(d *schema.ResourceData, m inter log.Printf("[INFO] Creating Dns Forwarder for Gateway %s", gwID) - err = patchNsxtPolicyGatewayDNSForwarder(connector, d, gwID, isT0, isGlobalManager) + err = patchNsxtPolicyGatewayDNSForwarder(sessionContext, connector, d, gwID, isT0) if err != nil { return handleCreateError("Gateway Dns Forwarder", gwID, err) } @@ -246,7 +202,7 @@ func resourceNsxtPolicyGatewayDNSForwarderUpdate(d *schema.ResourceData, m inter } log.Printf("[INFO] Updating Gateway Dns Forwarder with ID %s", gwID) - err := patchNsxtPolicyGatewayDNSForwarder(connector, d, gwID, isT0, isPolicyGlobalManager(m)) + err := patchNsxtPolicyGatewayDNSForwarder(getSessionContext(d, m), connector, d, gwID, isT0) if err != nil { return handleUpdateError("Gateway Dns Forwarder", gwID, err) } @@ -256,7 +212,6 @@ func resourceNsxtPolicyGatewayDNSForwarderUpdate(d *schema.ResourceData, m inter func resourceNsxtPolicyGatewayDNSForwarderDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - isGlobalManager := isPolicyGlobalManager(m) gwPolicyPath := d.Get("gateway_path").(string) isT0, gwID := parseGatewayPolicyPath(gwPolicyPath) @@ -265,22 +220,13 @@ func resourceNsxtPolicyGatewayDNSForwarderDelete(d *schema.ResourceData, m inter } var err error - if isGlobalManager { - if isT0 { - client := gm_tier_0s.NewDnsForwarderClient(connector) - err = client.Delete(gwID) - } else { - client := gm_tier_1s.NewDnsForwarderClient(connector) - err = client.Delete(gwID) - } + sessionContext := getSessionContext(d, m) + if isT0 { + client := tier0s.NewDnsForwarderClient(sessionContext, connector) + err = client.Delete(gwID) } else { - if isT0 { - client := tier_0s.NewDnsForwarderClient(connector) - err = client.Delete(gwID) - } else { - client := tier_1s.NewDnsForwarderClient(connector) - err = client.Delete(gwID) - } + client := tier1s.NewDnsForwarderClient(sessionContext, connector) + err = client.Delete(gwID) } if err != nil { return handleDeleteError("Gateway Dns Forwarder", gwID, err) diff --git a/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go b/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go index 0a53bd1fd..6da98f59f 100644 --- a/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go +++ b/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go @@ -146,7 +146,7 @@ func testAccNsxtPolicyGatewayDNSForwarderExists(resourceName string) resource.Te gwPath := rs.Primary.Attributes["gateway_path"] isT0, gwID := parseGatewayPolicyPath(gwPath) - _, err := policyGatewayDNSForwarderGet(connector, gwID, isT0, testAccIsGlobalManager()) + _, err := policyGatewayDNSForwarderGet(testAccGetSessionContext(), connector, gwID, isT0) if err != nil { return fmt.Errorf("Policy Gateway DNS Forwarder resource does not exist on %s", gwPath) } @@ -166,7 +166,7 @@ func testAccNsxtPolicyGatewayDNSForwarderCheckDestroy(state *terraform.State, di gwPath := rs.Primary.Attributes["gateway_path"] isT0, gwID := parseGatewayPolicyPath(gwPath) - _, err := policyGatewayDNSForwarderGet(connector, gwID, isT0, testAccIsGlobalManager()) + _, err := policyGatewayDNSForwarderGet(testAccGetSessionContext(), connector, gwID, isT0) if err == nil { return fmt.Errorf("Policy Gateway DNS Forwarder %s still exists", displayName) } diff --git a/nsxt/resource_nsxt_policy_gateway_policy.go b/nsxt/resource_nsxt_policy_gateway_policy.go index abbfdd680..a350ceeb4 100644 --- a/nsxt/resource_nsxt_policy_gateway_policy.go +++ b/nsxt/resource_nsxt_policy_gateway_policy.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_domains "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyGatewayPolicy() *schema.Resource { @@ -30,26 +30,14 @@ func resourceNsxtPolicyGatewayPolicy() *schema.Resource { } } -func getGatewayPolicyInDomain(id string, domainName string, connector client.Connector, isGlobalManager bool) (model.GatewayPolicy, error) { - if isGlobalManager { - client := gm_domains.NewGatewayPoliciesClient(connector) - gmObj, err := client.Get(domainName, id) - if err != nil { - return model.GatewayPolicy{}, err - } - rawObj, convErr := convertModelBindingType(gmObj, gm_model.GatewayPolicyBindingType(), model.GatewayPolicyBindingType()) - if convErr != nil { - return model.GatewayPolicy{}, convErr - } - return rawObj.(model.GatewayPolicy), nil - } - client := domains.NewGatewayPoliciesClient(connector) +func getGatewayPolicyInDomain(sessionContext utl.SessionContext, id string, domainName string, connector client.Connector) (model.GatewayPolicy, error) { + client := domains.NewGatewayPoliciesClient(sessionContext, connector) return client.Get(domainName, id) } -func resourceNsxtPolicyGatewayPolicyExistsInDomain(id string, domainName string, connector client.Connector, isGlobalManager bool) (bool, error) { - _, err := getGatewayPolicyInDomain(id, domainName, connector, isGlobalManager) +func resourceNsxtPolicyGatewayPolicyExistsInDomain(sessionContext utl.SessionContext, id string, domainName string, connector client.Connector) (bool, error) { + _, err := getGatewayPolicyInDomain(sessionContext, id, domainName, connector) if err == nil { return true, nil @@ -62,9 +50,9 @@ func resourceNsxtPolicyGatewayPolicyExistsInDomain(id string, domainName string, return false, logAPIError("Error retrieving Gateway Policy", err) } -func resourceNsxtPolicyGatewayPolicyExistsPartial(domainName string) func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return resourceNsxtPolicyGatewayPolicyExistsInDomain(id, domainName, connector, isGlobalManager) +func resourceNsxtPolicyGatewayPolicyExistsPartial(domainName string) func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return resourceNsxtPolicyGatewayPolicyExistsInDomain(sessionContext, id, domainName, connector) } } @@ -171,14 +159,14 @@ func policyGatewayPolicyBuildAndPatch(d *schema.ResourceData, m interface{}, con obj.Children = policyChildren } - return gatewayPolicyInfraPatch(obj, domain, m) + return gatewayPolicyInfraPatch(getSessionContext(d, m), obj, domain, m) } func resourceNsxtPolicyGatewayPolicyCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyGatewayPolicyExistsPartial(d.Get("domain").(string))) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyGatewayPolicyExistsPartial(d.Get("domain").(string))) if err != nil { return err } @@ -202,7 +190,7 @@ func resourceNsxtPolicyGatewayPolicyRead(d *schema.ResourceData, m interface{}) return fmt.Errorf("Error obtaining Gateway Policy ID") } - obj, err := getGatewayPolicyInDomain(id, d.Get("domain").(string), connector, isPolicyGlobalManager(m)) + obj, err := getGatewayPolicyInDomain(getSessionContext(d, m), id, d.Get("domain").(string), connector) if err != nil { return handleReadError(d, "Gateway Policy", id, err) } @@ -249,14 +237,8 @@ func resourceNsxtPolicyGatewayPolicyDelete(d *schema.ResourceData, m interface{} } connector := getPolicyConnector(m) - var err error - if isPolicyGlobalManager(m) { - client := gm_domains.NewGatewayPoliciesClient(connector) - err = client.Delete(d.Get("domain").(string), id) - } else { - client := domains.NewGatewayPoliciesClient(connector) - err = client.Delete(d.Get("domain").(string), id) - } + client := domains.NewGatewayPoliciesClient(getSessionContext(d, m), connector) + err := client.Delete(d.Get("domain").(string), id) if err != nil { return handleDeleteError("Gateway Policy", id, err) } diff --git a/nsxt/resource_nsxt_policy_gateway_policy_test.go b/nsxt/resource_nsxt_policy_gateway_policy_test.go index 3be2028f0..2b0460b85 100644 --- a/nsxt/resource_nsxt_policy_gateway_policy_test.go +++ b/nsxt/resource_nsxt_policy_gateway_policy_test.go @@ -541,7 +541,7 @@ func testAccNsxtPolicyGatewayPolicyExists(resourceName string, domainName string return fmt.Errorf("Policy GatewayPolicy resource ID not set in resources") } - exists, err := resourceNsxtPolicyGatewayPolicyExistsInDomain(resourceID, domainName, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyGatewayPolicyExistsInDomain(testAccGetSessionContext(), resourceID, domainName, connector) if err != nil { return err } @@ -561,7 +561,7 @@ func testAccNsxtPolicyGatewayPolicyCheckDestroy(state *terraform.State, displayN } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyGatewayPolicyExistsInDomain(resourceID, domainName, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyGatewayPolicyExistsInDomain(testAccGetSessionContext(), resourceID, domainName, connector) if err != nil { return err } diff --git a/nsxt/resource_nsxt_policy_gateway_redistribution_config.go b/nsxt/resource_nsxt_policy_gateway_redistribution_config.go index bbdb0abb1..2e459b7f0 100644 --- a/nsxt/resource_nsxt_policy_gateway_redistribution_config.go +++ b/nsxt/resource_nsxt_policy_gateway_redistribution_config.go @@ -8,10 +8,9 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - gm_tier0s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + tier0s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_0s" ) func resourceNsxtPolicyGatewayRedistributionConfig() *schema.Resource { @@ -86,17 +85,7 @@ func policyGatewayRedistributionConfigPatch(d *schema.ResourceData, m interface{ } doPatch := func() error { - if isPolicyGlobalManager(m) { - // Use patch to only update the relevant fields - rawObj, errConv := convertModelBindingType(serviceStruct, model.LocaleServicesBindingType(), gm_model.LocaleServicesBindingType()) - if errConv != nil { - return errConv - } - client := gm_tier0s.NewLocaleServicesClient(connector) - return client.Patch(gwID, localeServiceID, rawObj.(gm_model.LocaleServices)) - - } - client := tier_0s.NewLocaleServicesClient(connector) + client := tier0s.NewLocaleServicesClient(getSessionContext(d, m), connector) return client.Patch(gwID, localeServiceID, serviceStruct) } // since redistribution config is not a separate API endpoint, but sub-clause of Tier0, @@ -115,11 +104,12 @@ func resourceNsxtPolicyGatewayRedistributionConfigCreate(d *schema.ResourceData, } localeServiceID := "" + context := getSessionContext(d, m) if isPolicyGlobalManager(m) { if sitePath == "" { return attributeRequiredGlobalManagerError("site_path", "nsxt_policy_gateway_redistribution_config") } - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, gwID, true) + localeServices, err := listPolicyTier0GatewayLocaleServices(context, connector, gwID) if err != nil { return err } @@ -131,7 +121,7 @@ func resourceNsxtPolicyGatewayRedistributionConfigCreate(d *schema.ResourceData, if sitePath != "" { return globalManagerOnlyError() } - localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(gwID, connector) + localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(context, gwID, connector) if err != nil { return err } @@ -164,25 +154,10 @@ func resourceNsxtPolicyGatewayRedistributionConfigRead(d *schema.ResourceData, m return fmt.Errorf("Error obtaining Tier0 Gateway id or Locale Service id") } - var obj model.LocaleServices - if isPolicyGlobalManager(m) { - client := gm_tier0s.NewLocaleServicesClient(connector) - gmObj, err1 := client.Get(gwID, localeServiceID) - if err1 != nil { - return handleReadError(d, "Tier0 Redistribution Config", id, err1) - } - lmObj, err2 := convertModelBindingType(gmObj, model.LocaleServicesBindingType(), model.LocaleServicesBindingType()) - if err2 != nil { - return err2 - } - obj = lmObj.(model.LocaleServices) - } else { - var err error - client := tier_0s.NewLocaleServicesClient(connector) - obj, err = client.Get(gwID, localeServiceID) - if err != nil { - return handleReadError(d, "Tier0 Redistribution Config", id, err) - } + client := tier0s.NewLocaleServicesClient(getSessionContext(d, m), connector) + obj, err := client.Get(gwID, localeServiceID) + if err != nil { + return handleReadError(d, "Tier0 Redistribution Config", id, err) } config := obj.RouteRedistributionConfig @@ -230,17 +205,7 @@ func resourceNsxtPolicyGatewayRedistributionConfigDelete(d *schema.ResourceData, // Update the locale service with empty Redistribution config using get/post doUpdate := func() error { - if isPolicyGlobalManager(m) { - client := gm_tier0s.NewLocaleServicesClient(connector) - gmObj, err := client.Get(gwID, localeServiceID) - if err != nil { - return err - } - gmObj.RouteRedistributionConfig = nil - _, err = client.Update(gwID, localeServiceID, gmObj) - return err - } - client := tier_0s.NewLocaleServicesClient(connector) + client := tier0s.NewLocaleServicesClient(getSessionContext(d, m), connector) obj, err := client.Get(gwID, localeServiceID) if err != nil { return err @@ -270,18 +235,10 @@ func resourceNsxtPolicyGatewayRedistributionConfigImport(d *schema.ResourceData, gwID := s[0] localeServiceID := s[1] connector := getPolicyConnector(m) - if isPolicyGlobalManager(m) { - client := gm_tier0s.NewLocaleServicesClient(connector) - obj, err := client.Get(gwID, localeServiceID) - if err != nil || obj.RouteRedistributionConfig == nil { - return nil, fmt.Errorf("Failed to retrieve redistribution config for locale service %s on gateway %s", localeServiceID, gwID) - } - } else { - client := tier_0s.NewLocaleServicesClient(connector) - obj, err := client.Get(gwID, localeServiceID) - if err != nil || obj.RouteRedistributionConfig == nil { - return nil, fmt.Errorf("Failed to retrieve redistribution config for locale service %s on gateway %s", localeServiceID, gwID) - } + client := tier0s.NewLocaleServicesClient(getSessionContext(d, m), connector) + obj, err := client.Get(gwID, localeServiceID) + if err != nil || obj.RouteRedistributionConfig == nil { + return nil, fmt.Errorf("Failed to retrieve redistribution config for locale service %s on gateway %s", localeServiceID, gwID) } d.Set("gateway_id", gwID) diff --git a/nsxt/resource_nsxt_policy_group.go b/nsxt/resource_nsxt_policy_group.go index cf8fcd1c9..80ddc0ab4 100644 --- a/nsxt/resource_nsxt_policy_group.go +++ b/nsxt/resource_nsxt_policy_group.go @@ -13,10 +13,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_domains "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var conditionKeyValues = []string{ @@ -100,6 +100,7 @@ func resourceNsxtPolicyGroup() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "domain": getDomainNameSchema(), "group_type": { Type: schema.TypeString, @@ -316,15 +317,9 @@ func getExtendedCriteriaSetSchema() *schema.Resource { } } -func resourceNsxtPolicyGroupExistsInDomain(id string, domain string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_domains.NewGroupsClient(connector) - _, err = client.Get(domain, id) - } else { - client := domains.NewGroupsClient(connector) - _, err = client.Get(domain, id) - } +func resourceNsxtPolicyGroupExistsInDomain(sessionContext utl.SessionContext, id string, domain string, connector client.Connector) (bool, error) { + client := domains.NewGroupsClient(sessionContext, connector) + _, err := client.Get(domain, id) if err == nil { return true, nil } @@ -337,9 +332,9 @@ func resourceNsxtPolicyGroupExistsInDomain(id string, domain string, connector c } -func resourceNsxtPolicyGroupExistsInDomainPartial(domain string) func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return resourceNsxtPolicyGroupExistsInDomain(id, domain, connector, isGlobalManager) +func resourceNsxtPolicyGroupExistsInDomainPartial(domain string) func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return resourceNsxtPolicyGroupExistsInDomain(sessionContext, id, domain, connector) } } @@ -837,7 +832,7 @@ func resourceNsxtPolicyGroupCreate(d *schema.ResourceData, m interface{}) error connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyGroupExistsInDomainPartial(d.Get("domain").(string))) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyGroupExistsInDomainPartial(d.Get("domain").(string))) if err != nil { return err } @@ -883,17 +878,9 @@ func resourceNsxtPolicyGroupCreate(d *schema.ResourceData, m interface{}) error obj.GroupType = groupTypes } - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.GroupBindingType(), gm_model.GroupBindingType()) - if err1 != nil { - return err1 - } - client := gm_domains.NewGroupsClient(connector) - err = client.Patch(d.Get("domain").(string), id, gmObj.(gm_model.Group)) - } else { - client := domains.NewGroupsClient(connector) - err = client.Patch(d.Get("domain").(string), id, obj) - } + client := domains.NewGroupsClient(getSessionContext(d, m), connector) + err = client.Patch(d.Get("domain").(string), id, obj) + // Create the resource using PATCH log.Printf("[INFO] Creating Group with ID %s", id) if err != nil { @@ -913,25 +900,10 @@ func resourceNsxtPolicyGroupRead(d *schema.ResourceData, m interface{}) error { if id == "" { return fmt.Errorf("Error obtaining Group ID") } - var obj model.Group - if isPolicyGlobalManager(m) { - client := gm_domains.NewGroupsClient(connector) - gmObj, err := client.Get(domainName, id) - if err != nil { - return handleReadError(d, "Group", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.GroupBindingType(), model.GroupBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.Group) - } else { - var err error - client := domains.NewGroupsClient(connector) - obj, err = client.Get(domainName, id) - if err != nil { - return handleReadError(d, "Group", id, err) - } + client := domains.NewGroupsClient(getSessionContext(d, m), connector) + obj, err := client.Get(domainName, id) + if err != nil { + return handleReadError(d, "Group", id, err) } d.Set("display_name", obj.DisplayName) d.Set("description", obj.Description) @@ -1019,22 +991,10 @@ func resourceNsxtPolicyGroupUpdate(d *schema.ResourceData, m interface{}) error obj.GroupType = groupTypes } - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.GroupBindingType(), gm_model.GroupBindingType()) - if err1 != nil { - return err1 - } - gmGroup := gmObj.(gm_model.Group) - client := gm_domains.NewGroupsClient(connector) - - // Update the resource using PATCH - err = client.Patch(d.Get("domain").(string), id, gmGroup) - } else { - client := domains.NewGroupsClient(connector) + client := domains.NewGroupsClient(getSessionContext(d, m), connector) - // Update the resource using PATCH - err = client.Patch(d.Get("domain").(string), id, obj) - } + // Update the resource using PATCH + err = client.Patch(d.Get("domain").(string), id, obj) if err != nil { return handleUpdateError("Group", id, err) } @@ -1053,11 +1013,7 @@ func resourceNsxtPolicyGroupDelete(d *schema.ResourceData, m interface{}) error failIfSubtreeExists := false doDelete := func() error { - if isPolicyGlobalManager(m) { - client := gm_domains.NewGroupsClient(connector) - return client.Delete(d.Get("domain").(string), id, &failIfSubtreeExists, &forceDelete) - } - client := domains.NewGroupsClient(connector) + client := domains.NewGroupsClient(getSessionContext(d, m), connector) return client.Delete(d.Get("domain").(string), id, &failIfSubtreeExists, &forceDelete) } diff --git a/nsxt/resource_nsxt_policy_group_test.go b/nsxt/resource_nsxt_policy_group_test.go index f9fea983e..bcad83e24 100644 --- a/nsxt/resource_nsxt_policy_group_test.go +++ b/nsxt/resource_nsxt_policy_group_test.go @@ -682,7 +682,7 @@ func testAccNsxtPolicyGroupCheckDestroy(state *terraform.State, displayName stri return fmt.Errorf("Error while retrieving policy domain %s. Error: %v", domainName, errDomain) } } - exists, err := resourceNsxtPolicyGroupExistsInDomain(resourceID, domainID, connector, isPolicyGlobalManager) + exists, err := resourceNsxtPolicyGroupExistsInDomain(testAccGetSessionContext(), resourceID, domainID, connector) if err != nil { return err } diff --git a/nsxt/resource_nsxt_policy_intrusion_service_policy.go b/nsxt/resource_nsxt_policy_intrusion_service_policy.go index 8cdd7aab8..e37593620 100644 --- a/nsxt/resource_nsxt_policy_intrusion_service_policy.go +++ b/nsxt/resource_nsxt_policy_intrusion_service_policy.go @@ -13,6 +13,8 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + tf_api "github.com/vmware/terraform-provider-nsxt/api/utl" ) // TODO: revisit with new SDK if constant is available @@ -27,7 +29,7 @@ func resourceNsxtPolicyIntrusionServicePolicy() *schema.Resource { Importer: &schema.ResourceImporter{ State: nsxtDomainResourceImporter, }, - Schema: getPolicySecurityPolicySchema(true), + Schema: getPolicySecurityPolicySchema(true, false), } } @@ -282,10 +284,10 @@ func updateIdsSecurityPolicy(id string, d *schema.ResourceData, m interface{}) e obj.Children = childRules } - return idsPolicyInfraPatch(obj, domain, m) + return idsPolicyInfraPatch(getSessionContext(d, m), obj, domain, m) } -func idsPolicyInfraPatch(policy model.IdsSecurityPolicy, domain string, m interface{}) error { +func idsPolicyInfraPatch(context tf_api.SessionContext, policy model.IdsSecurityPolicy, domain string, m interface{}) error { childDomain, err := createChildDomainWithIdsSecurityPolicy(domain, *policy.Id, policy) if err != nil { return fmt.Errorf("Failed to create H-API for Ids Policy: %s", err) @@ -300,7 +302,7 @@ func idsPolicyInfraPatch(policy model.IdsSecurityPolicy, domain string, m interf ResourceType: &infraType, } - return policyInfraPatch(infraObj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + return policyInfraPatch(context, infraObj, getPolicyConnector(m), false) } diff --git a/nsxt/resource_nsxt_policy_ip_address_allocation.go b/nsxt/resource_nsxt_policy_ip_address_allocation.go index a6a6c4e57..afaccd2e2 100644 --- a/nsxt/resource_nsxt_policy_ip_address_allocation.go +++ b/nsxt/resource_nsxt_policy_ip_address_allocation.go @@ -11,9 +11,11 @@ import ( "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + ippools "github.com/vmware/terraform-provider-nsxt/api/infra/ip_pools" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyIPAddressAllocation() *schema.Resource { @@ -33,6 +35,7 @@ func resourceNsxtPolicyIPAddressAllocation() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "pool_path": getPolicyPathSchema(true, true, "The path of the IP Pool for this allocation"), "allocation_ip": { Type: schema.TypeString, @@ -46,8 +49,8 @@ func resourceNsxtPolicyIPAddressAllocation() *schema.Resource { } } -func resourceNsxtPolicyIPAddressAllocationExists(poolID string, allocationID string, connector client.Connector) (bool, error) { - client := ip_pools.NewIpAllocationsClient(connector) +func resourceNsxtPolicyIPAddressAllocationExists(sessionContext utl.SessionContext, poolID string, allocationID string, connector client.Connector) (bool, error) { + client := ippools.NewIpAllocationsClient(sessionContext, connector) _, err := client.Get(poolID, allocationID) if err == nil { @@ -63,7 +66,8 @@ func resourceNsxtPolicyIPAddressAllocationExists(poolID string, allocationID str func resourceNsxtPolicyIPAddressAllocationCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpAllocationsClient(connector) + sessionContext := getSessionContext(d, m) + client := ippools.NewIpAllocationsClient(sessionContext, connector) if client == nil { return policyResourceNotSupportedError() @@ -77,7 +81,7 @@ func resourceNsxtPolicyIPAddressAllocationCreate(d *schema.ResourceData, m inter id = uuid.String() } - exists, err := resourceNsxtPolicyIPAddressAllocationExists(poolID, id, connector) + exists, err := resourceNsxtPolicyIPAddressAllocationExists(sessionContext, poolID, id, connector) if err != nil { return err } @@ -115,7 +119,7 @@ func resourceNsxtPolicyIPAddressAllocationCreate(d *schema.ResourceData, m inter func resourceNsxtPolicyIPAddressAllocationRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpAllocationsClient(connector) + client := ippools.NewIpAllocationsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() @@ -166,7 +170,7 @@ func resourceNsxtPolicyIPAddressAllocationRead(d *schema.ResourceData, m interfa func resourceNsxtPolicyIPAddressAllocationUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpAllocationsClient(connector) + client := ippools.NewIpAllocationsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() @@ -200,7 +204,7 @@ func resourceNsxtPolicyIPAddressAllocationUpdate(d *schema.ResourceData, m inter func resourceNsxtPolicyIPAddressAllocationDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpAllocationsClient(connector) + client := ippools.NewIpAllocationsClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } @@ -229,7 +233,7 @@ func resourceNsxtPolicyIPAddressAllocationImport(d *schema.ResourceData, m inter poolID := s[0] connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) pool, err := client.Get(poolID) if err != nil { diff --git a/nsxt/resource_nsxt_policy_ip_block.go b/nsxt/resource_nsxt_policy_ip_block.go index d17b248b9..0fcc00484 100644 --- a/nsxt/resource_nsxt_policy_ip_block.go +++ b/nsxt/resource_nsxt_policy_ip_block.go @@ -9,8 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyIPBlock() *schema.Resource { @@ -30,6 +32,7 @@ func resourceNsxtPolicyIPBlock() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "cidr": { Type: schema.TypeString, Description: "Network address and the prefix length which will be associated with a layer-2 broadcast domain", @@ -40,8 +43,8 @@ func resourceNsxtPolicyIPBlock() *schema.Resource { } } -func resourceNsxtPolicyIPBlockExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - client := infra.NewIpBlocksClient(connector) +func resourceNsxtPolicyIPBlockExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewIpBlocksClient(sessionContext, connector) _, err := client.Get(id) if err == nil { @@ -57,7 +60,7 @@ func resourceNsxtPolicyIPBlockExists(id string, connector client.Connector, isGl func resourceNsxtPolicyIPBlockRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpBlocksClient(connector) + client := infra.NewIpBlocksClient(getSessionContext(d, m), connector) id := d.Id() if id == "" { @@ -82,9 +85,9 @@ func resourceNsxtPolicyIPBlockRead(d *schema.ResourceData, m interface{}) error func resourceNsxtPolicyIPBlockCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpBlocksClient(connector) + client := infra.NewIpBlocksClient(getSessionContext(d, m), connector) - id, err := getOrGenerateID(d, m, resourceNsxtPolicyIPBlockExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyIPBlockExists) if err != nil { return err } @@ -115,7 +118,7 @@ func resourceNsxtPolicyIPBlockCreate(d *schema.ResourceData, m interface{}) erro func resourceNsxtPolicyIPBlockUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpBlocksClient(connector) + client := infra.NewIpBlocksClient(getSessionContext(d, m), connector) id := d.Id() if id == "" { @@ -153,7 +156,7 @@ func resourceNsxtPolicyIPBlockDelete(d *schema.ResourceData, m interface{}) erro } connector := getPolicyConnector(m) - client := infra.NewIpBlocksClient(connector) + client := infra.NewIpBlocksClient(getSessionContext(d, m), connector) err := client.Delete(id) if err != nil { return handleDeleteError("IP Block", id, err) diff --git a/nsxt/resource_nsxt_policy_ip_discovery_profile.go b/nsxt/resource_nsxt_policy_ip_discovery_profile.go index 0612f0541..25987b37a 100644 --- a/nsxt/resource_nsxt_policy_ip_discovery_profile.go +++ b/nsxt/resource_nsxt_policy_ip_discovery_profile.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { @@ -33,6 +33,7 @@ func resourceNsxtPolicyIPDiscoveryProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "arp_nd_binding_timeout": { Type: schema.TypeInt, Description: "ARP and ND cache timeout (in minutes)", @@ -153,15 +154,9 @@ func ipDiscoveryProfileObjFromSchema(d *schema.ResourceData) model.IPDiscoveryPr } } -func resourceNsxtPolicyIPDiscoveryProfileExists(id string, connector client.Connector, isGlobalmodel bool) (bool, error) { - var err error - if isGlobalmodel { - client := gm_infra.NewIpDiscoveryProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewIpDiscoveryProfilesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyIPDiscoveryProfileExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewIpDiscoveryProfilesClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -177,7 +172,7 @@ func resourceNsxtPolicyIPDiscoveryProfileCreate(d *schema.ResourceData, m interf connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyIPDiscoveryProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyIPDiscoveryProfileExists) if err != nil { return err } @@ -187,18 +182,8 @@ func resourceNsxtPolicyIPDiscoveryProfileCreate(d *schema.ResourceData, m interf // Create the resource using PATCH log.Printf("[INFO] Creating IPDiscoveryProfile with ID %s", id) boolFalse := false - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.IPDiscoveryProfileBindingType(), gm_model.IPDiscoveryProfileBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewIpDiscoveryProfilesClient(connector) - err = client.Patch(id, gmObj.(gm_model.IPDiscoveryProfile), &boolFalse) - } else { - client := infra.NewIpDiscoveryProfilesClient(connector) - err = client.Patch(id, obj, &boolFalse) - } + client := infra.NewIpDiscoveryProfilesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj, &boolFalse) if err != nil { return handleCreateError("IPDiscoveryProfile", id, err) } @@ -217,26 +202,10 @@ func resourceNsxtPolicyIPDiscoveryProfileRead(d *schema.ResourceData, m interfac return fmt.Errorf("Error obtaining IPDiscoveryProfile ID") } - var obj model.IPDiscoveryProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewIpDiscoveryProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "IPDiscoveryProfile", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.IPDiscoveryProfileBindingType(), model.IPDiscoveryProfileBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.IPDiscoveryProfile) - - } else { - var err error - client := infra.NewIpDiscoveryProfilesClient(connector) - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "IPDiscoveryProfile", id, err) - } + client := infra.NewIpDiscoveryProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "IPDiscoveryProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -263,7 +232,7 @@ func resourceNsxtPolicyIPDiscoveryProfileRead(d *schema.ResourceData, m interfac func resourceNsxtPolicyIPDiscoveryProfileUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpDiscoveryProfilesClient(connector) + client := infra.NewIpDiscoveryProfilesClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } @@ -279,19 +248,7 @@ func resourceNsxtPolicyIPDiscoveryProfileUpdate(d *schema.ResourceData, m interf // Create the resource using PATCH log.Printf("[INFO] Updating IPDiscoveryProfile with ID %s", id) boolFalse := false - var err error - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.IPDiscoveryProfileBindingType(), gm_model.IPDiscoveryProfileBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewIpDiscoveryProfilesClient(connector) - err = client.Patch(id, gmObj.(gm_model.IPDiscoveryProfile), &boolFalse) - } else { - client := infra.NewIpDiscoveryProfilesClient(connector) - err = client.Patch(id, obj, &boolFalse) - } + err := client.Patch(id, obj, &boolFalse) if err != nil { return handleUpdateError("IPDiscoveryProfile", id, err) } @@ -308,13 +265,9 @@ func resourceNsxtPolicyIPDiscoveryProfileDelete(d *schema.ResourceData, m interf var err error connector := getPolicyConnector(m) boolFalse := false - if isPolicyGlobalManager(m) { - client := gm_infra.NewIpDiscoveryProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } else { - client := infra.NewIpDiscoveryProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } + + client := infra.NewIpDiscoveryProfilesClient(getSessionContext(d, m), connector) + err = client.Delete(id, &boolFalse) if err != nil { return handleDeleteError("IPDiscoveryProfile", id, err) diff --git a/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go b/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go index 4ae3d1b5e..e42878dfe 100644 --- a/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go +++ b/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go @@ -165,7 +165,7 @@ func testAccNsxtPolicyIPDiscoveryProfileExists(displayName string, resourceName return fmt.Errorf("Policy IPDiscoveryProfile resource ID not set in resources") } - exists, err := resourceNsxtPolicyIPDiscoveryProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyIPDiscoveryProfileExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -186,7 +186,7 @@ func testAccNsxtPolicyIPDiscoveryProfileCheckDestroy(state *terraform.State, dis } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyIPDiscoveryProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyIPDiscoveryProfileExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_ip_pool.go b/nsxt/resource_nsxt_policy_ip_pool.go index 967b376bf..b4784c9b3 100644 --- a/nsxt/resource_nsxt_policy_ip_pool.go +++ b/nsxt/resource_nsxt_policy_ip_pool.go @@ -9,8 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyIPPool() *schema.Resource { @@ -30,12 +32,13 @@ func resourceNsxtPolicyIPPool() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), }, } } -func resourceNsxtPolicyIPPoolExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - client := infra.NewIpPoolsClient(connector) +func resourceNsxtPolicyIPPoolExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewIpPoolsClient(sessionContext, connector) _, err := client.Get(id) if err == nil { @@ -51,7 +54,7 @@ func resourceNsxtPolicyIPPoolExists(id string, connector client.Connector, isGlo func resourceNsxtPolicyIPPoolRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) id := d.Id() if id == "" { @@ -80,9 +83,9 @@ func resourceNsxtPolicyIPPoolRead(d *schema.ResourceData, m interface{}) error { func resourceNsxtPolicyIPPoolCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) - id, err := getOrGenerateID(d, m, resourceNsxtPolicyIPPoolExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyIPPoolExists) if err != nil { return err } @@ -111,7 +114,7 @@ func resourceNsxtPolicyIPPoolCreate(d *schema.ResourceData, m interface{}) error func resourceNsxtPolicyIPPoolUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) id := d.Id() if id == "" { @@ -142,7 +145,7 @@ func resourceNsxtPolicyIPPoolUpdate(d *schema.ResourceData, m interface{}) error func resourceNsxtPolicyIPPoolDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) id := d.Id() if id == "" { diff --git a/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go b/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go index 8983f7a4b..2a8057ee1 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go +++ b/nsxt/resource_nsxt_policy_ip_pool_block_subnet.go @@ -14,10 +14,12 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + ippools "github.com/vmware/terraform-provider-nsxt/api/infra/ip_pools" + realizedstate "github.com/vmware/terraform-provider-nsxt/api/infra/realized_state" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyIPPoolBlockSubnet() *schema.Resource { @@ -37,6 +39,7 @@ func resourceNsxtPolicyIPPoolBlockSubnet() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "auto_assign_gateway": { Type: schema.TypeBool, Description: "If true, the first IP in the range will be reserved for gateway", @@ -88,7 +91,7 @@ func resourceNsxtPolicyIPPoolBlockSubnetSchemaToStructValue(d *schema.ResourceDa func resourceNsxtPolicyIPPoolBlockSubnetRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) converter := bindings.NewTypeConverter() poolPath := d.Get("pool_path").(string) @@ -131,7 +134,7 @@ func resourceNsxtPolicyIPPoolBlockSubnetRead(d *schema.ResourceData, m interface func resourceNsxtPolicyIPPoolBlockSubnetCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) @@ -166,7 +169,7 @@ func resourceNsxtPolicyIPPoolBlockSubnetCreate(d *schema.ResourceData, m interfa func resourceNsxtPolicyIPPoolBlockSubnetUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) @@ -194,7 +197,7 @@ func resourceNsxtPolicyIPPoolBlockSubnetUpdate(d *schema.ResourceData, m interfa func resourceNsxtPolicyIPPoolBlockSubnetDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) @@ -210,13 +213,13 @@ func resourceNsxtPolicyIPPoolBlockSubnetDelete(d *schema.ResourceData, m interfa return handleDeleteError("Block Subnet", id, err) } - return resourceNsxtPolicyIPPoolBlockSubnetVerifyDelete(d, connector) + return resourceNsxtPolicyIPPoolBlockSubnetVerifyDelete(getSessionContext(d, m), d, connector) } // NOTE: This will not be needed when IPAM is handled by NSXT Policy -func resourceNsxtPolicyIPPoolBlockSubnetVerifyDelete(d *schema.ResourceData, connector client.Connector) error { +func resourceNsxtPolicyIPPoolBlockSubnetVerifyDelete(sessionContext utl.SessionContext, d *schema.ResourceData, connector client.Connector) error { - client := realized_state.NewRealizedEntitiesClient(connector) + client := realizedstate.NewRealizedEntitiesClient(sessionContext, connector) path := d.Get("path").(string) // Wait for realization state to disappear (not_found) - this means @@ -260,7 +263,7 @@ func resourceNsxtPolicyIPPoolSubnetImport(d *schema.ResourceData, m interface{}) poolID := s[0] connector := getPolicyConnector(m) - client := infra.NewIpPoolsClient(connector) + client := infra.NewIpPoolsClient(getSessionContext(d, m), connector) pool, err := client.Get(poolID) if err != nil { diff --git a/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go b/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go index 08593aec7..516f2b1d1 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go +++ b/nsxt/resource_nsxt_policy_ip_pool_static_subnet.go @@ -8,9 +8,9 @@ import ( "log" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + ippools "github.com/vmware/terraform-provider-nsxt/api/infra/ip_pools" "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/ip_pools" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) @@ -31,6 +31,7 @@ func resourceNsxtPolicyIPPoolStaticSubnet() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "pool_path": getPolicyPathSchema(true, true, "Policy path to the IP Pool for this Subnet"), "allocation_range": getAllocationRangeListSchema(true, "A collection of IPv4 or IPv6 IP ranges"), "cidr": { @@ -119,7 +120,7 @@ func resourceNsxtPolicyIPPoolStaticSubnetSchemaToStructValue(d *schema.ResourceD func resourceNsxtPolicyIPPoolStaticSubnetRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) converter := bindings.NewTypeConverter() poolPath := d.Get("pool_path").(string) @@ -172,7 +173,7 @@ func resourceNsxtPolicyIPPoolStaticSubnetRead(d *schema.ResourceData, m interfac func resourceNsxtPolicyIPPoolStaticSubnetCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) @@ -207,7 +208,7 @@ func resourceNsxtPolicyIPPoolStaticSubnetCreate(d *schema.ResourceData, m interf func resourceNsxtPolicyIPPoolStaticSubnetUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) @@ -235,7 +236,7 @@ func resourceNsxtPolicyIPPoolStaticSubnetUpdate(d *schema.ResourceData, m interf func resourceNsxtPolicyIPPoolStaticSubnetDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := ip_pools.NewIpSubnetsClient(connector) + client := ippools.NewIpSubnetsClient(getSessionContext(d, m), connector) poolPath := d.Get("pool_path").(string) poolID := getPolicyIDFromPath(poolPath) diff --git a/nsxt/resource_nsxt_policy_mac_discovery_profile.go b/nsxt/resource_nsxt_policy_mac_discovery_profile.go index 62e878638..e2cf7828a 100644 --- a/nsxt/resource_nsxt_policy_mac_discovery_profile.go +++ b/nsxt/resource_nsxt_policy_mac_discovery_profile.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var macDiscoveryProfileMacLimitPolicyValues = []string{ @@ -38,6 +38,7 @@ func resourceNsxtPolicyMacDiscoveryProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "mac_change_enabled": { Type: schema.TypeBool, Optional: true, @@ -73,15 +74,10 @@ func resourceNsxtPolicyMacDiscoveryProfile() *schema.Resource { } } -func resourceNsxtPolicyMacDiscoveryProfileExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { +func resourceNsxtPolicyMacDiscoveryProfileExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { var err error - if isGlobalManager { - client := gm_infra.NewMacDiscoveryProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewMacDiscoveryProfilesClient(connector) - _, err = client.Get(id) - } + client := infra.NewMacDiscoveryProfilesClient(sessionContext, connector) + _, err = client.Get(id) if err == nil { return true, nil } @@ -97,7 +93,7 @@ func resourceNsxtPolicyMacDiscoveryProfileCreate(d *schema.ResourceData, m inter connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyMacDiscoveryProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyMacDiscoveryProfileExists) if err != nil { return err } @@ -127,17 +123,8 @@ func resourceNsxtPolicyMacDiscoveryProfileCreate(d *schema.ResourceData, m inter // Create the resource using PATCH log.Printf("[INFO] Creating MacDiscoveryProfile with ID %s", id) boolFalse := false - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.MacDiscoveryProfileBindingType(), gm_model.MacDiscoveryProfileBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewMacDiscoveryProfilesClient(connector) - err = client.Patch(id, gmObj.(gm_model.MacDiscoveryProfile), &boolFalse) - } else { - client := infra.NewMacDiscoveryProfilesClient(connector) - err = client.Patch(id, obj, &boolFalse) - } + client := infra.NewMacDiscoveryProfilesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj, &boolFalse) if err != nil { return handleCreateError("MacDiscoveryProfile", id, err) } @@ -156,26 +143,10 @@ func resourceNsxtPolicyMacDiscoveryProfileRead(d *schema.ResourceData, m interfa return fmt.Errorf("Error obtaining MacDiscoveryProfile ID") } - var obj model.MacDiscoveryProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewMacDiscoveryProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "MacDiscoveryProfile", id, err) - } - - lmObj, err := convertModelBindingType(gmObj, gm_model.MacDiscoveryProfileBindingType(), model.MacDiscoveryProfileBindingType()) - if err != nil { - return err - } - obj = lmObj.(model.MacDiscoveryProfile) - } else { - client := infra.NewMacDiscoveryProfilesClient(connector) - var err error - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "MacDiscoveryProfile", id, err) - } + client := infra.NewMacDiscoveryProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "MacDiscoveryProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -230,19 +201,9 @@ func resourceNsxtPolicyMacDiscoveryProfileUpdate(d *schema.ResourceData, m inter } // Update the resource using PATCH - var err error boolFalse := false - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.MacDiscoveryProfileBindingType(), gm_model.MacDiscoveryProfileBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewMacDiscoveryProfilesClient(connector) - _, err = client.Update(id, gmObj.(gm_model.MacDiscoveryProfile), &boolFalse) - } else { - client := infra.NewMacDiscoveryProfilesClient(connector) - _, err = client.Update(id, obj, &boolFalse) - } + client := infra.NewMacDiscoveryProfilesClient(getSessionContext(d, m), connector) + _, err := client.Update(id, obj, &boolFalse) if err != nil { return handleUpdateError("MacDiscoveryProfile", id, err) } @@ -257,15 +218,9 @@ func resourceNsxtPolicyMacDiscoveryProfileDelete(d *schema.ResourceData, m inter } connector := getPolicyConnector(m) - var err error boolFalse := false - if isPolicyGlobalManager(m) { - client := gm_infra.NewMacDiscoveryProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } else { - client := infra.NewMacDiscoveryProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } + client := infra.NewMacDiscoveryProfilesClient(getSessionContext(d, m), connector) + err := client.Delete(id, &boolFalse) if err != nil { return handleDeleteError("MacDiscoveryProfile", id, err) diff --git a/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go b/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go index 2b79a3045..c373e8808 100644 --- a/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go +++ b/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go @@ -134,7 +134,7 @@ func testAccNsxtPolicyMacDiscoveryProfileExists(displayName string, resourceName return fmt.Errorf("Policy MacDiscoveryProfile resource ID not set in resources") } - exists, err := resourceNsxtPolicyMacDiscoveryProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyMacDiscoveryProfileExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -155,7 +155,7 @@ func testAccNsxtPolicyMacDiscoveryProfileCheckDestroy(state *terraform.State, di } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyMacDiscoveryProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyMacDiscoveryProfileExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_nat_rule.go b/nsxt/resource_nsxt_policy_nat_rule.go index a7d10a460..e2f99e10c 100644 --- a/nsxt/resource_nsxt_policy_nat_rule.go +++ b/nsxt/resource_nsxt_policy_nat_rule.go @@ -11,14 +11,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_t0nat "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s/nat" - gm_t1nat "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s/nat" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - t0nat "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/nat" - t1nat "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/nat" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + t0nat "github.com/vmware/terraform-provider-nsxt/api/infra/tier_0s/nat" + t1nat "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s/nat" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var policyNATRuleActionTypeValues = []string{ @@ -52,6 +50,7 @@ func resourceNsxtPolicyNATRule() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "gateway_path": getPolicyGatewayPathSchema(), "action": { Type: schema.TypeString, @@ -135,20 +134,12 @@ func resourceNsxtPolicyNATRule() *schema.Resource { } } -func deleteNsxtPolicyNATRule(connector client.Connector, gwID string, isT0 bool, natType string, ruleID string, isGlobalManager bool) error { - if isGlobalManager { - if isT0 { - client := gm_t0nat.NewNatRulesClient(connector) - return client.Delete(gwID, natType, ruleID) - } - client := gm_t1nat.NewNatRulesClient(connector) - return client.Delete(gwID, natType, ruleID) - } +func deleteNsxtPolicyNATRule(sessionContext utl.SessionContext, connector client.Connector, gwID string, isT0 bool, natType string, ruleID string) error { if isT0 { - client := t0nat.NewNatRulesClient(connector) + client := t0nat.NewNatRulesClient(sessionContext, connector) return client.Delete(gwID, natType, ruleID) } - client := t1nat.NewNatRulesClient(connector) + client := t1nat.NewNatRulesClient(sessionContext, connector) return client.Delete(gwID, natType, ruleID) } @@ -166,7 +157,7 @@ func resourceNsxtPolicyNATRuleDelete(d *schema.ResourceData, m interface{}) erro action := d.Get("action").(string) natType := getNatTypeByAction(action) - err := deleteNsxtPolicyNATRule(getPolicyConnector(m), gwID, isT0, natType, id, isPolicyGlobalManager(m)) + err := deleteNsxtPolicyNATRule(getSessionContext(d, m), getPolicyConnector(m), gwID, isT0, natType, id) if err != nil { return handleDeleteError("NAT Rule", id, err) } @@ -174,59 +165,26 @@ func resourceNsxtPolicyNATRuleDelete(d *schema.ResourceData, m interface{}) erro return nil } -func getNsxtPolicyNATRuleByID(connector client.Connector, gwID string, isT0 bool, natType string, ruleID string, isGlobalManager bool) (model.PolicyNatRule, error) { - if isGlobalManager { - var obj model.PolicyNatRule - var gmObj gm_model.PolicyNatRule - var rawObj interface{} - var err error - if isT0 { - client := gm_t0nat.NewNatRulesClient(connector) - gmObj, err = client.Get(gwID, natType, ruleID) - } else { - client := gm_t1nat.NewNatRulesClient(connector) - gmObj, err = client.Get(gwID, natType, ruleID) - } - if err != nil { - return obj, err - } - rawObj, err = convertModelBindingType(gmObj, gm_model.PolicyNatRuleBindingType(), model.PolicyNatRuleBindingType()) - if err != nil { - return obj, err - } - return rawObj.(model.PolicyNatRule), err - } +func getNsxtPolicyNATRuleByID(sessionContext utl.SessionContext, connector client.Connector, gwID string, isT0 bool, natType string, ruleID string) (model.PolicyNatRule, error) { if isT0 { - client := t0nat.NewNatRulesClient(connector) + client := t0nat.NewNatRulesClient(sessionContext, connector) return client.Get(gwID, natType, ruleID) } - client := t1nat.NewNatRulesClient(connector) + client := t1nat.NewNatRulesClient(sessionContext, connector) return client.Get(gwID, natType, ruleID) } -func patchNsxtPolicyNATRule(connector client.Connector, gwID string, rule model.PolicyNatRule, isT0 bool, isGlobalManager bool) error { +func patchNsxtPolicyNATRule(sessionContext utl.SessionContext, connector client.Connector, gwID string, rule model.PolicyNatRule, isT0 bool) error { natType := getNatTypeByAction(*rule.Action) _, err := getTranslatedNetworks(rule) if err != nil { return err } - if isGlobalManager { - rawObj, err := convertModelBindingType(rule, model.PolicyNatRuleBindingType(), gm_model.PolicyNatRuleBindingType()) - if err != nil { - return err - } - if isT0 { - client := gm_t0nat.NewNatRulesClient(connector) - return client.Patch(gwID, natType, *rule.Id, rawObj.(gm_model.PolicyNatRule)) - } - client := gm_t1nat.NewNatRulesClient(connector) - return client.Patch(gwID, natType, *rule.Id, rawObj.(gm_model.PolicyNatRule)) - } if isT0 { - client := t0nat.NewNatRulesClient(connector) + client := t0nat.NewNatRulesClient(sessionContext, connector) return client.Patch(gwID, natType, *rule.Id, rule) } - client := t1nat.NewNatRulesClient(connector) + client := t1nat.NewNatRulesClient(sessionContext, connector) return client.Patch(gwID, natType, *rule.Id, rule) } @@ -267,7 +225,7 @@ func resourceNsxtPolicyNATRuleRead(d *schema.ResourceData, m interface{}) error action := d.Get("action").(string) natType := getNatTypeByAction(action) - obj, err := getNsxtPolicyNATRuleByID(connector, gwID, isT0, natType, id, isPolicyGlobalManager(m)) + obj, err := getNsxtPolicyNATRuleByID(getSessionContext(d, m), connector, gwID, isT0, natType, id) if err != nil { return handleReadError(d, "NAT Rule", id, err) } @@ -311,13 +269,12 @@ func resourceNsxtPolicyNATRuleCreate(d *schema.ResourceData, m interface{}) erro if gwID == "" { return fmt.Errorf("gateway_path is not valid") } - isGlobalManager := isPolicyGlobalManager(m) id := d.Get("nsx_id").(string) if id == "" { id = newUUID() } else { - _, err := getNsxtPolicyNATRuleByID(connector, gwID, isT0, natType, id, isGlobalManager) + _, err := getNsxtPolicyNATRuleByID(getSessionContext(d, m), connector, gwID, isT0, natType, id) if err == nil { return fmt.Errorf("NAT Rule with nsx_id '%s' already exists", id) } else if !isNotFoundError(err) { @@ -365,7 +322,7 @@ func resourceNsxtPolicyNATRuleCreate(d *schema.ResourceData, m interface{}) erro log.Printf("[INFO] Creating NAT Rule with ID %s", id) - err := patchNsxtPolicyNATRule(connector, gwID, ruleStruct, isT0, isGlobalManager) + err := patchNsxtPolicyNATRule(getSessionContext(d, m), connector, gwID, ruleStruct, isT0) if err != nil { return handleCreateError("NAT Rule", id, err) } @@ -430,7 +387,7 @@ func resourceNsxtPolicyNATRuleUpdate(d *schema.ResourceData, m interface{}) erro } log.Printf("[INFO] Updating NAT Rule with ID %s", id) - err := patchNsxtPolicyNATRule(connector, gwID, ruleStruct, isT0, isPolicyGlobalManager(m)) + err := patchNsxtPolicyNATRule(getSessionContext(d, m), connector, gwID, ruleStruct, isT0) if err != nil { return handleUpdateError("NAT Rule", id, err) } @@ -457,38 +414,20 @@ func resourceNsxtPolicyNATRuleImport(d *schema.ResourceData, m interface{}) ([]* gwID := s[0] connector := getPolicyConnector(m) - if isPolicyGlobalManager(m) { - t0Client := gm_infra.NewTier0sClient(connector) - t0gw, err := t0Client.Get(gwID) - if err != nil { - if !isNotFoundError(err) { - return nil, err - } - t1Client := gm_infra.NewTier1sClient(connector) - t1gw, err := t1Client.Get(gwID) - if err != nil { - return nil, err - } - d.Set("gateway_path", t1gw.Path) - } else { - d.Set("gateway_path", t0gw.Path) + t0Client := infra.NewTier0sClient(getSessionContext(d, m), connector) + t0gw, err := t0Client.Get(gwID) + if err != nil { + if !isNotFoundError(err) { + return nil, err } - } else { - t0Client := infra.NewTier0sClient(connector) - t0gw, err := t0Client.Get(gwID) + t1Client := infra.NewTier1sClient(getSessionContext(d, m), connector) + t1gw, err := t1Client.Get(gwID) if err != nil { - if !isNotFoundError(err) { - return nil, err - } - t1Client := infra.NewTier1sClient(connector) - t1gw, err := t1Client.Get(gwID) - if err != nil { - return nil, err - } - d.Set("gateway_path", t1gw.Path) - } else { - d.Set("gateway_path", t0gw.Path) + return nil, err } + d.Set("gateway_path", t1gw.Path) + } else { + d.Set("gateway_path", t0gw.Path) } d.SetId(s[1]) diff --git a/nsxt/resource_nsxt_policy_nat_rule_test.go b/nsxt/resource_nsxt_policy_nat_rule_test.go index ab7958214..877ef91c0 100644 --- a/nsxt/resource_nsxt_policy_nat_rule_test.go +++ b/nsxt/resource_nsxt_policy_nat_rule_test.go @@ -360,7 +360,7 @@ func testAccNsxtPolicyNATRuleExists(resourceName string, isNat bool) resource.Te natType = model.PolicyNat_NAT_TYPE_NAT64 } isT0, gwID := parseGatewayPolicyPath(gwPath) - _, err := getNsxtPolicyNATRuleByID(connector, gwID, isT0, natType, resourceID, testAccIsGlobalManager()) + _, err := getNsxtPolicyNATRuleByID(testAccGetSessionContext(), connector, gwID, isT0, natType, resourceID) if err != nil { return fmt.Errorf("Error while retrieving policy NAT Rule ID %s. Error: %v", resourceID, err) } @@ -384,7 +384,7 @@ func testAccNsxtPolicyNATRuleCheckDestroy(state *terraform.State, displayName st if isNat { natType = model.PolicyNat_NAT_TYPE_NAT64 } - _, err := getNsxtPolicyNATRuleByID(connector, gwID, isT0, natType, resourceID, testAccIsGlobalManager()) + _, err := getNsxtPolicyNATRuleByID(testAccGetSessionContext(), connector, gwID, isT0, natType, resourceID) if err == nil { return fmt.Errorf("Policy NAT Rule %s still exists", displayName) } diff --git a/nsxt/resource_nsxt_policy_ospf_config.go b/nsxt/resource_nsxt_policy_ospf_config.go index b72ab900a..11d7677c5 100644 --- a/nsxt/resource_nsxt_policy_ospf_config.go +++ b/nsxt/resource_nsxt_policy_ospf_config.go @@ -142,7 +142,7 @@ func resourceNsxtPolicyOspfConfigCreate(d *schema.ResourceData, m interface{}) e return fmt.Errorf("Tier0 Gateway path expected, got %s", gwPath) } - localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(gwID, connector) + localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(getSessionContext(d, m), gwID, connector) if err != nil { return fmt.Errorf("Tier0 Gateway path with configured edge cluster expected, got %s", gwPath) } diff --git a/nsxt/resource_nsxt_policy_predefined_gateway_policy.go b/nsxt/resource_nsxt_policy_predefined_gateway_policy.go index a17132a36..b49dfca07 100644 --- a/nsxt/resource_nsxt_policy_predefined_gateway_policy.go +++ b/nsxt/resource_nsxt_policy_predefined_gateway_policy.go @@ -13,10 +13,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_domains "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyPredefinedGatewayPolicy() *schema.Resource { @@ -41,6 +41,7 @@ func getPolicyPredefinedGatewayPolicySchema() map[string]*schema.Schema { "rule": getSecurityPolicyAndGatewayRulesSchema(true, false, false), "default_rule": getGatewayPolicyDefaultRulesSchema(), "revision": getRevisionSchema(), + "context": getContextSchema(), } } @@ -261,7 +262,7 @@ func createChildDomainWithGatewayPolicy(domain string, policyID string, policy m return dataValue.(*data.StructValue), nil } -func gatewayPolicyInfraPatch(policy model.GatewayPolicy, domain string, m interface{}) error { +func gatewayPolicyInfraPatch(context utl.SessionContext, policy model.GatewayPolicy, domain string, m interface{}) error { childDomain, err := createChildDomainWithGatewayPolicy(domain, *policy.Id, policy) if err != nil { return fmt.Errorf("Failed to create H-API for Predefined Gateway Policy: %s", err) @@ -276,7 +277,7 @@ func gatewayPolicyInfraPatch(policy model.GatewayPolicy, domain string, m interf ResourceType: &infraType, } - return policyInfraPatch(infraObj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + return policyInfraPatch(context, infraObj, getPolicyConnector(m), false) } @@ -291,7 +292,7 @@ func updatePolicyPredefinedGatewayPolicy(id string, d *schema.ResourceData, m in return fmt.Errorf("Failed to extract domain from Gateway Policy path %s", path) } - predefinedPolicy, err := getGatewayPolicyInDomain(id, domain, connector, isPolicyGlobalManager(m)) + predefinedPolicy, err := getGatewayPolicyInDomain(getSessionContext(d, m), id, domain, connector) if err != nil { return err } @@ -374,7 +375,7 @@ func updatePolicyPredefinedGatewayPolicy(id string, d *schema.ResourceData, m in predefinedPolicy.Children = childRules } - err = gatewayPolicyInfraPatch(predefinedPolicy, domain, m) + err = gatewayPolicyInfraPatch(getSessionContext(d, m), predefinedPolicy, domain, m) if err != nil { return handleUpdateError("Predefined Gateway Policy", id, err) } @@ -411,25 +412,10 @@ func resourceNsxtPolicyPredefinedGatewayPolicyRead(d *schema.ResourceData, m int path := d.Get("path").(string) domain := getDomainFromResourcePath(path) - var obj model.GatewayPolicy - if isPolicyGlobalManager(m) { - client := gm_domains.NewGatewayPoliciesClient(connector) - gmObj, err := client.Get(domain, id) - if err != nil { - return handleReadError(d, "Predefined Gateway Policy", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.GatewayPolicyBindingType(), model.GatewayPolicyBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.GatewayPolicy) - } else { - var err error - client := domains.NewGatewayPoliciesClient(connector) - obj, err = client.Get(domain, id) - if err != nil { - return handleReadError(d, "Predefined Gateway Policy", id, err) - } + client := domains.NewGatewayPoliciesClient(getSessionContext(d, m), connector) + obj, err := client.Get(domain, id) + if err != nil { + return handleReadError(d, "Predefined Gateway Policy", id, err) } d.Set("description", obj.Description) @@ -448,7 +434,7 @@ func resourceNsxtPolicyPredefinedGatewayPolicyRead(d *schema.ResourceData, m int } } - err := setPolicyRulesInSchema(d, rules) + err = setPolicyRulesInSchema(d, rules) if err != nil { return err } @@ -478,7 +464,7 @@ func resourceNsxtPolicyPredefinedGatewayPolicyDelete(d *schema.ResourceData, m i path := d.Get("path").(string) domain := getDomainFromResourcePath(path) - predefinedPolicy, err := getGatewayPolicyInDomain(id, domain, getPolicyConnector(m), isPolicyGlobalManager(m)) + predefinedPolicy, err := getGatewayPolicyInDomain(getSessionContext(d, m), id, domain, getPolicyConnector(m)) if err != nil { return err } @@ -488,7 +474,7 @@ func resourceNsxtPolicyPredefinedGatewayPolicyDelete(d *schema.ResourceData, m i return fmt.Errorf("Failed to revert Predefined Gateway Policy %s: %s", id, err) } - err = gatewayPolicyInfraPatch(revertedPolicy, domain, m) + err = gatewayPolicyInfraPatch(getSessionContext(d, m), revertedPolicy, domain, m) if err != nil { return handleUpdateError("Predefined Gateway Policy", id, err) } diff --git a/nsxt/resource_nsxt_policy_predefined_security_policy.go b/nsxt/resource_nsxt_policy_predefined_security_policy.go index 0064df003..42025ada0 100644 --- a/nsxt/resource_nsxt_policy_predefined_security_policy.go +++ b/nsxt/resource_nsxt_policy_predefined_security_policy.go @@ -12,10 +12,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" - gm_domains "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyPredefinedSecurityPolicy() *schema.Resource { @@ -38,7 +38,8 @@ func getSecurityPolicyDefaultRulesSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "nsx_id": getComputedNsxIDSchema(), + "nsx_id": getComputedNsxIDSchema(), + "context": getContextSchema(), "scope": { Type: schema.TypeString, Description: "Scope for this rule", @@ -84,6 +85,7 @@ func getPolicyPredefinedSecurityPolicySchema() map[string]*schema.Schema { "rule": getSecurityPolicyAndGatewayRulesSchema(false, false, false), "default_rule": getSecurityPolicyDefaultRulesSchema(), "revision": getRevisionSchema(), + "context": getContextSchema(), } } @@ -217,7 +219,7 @@ func updatePolicyPredefinedSecurityPolicy(id string, d *schema.ResourceData, m i return fmt.Errorf("Failed to extract domain from Security Policy path %s", path) } - predefinedPolicy, err := getSecurityPolicyInDomain(id, domain, connector, isPolicyGlobalManager(m)) + predefinedPolicy, err := getSecurityPolicyInDomain(getSessionContext(d, m), id, domain, connector) if err != nil { return err } @@ -296,7 +298,7 @@ func updatePolicyPredefinedSecurityPolicy(id string, d *schema.ResourceData, m i predefinedPolicy.Children = childRules } - err = securityPolicyInfraPatch(predefinedPolicy, domain, m) + err = securityPolicyInfraPatch(getSessionContext(d, m), predefinedPolicy, domain, m) if err != nil { return handleUpdateError("Predefined Security Policy", id, err) } @@ -333,25 +335,10 @@ func resourceNsxtPolicyPredefinedSecurityPolicyRead(d *schema.ResourceData, m in path := d.Get("path").(string) domain := getDomainFromResourcePath(path) - var obj model.SecurityPolicy - if isPolicyGlobalManager(m) { - client := gm_domains.NewSecurityPoliciesClient(connector) - gmObj, err := client.Get(domain, id) - if err != nil { - return handleReadError(d, "Predefined Security Policy", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.SecurityPolicyBindingType(), model.SecurityPolicyBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.SecurityPolicy) - } else { - var err error - client := domains.NewSecurityPoliciesClient(connector) - obj, err = client.Get(domain, id) - if err != nil { - return handleReadError(d, "Predefined Security Policy", id, err) - } + client := domains.NewSecurityPoliciesClient(getSessionContext(d, m), connector) + obj, err := client.Get(domain, id) + if err != nil { + return handleReadError(d, "Predefined Security Policy", id, err) } d.Set("description", obj.Description) @@ -370,7 +357,7 @@ func resourceNsxtPolicyPredefinedSecurityPolicyRead(d *schema.ResourceData, m in } } - err := setPolicyRulesInSchema(d, rules) + err = setPolicyRulesInSchema(d, rules) if err != nil { return err } @@ -399,8 +386,9 @@ func resourceNsxtPolicyPredefinedSecurityPolicyDelete(d *schema.ResourceData, m path := d.Get("path").(string) domain := getDomainFromResourcePath(path) + context := getSessionContext(d, m) - predefinedPolicy, err := getSecurityPolicyInDomain(id, domain, getPolicyConnector(m), isPolicyGlobalManager(m)) + predefinedPolicy, err := getSecurityPolicyInDomain(context, id, domain, getPolicyConnector(m)) if err != nil { return err } @@ -410,14 +398,14 @@ func resourceNsxtPolicyPredefinedSecurityPolicyDelete(d *schema.ResourceData, m return fmt.Errorf("Failed to revert Predefined Security Policy %s: %s", id, err) } - err = securityPolicyInfraPatch(revertedPolicy, domain, m) + err = securityPolicyInfraPatch(context, revertedPolicy, domain, m) if err != nil { return handleUpdateError("Predefined Security Policy", id, err) } return nil } -func securityPolicyInfraPatch(policy model.SecurityPolicy, domain string, m interface{}) error { +func securityPolicyInfraPatch(context utl.SessionContext, policy model.SecurityPolicy, domain string, m interface{}) error { childDomain, err := createChildDomainWithSecurityPolicy(domain, *policy.Id, policy) if err != nil { return fmt.Errorf("Failed to create H-API for Predefined Security Policy: %s", err) @@ -432,6 +420,6 @@ func securityPolicyInfraPatch(policy model.SecurityPolicy, domain string, m inte ResourceType: &infraType, } - return policyInfraPatch(infraObj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + return policyInfraPatch(context, infraObj, getPolicyConnector(m), false) } diff --git a/nsxt/resource_nsxt_policy_qos_profile.go b/nsxt/resource_nsxt_policy_qos_profile.go index e638890fc..373ee4509 100644 --- a/nsxt/resource_nsxt_policy_qos_profile.go +++ b/nsxt/resource_nsxt_policy_qos_profile.go @@ -12,10 +12,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var rateLimiterResourceTypes = []string{model.QosBaseRateLimiter_RESOURCE_TYPE_INGRESSRATELIMITER, model.QosBaseRateLimiter_RESOURCE_TYPE_INGRESSBROADCASTRATELIMITER, model.QosBaseRateLimiter_RESOURCE_TYPE_EGRESSRATELIMITER} @@ -37,6 +37,7 @@ func resourceNsxtPolicyQosProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "class_of_service": { Type: schema.TypeInt, Description: "Class of service", @@ -63,15 +64,9 @@ func resourceNsxtPolicyQosProfile() *schema.Resource { } } -func resourceNsxtPolicyQosProfileExists(id string, connector client.Connector, isGlobalmodel bool) (bool, error) { - var err error - if isGlobalmodel { - client := gm_infra.NewQosProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewQosProfilesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyQosProfileExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewQosProfilesClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -140,7 +135,7 @@ func resourceNsxtPolicyQosProfileCreate(d *schema.ResourceData, m interface{}) e connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyQosProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyQosProfileExists) if err != nil { return err } @@ -179,18 +174,8 @@ func resourceNsxtPolicyQosProfileCreate(d *schema.ResourceData, m interface{}) e // Create the resource using PATCH log.Printf("[INFO] Creating QosProfile with ID %s", id) boolFalse := false - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.QosProfileBindingType(), gm_model.QosProfileBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewQosProfilesClient(connector) - err = client.Patch(id, gmObj.(gm_model.QosProfile), &boolFalse) - } else { - client := infra.NewQosProfilesClient(connector) - err = client.Patch(id, obj, &boolFalse) - } + client := infra.NewQosProfilesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj, &boolFalse) if err != nil { return handleCreateError("QosProfile", id, err) } @@ -209,26 +194,10 @@ func resourceNsxtPolicyQosProfileRead(d *schema.ResourceData, m interface{}) err return fmt.Errorf("Error obtaining QosProfile ID") } - var obj model.QosProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewQosProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "QosProfile", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.QosProfileBindingType(), model.QosProfileBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.QosProfile) - - } else { - var err error - client := infra.NewQosProfilesClient(connector) - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "QosProfile", id, err) - } + client := infra.NewQosProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "QosProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -253,7 +222,7 @@ func resourceNsxtPolicyQosProfileRead(d *schema.ResourceData, m interface{}) err func resourceNsxtPolicyQosProfileUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - client := infra.NewQosProfilesClient(connector) + client := infra.NewQosProfilesClient(getSessionContext(d, m), connector) if client == nil { return policyResourceNotSupportedError() } @@ -298,19 +267,7 @@ func resourceNsxtPolicyQosProfileUpdate(d *schema.ResourceData, m interface{}) e // Create the resource using PATCH log.Printf("[INFO] Updating QosProfile with ID %s", id) boolFalse := false - var err error - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.QosProfileBindingType(), gm_model.QosProfileBindingType()) - if err1 != nil { - return err1 - } - - client := gm_infra.NewQosProfilesClient(connector) - err = client.Patch(id, gmObj.(gm_model.QosProfile), &boolFalse) - } else { - client := infra.NewQosProfilesClient(connector) - err = client.Patch(id, obj, &boolFalse) - } + err := client.Patch(id, obj, &boolFalse) if err != nil { return handleUpdateError("QosProfile", id, err) } @@ -324,16 +281,10 @@ func resourceNsxtPolicyQosProfileDelete(d *schema.ResourceData, m interface{}) e return fmt.Errorf("Error obtaining QosProfile ID") } - var err error connector := getPolicyConnector(m) boolFalse := false - if isPolicyGlobalManager(m) { - client := gm_infra.NewQosProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } else { - client := infra.NewQosProfilesClient(connector) - err = client.Delete(id, &boolFalse) - } + client := infra.NewQosProfilesClient(getSessionContext(d, m), connector) + err := client.Delete(id, &boolFalse) if err != nil { return handleDeleteError("QosProfile", id, err) diff --git a/nsxt/resource_nsxt_policy_qos_profile_test.go b/nsxt/resource_nsxt_policy_qos_profile_test.go index a945a7715..01a7d467c 100644 --- a/nsxt/resource_nsxt_policy_qos_profile_test.go +++ b/nsxt/resource_nsxt_policy_qos_profile_test.go @@ -136,7 +136,7 @@ func testAccNSXPolicyQosProfileExists(displayName string, resourceName string) r return fmt.Errorf("Policy QosProfile resource ID not set in resources") } - exists, err := resourceNsxtPolicyQosProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyQosProfileExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -157,7 +157,7 @@ func testAccNSXPolicyQosProfileCheckDestroy(state *terraform.State, displayName } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicyQosProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicyQosProfileExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_security_policy.go b/nsxt/resource_nsxt_policy_security_policy.go index 07670af22..bb969f3fc 100644 --- a/nsxt/resource_nsxt_policy_security_policy.go +++ b/nsxt/resource_nsxt_policy_security_policy.go @@ -9,10 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_domains "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/domains" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/domains" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra/domains" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicySecurityPolicy() *schema.Resource { @@ -24,37 +24,19 @@ func resourceNsxtPolicySecurityPolicy() *schema.Resource { Importer: &schema.ResourceImporter{ State: nsxtDomainResourceImporter, }, - Schema: getPolicySecurityPolicySchema(false), + Schema: getPolicySecurityPolicySchema(false, true), } } -func getSecurityPolicyInDomain(id string, domainName string, connector client.Connector, isGlobalManager bool) (model.SecurityPolicy, error) { - if isGlobalManager { - client := gm_domains.NewSecurityPoliciesClient(connector) - gmObj, err := client.Get(domainName, id) - if err != nil { - return model.SecurityPolicy{}, err - } - rawObj, convErr := convertModelBindingType(gmObj, gm_model.SecurityPolicyBindingType(), model.SecurityPolicyBindingType()) - if convErr != nil { - return model.SecurityPolicy{}, convErr - } - return rawObj.(model.SecurityPolicy), nil - } - client := domains.NewSecurityPoliciesClient(connector) +func getSecurityPolicyInDomain(sessionContext utl.SessionContext, id string, domainName string, connector client.Connector) (model.SecurityPolicy, error) { + client := domains.NewSecurityPoliciesClient(sessionContext, connector) return client.Get(domainName, id) } -func resourceNsxtPolicySecurityPolicyExistsInDomain(id string, domainName string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_domains.NewSecurityPoliciesClient(connector) - _, err = client.Get(domainName, id) - } else { - client := domains.NewSecurityPoliciesClient(connector) - _, err = client.Get(domainName, id) - } +func resourceNsxtPolicySecurityPolicyExistsInDomain(sessionContext utl.SessionContext, id string, domainName string, connector client.Connector) (bool, error) { + client := domains.NewSecurityPoliciesClient(sessionContext, connector) + _, err := client.Get(domainName, id) if err == nil { return true, nil @@ -67,9 +49,9 @@ func resourceNsxtPolicySecurityPolicyExistsInDomain(id string, domainName string return false, logAPIError("Error retrieving Security Policy", err) } -func resourceNsxtPolicySecurityPolicyExistsPartial(domainName string) func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return resourceNsxtPolicySecurityPolicyExistsInDomain(id, domainName, connector, isGlobalManager) +func resourceNsxtPolicySecurityPolicyExistsPartial(domainName string) func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return func(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + return resourceNsxtPolicySecurityPolicyExistsInDomain(sessionContext, id, domainName, connector) } } @@ -118,14 +100,14 @@ func policySecurityPolicyBuildAndPatch(d *schema.ResourceData, m interface{}, co obj.Children = policyChildren } - return securityPolicyInfraPatch(obj, domain, m) + return securityPolicyInfraPatch(getSessionContext(d, m), obj, domain, m) } func resourceNsxtPolicySecurityPolicyCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicySecurityPolicyExistsPartial(d.Get("domain").(string))) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicySecurityPolicyExistsPartial(d.Get("domain").(string))) if err != nil { return err } @@ -149,25 +131,10 @@ func resourceNsxtPolicySecurityPolicyRead(d *schema.ResourceData, m interface{}) if id == "" { return fmt.Errorf("Error obtaining Security Policy id") } - var obj model.SecurityPolicy - if isPolicyGlobalManager(m) { - client := gm_domains.NewSecurityPoliciesClient(connector) - gmObj, err := client.Get(domainName, id) - if err != nil { - return handleReadError(d, "SecurityPolicy", id, err) - } - rawObj, err := convertModelBindingType(gmObj, gm_model.SecurityPolicyBindingType(), model.SecurityPolicyBindingType()) - if err != nil { - return err - } - obj = rawObj.(model.SecurityPolicy) - } else { - var err error - client := domains.NewSecurityPoliciesClient(connector) - obj, err = client.Get(domainName, id) - if err != nil { - return handleReadError(d, "SecurityPolicy", id, err) - } + client := domains.NewSecurityPoliciesClient(getSessionContext(d, m), connector) + obj, err := client.Get(domainName, id) + if err != nil { + return handleReadError(d, "SecurityPolicy", id, err) } d.Set("display_name", obj.DisplayName) d.Set("description", obj.Description) @@ -212,15 +179,9 @@ func resourceNsxtPolicySecurityPolicyDelete(d *schema.ResourceData, m interface{ } connector := getPolicyConnector(m) - var err error - if isPolicyGlobalManager(m) { - client := gm_domains.NewSecurityPoliciesClient(connector) - err = client.Delete(d.Get("domain").(string), id) - } else { - client := domains.NewSecurityPoliciesClient(connector) - err = client.Delete(d.Get("domain").(string), id) - } + client := domains.NewSecurityPoliciesClient(getSessionContext(d, m), connector) + err := client.Delete(d.Get("domain").(string), id) if err != nil { return handleDeleteError("Security Policy", id, err) diff --git a/nsxt/resource_nsxt_policy_security_policy_test.go b/nsxt/resource_nsxt_policy_security_policy_test.go index bad427260..d42dec36b 100644 --- a/nsxt/resource_nsxt_policy_security_policy_test.go +++ b/nsxt/resource_nsxt_policy_security_policy_test.go @@ -581,8 +581,7 @@ func testAccNsxtPolicySecurityPolicyExists(resourceName string, domainName strin return fmt.Errorf("Policy SecurityPolicy resource ID not set in resources") } - isPolicyGlobalManager := isPolicyGlobalManager(testAccProvider.Meta()) - exists, err := resourceNsxtPolicySecurityPolicyExistsInDomain(resourceID, domainName, connector, isPolicyGlobalManager) + exists, err := resourceNsxtPolicySecurityPolicyExistsInDomain(testAccGetSessionContext(), resourceID, domainName, connector) if err != nil { return err } @@ -595,7 +594,6 @@ func testAccNsxtPolicySecurityPolicyExists(resourceName string, domainName strin func testAccNsxtPolicySecurityPolicyCheckDestroy(state *terraform.State, displayName string, domainName string) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) - isPolicyGlobalManager := isPolicyGlobalManager(testAccProvider.Meta()) for _, rs := range state.RootModule().Resources { if rs.Type != "nsxt_policy_security_policy" { @@ -603,7 +601,7 @@ func testAccNsxtPolicySecurityPolicyCheckDestroy(state *terraform.State, display } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicySecurityPolicyExistsInDomain(resourceID, domainName, connector, isPolicyGlobalManager) + exists, err := resourceNsxtPolicySecurityPolicyExistsInDomain(testAccGetSessionContext(), resourceID, domainName, connector) if err != nil { return err } diff --git a/nsxt/resource_nsxt_policy_segment_security_profile.go b/nsxt/resource_nsxt_policy_segment_security_profile.go index 5ace0b735..7588269d9 100644 --- a/nsxt/resource_nsxt_policy_segment_security_profile.go +++ b/nsxt/resource_nsxt_policy_segment_security_profile.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicySegmentSecurityProfile() *schema.Resource { @@ -33,6 +33,7 @@ func resourceNsxtPolicySegmentSecurityProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "bpdu_filter_allow": { Type: schema.TypeSet, Elem: &schema.Schema{ @@ -114,15 +115,9 @@ func resourceNsxtPolicySegmentSecurityProfile() *schema.Resource { } } -func resourceNsxtPolicySegmentSecurityProfileExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewSegmentSecurityProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewSegmentSecurityProfilesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicySegmentSecurityProfileExists(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewSegmentSecurityProfilesClient(context, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -184,23 +179,14 @@ func resourceNsxtPolicySegmentSecurityProfilePatch(d *schema.ResourceData, m int } log.Printf("[INFO] Sending SegmentSecurityProfile with ID %s", id) - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.SegmentSecurityProfileBindingType(), gm_model.SegmentSecurityProfileBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewSegmentSecurityProfilesClient(connector) - return client.Patch(id, gmObj.(gm_model.SegmentSecurityProfile), nil) - } - - client := infra.NewSegmentSecurityProfilesClient(connector) + client := infra.NewSegmentSecurityProfilesClient(getSessionContext(d, m), connector) return client.Patch(id, obj, nil) } func resourceNsxtPolicySegmentSecurityProfileCreate(d *schema.ResourceData, m interface{}) error { // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicySegmentSecurityProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicySegmentSecurityProfileExists) if err != nil { return err } @@ -224,26 +210,10 @@ func resourceNsxtPolicySegmentSecurityProfileRead(d *schema.ResourceData, m inte return fmt.Errorf("Error obtaining SegmentSecurityProfile ID") } - var obj model.SegmentSecurityProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewSegmentSecurityProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "SegmentSecurityProfile", id, err) - } - - lmObj, err := convertModelBindingType(gmObj, gm_model.SegmentSecurityProfileBindingType(), model.SegmentSecurityProfileBindingType()) - if err != nil { - return err - } - obj = lmObj.(model.SegmentSecurityProfile) - } else { - client := infra.NewSegmentSecurityProfilesClient(connector) - var err error - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "SegmentSecurityProfile", id, err) - } + client := infra.NewSegmentSecurityProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "SegmentSecurityProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -300,14 +270,8 @@ func resourceNsxtPolicySegmentSecurityProfileDelete(d *schema.ResourceData, m in } connector := getPolicyConnector(m) - var err error - if isPolicyGlobalManager(m) { - client := gm_infra.NewSegmentSecurityProfilesClient(connector) - err = client.Delete(id, nil) - } else { - client := infra.NewSegmentSecurityProfilesClient(connector) - err = client.Delete(id, nil) - } + client := infra.NewSegmentSecurityProfilesClient(getSessionContext(d, m), connector) + err := client.Delete(id, nil) if err != nil { return handleDeleteError("SegmentSecurityProfile", id, err) diff --git a/nsxt/resource_nsxt_policy_segment_security_profile_test.go b/nsxt/resource_nsxt_policy_segment_security_profile_test.go index 0b70ee229..9e6e5758a 100644 --- a/nsxt/resource_nsxt_policy_segment_security_profile_test.go +++ b/nsxt/resource_nsxt_policy_segment_security_profile_test.go @@ -164,7 +164,7 @@ func testAccNsxtPolicySegmentSecurityProfileExists(displayName string, resourceN return fmt.Errorf("Policy SegmentSecurityProfile resource ID not set in resources") } - exists, err := resourceNsxtPolicySegmentSecurityProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicySegmentSecurityProfileExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -185,7 +185,7 @@ func testAccNsxtPolicySegmentSecurityProfileCheckDestroy(state *terraform.State, } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicySegmentSecurityProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicySegmentSecurityProfileExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_segment_test.go b/nsxt/resource_nsxt_policy_segment_test.go index 0105e73e3..d3addfe0a 100644 --- a/nsxt/resource_nsxt_policy_segment_test.go +++ b/nsxt/resource_nsxt_policy_segment_test.go @@ -431,11 +431,13 @@ func TestAccResourceNsxtPolicySegment_withDhcp(t *testing.T) { // TODO: add tests for l2_extension; requires L2 VPN Session func testAccNsxtPolicySegmentExists(resourceName string) resource.TestCheckFunc { - return testAccNsxtPolicyResourceExists(resourceName, resourceNsxtPolicySegmentExists("", false)) + context := testAccGetSessionContext() + return testAccNsxtPolicyResourceExists(context, resourceName, resourceNsxtPolicySegmentExists(context, "", false)) } func testAccNsxtPolicySegmentCheckDestroy(state *terraform.State, displayName string) error { - return testAccNsxtPolicyResourceCheckDestroy(state, displayName, "nsxt_policy_segment", resourceNsxtPolicySegmentExists("", false)) + context := testAccGetSessionContext() + return testAccNsxtPolicyResourceCheckDestroy(context, state, displayName, "nsxt_policy_segment", resourceNsxtPolicySegmentExists(context, "", false)) } func testAccNsxtPolicySegmentDeps(tzName string) string { diff --git a/nsxt/resource_nsxt_policy_service.go b/nsxt/resource_nsxt_policy_service.go index a31913932..08c61f406 100644 --- a/nsxt/resource_nsxt_policy_service.go +++ b/nsxt/resource_nsxt_policy_service.go @@ -13,10 +13,10 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyService() *schema.Resource { @@ -36,6 +36,7 @@ func resourceNsxtPolicyService() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "icmp_entry": { Type: schema.TypeSet, @@ -420,15 +421,9 @@ func resourceNsxtPolicyServiceGetEntriesFromSchema(d *schema.ResourceData) ([]*d return serviceEntries, nil } -func resourceNsxtPolicyServiceExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewServicesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewServicesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyServiceExists(sessionContext utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewServicesClient(sessionContext, connector) + _, err := client.Get(id) if err == nil { return true, nil @@ -452,7 +447,7 @@ func resourceNsxtPolicyServiceCreate(d *schema.ResourceData, m interface{}) erro connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyServiceExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyServiceExists) if err != nil { return err } @@ -475,17 +470,8 @@ func resourceNsxtPolicyServiceCreate(d *schema.ResourceData, m interface{}) erro // Create the resource using PATCH log.Printf("[INFO] Creating service with ID %s", id) - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.ServiceBindingType(), gm_model.ServiceBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewServicesClient(connector) - err = client.Patch(id, gmObj.(gm_model.Service)) - } else { - client := infra.NewServicesClient(connector) - err = client.Patch(id, obj) - } + client := infra.NewServicesClient(getSessionContext(d, m), connector) + err = client.Patch(id, obj) if err != nil { return handleCreateError("Service", id, err) } @@ -503,25 +489,10 @@ func resourceNsxtPolicyServiceRead(d *schema.ResourceData, m interface{}) error return fmt.Errorf("Error obtaining service id") } - var obj model.Service - if isPolicyGlobalManager(m) { - client := gm_infra.NewServicesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "Service", id, err) - } - lmObj, err := convertModelBindingType(gmObj, gm_model.ServiceBindingType(), model.ServiceBindingType()) - if err != nil { - return err - } - obj = lmObj.(model.Service) - } else { - client := infra.NewServicesClient(connector) - var err error - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "Service", id, err) - } + client := infra.NewServicesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "Service", id, err) } d.Set("display_name", obj.DisplayName) @@ -645,7 +616,7 @@ func resourceNsxtPolicyServiceRead(d *schema.ResourceData, m interface{}) error } } - err := d.Set("icmp_entry", icmpEntriesList) + err = d.Set("icmp_entry", icmpEntriesList) if err != nil { return err } @@ -709,19 +680,8 @@ func resourceNsxtPolicyServiceUpdate(d *schema.ResourceData, m interface{}) erro } // Update the resource using Update to totally replace the list of entries - var err error - if isPolicyGlobalManager(m) { - - gmObj, convErr := convertModelBindingType(obj, model.ServiceBindingType(), gm_model.ServiceBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewServicesClient(connector) - _, err = client.Update(id, gmObj.(gm_model.Service)) - } else { - client := infra.NewServicesClient(connector) - _, err = client.Update(id, obj) - } + client := infra.NewServicesClient(getSessionContext(d, m), connector) + _, err := client.Update(id, obj) if err != nil { return handleUpdateError("Service", id, err) @@ -738,11 +698,7 @@ func resourceNsxtPolicyServiceDelete(d *schema.ResourceData, m interface{}) erro connector := getPolicyConnector(m) doDelete := func() error { - if isPolicyGlobalManager(m) { - client := gm_infra.NewServicesClient(connector) - return client.Delete(id) - } - client := infra.NewServicesClient(connector) + client := infra.NewServicesClient(getSessionContext(d, m), connector) return client.Delete(id) } diff --git a/nsxt/resource_nsxt_policy_spoof_guard_profile.go b/nsxt/resource_nsxt_policy_spoof_guard_profile.go index fd0e38e94..5dcf7956a 100644 --- a/nsxt/resource_nsxt_policy_spoof_guard_profile.go +++ b/nsxt/resource_nsxt_policy_spoof_guard_profile.go @@ -9,10 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicySpoofGuardProfile() *schema.Resource { @@ -32,6 +32,7 @@ func resourceNsxtPolicySpoofGuardProfile() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "address_binding_allowlist": { Type: schema.TypeBool, Optional: true, @@ -40,15 +41,9 @@ func resourceNsxtPolicySpoofGuardProfile() *schema.Resource { } } -func resourceNsxtPolicySpoofGuardProfileExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewSpoofguardProfilesClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewSpoofguardProfilesClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicySpoofGuardProfileExists(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewSpoofguardProfilesClient(context, connector) + _, err := client.Get(id) if err == nil { return true, nil } @@ -76,23 +71,14 @@ func resourceNsxtPolicySpoofGuardProfilePatch(d *schema.ResourceData, m interfac } log.Printf("[INFO] Patching SpoofGuardProfile with ID %s", id) - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.SpoofGuardProfileBindingType(), gm_model.SpoofGuardProfileBindingType()) - if convErr != nil { - return convErr - } - client := gm_infra.NewSpoofguardProfilesClient(connector) - return client.Patch(id, gmObj.(gm_model.SpoofGuardProfile), nil) - } - - client := infra.NewSpoofguardProfilesClient(connector) + client := infra.NewSpoofguardProfilesClient(getSessionContext(d, m), connector) return client.Patch(id, obj, nil) } func resourceNsxtPolicySpoofGuardProfileCreate(d *schema.ResourceData, m interface{}) error { // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicySpoofGuardProfileExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicySpoofGuardProfileExists) if err != nil { return err } @@ -116,26 +102,10 @@ func resourceNsxtPolicySpoofGuardProfileRead(d *schema.ResourceData, m interface return fmt.Errorf("Error obtaining SpoofGuardProfile ID") } - var obj model.SpoofGuardProfile - if isPolicyGlobalManager(m) { - client := gm_infra.NewSpoofguardProfilesClient(connector) - gmObj, err := client.Get(id) - if err != nil { - return handleReadError(d, "SpoofGuardProfile", id, err) - } - - lmObj, err := convertModelBindingType(gmObj, gm_model.SpoofGuardProfileBindingType(), model.SpoofGuardProfileBindingType()) - if err != nil { - return err - } - obj = lmObj.(model.SpoofGuardProfile) - } else { - client := infra.NewSpoofguardProfilesClient(connector) - var err error - obj, err = client.Get(id) - if err != nil { - return handleReadError(d, "SpoofGuardProfile", id, err) - } + client := infra.NewSpoofguardProfilesClient(getSessionContext(d, m), connector) + obj, err := client.Get(id) + if err != nil { + return handleReadError(d, "SpoofGuardProfile", id, err) } d.Set("display_name", obj.DisplayName) @@ -172,14 +142,8 @@ func resourceNsxtPolicySpoofGuardProfileDelete(d *schema.ResourceData, m interfa } connector := getPolicyConnector(m) - var err error - if isPolicyGlobalManager(m) { - client := gm_infra.NewSpoofguardProfilesClient(connector) - err = client.Delete(id, nil) - } else { - client := infra.NewSpoofguardProfilesClient(connector) - err = client.Delete(id, nil) - } + client := infra.NewSpoofguardProfilesClient(getSessionContext(d, m), connector) + err := client.Delete(id, nil) if err != nil { return handleDeleteError("SpoofGuardProfile", id, err) diff --git a/nsxt/resource_nsxt_policy_spoof_guard_profile_test.go b/nsxt/resource_nsxt_policy_spoof_guard_profile_test.go index 52d299b43..8503a449c 100644 --- a/nsxt/resource_nsxt_policy_spoof_guard_profile_test.go +++ b/nsxt/resource_nsxt_policy_spoof_guard_profile_test.go @@ -114,7 +114,7 @@ func testAccNsxtPolicySpoofGuardProfileExists(displayName string, resourceName s return fmt.Errorf("Policy SpoofGuardProfile resource ID not set in resources") } - exists, err := resourceNsxtPolicySpoofGuardProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicySpoofGuardProfileExists(testAccGetSessionContext(), resourceID, connector) if err != nil { return err } @@ -135,7 +135,7 @@ func testAccNsxtPolicySpoofGuardProfileCheckDestroy(state *terraform.State, disp } resourceID := rs.Primary.Attributes["id"] - exists, err := resourceNsxtPolicySpoofGuardProfileExists(resourceID, connector, testAccIsGlobalManager()) + exists, err := resourceNsxtPolicySpoofGuardProfileExists(testAccGetSessionContext(), resourceID, connector) if err == nil { return err } diff --git a/nsxt/resource_nsxt_policy_static_route.go b/nsxt/resource_nsxt_policy_static_route.go index 691a176f3..c0ca5b1ee 100644 --- a/nsxt/resource_nsxt_policy_static_route.go +++ b/nsxt/resource_nsxt_policy_static_route.go @@ -11,10 +11,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + tier0s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_0s" + tier1s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) func resourceNsxtPolicyStaticRoute() *schema.Resource { @@ -34,6 +36,7 @@ func resourceNsxtPolicyStaticRoute() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "gateway_path": getPolicyGatewayPathSchema(), "network": { Type: schema.TypeString, @@ -75,30 +78,30 @@ func resourceNsxtPolicyStaticRoute() *schema.Resource { } } -func patchNsxtPolicyStaticRoute(connector client.Connector, gwID string, route model.StaticRoutes, isT0 bool) error { +func patchNsxtPolicyStaticRoute(sessionContext utl.SessionContext, connector client.Connector, gwID string, route model.StaticRoutes, isT0 bool) error { if isT0 { - routeClient := tier_0s.NewStaticRoutesClient(connector) + routeClient := tier0s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Patch(gwID, *route.Id, route) } - routeClient := tier_1s.NewStaticRoutesClient(connector) + routeClient := tier1s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Patch(gwID, *route.Id, route) } -func deleteNsxtPolicyStaticRoute(connector client.Connector, gwID string, isT0 bool, routeID string) error { +func deleteNsxtPolicyStaticRoute(sessionContext utl.SessionContext, connector client.Connector, gwID string, isT0 bool, routeID string) error { if isT0 { - routeClient := tier_0s.NewStaticRoutesClient(connector) + routeClient := tier0s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Delete(gwID, routeID) } - routeClient := tier_1s.NewStaticRoutesClient(connector) + routeClient := tier1s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Delete(gwID, routeID) } -func getNsxtPolicyStaticRouteByID(connector client.Connector, gwID string, isT0 bool, routeID string) (model.StaticRoutes, error) { +func getNsxtPolicyStaticRouteByID(sessionContext utl.SessionContext, connector client.Connector, gwID string, isT0 bool, routeID string) (model.StaticRoutes, error) { if isT0 { - routeClient := tier_0s.NewStaticRoutesClient(connector) + routeClient := tier0s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Get(gwID, routeID) } - routeClient := tier_1s.NewStaticRoutesClient(connector) + routeClient := tier1s.NewStaticRoutesClient(sessionContext, connector) return routeClient.Get(gwID, routeID) } @@ -115,7 +118,7 @@ func resourceNsxtPolicyStaticRouteCreate(d *schema.ResourceData, m interface{}) if id == "" { id = newUUID() } else { - _, err := getNsxtPolicyStaticRouteByID(connector, gwID, isT0, id) + _, err := getNsxtPolicyStaticRouteByID(getSessionContext(d, m), connector, gwID, isT0, id) if err == nil { return fmt.Errorf("Static Route with nsx_id '%s' already exists", id) } else if !isNotFoundError(err) { @@ -163,7 +166,7 @@ func resourceNsxtPolicyStaticRouteCreate(d *schema.ResourceData, m interface{}) } log.Printf("[INFO] Creating Static Route with ID %s", id) - err := patchNsxtPolicyStaticRoute(connector, gwID, routeStruct, isT0) + err := patchNsxtPolicyStaticRoute(getSessionContext(d, m), connector, gwID, routeStruct, isT0) if err != nil { return handleCreateError("Static Route", id, err) } @@ -188,7 +191,7 @@ func resourceNsxtPolicyStaticRouteRead(d *schema.ResourceData, m interface{}) er return fmt.Errorf("gateway_path is not a valid") } - obj, err := getNsxtPolicyStaticRouteByID(connector, gwID, isT0, id) + obj, err := getNsxtPolicyStaticRouteByID(getSessionContext(d, m), connector, gwID, isT0, id) if err != nil { return handleReadError(d, "Static Route", id, err) } @@ -281,7 +284,7 @@ func resourceNsxtPolicyStaticRouteUpdate(d *schema.ResourceData, m interface{}) } log.Printf("[INFO] Updating Static Route with ID %s", id) - err := patchNsxtPolicyStaticRoute(connector, gwID, routeStruct, isT0) + err := patchNsxtPolicyStaticRoute(getSessionContext(d, m), connector, gwID, routeStruct, isT0) if err != nil { return handleUpdateError("Static Route", id, err) } @@ -304,7 +307,7 @@ func resourceNsxtPolicyStaticRouteDelete(d *schema.ResourceData, m interface{}) return fmt.Errorf("gateway_path is not valid") } - err := deleteNsxtPolicyStaticRoute(getPolicyConnector(m), gwID, isT0, id) + err := deleteNsxtPolicyStaticRoute(getSessionContext(d, m), getPolicyConnector(m), gwID, isT0, id) if err != nil { return handleDeleteError("Static Route", id, err) } @@ -321,13 +324,13 @@ func resourceNsxtPolicyStaticRouteImport(d *schema.ResourceData, m interface{}) gwID := s[0] connector := getPolicyConnector(m) - t0Client := infra.NewTier0sClient(connector) + t0Client := infra.NewTier0sClient(getSessionContext(d, m), connector) t0gw, err := t0Client.Get(gwID) if err != nil { if !isNotFoundError(err) { return nil, err } - t1Client := infra.NewTier1sClient(connector) + t1Client := infra.NewTier1sClient(getSessionContext(d, m), connector) t1gw, err := t1Client.Get(gwID) if err != nil { return nil, err diff --git a/nsxt/resource_nsxt_policy_static_route_test.go b/nsxt/resource_nsxt_policy_static_route_test.go index 696b2e137..c362ca236 100644 --- a/nsxt/resource_nsxt_policy_static_route_test.go +++ b/nsxt/resource_nsxt_policy_static_route_test.go @@ -207,7 +207,7 @@ func testAccNsxtPolicyStaticRouteExists(resourceName string) resource.TestCheckF gwPath := rs.Primary.Attributes["gateway_path"] isT0, gwID := parseGatewayPolicyPath(gwPath) - _, err := getNsxtPolicyStaticRouteByID(connector, gwID, isT0, resourceID) + _, err := getNsxtPolicyStaticRouteByID(testAccGetSessionContext(), connector, gwID, isT0, resourceID) if err != nil { return fmt.Errorf("Error while retrieving policy Static Route ID %s. Error: %v", resourceID, err) } @@ -227,7 +227,7 @@ func testAccNsxtPolicyStaticRouteCheckDestroy(state *terraform.State, displayNam resourceID := rs.Primary.Attributes["id"] gwPath := rs.Primary.Attributes["gateway_path"] isT0, gwID := parseGatewayPolicyPath(gwPath) - _, err := getNsxtPolicyStaticRouteByID(connector, gwID, isT0, resourceID) + _, err := getNsxtPolicyStaticRouteByID(testAccGetSessionContext(), connector, gwID, isT0, resourceID) if err == nil { return fmt.Errorf("Policy Static Route %s still exists", displayName) } diff --git a/nsxt/resource_nsxt_policy_tier0_gateway.go b/nsxt/resource_nsxt_policy_tier0_gateway.go index 41a907823..568750a19 100644 --- a/nsxt/resource_nsxt_policy_tier0_gateway.go +++ b/nsxt/resource_nsxt_policy_tier0_gateway.go @@ -15,6 +15,8 @@ import ( gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" gm_tier_0s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_0s" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" + + utl "github.com/vmware/terraform-provider-nsxt/api/utl" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services" @@ -298,7 +300,7 @@ func getPolicyVRFConfigSchema() *schema.Schema { } } -func listGlobalManagerTier0GatewayLocaleServices(connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { +func listGlobalManagerTier0GatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { client := gm_tier_0s.NewLocaleServicesClient(connector) markForDelete := false listResponse, err := client.List(gwID, cursor, &markForDelete, nil, nil, nil, nil) @@ -314,22 +316,22 @@ func listGlobalManagerTier0GatewayLocaleServices(connector client.Connector, gwI return convertedResult.(model.LocaleServicesListResult), nil } -func listLocalManagerTier0GatewayLocaleServices(connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { +func listLocalManagerTier0GatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { client := tier_0s.NewLocaleServicesClient(connector) markForDelete := false return client.List(gwID, cursor, &markForDelete, nil, nil, nil, nil) } -func listPolicyTier0GatewayLocaleServices(connector client.Connector, gwID string, isGlobalManager bool) ([]model.LocaleServices, error) { +func listPolicyTier0GatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string) ([]model.LocaleServices, error) { - if isGlobalManager { - return listPolicyGatewayLocaleServices(connector, gwID, listGlobalManagerTier0GatewayLocaleServices) + if context.ClientType == utl.Global { + return listPolicyGatewayLocaleServices(context, connector, gwID, listGlobalManagerTier0GatewayLocaleServices) } - return listPolicyGatewayLocaleServices(connector, gwID, listLocalManagerTier0GatewayLocaleServices) + return listPolicyGatewayLocaleServices(context, connector, gwID, listLocalManagerTier0GatewayLocaleServices) } -func getPolicyTier0GatewayLocaleServiceWithEdgeCluster(gwID string, connector client.Connector) (*model.LocaleServices, error) { +func getPolicyTier0GatewayLocaleServiceWithEdgeCluster(context utl.SessionContext, gwID string, connector client.Connector) (*model.LocaleServices, error) { // Get the locale services of this Tier0 for the edge-cluster id client := tier_0s.NewLocaleServicesClient(connector) obj, err := client.Get(gwID, defaultPolicyLocaleServiceID) @@ -339,7 +341,7 @@ func getPolicyTier0GatewayLocaleServiceWithEdgeCluster(gwID string, connector cl // No locale-service with the default ID // List all the locale services - objList, errList := listPolicyTier0GatewayLocaleServices(connector, gwID, false) + objList, errList := listPolicyTier0GatewayLocaleServices(context, connector, gwID) if errList != nil { if isNotFoundError(errList) { return nil, nil @@ -636,14 +638,14 @@ func resourceNsxtPolicyTier0GatewayBGPConfigSchemaToStruct(cfg interface{}, isVr return routeStruct } -func initSingleTier0GatewayLocaleService(d *schema.ResourceData, children []*data.StructValue, connector client.Connector) (*data.StructValue, error) { +func initSingleTier0GatewayLocaleService(context utl.SessionContext, d *schema.ResourceData, children []*data.StructValue, connector client.Connector) (*data.StructValue, error) { edgeClusterPath := d.Get("edge_cluster_path").(string) var serviceStruct *model.LocaleServices var err error if len(d.Id()) > 0 { // This is an update flow - fetch existing locale service to reuse if needed - serviceStruct, err = getPolicyTier0GatewayLocaleServiceWithEdgeCluster(d.Id(), connector) + serviceStruct, err = getPolicyTier0GatewayLocaleServiceWithEdgeCluster(context, d.Id(), connector) if err != nil { return nil, err } @@ -702,10 +704,11 @@ func initPolicyTier0ChildBgpConfig(config *model.BgpRoutingConfig) (*data.Struct return dataValue.(*data.StructValue), nil } -func policyTier0GatewayResourceToInfraStruct(d *schema.ResourceData, connector client.Connector, isGlobalManager bool, id string) (model.Infra, error) { +func policyTier0GatewayResourceToInfraStruct(context utl.SessionContext, d *schema.ResourceData, connector client.Connector, id string) (model.Infra, error) { var infraChildren, gwChildren, lsChildren []*data.StructValue var infraStruct model.Infra converter := bindings.NewTypeConverter() + isGlobalManager := context.ClientType == utl.Global displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -781,7 +784,7 @@ func policyTier0GatewayResourceToInfraStruct(d *schema.ResourceData, connector c // The user can either define locale_service (GL or LM) or edge_cluster_path (LM only) if d.HasChange("locale_service") { // Update locale services only if configuration changed - localeServices, err := initGatewayLocaleServices(d, connector, isGlobalManager, listPolicyTier0GatewayLocaleServices) + localeServices, err := initGatewayLocaleServices(context, d, connector, listPolicyTier0GatewayLocaleServices) if err != nil { return infraStruct, err } @@ -802,7 +805,7 @@ func policyTier0GatewayResourceToInfraStruct(d *schema.ResourceData, connector c } var err error - dataValue, err := initSingleTier0GatewayLocaleService(d, lsChildren, connector) + dataValue, err := initSingleTier0GatewayLocaleService(context, d, lsChildren, connector) if err != nil { return infraStruct, err } @@ -833,8 +836,8 @@ func policyTier0GatewayResourceToInfraStruct(d *schema.ResourceData, connector c func resourceNsxtPolicyTier0GatewayCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - isGlobalManager := isPolicyGlobalManager(m) - + context := getSessionContext(d, m) + isGlobalManager := context.ClientType == utl.Global err := verifyPolicyTier0GatewayConfig(d, isGlobalManager) if err != nil { return err @@ -846,14 +849,14 @@ func resourceNsxtPolicyTier0GatewayCreate(d *schema.ResourceData, m interface{}) return err } - obj, err := policyTier0GatewayResourceToInfraStruct(d, connector, isGlobalManager, id) + obj, err := policyTier0GatewayResourceToInfraStruct(getSessionContext(d, m), d, connector, id) if err != nil { return err } log.Printf("[INFO] Using H-API to create Tier0 with ID %s", id) - err = policyInfraPatch(obj, isGlobalManager, getPolicyConnector(m), false) + err = policyInfraPatch(getSessionContext(d, m), obj, getPolicyConnector(m), false) if err != nil { return handleCreateError("Tier0", id, err) } @@ -923,7 +926,7 @@ func resourceNsxtPolicyTier0GatewayRead(d *schema.ResourceData, m interface{}) e d.Set("dhcp_config_path", dhcpPaths[0]) } // Get the edge cluster Id or locale services - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, id, isGlobalManager) + localeServices, err := listPolicyTier0GatewayLocaleServices(getSessionContext(d, m), connector, id) if err != nil { return handleReadError(d, "Locale Service for T0", id, err) } @@ -1010,14 +1013,14 @@ func resourceNsxtPolicyTier0GatewayUpdate(d *schema.ResourceData, m interface{}) return fmt.Errorf("Error obtaining Tier0 ID") } - obj, err := policyTier0GatewayResourceToInfraStruct(d, connector, isGlobalManager, id) + obj, err := policyTier0GatewayResourceToInfraStruct(getSessionContext(d, m), d, connector, id) if err != nil { return handleUpdateError("Tier0", id, err) } log.Printf("[INFO] Using H-API to update Tier0 with ID %s", id) - err = policyInfraPatch(obj, isGlobalManager, connector, true) + err = policyInfraPatch(getSessionContext(d, m), obj, connector, true) if err != nil { return handleUpdateError("Tier0", id, err) } @@ -1058,7 +1061,7 @@ func resourceNsxtPolicyTier0GatewayDelete(d *schema.ResourceData, m interface{}) } log.Printf("[DEBUG] Using H-API to delete Tier0 with ID %s", id) - err := policyInfraPatch(obj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err := policyInfraPatch(getSessionContext(d, m), obj, getPolicyConnector(m), false) if err != nil { return handleDeleteError("Tier0", id, err) } diff --git a/nsxt/resource_nsxt_policy_tier0_gateway_interface.go b/nsxt/resource_nsxt_policy_tier0_gateway_interface.go index aaf72010d..366c305f3 100644 --- a/nsxt/resource_nsxt_policy_tier0_gateway_interface.go +++ b/nsxt/resource_nsxt_policy_tier0_gateway_interface.go @@ -246,6 +246,7 @@ func resourceNsxtPolicyTier0GatewayInterfaceCreate(d *schema.ResourceData, m int } localeServiceID := "" + context := getSessionContext(d, m) if isPolicyGlobalManager(m) { enablePIM := d.Get("enable_pim").(bool) if enablePIM { @@ -254,7 +255,7 @@ func resourceNsxtPolicyTier0GatewayInterfaceCreate(d *schema.ResourceData, m int if objSitePath == "" { return attributeRequiredGlobalManagerError("site_path", "nsxt_policy_tier0_gateway_interface") } - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, tier0ID, true) + localeServices, err := listPolicyTier0GatewayLocaleServices(context, connector, tier0ID) if err != nil { return err } @@ -266,7 +267,7 @@ func resourceNsxtPolicyTier0GatewayInterfaceCreate(d *schema.ResourceData, m int if objSitePath != "" { return globalManagerOnlyError() } - localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(tier0ID, connector) + localeService, err := getPolicyTier0GatewayLocaleServiceWithEdgeCluster(context, tier0ID, connector) if err != nil { return err } diff --git a/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go b/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go index fe7d1da14..1eb050c2d 100644 --- a/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go +++ b/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go @@ -483,7 +483,7 @@ func testAccNSXPolicyTier0InterfaceImporterGetID(s *terraform.State) (string, er localeServiceID := defaultPolicyLocaleServiceID if testAccIsGlobalManager() { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) - localeServices, err := listPolicyTier0GatewayLocaleServices(connector, gwID, true) + localeServices, err := listPolicyTier0GatewayLocaleServices(testAccGetSessionContext(), connector, gwID) if err != nil { return "", err } diff --git a/nsxt/resource_nsxt_policy_tier1_gateway.go b/nsxt/resource_nsxt_policy_tier1_gateway.go index f24955bbc..bbb141ef7 100644 --- a/nsxt/resource_nsxt_policy_tier1_gateway.go +++ b/nsxt/resource_nsxt_policy_tier1_gateway.go @@ -12,12 +12,11 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" - gm_tier_1s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s" - gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + tier1s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var advertismentTypeValues = []string{ @@ -129,6 +128,7 @@ func resourceNsxtPolicyTier1Gateway() *schema.Resource { Optional: true, Default: model.Tier1_HA_MODE_STANDBY, }, + "context": getContextSchema(), }, } } @@ -182,40 +182,20 @@ func getAdvRulesSchema() *schema.Schema { } } -func listGlobalManagerTier1GatewayLocaleServices(connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { - client := gm_tier_1s.NewLocaleServicesClient(connector) - markForDelete := false - listResponse, err := client.List(gwID, cursor, &markForDelete, nil, nil, nil, nil) - if err != nil { - return model.LocaleServicesListResult{}, err - } - - convertedResult, conversionErr := convertModelBindingType(listResponse, gm_model.LocaleServicesListResultBindingType(), model.LocaleServicesListResultBindingType()) - if conversionErr != nil { - return model.LocaleServicesListResult{}, conversionErr - } - - return convertedResult.(model.LocaleServicesListResult), nil -} - -func listLocalManagerTier1GatewayLocaleServices(connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { - client := tier_1s.NewLocaleServicesClient(connector) +func listTier1GatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string, cursor *string) (model.LocaleServicesListResult, error) { + client := tier1s.NewLocaleServicesClient(context, connector) markForDelete := false return client.List(gwID, cursor, &markForDelete, nil, nil, nil, nil) } -func listPolicyTier1GatewayLocaleServices(connector client.Connector, gwID string, isGlobalManager bool) ([]model.LocaleServices, error) { - - if isGlobalManager { - return listPolicyGatewayLocaleServices(connector, gwID, listGlobalManagerTier1GatewayLocaleServices) - } +func listPolicyTier1GatewayLocaleServices(context utl.SessionContext, connector client.Connector, gwID string) ([]model.LocaleServices, error) { - return listPolicyGatewayLocaleServices(connector, gwID, listLocalManagerTier1GatewayLocaleServices) + return listPolicyGatewayLocaleServices(context, connector, gwID, listTier1GatewayLocaleServices) } -func getPolicyTier1GatewayLocaleServiceEntry(gwID string, connector client.Connector) (*model.LocaleServices, error) { +func getPolicyTier1GatewayLocaleServiceEntry(context utl.SessionContext, gwID string, connector client.Connector) (*model.LocaleServices, error) { // Get the locale services of this Tier1 for the edge-cluster id - client := tier_1s.NewLocaleServicesClient(connector) + client := tier1s.NewLocaleServicesClient(context, connector) obj, err := client.Get(gwID, defaultPolicyLocaleServiceID) if err == nil { return &obj, nil @@ -223,7 +203,7 @@ func getPolicyTier1GatewayLocaleServiceEntry(gwID string, connector client.Conne // No locale-service with the default ID // List all the locale services - objList, errList := listPolicyTier1GatewayLocaleServices(connector, gwID, false) + objList, errList := listPolicyTier1GatewayLocaleServices(context, connector, gwID) if errList != nil { return nil, fmt.Errorf("Error while reading Tier1 %v locale-services: %v", gwID, err) } @@ -243,9 +223,9 @@ func getPolicyTier1GatewayLocaleServiceEntry(gwID string, connector client.Conne return nil, nil } -func resourceNsxtPolicyTier1GatewayReadEdgeCluster(d *schema.ResourceData, connector client.Connector) error { +func resourceNsxtPolicyTier1GatewayReadEdgeCluster(context utl.SessionContext, d *schema.ResourceData, connector client.Connector) error { // Get the locale services of this Tier1 for the edge-cluster id - obj, err := getPolicyTier1GatewayLocaleServiceEntry(d.Id(), connector) + obj, err := getPolicyTier1GatewayLocaleServiceEntry(context, d.Id(), connector) if err != nil || obj == nil { // No locale-service found return nil @@ -258,15 +238,9 @@ func resourceNsxtPolicyTier1GatewayReadEdgeCluster(d *schema.ResourceData, conne return nil } -func resourceNsxtPolicyTier1GatewayExists(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - if isGlobalManager { - client := gm_infra.NewTier1sClient(connector) - _, err = client.Get(id) - } else { - client := infra.NewTier1sClient(connector) - _, err = client.Get(id) - } +func resourceNsxtPolicyTier1GatewayExists(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + client := infra.NewTier1sClient(context, connector) + _, err := client.Get(id) if err == nil { return true, nil @@ -341,14 +315,14 @@ func resourceNsxtPolicyTier1GatewaySetVersionDependentAttrs(d *schema.ResourceDa } -func initSingleTier1GatewayLocaleService(d *schema.ResourceData, connector client.Connector) (*data.StructValue, error) { +func initSingleTier1GatewayLocaleService(context utl.SessionContext, d *schema.ResourceData, connector client.Connector) (*data.StructValue, error) { edgeClusterPath := d.Get("edge_cluster_path").(string) var serviceStruct *model.LocaleServices var err error if len(d.Id()) > 0 { // This is an update flow - fetch existing locale service to reuse if needed - serviceStruct, err = getPolicyTier1GatewayLocaleServiceEntry(d.Id(), connector) + serviceStruct, err = getPolicyTier1GatewayLocaleServiceEntry(context, d.Id(), connector) if err != nil { return nil, err } @@ -371,7 +345,7 @@ func initSingleTier1GatewayLocaleService(d *schema.ResourceData, connector clien return initChildLocaleService(serviceStruct, false) } -func policyTier1GatewayResourceToInfraStruct(d *schema.ResourceData, connector client.Connector, id string, isGlobalManager bool) (model.Infra, error) { +func policyTier1GatewayResourceToInfraStruct(context utl.SessionContext, d *schema.ResourceData, connector client.Connector, id string) (model.Infra, error) { var infraChildren, gwChildren []*data.StructValue var infraStruct model.Infra converter := bindings.NewTypeConverter() @@ -431,14 +405,14 @@ func policyTier1GatewayResourceToInfraStruct(d *schema.ResourceData, connector c resourceNsxtPolicyTier1GatewaySetVersionDependentAttrs(d, &obj) - if isGlobalManager { + if context.ClientType == utl.Global { intersiteConfig := getPolicyGatewayIntersiteConfigFromSchema(d) obj.IntersiteConfig = intersiteConfig } // set edge cluster for local manager if needed - if d.HasChange("edge_cluster_path") && !isGlobalManager { - dataValue, err := initSingleTier1GatewayLocaleService(d, connector) + if d.HasChange("edge_cluster_path") && context.ClientType != utl.Global { + dataValue, err := initSingleTier1GatewayLocaleService(context, d, connector) if err != nil { return infraStruct, err } @@ -448,7 +422,7 @@ func policyTier1GatewayResourceToInfraStruct(d *schema.ResourceData, connector c if d.HasChange("locale_service") { // Update locale services only if configuration changed - localeServices, err := initGatewayLocaleServices(d, connector, isGlobalManager, listPolicyTier1GatewayLocaleServices) + localeServices, err := initGatewayLocaleServices(context, d, connector, listPolicyTier1GatewayLocaleServices) if err != nil { return infraStruct, err } @@ -483,19 +457,19 @@ func resourceNsxtPolicyTier1GatewayCreate(d *schema.ResourceData, m interface{}) connector := getPolicyConnector(m) // Initialize resource Id and verify this ID is not yet used - id, err := getOrGenerateID(d, m, resourceNsxtPolicyTier1GatewayExists) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicyTier1GatewayExists) if err != nil { return err } - obj, err := policyTier1GatewayResourceToInfraStruct(d, connector, id, isPolicyGlobalManager(m)) + obj, err := policyTier1GatewayResourceToInfraStruct(getSessionContext(d, m), d, connector, id) if err != nil { return err } // Create the resource using PATCH log.Printf("[INFO] Using H-API to create Tier1 with ID %s", id) - err = policyInfraPatch(obj, isPolicyGlobalManager(m), connector, false) + err = policyInfraPatch(getSessionContext(d, m), obj, connector, false) if err != nil { return handleCreateError("Tier1", id, err) } @@ -508,31 +482,15 @@ func resourceNsxtPolicyTier1GatewayCreate(d *schema.ResourceData, m interface{}) func resourceNsxtPolicyTier1GatewayRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) - var obj model.Tier1 - var err error id := d.Id() if id == "" { return fmt.Errorf("Error obtaining Tier1 id") } - isGlobalManager := isPolicyGlobalManager(m) - if isGlobalManager { - client := gm_infra.NewTier1sClient(connector) - gmObj, getErr := client.Get(id) - if getErr != nil { - return handleReadError(d, "Tier0", id, getErr) - } - - convertedObj, convErr := convertModelBindingType(gmObj, model.Tier1BindingType(), model.Tier1BindingType()) - if convErr != nil { - return convErr - } - obj = convertedObj.(model.Tier1) - } else { - client := infra.NewTier1sClient(connector) - obj, err = client.Get(id) - } + context := getSessionContext(d, m) + client := infra.NewTier1sClient(context, connector) + obj, err := client.Get(id) if err != nil { return handleReadError(d, "Tier1", id, err) @@ -574,13 +532,13 @@ func resourceNsxtPolicyTier1GatewayRead(d *schema.ResourceData, m interface{}) e } // Get the edge cluster Id or locale services - localeServices, err := listPolicyTier1GatewayLocaleServices(connector, id, isGlobalManager) + localeServices, err := listPolicyTier1GatewayLocaleServices(context, connector, id) if err != nil { return handleReadError(d, "Locale Service for T1", id, err) } var services []map[string]interface{} _, shouldSetLS := d.GetOk("locale_service") - if isGlobalManager { + if context.ClientType == utl.Global { shouldSetLS = true } @@ -620,7 +578,7 @@ func resourceNsxtPolicyTier1GatewayRead(d *schema.ResourceData, m interface{}) e return fmt.Errorf("Failed to get Tier1 %s ipv6 profiles: %v", *obj.Id, err) } - if isGlobalManager { + if context.ClientType == utl.Global { err = setPolicyGatewayIntersiteConfigInSchema(d, obj.IntersiteConfig) if err != nil { return fmt.Errorf("Failed to get Tier1 %s interset config: %v", *obj.Id, err) @@ -638,13 +596,13 @@ func resourceNsxtPolicyTier1GatewayUpdate(d *schema.ResourceData, m interface{}) return fmt.Errorf("Error obtaining Tier1 id") } - obj, err := policyTier1GatewayResourceToInfraStruct(d, connector, id, isPolicyGlobalManager(m)) + obj, err := policyTier1GatewayResourceToInfraStruct(getSessionContext(d, m), d, connector, id) if err != nil { return err } log.Printf("[INFO] Using H-API to update Tier1 with ID %s", id) - err = policyInfraPatch(obj, isPolicyGlobalManager(m), connector, true) + err = policyInfraPatch(getSessionContext(d, m), obj, connector, true) if err != nil { return handleUpdateError("Tier1", id, err) } @@ -683,7 +641,7 @@ func resourceNsxtPolicyTier1GatewayDelete(d *schema.ResourceData, m interface{}) } log.Printf("[DEBUG] Using H-API to delete Tier1 with ID %s", id) - err := policyInfraPatch(obj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err := policyInfraPatch(getSessionContext(d, m), obj, getPolicyConnector(m), false) if err != nil { return handleDeleteError("Tier1", id, err) } diff --git a/nsxt/resource_nsxt_policy_tier1_gateway_interface.go b/nsxt/resource_nsxt_policy_tier1_gateway_interface.go index 54f2c7c7f..b9ef38f00 100644 --- a/nsxt/resource_nsxt_policy_tier1_gateway_interface.go +++ b/nsxt/resource_nsxt_policy_tier1_gateway_interface.go @@ -10,13 +10,13 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" gm_tier1s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s" gm_locale_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s/locale_services" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + localeservices "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s/locale_services" ) func resourceNsxtPolicyTier1GatewayInterface() *schema.Resource { @@ -36,6 +36,7 @@ func resourceNsxtPolicyTier1GatewayInterface() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "gateway_path": getPolicyPathSchema(true, true, "Policy path for tier1 gateway"), "segment_path": getPolicyPathSchema(true, true, "Policy path for connected segment"), "subnets": getGatewayInterfaceSubnetsSchema(), @@ -85,11 +86,12 @@ func resourceNsxtPolicyTier1GatewayInterfaceCreate(d *schema.ResourceData, m int sitePath := d.Get("site_path").(string) tier1ID := getPolicyIDFromPath(tier1Path) localeServiceID := "" + context := getSessionContext(d, m) if isPolicyGlobalManager(m) { if sitePath == "" { return attributeRequiredGlobalManagerError("site_path", "nsxt_policy_tier1_gateway_interface") } - localeServices, err := listPolicyTier1GatewayLocaleServices(connector, tier1ID, true) + localeServices, err := listPolicyTier1GatewayLocaleServices(context, connector, tier1ID) if err != nil { return err } @@ -102,7 +104,7 @@ func resourceNsxtPolicyTier1GatewayInterfaceCreate(d *schema.ResourceData, m int if sitePath != "" { return globalManagerOnlyError() } - localeService, err := getPolicyTier1GatewayLocaleServiceEntry(tier1ID, connector) + localeService, err := getPolicyTier1GatewayLocaleServiceEntry(context, tier1ID, connector) if err != nil { return err } @@ -116,13 +118,8 @@ func resourceNsxtPolicyTier1GatewayInterfaceCreate(d *schema.ResourceData, m int id = newUUID() } else { var err error - if isPolicyGlobalManager(m) { - client := gm_locale_services.NewInterfacesClient(connector) - _, err = client.Get(tier1ID, localeServiceID, id) - } else { - client := locale_services.NewInterfacesClient(connector) - _, err = client.Get(tier1ID, localeServiceID, id) - } + client := localeservices.NewInterfacesClient(getSessionContext(d, m), connector) + _, err = client.Get(tier1ID, localeServiceID, id) if err == nil { return fmt.Errorf("Interface with ID '%s' already exists on Tier1 Gateway %s", id, tier1ID) @@ -162,18 +159,8 @@ func resourceNsxtPolicyTier1GatewayInterfaceCreate(d *schema.ResourceData, m int // Create the resource using PATCH log.Printf("[INFO] Creating tier1 interface with ID %s", id) - var err error - if isPolicyGlobalManager(m) { - gmObj, convErr := convertModelBindingType(obj, model.Tier1InterfaceBindingType(), gm_model.Tier1InterfaceBindingType()) - if convErr != nil { - return convErr - } - client := gm_locale_services.NewInterfacesClient(connector) - err = client.Patch(tier1ID, localeServiceID, id, gmObj.(gm_model.Tier1Interface)) - } else { - client := locale_services.NewInterfacesClient(connector) - err = client.Patch(tier1ID, localeServiceID, id, obj) - } + client := localeservices.NewInterfacesClient(getSessionContext(d, m), connector) + err := client.Patch(tier1ID, localeServiceID, id, obj) if err != nil { return handleCreateError("Tier1 Interface", id, err) @@ -217,7 +204,7 @@ func resourceNsxtPolicyTier1GatewayInterfaceRead(d *schema.ResourceData, m inter d.Set("site_path", sitePath) } else { var err error - client := locale_services.NewInterfacesClient(connector) + client := localeservices.NewInterfacesClient(getSessionContext(d, m), connector) obj, err = client.Get(tier1ID, localeServiceID, id) if err != nil { return handleReadError(d, "Tier1 Interface", id, err) @@ -296,17 +283,8 @@ func resourceNsxtPolicyTier1GatewayInterfaceUpdate(d *schema.ResourceData, m int obj.UrpfMode = &urpfMode } var err error - if isPolicyGlobalManager(m) { - gmObj, err1 := convertModelBindingType(obj, model.Tier1InterfaceBindingType(), gm_model.Tier1InterfaceBindingType()) - if err1 != nil { - return err1 - } - client := gm_locale_services.NewInterfacesClient(connector) - _, err = client.Update(tier1ID, localeServiceID, id, gmObj.(gm_model.Tier1Interface)) - } else { - client := locale_services.NewInterfacesClient(connector) - _, err = client.Update(tier1ID, localeServiceID, id, obj) - } + client := localeservices.NewInterfacesClient(getSessionContext(d, m), connector) + _, err = client.Update(tier1ID, localeServiceID, id, obj) if err != nil { return handleUpdateError("Tier1 Interface", id, err) } @@ -326,13 +304,8 @@ func resourceNsxtPolicyTier1GatewayInterfaceDelete(d *schema.ResourceData, m int } var err error - if isPolicyGlobalManager(m) { - client := gm_locale_services.NewInterfacesClient(connector) - err = client.Delete(tier1ID, localeServiceID, id) - } else { - client := locale_services.NewInterfacesClient(connector) - err = client.Delete(tier1ID, localeServiceID, id) - } + client := localeservices.NewInterfacesClient(getSessionContext(d, m), connector) + err = client.Delete(tier1ID, localeServiceID, id) if err != nil { return handleDeleteError("Tier1 Interface", id, err) } @@ -350,24 +323,11 @@ func resourceNsxtPolicyTier1GatewayInterfaceImport(d *schema.ResourceData, m int gwID := s[0] connector := getPolicyConnector(m) var tier1GW model.Tier1 - if isPolicyGlobalManager(m) { - client := gm_infra.NewTier1sClient(connector) - gmObj, err := client.Get(gwID) - if err != nil { - return nil, err - } - lmObj, err := convertModelBindingType(gmObj, gm_model.Tier1BindingType(), model.Tier1BindingType()) - if err != nil { - return nil, err - } - tier1GW = lmObj.(model.Tier1) - } else { - var err error - client := infra.NewTier1sClient(connector) - tier1GW, err = client.Get(gwID) - if err != nil { - return nil, err - } + var err error + client := infra.NewTier1sClient(getSessionContext(d, m), connector) + tier1GW, err = client.Get(gwID) + if err != nil { + return nil, err } d.Set("gateway_path", tier1GW.Path) d.Set("locale_service_id", s[1]) diff --git a/nsxt/resource_nsxt_policy_tier1_gateway_test.go b/nsxt/resource_nsxt_policy_tier1_gateway_test.go index bdb76cdfa..12d1eaba2 100644 --- a/nsxt/resource_nsxt_policy_tier1_gateway_test.go +++ b/nsxt/resource_nsxt_policy_tier1_gateway_test.go @@ -454,11 +454,11 @@ func TestAccResourceNsxtPolicyTier1Gateway_importBasic(t *testing.T) { } func testAccNsxtPolicyTier1Exists(resourceName string) resource.TestCheckFunc { - return testAccNsxtPolicyResourceExists(resourceName, resourceNsxtPolicyTier1GatewayExists) + return testAccNsxtPolicyResourceExists(testAccGetSessionContext(), resourceName, resourceNsxtPolicyTier1GatewayExists) } func testAccNsxtPolicyTier1CheckDestroy(state *terraform.State, displayName string) error { - return testAccNsxtPolicyResourceCheckDestroy(state, displayName, "nsxt_policy_tier1_gateway", resourceNsxtPolicyTier1GatewayExists) + return testAccNsxtPolicyResourceCheckDestroy(testAccGetSessionContext(), state, displayName, "nsxt_policy_tier1_gateway", resourceNsxtPolicyTier1GatewayExists) } func testAccNsxtPolicyTier1CreateDHCPTemplate() string { diff --git a/nsxt/resource_nsxt_policy_vlan_segment_test.go b/nsxt/resource_nsxt_policy_vlan_segment_test.go index 8d92bb0b4..4de632738 100644 --- a/nsxt/resource_nsxt_policy_vlan_segment_test.go +++ b/nsxt/resource_nsxt_policy_vlan_segment_test.go @@ -249,7 +249,8 @@ func testAccNsxtPolicyVlanSegmentExists(resourceName string) resource.TestCheckF if resourceID == "" { return fmt.Errorf("Policy VLAN Segment resource ID not set in resources") } - exists, err := resourceNsxtPolicySegmentExists("", false)(resourceID, connector, testAccIsGlobalManager()) + context := testAccGetSessionContext() + exists, err := resourceNsxtPolicySegmentExists(context, "", false)(context, resourceID, connector) if err != nil { return err } @@ -270,8 +271,8 @@ func testAccNsxtPolicyVlanSegmentCheckDestroy(state *terraform.State, displayNam } resourceID := rs.Primary.Attributes["id"] - - exists, err := resourceNsxtPolicySegmentExists("", false)(resourceID, connector, testAccIsGlobalManager()) + context := testAccGetSessionContext() + exists, err := resourceNsxtPolicySegmentExists(context, "", false)(context, resourceID, connector) if err != nil { return err } diff --git a/nsxt/resource_nsxt_policy_vm_tags.go b/nsxt/resource_nsxt_policy_vm_tags.go index 18bb07dc6..bde39645a 100644 --- a/nsxt/resource_nsxt_policy_vm_tags.go +++ b/nsxt/resource_nsxt_policy_vm_tags.go @@ -11,10 +11,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/realized_state/enforcement_points" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + realizedstate "github.com/vmware/terraform-provider-nsxt/api/infra/realized_state" + "github.com/vmware/terraform-provider-nsxt/api/infra/segments" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var ( @@ -50,12 +52,13 @@ func resourceNsxtPolicyVMTags() *schema.Resource { }, }, }, + "context": getContextSchema(), }, } } -func listAllPolicyVirtualMachines(connector client.Connector, m interface{}) ([]model.VirtualMachine, error) { - client := realized_state.NewVirtualMachinesClient(connector) +func listAllPolicyVirtualMachines(context utl.SessionContext, connector client.Connector, m interface{}) ([]model.VirtualMachine, error) { + client := realizedstate.NewVirtualMachinesClient(context, connector) var results []model.VirtualMachine boolFalse := false var cursor *string @@ -92,8 +95,8 @@ func listAllPolicyVirtualMachines(connector client.Connector, m interface{}) ([] } } -func listAllPolicySegmentPorts(connector client.Connector, segmentPath string) ([]model.SegmentPort, error) { - client := segments.NewPortsClient(connector) +func listAllPolicySegmentPorts(context utl.SessionContext, connector client.Connector, segmentPath string) ([]model.SegmentPort, error) { + client := segments.NewPortsClient(context, connector) segmentID := getPolicyIDFromPath(segmentPath) var results []model.SegmentPort boolFalse := false @@ -144,10 +147,10 @@ func listAllPolicyVifs(m interface{}) ([]model.VirtualNetworkInterface, error) { } } -func findNsxtPolicyVMByNamePrefix(connector client.Connector, namePrefix string, m interface{}) ([]model.VirtualMachine, []model.VirtualMachine, error) { +func findNsxtPolicyVMByNamePrefix(context utl.SessionContext, connector client.Connector, namePrefix string, m interface{}) ([]model.VirtualMachine, []model.VirtualMachine, error) { var perfectMatch, prefixMatch []model.VirtualMachine - allVMs, err := listAllPolicyVirtualMachines(connector, m) + allVMs, err := listAllPolicyVirtualMachines(context, connector, m) if err != nil { log.Printf("[INFO] Error reading Virtual Machines when looking for name: %s", namePrefix) return perfectMatch, prefixMatch, err @@ -163,10 +166,10 @@ func findNsxtPolicyVMByNamePrefix(connector client.Connector, namePrefix string, return perfectMatch, prefixMatch, nil } -func findNsxtPolicyVMByID(connector client.Connector, vmID string, m interface{}) (model.VirtualMachine, error) { +func findNsxtPolicyVMByID(context utl.SessionContext, connector client.Connector, vmID string, m interface{}) (model.VirtualMachine, error) { var virtualMachineStruct model.VirtualMachine - allVMs, err := listAllPolicyVirtualMachines(connector, m) + allVMs, err := listAllPolicyVirtualMachines(context, connector, m) if err != nil { log.Printf("[INFO] Error reading Virtual Machines when looking for ID: %s", vmID) return virtualMachineStruct, err @@ -212,9 +215,9 @@ func listPolicyVifAttachmentsForVM(m interface{}, externalID string) ([]string, return vifAttachmentIds, nil } -func updateNsxtPolicyVMPortTags(connector client.Connector, externalID string, portTags []interface{}, m interface{}, isDelete bool) error { +func updateNsxtPolicyVMPortTags(context utl.SessionContext, connector client.Connector, externalID string, portTags []interface{}, m interface{}, isDelete bool) error { - client := segments.NewPortsClient(connector) + client := segments.NewPortsClient(context, connector) vifAttachmentIds, err := listPolicyVifAttachmentsForVM(m, externalID) if err != nil { @@ -229,7 +232,7 @@ func updateNsxtPolicyVMPortTags(connector client.Connector, externalID string, p tags = getPolicyTagsFromSet(data["tag"].(*schema.Set)) } - ports, portsErr := listAllPolicySegmentPorts(connector, segmentPath) + ports, portsErr := listAllPolicySegmentPorts(context, connector, segmentPath) if portsErr != nil { return portsErr } @@ -263,6 +266,7 @@ func setPolicyVMPortTagsInSchema(d *schema.ResourceData, m interface{}, external if err != nil { return err } + context := getSessionContext(d, m) portTags := d.Get("port").([]interface{}) var actualPortTags []map[string]interface{} @@ -270,7 +274,7 @@ func setPolicyVMPortTagsInSchema(d *schema.ResourceData, m interface{}, external data := portTag.(map[string]interface{}) segmentPath := data["segment_path"].(string) - ports, portsErr := listAllPolicySegmentPorts(connector, segmentPath) + ports, portsErr := listAllPolicySegmentPorts(context, connector, segmentPath) if portsErr != nil { return portsErr } @@ -303,7 +307,7 @@ func resourceNsxtPolicyVMTagsRead(d *schema.ResourceData, m interface{}) error { return fmt.Errorf("Error obtaining Virtual Machine ID") } - vm, err := findNsxtPolicyVMByID(connector, vmID, m) + vm, err := findNsxtPolicyVMByID(getSessionContext(d, m), connector, vmID, m) if err != nil { d.SetId("") log.Printf("[ERROR] Cannot find VM with ID %s, skip reading VM tag", vmID) @@ -323,8 +327,9 @@ func resourceNsxtPolicyVMTagsRead(d *schema.ResourceData, m interface{}) error { func resourceNsxtPolicyVMTagsCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) instanceID := d.Get("instance_id").(string) + context := getSessionContext(d, m) - vm, err := findNsxtPolicyVMByID(connector, instanceID, m) + vm, err := findNsxtPolicyVMByID(context, connector, instanceID, m) if err != nil { if len(d.Id()) == 0 { // This is create flow @@ -347,7 +352,7 @@ func resourceNsxtPolicyVMTagsCreate(d *schema.ResourceData, m interface{}) error } portTags := d.Get("port").([]interface{}) - err = updateNsxtPolicyVMPortTags(connector, *vm.ExternalId, portTags, m, false) + err = updateNsxtPolicyVMPortTags(context, connector, *vm.ExternalId, portTags, m, false) if err != nil { return handleCreateError("Segment Port Tag", *vm.ExternalId, err) } @@ -365,8 +370,9 @@ func resourceNsxtPolicyVMTagsUpdate(d *schema.ResourceData, m interface{}) error func resourceNsxtPolicyVMTagsDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) instanceID := d.Get("instance_id").(string) + context := getSessionContext(d, m) - vm, err := findNsxtPolicyVMByID(connector, instanceID, m) + vm, err := findNsxtPolicyVMByID(context, connector, instanceID, m) if err != nil { d.SetId("") @@ -382,7 +388,7 @@ func resourceNsxtPolicyVMTagsDelete(d *schema.ResourceData, m interface{}) error } portTags := d.Get("port").([]interface{}) - err = updateNsxtPolicyVMPortTags(connector, *vm.ExternalId, portTags, m, true) + err = updateNsxtPolicyVMPortTags(context, connector, *vm.ExternalId, portTags, m, true) if err != nil { return handleDeleteError("Segment Port Tag", *vm.ExternalId, err) } diff --git a/nsxt/resource_nsxt_policy_vm_tags_test.go b/nsxt/resource_nsxt_policy_vm_tags_test.go index ec04c7633..3b912afed 100644 --- a/nsxt/resource_nsxt_policy_vm_tags_test.go +++ b/nsxt/resource_nsxt_policy_vm_tags_test.go @@ -122,7 +122,7 @@ func testAccNSXPolicyVMTagsCheckExists(resourceName string) resource.TestCheckFu return fmt.Errorf("NSX Policy VM Tags resource ID not set in resources ") } - _, err := findNsxtPolicyVMByID(connector, resourceID, testAccProvider.Meta()) + _, err := findNsxtPolicyVMByID(testAccGetSessionContext(), connector, resourceID, testAccProvider.Meta()) if err != nil { return fmt.Errorf("Failed to find VM %s", resourceID) } @@ -140,7 +140,7 @@ func testAccNSXPolicyVMTagsCheckDestroy(state *terraform.State) error { } resourceID := rs.Primary.Attributes["id"] - vm, err := findNsxtPolicyVMByID(connector, resourceID, testAccProvider.Meta()) + vm, err := findNsxtPolicyVMByID(testAccGetSessionContext(), connector, resourceID, testAccProvider.Meta()) if err != nil { return fmt.Errorf("Failed to find VM %s", resourceID) } diff --git a/nsxt/segment_common.go b/nsxt/segment_common.go index c89551942..cdcb6d1d4 100644 --- a/nsxt/segment_common.go +++ b/nsxt/segment_common.go @@ -6,20 +6,21 @@ import ( "strings" "time" + tier1s "github.com/vmware/terraform-provider-nsxt/api/infra/tier_1s" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" - gm_infra "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra" gm_segments "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/segments" - gm_tier_1s "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/global_infra/tier_1s" gm_model "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/model" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/segments" - "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + "github.com/vmware/terraform-provider-nsxt/api/infra" + "github.com/vmware/terraform-provider-nsxt/api/infra/segments" + utl "github.com/vmware/terraform-provider-nsxt/api/utl" ) var connectivityValues = []string{ @@ -265,6 +266,7 @@ func getPolicyCommonSegmentSchema(vlanRequired bool, isFixed bool) map[string]*s "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), + "context": getContextSchema(), "advanced_config": { Type: schema.TypeList, Description: "Advanced segment configuration", @@ -680,7 +682,7 @@ func nsxtPolicySegmentAddGatewayToInfraStruct(d *schema.ResourceData, dataValue return dataValue1.(*data.StructValue), nil } -func policySegmentResourceToInfraStruct(id string, d *schema.ResourceData, isVlan bool, isFixed bool, isGlobalManager bool) (model.Infra, error) { +func policySegmentResourceToInfraStruct(context utl.SessionContext, id string, d *schema.ResourceData, isVlan bool, isFixed bool) (model.Infra, error) { // Read the rest of the configured parameters var infraChildren []*data.StructValue @@ -694,7 +696,7 @@ func policySegmentResourceToInfraStruct(id string, d *schema.ResourceData, isVla revision := int64(d.Get("revision").(int)) resourceType := "Segment" - if (tzPath == "") && !isGlobalManager && !isFixed { + if (tzPath == "") && context.ClientType == utl.Local && !isFixed { return model.Infra{}, fmt.Errorf("transport_zone_path needs to be specified for infra segment on local manager") } @@ -833,7 +835,7 @@ func policySegmentResourceToInfraStruct(id string, d *schema.ResourceData, isVla } } - if !isGlobalManager { + if context.ClientType != utl.Global { setBridgeConfigInStruct(d, &obj) } @@ -869,15 +871,9 @@ func policySegmentResourceToInfraStruct(id string, d *schema.ResourceData, isVla return infraStruct, nil } -func resourceNsxtPolicySegmentExists(gwPath string, isFixed bool) func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - return func(id string, connector client.Connector, isGlobalManager bool) (bool, error) { - var err error - - if isGlobalManager { - _, err = nsxtPolicyGlobalManagerGetSegment(connector, id, gwPath, isFixed) - } else { - _, err = nsxtPolicyLocalManagerGetSegment(connector, id, gwPath, isFixed) - } +func resourceNsxtPolicySegmentExists(context utl.SessionContext, gwPath string, isFixed bool) func(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + return func(context utl.SessionContext, id string, connector client.Connector) (bool, error) { + _, err := nsxtPolicyGetSegment(context, connector, id, gwPath, isFixed) if err == nil { return true, nil } @@ -1164,7 +1160,7 @@ func nsxtPolicySegmentDiscoveryProfileRead(d *schema.ResourceData, m interface{} } results = lmResults.(model.SegmentDiscoveryProfileBindingMapListResult) } else { - client := segments.NewSegmentDiscoveryProfileBindingMapsClient(connector) + client := segments.NewSegmentDiscoveryProfileBindingMapsClient(getSessionContext(d, m), connector) var err error results, err = client.List(segmentID, nil, nil, nil, nil, nil, nil) if err != nil { @@ -1205,7 +1201,7 @@ func nsxtPolicySegmentQosProfileRead(d *schema.ResourceData, m interface{}) erro } results = lmResults.(model.SegmentQosProfileBindingMapListResult) } else { - client := segments.NewSegmentQosProfileBindingMapsClient(connector) + client := segments.NewSegmentQosProfileBindingMapsClient(getSessionContext(d, m), connector) var err error results, err = client.List(segmentID, nil, nil, nil, nil, nil) if err != nil { @@ -1245,7 +1241,7 @@ func nsxtPolicySegmentSecurityProfileRead(d *schema.ResourceData, m interface{}) } results = lmResults.(model.SegmentSecurityProfileBindingMapListResult) } else { - client := segments.NewSegmentSecurityProfileBindingMapsClient(connector) + client := segments.NewSegmentSecurityProfileBindingMapsClient(getSessionContext(d, m), connector) var err error results, err = client.List(segmentID, nil, nil, nil, nil, nil) if err != nil { @@ -1305,9 +1301,9 @@ func setSegmentBridgeConfigInSchema(d *schema.ResourceData, obj *model.Segment) d.Set("bridge_config", configs) } -func nsxtPolicyLocalManagerGetSegment(connector client.Connector, id string, gwPath string, isFixed bool) (model.Segment, error) { +func nsxtPolicyGetSegment(context utl.SessionContext, connector client.Connector, id string, gwPath string, isFixed bool) (model.Segment, error) { if !isFixed { - return infra.NewSegmentsClient(connector).Get(id) + return infra.NewSegmentsClient(context, connector).Get(id) } isT0, gwID := parseGatewayPolicyPath(gwPath) @@ -1318,35 +1314,7 @@ func nsxtPolicyLocalManagerGetSegment(connector client.Connector, id string, gwP return model.Segment{}, fmt.Errorf("Tier-0 fixed segments are not supported") } - return tier_1s.NewSegmentsClient(connector).Get(gwID, id) -} - -func nsxtPolicyGlobalManagerGetSegment(connector client.Connector, id string, gwPath string, isFixed bool) (model.Segment, error) { - var err error - var gmObj gm_model.Segment - - if !isFixed { - gmObj, err = gm_infra.NewSegmentsClient(connector).Get(id) - } else { - isT0, gwID := parseGatewayPolicyPath(gwPath) - if gwID == "" { - return model.Segment{}, fmt.Errorf("connectivity_path is not a valid gateway path") - } - if isT0 { - return model.Segment{}, fmt.Errorf("Tier-0 fixed segments are not supported") - } - gmObj, err = gm_tier_1s.NewSegmentsClient(connector).Get(gwID, id) - } - - if err != nil { - return model.Segment{}, err - } - - lmObj, err := convertModelBindingType(gmObj, gm_model.SegmentBindingType(), model.SegmentBindingType()) - if err != nil { - return model.Segment{}, err - } - return lmObj.(model.Segment), nil + return tier1s.NewSegmentsClient(context, connector).Get(gwID, id) } func nsxtPolicySegmentRead(d *schema.ResourceData, m interface{}, isVlan bool, isFixed bool) error { @@ -1357,18 +1325,12 @@ func nsxtPolicySegmentRead(d *schema.ResourceData, m interface{}, isVlan bool, i return fmt.Errorf("Error obtaining Segment ID") } - var obj model.Segment - var err error gwPath := "" if !isVlan { gwPath = d.Get("connectivity_path").(string) } - if isPolicyGlobalManager(m) { - obj, err = nsxtPolicyGlobalManagerGetSegment(connector, id, gwPath, isFixed) - } else { - obj, err = nsxtPolicyLocalManagerGetSegment(connector, id, gwPath, isFixed) - } + obj, err := nsxtPolicyGetSegment(getSessionContext(d, m), connector, id, gwPath, isFixed) if err != nil { return handleReadError(d, "Segment", id, err) @@ -1476,17 +1438,17 @@ func nsxtPolicySegmentCreate(d *schema.ResourceData, m interface{}, isVlan bool, gwPath = d.Get("connectivity_path").(string) } - id, err := getOrGenerateID(d, m, resourceNsxtPolicySegmentExists(gwPath, isFixed)) + id, err := getOrGenerateID2(d, m, resourceNsxtPolicySegmentExists(getSessionContext(d, m), gwPath, isFixed)) if err != nil { return err } - obj, err := policySegmentResourceToInfraStruct(id, d, isVlan, isFixed, isPolicyGlobalManager(m)) + obj, err := policySegmentResourceToInfraStruct(getSessionContext(d, m), id, d, isVlan, isFixed) if err != nil { return err } - err = policyInfraPatch(obj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err = policyInfraPatch(getSessionContext(d, m), obj, getPolicyConnector(m), false) if err != nil { return handleCreateError("Segment", id, err) } @@ -1504,12 +1466,12 @@ func nsxtPolicySegmentUpdate(d *schema.ResourceData, m interface{}, isVlan bool, return fmt.Errorf("Error obtaining Segment ID") } - obj, err := policySegmentResourceToInfraStruct(id, d, isVlan, isFixed, isPolicyGlobalManager(m)) + obj, err := policySegmentResourceToInfraStruct(getSessionContext(d, m), id, d, isVlan, isFixed) if err != nil { return err } - err = policyInfraPatch(obj, isPolicyGlobalManager(m), getPolicyConnector(m), true) + err = policyInfraPatch(getSessionContext(d, m), obj, getPolicyConnector(m), true) if err != nil { return handleCreateError("Segment", id, err) } @@ -1546,7 +1508,7 @@ func nsxtPolicySegmentDelete(d *schema.ResourceData, m interface{}, isFixed bool numOfPorts = len(gmPorts.Results) ports = gmPorts } else { - portsClient := segments.NewPortsClient(connector) + portsClient := segments.NewPortsClient(getSessionContext(d, m), connector) lmPorts, err := portsClient.List(id, nil, nil, nil, nil, nil, nil) if err != nil { return lmPorts, "error", logAPIError("Error listing segment ports", err) @@ -1613,7 +1575,7 @@ func nsxtPolicySegmentDelete(d *schema.ResourceData, m interface{}, isFixed bool } log.Printf("[DEBUG] Using H-API to delete segment with ID %s", id) - err := policyInfraPatch(infraObj, isPolicyGlobalManager(m), getPolicyConnector(m), false) + err := policyInfraPatch(getSessionContext(d, m), infraObj, getPolicyConnector(m), false) if err != nil { return handleDeleteError("Segment", id, err) } diff --git a/nsxt/utils.go b/nsxt/utils.go index 0a573438e..098878c2a 100644 --- a/nsxt/utils.go +++ b/nsxt/utils.go @@ -662,3 +662,22 @@ func handlePagination(lister func(*paginationInfo) error) (int64, error) { return total, nil } + +func getContextSchema() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Description: "Resource context", + Optional: true, + MaxItems: 1, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Description: "Id of the project which the resource belongs to.", + Required: true, + }, + }, + }, + } +} diff --git a/nsxt/utils_test.go b/nsxt/utils_test.go index 5fbc664e8..9131f0a83 100644 --- a/nsxt/utils_test.go +++ b/nsxt/utils_test.go @@ -20,6 +20,8 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + + tf_api "github.com/vmware/terraform-provider-nsxt/api/utl" ) // Default names or prefixed of NSX backend existing objects used in the acceptance tests. @@ -177,6 +179,20 @@ func testAccIsGlobalManager() bool { return os.Getenv("NSXT_GLOBAL_MANAGER") == "true" || os.Getenv("NSXT_GLOBAL_MANAGER") == "1" } +func testAccGetSessionContext() tf_api.SessionContext { + return tf_api.SessionContext{ProjectID: os.Getenv("NSXT_PROJECT_ID"), ClientType: testAccIsGlobalManager2()} +} + +func testAccIsGlobalManager2() tf_api.ClientType { + if os.Getenv("NSXT_PROJECT_ID") != "" { + return tf_api.Multitenancy + } + if os.Getenv("NSXT_GLOBAL_MANAGER") == "true" || os.Getenv("NSXT_GLOBAL_MANAGER") == "1" { + return tf_api.Global + } + return tf_api.Local +} + func testAccOnlyGlobalManager(t *testing.T) { if !testAccIsGlobalManager() { t.Skipf("This test requires a global manager environment") @@ -390,7 +406,7 @@ func testGetObjIDByName(objName string, resourceType string) (string, error) { return "", fmt.Errorf("Error during test client initialization: %v", err1) } - resultValues, err2 := listPolicyResourcesByNameAndType(connector, testAccIsGlobalManager(), objName, resourceType, nil) + resultValues, err2 := listPolicyResourcesByNameAndType(connector, testAccGetSessionContext(), objName, resourceType, nil) if err2 != nil { return "", err2 } @@ -504,7 +520,7 @@ func testAccNsxtPolicyGatewayTemplate(isT0 bool) string { return testAccNsxtPolicyTier1WithEdgeClusterForVPN() } -func testAccNsxtPolicyResourceExists(resourceName string, presenceChecker func(string, client.Connector, bool) (bool, error)) resource.TestCheckFunc { +func testAccNsxtPolicyResourceExists(context tf_api.SessionContext, resourceName string, presenceChecker func(tf_api.SessionContext, string, client.Connector) (bool, error)) resource.TestCheckFunc { return func(state *terraform.State) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) @@ -519,7 +535,7 @@ func testAccNsxtPolicyResourceExists(resourceName string, presenceChecker func(s return fmt.Errorf("Policy resource ID not set in resources") } - exists, err := presenceChecker(resourceID, connector, testAccIsGlobalManager()) + exists, err := presenceChecker(context, resourceID, connector) if err != nil { return err } @@ -532,7 +548,7 @@ func testAccNsxtPolicyResourceExists(resourceName string, presenceChecker func(s } } -func testAccNsxtPolicyResourceCheckDestroy(state *terraform.State, displayName string, resourceType string, presenceChecker func(string, client.Connector, bool) (bool, error)) error { +func testAccNsxtPolicyResourceCheckDestroy(context tf_api.SessionContext, state *terraform.State, displayName string, resourceType string, presenceChecker func(tf_api.SessionContext, string, client.Connector) (bool, error)) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) for _, rs := range state.RootModule().Resources { @@ -541,7 +557,7 @@ func testAccNsxtPolicyResourceCheckDestroy(state *terraform.State, displayName s } resourceID := rs.Primary.Attributes["id"] - exists, err := presenceChecker(resourceID, connector, testAccIsGlobalManager()) + exists, err := presenceChecker(context, resourceID, connector) if err != nil { return err } diff --git a/tools/api-wrapper-generator.py b/tools/api-wrapper-generator.py new file mode 100644 index 000000000..3a8e1d14c --- /dev/null +++ b/tools/api-wrapper-generator.py @@ -0,0 +1,326 @@ +#!/usr/bin/python3 +import argparse +import atexit +import git +import os +import re +import shutil +import string +import tempfile +import yaml + +SDK_REPO = 'github.com/vmware/vsphere-automation-sdk-go' +SDK_BASE_PATH = 'services/nsxt' +TF_PROVIDER_REPO = 'github.com/vmware/terraform-provider-nsxt' + + +def cleanup(): + try: + # TODO: uncomment + shutil.rmtree(get_func_definition.repo_path) + pass + except (FileNotFoundError, AttributeError): + pass + + +def mkpath(path): + if not os.path.isdir(path): + os.makedirs(path) + + +def get_pkg_name_from_path(path): + return path.split('/')[-1].replace("_", "") + + +def camel_to_snake(name): + name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) + return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower() + + +def get_yaml_file(fname): + with open(fname) as f: + return yaml.safe_load(f) + + +def var_name(var): + # Variable names within function defs are the obj_name but with 1st char lowercase + return var[0].lower() + var[1:] + + +def get_arglist(arg_str): + # Retrieve function argument list from function definition + arg_list = arg_str.replace(', ', ',').split(',') + return [arg[0] for arg in [a.split(' ') for a in arg_list]] + + +def parse_new_call(func_def): + # Parse New* definition + try: + r = parse_new_call.regex + except AttributeError: + r = re.compile('func\s+(.*)\((.*)\)\s+(.*)\s+\{.*') + parse_new_call.regex = r + + m = r.match(func_def) + return m.groups() + + +def new_func_call_setup(api, subs_dict): + g = parse_new_call(subs_dict['func_def']) + arg_list = get_arglist(g[1]) + return '%s(%s)' % (g[0], ', '.join(arg_list)) + + +def api_func_call_setup(api, subs_dict): + g = parse_api_call(subs_dict['func_def']) + arg_list = get_arglist(g[2]) + if subs_dict['type'] == "Multitenancy": + arg_list = ['utl.DefaultOrgID', 'c.ProjectID'] + arg_list + return '%s(%s)' % (g[1], ', '.join(arg_list)) + + +def patch_func_call_setup(api, subs_dict): + g = parse_api_call(subs_dict['func_def']) + arg_list = get_arglist(g[2]) + if api['template_type'] == 'Convert': + for n in range(0, len(arg_list)): + if arg_list[n] == subs_dict['var_name']: + arg_list[n] = 'gmObj.(%s.%s)' % (subs_dict['model_import'], subs_dict['model_name']) + elif subs_dict['type'] == "Multitenancy": + arg_list = ['utl.DefaultOrgID', 'c.ProjectID'] + arg_list + return '%s(%s)' % (g[1], ', '.join(arg_list)) + + +def parse_api_call(func_def): + # Parse API definition + try: + r = parse_api_call.regex + except AttributeError: + r = re.compile('func\s+(.*)\s+(.*)\((.*)\)\s+(.*)\s+\{') + parse_api_call.regex = r + + m = r.match(func_def) + return m.groups() + + +def new_func_def_setup(subs_dict): + # Prepare New* definition from function definition + g = parse_new_call(subs_dict['func_def']) + return '%s(sessionContext utl.SessionContext, %s) *%sClientContext' % (g[0], g[1], subs_dict['model_name']) + + +def api_func_def_setup(subs_dict): + # Prepare API definition from function definition + func_def = subs_dict['func_def'].replace('%s.' % subs_dict['model_prefix'], '%s.' % subs_dict['main_model_import']) + g = parse_api_call(func_def) + return '(c %sClientContext) %s(%s) %s' % (subs_dict['model_name'], g[1], g[2], g[3]) + + +def list_func_def_setup(subs_dict): + # Prepare API definition from function definition + func_def = subs_dict['func_def'].replace('nsx_policyModel.', '%s.' % subs_dict['list_main_model_import']) + g = parse_api_call(func_def) + return '(c %sClientContext) %s(%s) %s' % (subs_dict['model_name'], g[1], g[2], g[3]) + + +def get_func_definition(api, func, path): + # Retrieve func definition from SDK repo + try: + repo_path = get_func_definition.repo_path + + except AttributeError: + # Get SDK repo from GitHub + repo_path = tempfile.mkdtemp() + git.Repo.clone_from('https://%s' % SDK_REPO, repo_path) + get_func_definition.repo_path = repo_path + + fname = api.get('client_name', '%ssClient' % api['obj_name']) + with open('%s/%s/%s.go' % (repo_path, path.replace(SDK_REPO, ''), fname), 'r') as f: + for line in f: + if line.startswith('func ') and ' ' + func + '(' in line: + return line + raise Exception('No function definition found for %s for model %s' % (func, api['model_name'])) + + +FUNC_DEF_CALLBACK = { + 'New': new_func_def_setup, + 'Create': api_func_def_setup, + 'Get': api_func_def_setup, + 'Patch': api_func_def_setup, + 'Update': api_func_def_setup, + 'Delete': api_func_def_setup, + 'List': list_func_def_setup +} + +FUNC_CALL_CALLBACK = { + 'New': new_func_call_setup, + 'Get': api_func_call_setup, + 'Create': patch_func_call_setup, + 'Patch': patch_func_call_setup, + 'Update': patch_func_call_setup, + 'Delete': api_func_call_setup, + 'List': api_func_call_setup +} + +atexit.register(cleanup) + + +def get_args(): + parser = argparse.ArgumentParser( + prog='api-wrapper-generator.py', + description='Generate API wrappers for NSX Golang SDK') + parser.add_argument('--api_list', required=True) + parser.add_argument('--api_templates', required=True) + parser.add_argument('--api_file_template', required=True) + parser.add_argument('--utl_file_template', required=True) + parser.add_argument('--out_dir', required=True) + return parser.parse_args() + + +def get_dicts_from_yaml(api_list_file, api_template_file, api_file_template_file, utl_file_template_file): + api_list = get_yaml_file(api_list_file) + api_templates = get_yaml_file(api_template_file) + api_file_template = get_yaml_file(api_file_template_file) + utl_file_template = get_yaml_file(utl_file_template_file) + + return api_list, api_templates, api_file_template, utl_file_template + + +def format_file(f): + os.system('gofmt -s -w %s' % f) + + +def write_utl_file(out_dir, utl_file_template): + # Create type definitions + type_set = set() + for api in api_list: + for pkg in api['api_packages']: + type_set.add(pkg['type']) + + # Build type list + n = 0 + type_list = [] + for t in sorted(type_set): + type_list.append(" %s = %d" % (t, n)) + n += 1 + + template = string.Template(utl_file_template) + output = template.substitute({ + "const": "\n".join(type_list), + "pkg_name": get_pkg_name_from_path(out_dir)}) + + utl_dir = out_dir + '/utl' + mkpath(utl_dir) + outfile = '%s/api_util.go' % utl_dir + with open(outfile, 'w') as f: + f.write(output) + + format_file(outfile) + + +def write_api_file(api, out_dir, api_file_template): + client_dict = {} + model_dict = {} + list_model_dict = {} + + for pkg in api['api_packages']: + if not client_dict.get(pkg['client']): + client_dict[pkg['client']] = 'client%d' % len(client_dict) + if not model_dict.get(pkg['model']): + model_dict[pkg['model']] = 'model%d' % len(model_dict) + if pkg.get('list_result_model') and not list_model_dict.get(pkg['list_result_model']): + list_model_dict[pkg['list_result_model']] = 'lrmodel%d' % len(list_model_dict) + # Build import list + import_dict = client_dict.copy() + import_dict.update(model_dict.copy()) + import_dict.update(list_model_dict.copy()) + import_list = [' %s "%s"' % (import_dict[s], s) for s in sorted(import_dict.keys())] + + template = string.Template(api_file_template) + context_type = '%sClientContext utl.ClientContext' % api['model_name'] + + pkg_name = get_pkg_name_from_path(api['api_packages'][0]['client']) + output = template.substitute({ + "imports": "\n".join(import_list), + "context_type": context_type, + "utl_pkg_import": 'utl "%s/%s"' % (TF_PROVIDER_REPO, os.path.relpath(out_dir + '/utl')), + "pkg_name": pkg_name}) + + subs_dict = { + "client_name": api.get('client_name', '%ssClient' % api['obj_name']), + "obj_name": api['obj_name'], + "model_name": api['model_name'], + "var_name": api.get('var_name', '%sParam' % var_name(api['obj_name'])), + "list_result_name": api.get('list_result_name', '%sListResult' % api['model_name']), + "model_prefix": api.get('model_prefix', 'nsx_policyModel'), + "ptr_prefix": '*' if api.get('model_pass_ptr') else '' + } + main_model_import = None + list_main_model_import = None + out_path = None + api_list = api.get('supported_method', api_templates.keys()) + for api_name in api_list: + tpl = api_templates[api_name] + case_items = "" + for pkg in api['api_packages']: + model_import = model_dict[pkg["model"]] + client_import = client_dict[pkg["client"]] + list_model_import = list_model_dict.get(pkg.get("list_result_model"), model_import) + if main_model_import is None: + main_model_import = model_import + list_main_model_import = list_model_import + out_path = pkg["client"].replace(SDK_REPO, '').replace(SDK_BASE_PATH, '') + if api_name == 'New': + if api.get('client_name'): + func_name = 'New%s' % api['client_name'] + else: + func_name = 'New%ssClient' % api['obj_name'] + else: + func_name = api_name + func_def = get_func_definition(api, func_name, api['api_packages'][0]['client']) + subs_dict.update({ + "client_import": client_import, + "model_import": model_import, + "main_model_import": main_model_import, + "list_model_import": list_model_import, + "list_main_model_import": list_main_model_import, + "func_def": func_def, + "type": pkg['type'] + }) + if api_name != 'List' and model_import == main_model_import: + api['template_type'] = "NoConvert" + elif api_name == 'List' and list_model_import == list_main_model_import: + api['template_type'] = "NoConvert" + else: + api['template_type'] = "Convert" + if FUNC_DEF_CALLBACK.get(api_name): + subs_dict['api_func_def'] = FUNC_DEF_CALLBACK[api_name](subs_dict) + if FUNC_CALL_CALLBACK.get(api_name): + subs_dict['api_func_call'] = FUNC_CALL_CALLBACK[api_name](api, subs_dict) + template = string.Template(tpl[api['template_type']]) + case_items += template.substitute(subs_dict) + + template = string.Template(tpl['main']) + subs_dict['case_items'] = case_items + output += template.substitute(subs_dict) + + mkpath('%s/%s' % (out_dir, out_path)) + outfile = '%s/%s/%s.go' % (out_dir, out_path, camel_to_snake(api.get('file_name', api['model_name']))) + with open(outfile, 'w') as f: + f.write(output) + + format_file(outfile) + + +args = get_args() +api_list, api_templates, api_file_template, utl_file_template = get_dicts_from_yaml(args.api_list, args.api_templates, + args.api_file_template, + args.utl_file_template) +out_dir = args.out_dir + +write_utl_file(out_dir, utl_file_template) + +for api in api_list: + write_api_file(api, out_dir, api_file_template) + +exit(0) diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraClient.go new file mode 100644 index 000000000..819a2fee7 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraClient.go @@ -0,0 +1,143 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Infra +// Used by client-side stubs. + +package projects + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type InfraClient interface { + + // Read infra. Returns only the infra related properties. Inner object are not populated. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param basePathParam Base Path for retrieving hierarchical intent (optional) + // @param filterParam Filter string as java regex (optional) + // @param typeFilterParam Filter string to retrieve hierarchy. (optional) + // @return com.vmware.nsx_policy.model.Infra + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, basePathParam *string, filterParam *string, typeFilterParam *string) (nsx_policyModel.Infra, error) + + // Patch API at infra level can be used in two flavours 1. Like a regular API to update Infra object 2. Hierarchical API: To create/update/delete entire or part of intent hierarchy Hierarchical API: Provides users a way to create entire or part of intent in single API invocation. Input is expressed in a tree format. Each node in tree can have multiple children of different types. System will resolve the dependecies of nodes within the intent tree and will create the model. Children for any node can be specified using ChildResourceReference or ChildPolicyConfigResource. If a resource is specified using ChildResourceReference then it will not be updated only its children will be updated. If Object is specified using ChildPolicyConfigResource, object along with its children will be updated. Hierarchical API can also be used to delete any sub-branch of entire tree. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraParam (required) + // @param enforceRevisionCheckParam Force revision check (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, infraParam nsx_policyModel.Infra, enforceRevisionCheckParam *bool) error +} + +type infraClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewInfraClient(connector vapiProtocolClient_.Connector) *infraClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := infraClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *infraClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *infraClient) Get(orgIdParam string, projectIdParam string, basePathParam *string, filterParam *string, typeFilterParam *string) (nsx_policyModel.Infra, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := infraGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(infraGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("BasePath", basePathParam) + sv.AddStructField("Filter", filterParam) + sv.AddStructField("TypeFilter", typeFilterParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Infra + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Infra + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InfraGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Infra), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *infraClient) Patch(orgIdParam string, projectIdParam string, infraParam nsx_policyModel.Infra, enforceRevisionCheckParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := infraPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(infraPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Infra", infraParam) + sv.AddStructField("EnforceRevisionCheck", enforceRevisionCheckParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraTypes.go new file mode 100644 index 000000000..a8d357d6b --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/InfraTypes.go @@ -0,0 +1,162 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Infra. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package projects + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func infraGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["base_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["type_filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["base_path"] = "BasePath" + fieldNameMap["filter"] = "Filter" + fieldNameMap["type_filter"] = "TypeFilter" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InfraGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.InfraBindingType) +} + +func infraGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["base_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["type_filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["base_path"] = "BasePath" + fieldNameMap["filter"] = "Filter" + fieldNameMap["type_filter"] = "TypeFilter" + paramsTypeMap["filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["base_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["type_filter"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["filter"] = "filter" + queryParams["base_path"] = "base_path" + queryParams["type_filter"] = "type_filter" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func infraPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra"] = vapiBindings_.NewReferenceType(nsx_policyModel.InfraBindingType) + fields["enforce_revision_check"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra"] = "Infra" + fieldNameMap["enforce_revision_check"] = "EnforceRevisionCheck" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InfraPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func infraPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra"] = vapiBindings_.NewReferenceType(nsx_policyModel.InfraBindingType) + fields["enforce_revision_check"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra"] = "Infra" + fieldNameMap["enforce_revision_check"] = "EnforceRevisionCheck" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra"] = vapiBindings_.NewReferenceType(nsx_policyModel.InfraBindingType) + paramsTypeMap["enforce_revision_check"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforce_revision_check"] = "enforce_revision_check" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "infra", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/ProjectsPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/ProjectsPackageTypes.go new file mode 100644 index 000000000..e96151055 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/ProjectsPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package projects diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsClient.go new file mode 100644 index 000000000..10f368677 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsClient.go @@ -0,0 +1,97 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: QuotaStats +// Used by client-side stubs. + +package projects + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type QuotaStatsClient interface { + + // Get quota details To create, update, list and delete the Quota, please refer to Constraint APIs with 'constraint_expressions' as 'EntityInstanceCountConstraintExpression'. + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // @param pathPrefixParam Path prefix for retriving the quota details. (required) + // @param constraintPathParam Constraint path to retrive the quota details. (optional) + // @return com.vmware.nsx_policy.model.QuotaStatsListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, pathPrefixParam string, constraintPathParam *string) (nsx_policyModel.QuotaStatsListResult, error) +} + +type quotaStatsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewQuotaStatsClient(connector vapiProtocolClient_.Connector) *quotaStatsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.quota_stats") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + qIface := quotaStatsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &qIface +} + +func (qIface *quotaStatsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := qIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (qIface *quotaStatsClient) Get(orgIdParam string, projectIdParam string, pathPrefixParam string, constraintPathParam *string) (nsx_policyModel.QuotaStatsListResult, error) { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := quotaStatsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(quotaStatsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("PathPrefix", pathPrefixParam) + sv.AddStructField("ConstraintPath", constraintPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.QuotaStatsListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.quota_stats", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.QuotaStatsListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), QuotaStatsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.QuotaStatsListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsTypes.go new file mode 100644 index 000000000..49a81e361 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/QuotaStatsTypes.go @@ -0,0 +1,88 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: QuotaStats. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package projects + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func quotaStatsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["path_prefix"] = vapiBindings_.NewStringType() + fields["constraint_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["path_prefix"] = "PathPrefix" + fieldNameMap["constraint_path"] = "ConstraintPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QuotaStatsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.QuotaStatsListResultBindingType) +} + +func quotaStatsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["path_prefix"] = vapiBindings_.NewStringType() + fields["constraint_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["path_prefix"] = "PathPrefix" + fieldNameMap["constraint_path"] = "ConstraintPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["path_prefix"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["constraint_path"] = "constraint_path" + queryParams["path_prefix"] = "path_prefix" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/quota-stats", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeClient.go new file mode 100644 index 000000000..7c2771ec2 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeClient.go @@ -0,0 +1,95 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SharedWithMe +// Used by client-side stubs. + +package projects + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SharedWithMeClient interface { + + // Get the list of resource shared with a given project. + // + // @param orgIdParam (required) + // @param projectIdParam (required) + // @param resourceTypeParam resource type (optional) + // @return com.vmware.nsx_policy.model.SharedResourceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, resourceTypeParam *string) (nsx_policyModel.SharedResourceListResult, error) +} + +type sharedWithMeClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSharedWithMeClient(connector vapiProtocolClient_.Connector) *sharedWithMeClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.shared_with_me") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := sharedWithMeClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sharedWithMeClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sharedWithMeClient) List(orgIdParam string, projectIdParam string, resourceTypeParam *string) (nsx_policyModel.SharedResourceListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sharedWithMeListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sharedWithMeListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ResourceType", resourceTypeParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SharedResourceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.shared_with_me", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SharedResourceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SharedWithMeListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SharedResourceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeTypes.go new file mode 100644 index 000000000..5fe37918c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/SharedWithMeTypes.go @@ -0,0 +1,82 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SharedWithMe. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package projects + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func sharedWithMeListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["resource_type"] = "ResourceType" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SharedWithMeListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SharedResourceListResultBindingType) +} + +func sharedWithMeListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["resource_type"] = "ResourceType" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["resource_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["resource_type"] = "resource_type" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/shared-with-me", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsClient.go new file mode 100644 index 000000000..c29086170 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Constraints +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ConstraintsClient interface { + + // Delete tenant constraint. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param constraintIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, constraintIdParam string) error + + // Read tenant constraint. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param constraintIdParam (required) + // @return com.vmware.nsx_policy.model.Constraint + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, constraintIdParam string) (nsx_policyModel.Constraint, error) + + // List tenant constraints. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.ConstraintListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ConstraintListResult, error) + + // Create tenant constraint if not exists, otherwise update the existing constraint. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param constraintIdParam (required) + // @param constraintParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, constraintIdParam string, constraintParam nsx_policyModel.Constraint) error + + // Create tenant constraint if it does not exist, otherwise replace the existing constraint. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param constraintIdParam (required) + // @param constraintParam (required) + // @return com.vmware.nsx_policy.model.Constraint + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, constraintIdParam string, constraintParam nsx_policyModel.Constraint) (nsx_policyModel.Constraint, error) +} + +type constraintsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewConstraintsClient(connector vapiProtocolClient_.Connector) *constraintsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.constraints") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + cIface := constraintsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &cIface +} + +func (cIface *constraintsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := cIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (cIface *constraintsClient) Delete(orgIdParam string, projectIdParam string, constraintIdParam string) error { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := constraintsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(constraintsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ConstraintId", constraintIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.constraints", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (cIface *constraintsClient) Get(orgIdParam string, projectIdParam string, constraintIdParam string) (nsx_policyModel.Constraint, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := constraintsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(constraintsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ConstraintId", constraintIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Constraint + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.constraints", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Constraint + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ConstraintsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Constraint), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (cIface *constraintsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ConstraintListResult, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := constraintsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(constraintsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ConstraintListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.constraints", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ConstraintListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ConstraintsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ConstraintListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (cIface *constraintsClient) Patch(orgIdParam string, projectIdParam string, constraintIdParam string, constraintParam nsx_policyModel.Constraint) error { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := constraintsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(constraintsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ConstraintId", constraintIdParam) + sv.AddStructField("Constraint", constraintParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.constraints", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (cIface *constraintsClient) Update(orgIdParam string, projectIdParam string, constraintIdParam string, constraintParam nsx_policyModel.Constraint) (nsx_policyModel.Constraint, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := constraintsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(constraintsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ConstraintId", constraintIdParam) + sv.AddStructField("Constraint", constraintParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Constraint + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.constraints", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Constraint + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ConstraintsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Constraint), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsTypes.go new file mode 100644 index 000000000..ecd0d4a5c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ConstraintsTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Constraints. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func constraintsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ConstraintsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func constraintsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["constraintId"] = vapiBindings_.NewStringType() + pathParams["constraint_id"] = "constraintId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/constraints/{constraintId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func constraintsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ConstraintsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) +} + +func constraintsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["constraintId"] = vapiBindings_.NewStringType() + pathParams["constraint_id"] = "constraintId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/constraints/{constraintId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func constraintsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ConstraintsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintListResultBindingType) +} + +func constraintsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/constraints", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func constraintsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fields["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + fieldNameMap["constraint"] = "Constraint" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ConstraintsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func constraintsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fields["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + fieldNameMap["constraint"] = "Constraint" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["constraintId"] = vapiBindings_.NewStringType() + pathParams["constraint_id"] = "constraintId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "constraint", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/constraints/{constraintId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func constraintsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fields["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + fieldNameMap["constraint"] = "Constraint" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ConstraintsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) +} + +func constraintsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["constraint_id"] = vapiBindings_.NewStringType() + fields["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["constraint_id"] = "ConstraintId" + fieldNameMap["constraint"] = "Constraint" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint_id"] = vapiBindings_.NewStringType() + paramsTypeMap["constraint"] = vapiBindings_.NewReferenceType(nsx_policyModel.ConstraintBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["constraintId"] = vapiBindings_.NewStringType() + pathParams["constraint_id"] = "constraintId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "constraint", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/constraints/{constraintId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesClient.go new file mode 100644 index 000000000..23fd5ca73 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesClient.go @@ -0,0 +1,299 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ContextProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ContextProfilesClient interface { + + // Deletes the specified Policy Context Profile. If the Policy Context Profile is consumed in a firewall rule, it won't get deleted. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param contextProfileIdParam Policy Context Profile Id (required) + // @param forceParam Force delete the resource even if it is being used somewhere (optional, default to false) + // @param overrideParam Delete the locally overriden global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, contextProfileIdParam string, forceParam *bool, overrideParam *bool) error + + // Get a single PolicyContextProfile by id + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param contextProfileIdParam (required) + // @return com.vmware.nsx_policy.model.PolicyContextProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, contextProfileIdParam string) (nsx_policyModel.PolicyContextProfile, error) + + // Get all PolicyContextProfiles + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyContextProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyContextProfileListResult, error) + + // Creates/Updates a PolicyContextProfile, which encapsulates attribute and sub-attributes of network services. Rules for using attributes and sub-attributes in single PolicyContextProfile 1. One type of attribute can't have multiple occurrences. ( Eg. - Attribute type APP_ID can be used only once per PolicyContextProfile.) 2. For specifying multiple values for an attribute, provide them in an array. 3. If sub-attribtes are mentioned for an attribute, then only single value is allowed for that attribute. 4. To get a list of supported attributes and sub-attributes fire the following REST API GET https:///policy/api/v1/infra/context-profiles/attributes 5. Do not create context profile with \"custom_attributes\" id + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param contextProfileIdParam (required) + // @param policyContextProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, contextProfileIdParam string, policyContextProfileParam nsx_policyModel.PolicyContextProfile, overrideParam *bool) error + + // Creates/Updates a PolicyContextProfile, which encapsulates attribute and sub-attributes of network services. Rules for using attributes and sub-attributes in single PolicyContextProfile 1. One type of attribute can't have multiple occurrences. ( Eg. - Attribute type APP_ID can be used only once per PolicyContextProfile.) 2. For specifying multiple values for an attribute, provide them in an array. 3. If sub-attribtes are mentioned for an attribute, then only single value is allowed for that attribute. 4. To get a list of supported attributes and sub-attributes fire the following REST API GET https:///policy/api/v1/infra/context-profiles/attributes 5. Do not create context profile with \"custom_attributes\" id + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param contextProfileIdParam (required) + // @param policyContextProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.PolicyContextProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, contextProfileIdParam string, policyContextProfileParam nsx_policyModel.PolicyContextProfile, overrideParam *bool) (nsx_policyModel.PolicyContextProfile, error) +} + +type contextProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewContextProfilesClient(connector vapiProtocolClient_.Connector) *contextProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.context_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + cIface := contextProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &cIface +} + +func (cIface *contextProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := cIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (cIface *contextProfilesClient) Delete(orgIdParam string, projectIdParam string, contextProfileIdParam string, forceParam *bool, overrideParam *bool) error { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := contextProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(contextProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ContextProfileId", contextProfileIdParam) + sv.AddStructField("Force", forceParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (cIface *contextProfilesClient) Get(orgIdParam string, projectIdParam string, contextProfileIdParam string) (nsx_policyModel.PolicyContextProfile, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := contextProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(contextProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ContextProfileId", contextProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyContextProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyContextProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ContextProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyContextProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (cIface *contextProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyContextProfileListResult, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := contextProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(contextProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyContextProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyContextProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ContextProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyContextProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (cIface *contextProfilesClient) Patch(orgIdParam string, projectIdParam string, contextProfileIdParam string, policyContextProfileParam nsx_policyModel.PolicyContextProfile, overrideParam *bool) error { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := contextProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(contextProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ContextProfileId", contextProfileIdParam) + sv.AddStructField("PolicyContextProfile", policyContextProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (cIface *contextProfilesClient) Update(orgIdParam string, projectIdParam string, contextProfileIdParam string, policyContextProfileParam nsx_policyModel.PolicyContextProfile, overrideParam *bool) (nsx_policyModel.PolicyContextProfile, error) { + typeConverter := cIface.connector.TypeConverter() + executionContext := cIface.connector.NewExecutionContext() + operationRestMetaData := contextProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(contextProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ContextProfileId", contextProfileIdParam) + sv.AddStructField("PolicyContextProfile", policyContextProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyContextProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := cIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyContextProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ContextProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyContextProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), cIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesTypes.go new file mode 100644 index 000000000..63f4aa128 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ContextProfilesTypes.go @@ -0,0 +1,402 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ContextProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func contextProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["force"] = "Force" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ContextProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func contextProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["force"] = "Force" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["context_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["contextProfileId"] = vapiBindings_.NewStringType() + pathParams["context_profile_id"] = "contextProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["force"] = "force" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/{contextProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func contextProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ContextProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) +} + +func contextProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["context_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["contextProfileId"] = vapiBindings_.NewStringType() + pathParams["context_profile_id"] = "contextProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/{contextProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func contextProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ContextProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileListResultBindingType) +} + +func contextProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func contextProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["policy_context_profile"] = "PolicyContextProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ContextProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func contextProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["policy_context_profile"] = "PolicyContextProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + paramsTypeMap["context_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["contextProfileId"] = vapiBindings_.NewStringType() + pathParams["context_profile_id"] = "contextProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_context_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/{contextProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func contextProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["policy_context_profile"] = "PolicyContextProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ContextProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) +} + +func contextProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["context_profile_id"] = vapiBindings_.NewStringType() + fields["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["context_profile_id"] = "ContextProfileId" + fieldNameMap["policy_context_profile"] = "PolicyContextProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_context_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileBindingType) + paramsTypeMap["context_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["contextProfileId"] = vapiBindings_.NewStringType() + pathParams["context_profile_id"] = "contextProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_context_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/{contextProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsClient.go new file mode 100644 index 000000000..341e1a6eb --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DhcpRelayConfigs +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DhcpRelayConfigsClient interface { + + // Delete DHCP relay configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpRelayConfigIdParam DHCP relay config ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string) error + + // Read DHCP relay configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpRelayConfigIdParam DHCP relay config ID (required) + // @return com.vmware.nsx_policy.model.DhcpRelayConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string) (nsx_policyModel.DhcpRelayConfig, error) + + // Paginated list of all DHCP relay config instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.DhcpRelayConfigListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpRelayConfigListResult, error) + + // If DHCP relay config with the dhcp-relay-config-id is not already present, create a new DHCP relay config instance. If it already exists, update the DHCP relay config instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpRelayConfigIdParam DHCP relay config ID (required) + // @param dhcpRelayConfigParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string, dhcpRelayConfigParam nsx_policyModel.DhcpRelayConfig) error + + // If DHCP relay config with the dhcp-relay-config-id is not already present, create a new DHCP relay config instance. If it already exists, replace the DHCP relay config instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpRelayConfigIdParam DHCP relay config ID (required) + // @param dhcpRelayConfigParam (required) + // @return com.vmware.nsx_policy.model.DhcpRelayConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string, dhcpRelayConfigParam nsx_policyModel.DhcpRelayConfig) (nsx_policyModel.DhcpRelayConfig, error) +} + +type dhcpRelayConfigsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDhcpRelayConfigsClient(connector vapiProtocolClient_.Connector) *dhcpRelayConfigsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dhcpRelayConfigsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dhcpRelayConfigsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dhcpRelayConfigsClient) Delete(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpRelayConfigsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpRelayConfigsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpRelayConfigId", dhcpRelayConfigIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpRelayConfigsClient) Get(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string) (nsx_policyModel.DhcpRelayConfig, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpRelayConfigsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpRelayConfigsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpRelayConfigId", dhcpRelayConfigIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpRelayConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpRelayConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpRelayConfigsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpRelayConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpRelayConfigsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpRelayConfigListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpRelayConfigsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpRelayConfigsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpRelayConfigListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpRelayConfigListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpRelayConfigsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpRelayConfigListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpRelayConfigsClient) Patch(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string, dhcpRelayConfigParam nsx_policyModel.DhcpRelayConfig) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpRelayConfigsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpRelayConfigsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpRelayConfigId", dhcpRelayConfigIdParam) + sv.AddStructField("DhcpRelayConfig", dhcpRelayConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpRelayConfigsClient) Update(orgIdParam string, projectIdParam string, dhcpRelayConfigIdParam string, dhcpRelayConfigParam nsx_policyModel.DhcpRelayConfig) (nsx_policyModel.DhcpRelayConfig, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpRelayConfigsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpRelayConfigsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpRelayConfigId", dhcpRelayConfigIdParam) + sv.AddStructField("DhcpRelayConfig", dhcpRelayConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpRelayConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_relay_configs", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpRelayConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpRelayConfigsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpRelayConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsTypes.go new file mode 100644 index 000000000..b133b9ffe --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpRelayConfigsTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DhcpRelayConfigs. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func dhcpRelayConfigsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpRelayConfigsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpRelayConfigsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + paramsTypeMap["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpRelayConfigId"] = vapiBindings_.NewStringType() + pathParams["dhcp_relay_config_id"] = "dhcpRelayConfigId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-relay-configs/{dhcpRelayConfigId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpRelayConfigsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpRelayConfigsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) +} + +func dhcpRelayConfigsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + paramsTypeMap["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpRelayConfigId"] = vapiBindings_.NewStringType() + pathParams["dhcp_relay_config_id"] = "dhcpRelayConfigId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-relay-configs/{dhcpRelayConfigId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpRelayConfigsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpRelayConfigsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigListResultBindingType) +} + +func dhcpRelayConfigsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-relay-configs", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpRelayConfigsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + fieldNameMap["dhcp_relay_config"] = "DhcpRelayConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpRelayConfigsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpRelayConfigsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + fieldNameMap["dhcp_relay_config"] = "DhcpRelayConfig" + paramsTypeMap["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + paramsTypeMap["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpRelayConfigId"] = vapiBindings_.NewStringType() + pathParams["dhcp_relay_config_id"] = "dhcpRelayConfigId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_relay_config", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-relay-configs/{dhcpRelayConfigId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpRelayConfigsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + fieldNameMap["dhcp_relay_config"] = "DhcpRelayConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpRelayConfigsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) +} + +func dhcpRelayConfigsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_relay_config_id"] = "DhcpRelayConfigId" + fieldNameMap["dhcp_relay_config"] = "DhcpRelayConfig" + paramsTypeMap["dhcp_relay_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpRelayConfigBindingType) + paramsTypeMap["dhcp_relay_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpRelayConfigId"] = vapiBindings_.NewStringType() + pathParams["dhcp_relay_config_id"] = "dhcpRelayConfigId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_relay_config", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-relay-configs/{dhcpRelayConfigId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsClient.go new file mode 100644 index 000000000..82ddb14f4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DhcpServerConfigs +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DhcpServerConfigsClient interface { + + // Delete DHCP server configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpServerConfigIdParam DHCP server config ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string) error + + // Read DHCP server configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpServerConfigIdParam DHCP server config ID (required) + // @return com.vmware.nsx_policy.model.DhcpServerConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string) (nsx_policyModel.DhcpServerConfig, error) + + // Paginated list of all DHCP server config instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.DhcpServerConfigListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpServerConfigListResult, error) + + // If DHCP server config with the dhcp-server-config-id is not already present, create a new DHCP server config instance. If it already exists, update the DHCP server config instance with specified attributes. Realized entities of this API can be found using the path of Tier-0, Tier1, or Segment where this config is applied on. Modification of edge_cluster_path in DhcpServerConfig will lose all existing DHCP leases. If both the preferred_edge_paths in the DhcpServerConfig are changed in a same PATCH API, e.g. change from [a,b] to [x,y], the current DHCP server leases will be lost, which could cause network connectivity issues. It is recommended to change only one member index in an update call, e.g. from [a, b] to [a,y]. Clearing preferred_edge_paths will not reassign edge nodes from the edge cluster. Instead, the previously-allocated edge nodes will be retained to avoid loss of leases. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpServerConfigIdParam DHCP server config ID (required) + // @param dhcpServerConfigParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string, dhcpServerConfigParam nsx_policyModel.DhcpServerConfig) error + + // If DHCP server config with the dhcp-server-config-id is not already present, create a new DHCP server config instance. If it already exists, replace the DHCP server config instance with this object. Realized entities of this API can be found using the path of Tier-0, Tier1, or Segment where this config is applied on. Modification of edge_cluster_path in DhcpServerConfig will lose all existing DHCP leases. If both the preferred_edge_paths in the DhcpServerConfig are changed in a same PUT API, e.g. change from [a,b] to [x,y], the current DHCP server leases will be lost, which could cause network connectivity issues. It is recommended to change only one member index in an update call, e.g. from [a, b] to [a,y]. Clearing preferred_edge_paths will not reassign edge nodes from the edge cluster. Instead, the previously-allocated edge nodes will be retained to avoid loss of leases. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dhcpServerConfigIdParam DHCP server config ID (required) + // @param dhcpServerConfigParam (required) + // @return com.vmware.nsx_policy.model.DhcpServerConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string, dhcpServerConfigParam nsx_policyModel.DhcpServerConfig) (nsx_policyModel.DhcpServerConfig, error) +} + +type dhcpServerConfigsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDhcpServerConfigsClient(connector vapiProtocolClient_.Connector) *dhcpServerConfigsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dhcpServerConfigsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dhcpServerConfigsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dhcpServerConfigsClient) Delete(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpServerConfigsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpServerConfigsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpServerConfigId", dhcpServerConfigIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpServerConfigsClient) Get(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string) (nsx_policyModel.DhcpServerConfig, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpServerConfigsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpServerConfigsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpServerConfigId", dhcpServerConfigIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpServerConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpServerConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpServerConfigsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpServerConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpServerConfigsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpServerConfigListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpServerConfigsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpServerConfigsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpServerConfigListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpServerConfigListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpServerConfigsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpServerConfigListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpServerConfigsClient) Patch(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string, dhcpServerConfigParam nsx_policyModel.DhcpServerConfig) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpServerConfigsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpServerConfigsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpServerConfigId", dhcpServerConfigIdParam) + sv.AddStructField("DhcpServerConfig", dhcpServerConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpServerConfigsClient) Update(orgIdParam string, projectIdParam string, dhcpServerConfigIdParam string, dhcpServerConfigParam nsx_policyModel.DhcpServerConfig) (nsx_policyModel.DhcpServerConfig, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpServerConfigsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpServerConfigsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DhcpServerConfigId", dhcpServerConfigIdParam) + sv.AddStructField("DhcpServerConfig", dhcpServerConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpServerConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dhcp_server_configs", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpServerConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpServerConfigsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpServerConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsTypes.go new file mode 100644 index 000000000..9673cbe23 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DhcpServerConfigsTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DhcpServerConfigs. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func dhcpServerConfigsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpServerConfigsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpServerConfigsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + paramsTypeMap["dhcp_server_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpServerConfigId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dhcp_server_config_id"] = "dhcpServerConfigId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-server-configs/{dhcpServerConfigId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpServerConfigsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpServerConfigsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) +} + +func dhcpServerConfigsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + paramsTypeMap["dhcp_server_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpServerConfigId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dhcp_server_config_id"] = "dhcpServerConfigId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-server-configs/{dhcpServerConfigId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpServerConfigsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpServerConfigsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigListResultBindingType) +} + +func dhcpServerConfigsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-server-configs", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpServerConfigsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + fieldNameMap["dhcp_server_config"] = "DhcpServerConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpServerConfigsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpServerConfigsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + fieldNameMap["dhcp_server_config"] = "DhcpServerConfig" + paramsTypeMap["dhcp_server_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpServerConfigId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dhcp_server_config_id"] = "dhcpServerConfigId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_server_config", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-server-configs/{dhcpServerConfigId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpServerConfigsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + fieldNameMap["dhcp_server_config"] = "DhcpServerConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpServerConfigsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) +} + +func dhcpServerConfigsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config_id"] = vapiBindings_.NewStringType() + fields["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dhcp_server_config_id"] = "DhcpServerConfigId" + fieldNameMap["dhcp_server_config"] = "DhcpServerConfig" + paramsTypeMap["dhcp_server_config_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcp_server_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpServerConfigBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcpServerConfigId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dhcp_server_config_id"] = "dhcpServerConfigId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_server_config", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dhcp-server-configs/{dhcpServerConfigId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesClient.go new file mode 100644 index 000000000..89e406523 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DnsForwarderZones +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DnsForwarderZonesClient interface { + + // Delete the DNS Forwarder Zone + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dnsForwarderZoneIdParam DNS Forwarder Zone ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string) error + + // Read the DNS Forwarder Zone + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dnsForwarderZoneIdParam DNS Forwarder Zone ID (required) + // @return com.vmware.nsx_policy.model.PolicyDnsForwarderZone + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string) (nsx_policyModel.PolicyDnsForwarderZone, error) + + // Paginated list of all Dns Forwarder Zones + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyDnsForwarderZoneListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyDnsForwarderZoneListResult, error) + + // Create or update the DNS Forwarder Zone + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dnsForwarderZoneIdParam DNS Forwarder Zone ID (required) + // @param policyDnsForwarderZoneParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam nsx_policyModel.PolicyDnsForwarderZone) error + + // Create or update the DNS Forwarder Zone + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dnsForwarderZoneIdParam DNS Forwarder Zone ID (required) + // @param policyDnsForwarderZoneParam (required) + // @return com.vmware.nsx_policy.model.PolicyDnsForwarderZone + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam nsx_policyModel.PolicyDnsForwarderZone) (nsx_policyModel.PolicyDnsForwarderZone, error) +} + +type dnsForwarderZonesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDnsForwarderZonesClient(connector vapiProtocolClient_.Connector) *dnsForwarderZonesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dnsForwarderZonesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dnsForwarderZonesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dnsForwarderZonesClient) Delete(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderZonesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderZonesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DnsForwarderZoneId", dnsForwarderZoneIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsForwarderZonesClient) Get(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string) (nsx_policyModel.PolicyDnsForwarderZone, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderZonesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderZonesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DnsForwarderZoneId", dnsForwarderZoneIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyDnsForwarderZone + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyDnsForwarderZone + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsForwarderZonesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyDnsForwarderZone), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dnsForwarderZonesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyDnsForwarderZoneListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderZonesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderZonesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyDnsForwarderZoneListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyDnsForwarderZoneListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsForwarderZonesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyDnsForwarderZoneListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dnsForwarderZonesClient) Patch(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam nsx_policyModel.PolicyDnsForwarderZone) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderZonesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderZonesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DnsForwarderZoneId", dnsForwarderZoneIdParam) + sv.AddStructField("PolicyDnsForwarderZone", policyDnsForwarderZoneParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsForwarderZonesClient) Update(orgIdParam string, projectIdParam string, dnsForwarderZoneIdParam string, policyDnsForwarderZoneParam nsx_policyModel.PolicyDnsForwarderZone) (nsx_policyModel.PolicyDnsForwarderZone, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderZonesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderZonesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DnsForwarderZoneId", dnsForwarderZoneIdParam) + sv.AddStructField("PolicyDnsForwarderZone", policyDnsForwarderZoneParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyDnsForwarderZone + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_forwarder_zones", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyDnsForwarderZone + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsForwarderZonesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyDnsForwarderZone), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesTypes.go new file mode 100644 index 000000000..04173c70e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsForwarderZonesTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DnsForwarderZones. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func dnsForwarderZonesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderZonesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsForwarderZonesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + paramsTypeMap["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dnsForwarderZoneId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dns_forwarder_zone_id"] = "dnsForwarderZoneId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-forwarder-zones/{dnsForwarderZoneId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderZonesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderZonesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) +} + +func dnsForwarderZonesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + paramsTypeMap["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dnsForwarderZoneId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dns_forwarder_zone_id"] = "dnsForwarderZoneId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-forwarder-zones/{dnsForwarderZoneId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderZonesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderZonesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneListResultBindingType) +} + +func dnsForwarderZonesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-forwarder-zones", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderZonesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + fieldNameMap["policy_dns_forwarder_zone"] = "PolicyDnsForwarderZone" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderZonesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsForwarderZonesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + fieldNameMap["policy_dns_forwarder_zone"] = "PolicyDnsForwarderZone" + paramsTypeMap["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dnsForwarderZoneId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dns_forwarder_zone_id"] = "dnsForwarderZoneId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_dns_forwarder_zone", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-forwarder-zones/{dnsForwarderZoneId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderZonesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + fieldNameMap["policy_dns_forwarder_zone"] = "PolicyDnsForwarderZone" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderZonesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) +} + +func dnsForwarderZonesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dns_forwarder_zone_id"] = "DnsForwarderZoneId" + fieldNameMap["policy_dns_forwarder_zone"] = "PolicyDnsForwarderZone" + paramsTypeMap["dns_forwarder_zone_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_dns_forwarder_zone"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderZoneBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dnsForwarderZoneId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["dns_forwarder_zone_id"] = "dnsForwarderZoneId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_dns_forwarder_zone", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-forwarder-zones/{dnsForwarderZoneId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesClient.go new file mode 100644 index 000000000..04283c1d5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DnsSecurityProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DnsSecurityProfilesClient interface { + + // Delete DNS security profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param profileIdParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, profileIdParam string, overrideParam *bool) error + + // Read the DNS Forwarder for the given tier-0 instance + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param profileIdParam (required) + // @return com.vmware.nsx_policy.model.DnsSecurityProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, profileIdParam string) (nsx_policyModel.DnsSecurityProfile, error) + + // List all DNS security profiles + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.DnsSecurityProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DnsSecurityProfileListResult, error) + + // Create or update DNS security profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param profileIdParam (required) + // @param dnsSecurityProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, profileIdParam string, dnsSecurityProfileParam nsx_policyModel.DnsSecurityProfile, overrideParam *bool) error + + // Create or update DNS security profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param profileIdParam (required) + // @param dnsSecurityProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.DnsSecurityProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, profileIdParam string, dnsSecurityProfileParam nsx_policyModel.DnsSecurityProfile, overrideParam *bool) (nsx_policyModel.DnsSecurityProfile, error) +} + +type dnsSecurityProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDnsSecurityProfilesClient(connector vapiProtocolClient_.Connector) *dnsSecurityProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dnsSecurityProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dnsSecurityProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dnsSecurityProfilesClient) Delete(orgIdParam string, projectIdParam string, profileIdParam string, overrideParam *bool) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsSecurityProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsSecurityProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ProfileId", profileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsSecurityProfilesClient) Get(orgIdParam string, projectIdParam string, profileIdParam string) (nsx_policyModel.DnsSecurityProfile, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsSecurityProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsSecurityProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ProfileId", profileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DnsSecurityProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DnsSecurityProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsSecurityProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DnsSecurityProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dnsSecurityProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DnsSecurityProfileListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsSecurityProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsSecurityProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DnsSecurityProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DnsSecurityProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsSecurityProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DnsSecurityProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dnsSecurityProfilesClient) Patch(orgIdParam string, projectIdParam string, profileIdParam string, dnsSecurityProfileParam nsx_policyModel.DnsSecurityProfile, overrideParam *bool) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsSecurityProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsSecurityProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ProfileId", profileIdParam) + sv.AddStructField("DnsSecurityProfile", dnsSecurityProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsSecurityProfilesClient) Update(orgIdParam string, projectIdParam string, profileIdParam string, dnsSecurityProfileParam nsx_policyModel.DnsSecurityProfile, overrideParam *bool) (nsx_policyModel.DnsSecurityProfile, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsSecurityProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsSecurityProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ProfileId", profileIdParam) + sv.AddStructField("DnsSecurityProfile", dnsSecurityProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DnsSecurityProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.dns_security_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DnsSecurityProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsSecurityProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DnsSecurityProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesTypes.go new file mode 100644 index 000000000..faf2f26cd --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DnsSecurityProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DnsSecurityProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func dnsSecurityProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsSecurityProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsSecurityProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["profileId"] = vapiBindings_.NewStringType() + pathParams["profile_id"] = "profileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-security-profiles/{profileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsSecurityProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsSecurityProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) +} + +func dnsSecurityProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["profileId"] = vapiBindings_.NewStringType() + pathParams["profile_id"] = "profileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-security-profiles/{profileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsSecurityProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsSecurityProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileListResultBindingType) +} + +func dnsSecurityProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-security-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsSecurityProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["dns_security_profile"] = "DnsSecurityProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsSecurityProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsSecurityProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["dns_security_profile"] = "DnsSecurityProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["profileId"] = vapiBindings_.NewStringType() + pathParams["profile_id"] = "profileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dns_security_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-security-profiles/{profileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsSecurityProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["dns_security_profile"] = "DnsSecurityProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsSecurityProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) +} + +func dnsSecurityProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["profile_id"] = vapiBindings_.NewStringType() + fields["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["profile_id"] = "ProfileId" + fieldNameMap["dns_security_profile"] = "DnsSecurityProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dns_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.DnsSecurityProfileBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["profileId"] = vapiBindings_.NewStringType() + pathParams["profile_id"] = "profileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dns_security_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/dns-security-profiles/{profileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsClient.go new file mode 100644 index 000000000..9339ec86b --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsClient.go @@ -0,0 +1,154 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Domains +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DomainsClient interface { + + // Read a domain. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @return com.vmware.nsx_policy.model.Domain + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, domainIdParam string) (nsx_policyModel.Domain, error) + + // Paginated list of all domains for infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.DomainListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DomainListResult, error) +} + +type domainsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDomainsClient(connector vapiProtocolClient_.Connector) *domainsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := domainsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *domainsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *domainsClient) Get(orgIdParam string, projectIdParam string, domainIdParam string) (nsx_policyModel.Domain, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := domainsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(domainsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Domain + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Domain + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DomainsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Domain), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *domainsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DomainListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := domainsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(domainsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DomainListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DomainListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DomainsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DomainListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsTypes.go new file mode 100644 index 000000000..e7bccbedd --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/DomainsTypes.go @@ -0,0 +1,176 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Domains. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func domainsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DomainsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DomainBindingType) +} + +func domainsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func domainsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DomainsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DomainListResultBindingType) +} + +func domainsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesClient.go new file mode 100644 index 000000000..ccafe5a9a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FirewallSessionTimerProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FirewallSessionTimerProfilesClient interface { + + // API will delete Firewall Session Timer Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param firewallSessionTimerProfileIdParam Firewall Session Timer Profile ID (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, overrideParam *bool) error + + // API will get Firewall Session Timer Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param firewallSessionTimerProfileIdParam Firewall Session Timer Profile ID (required) + // @return com.vmware.nsx_policy.model.PolicyFirewallSessionTimerProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string) (nsx_policyModel.PolicyFirewallSessionTimerProfile, error) + + // API will list all Firewall Session Timer Profiles + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyFirewallSessionTimerProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallSessionTimerProfileListResult, error) + + // API will create/update Firewall Session Timer Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param firewallSessionTimerProfileIdParam Firewall Session Timer Profile ID (required) + // @param policyFirewallSessionTimerProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, policyFirewallSessionTimerProfileParam nsx_policyModel.PolicyFirewallSessionTimerProfile, overrideParam *bool) error + + // API will update Firewall Session Timer Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param firewallSessionTimerProfileIdParam Firewall Session Timer Profile ID (required) + // @param policyFirewallSessionTimerProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.PolicyFirewallSessionTimerProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, policyFirewallSessionTimerProfileParam nsx_policyModel.PolicyFirewallSessionTimerProfile, overrideParam *bool) (nsx_policyModel.PolicyFirewallSessionTimerProfile, error) +} + +type firewallSessionTimerProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFirewallSessionTimerProfilesClient(connector vapiProtocolClient_.Connector) *firewallSessionTimerProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := firewallSessionTimerProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *firewallSessionTimerProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *firewallSessionTimerProfilesClient) Delete(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, overrideParam *bool) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FirewallSessionTimerProfileId", firewallSessionTimerProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *firewallSessionTimerProfilesClient) Get(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string) (nsx_policyModel.PolicyFirewallSessionTimerProfile, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FirewallSessionTimerProfileId", firewallSessionTimerProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FirewallSessionTimerProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyFirewallSessionTimerProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *firewallSessionTimerProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallSessionTimerProfileListResult, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FirewallSessionTimerProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyFirewallSessionTimerProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *firewallSessionTimerProfilesClient) Patch(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, policyFirewallSessionTimerProfileParam nsx_policyModel.PolicyFirewallSessionTimerProfile, overrideParam *bool) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FirewallSessionTimerProfileId", firewallSessionTimerProfileIdParam) + sv.AddStructField("PolicyFirewallSessionTimerProfile", policyFirewallSessionTimerProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *firewallSessionTimerProfilesClient) Update(orgIdParam string, projectIdParam string, firewallSessionTimerProfileIdParam string, policyFirewallSessionTimerProfileParam nsx_policyModel.PolicyFirewallSessionTimerProfile, overrideParam *bool) (nsx_policyModel.PolicyFirewallSessionTimerProfile, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FirewallSessionTimerProfileId", firewallSessionTimerProfileIdParam) + sv.AddStructField("PolicyFirewallSessionTimerProfile", policyFirewallSessionTimerProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.firewall_session_timer_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FirewallSessionTimerProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyFirewallSessionTimerProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesTypes.go new file mode 100644 index 000000000..7d946c5af --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FirewallSessionTimerProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FirewallSessionTimerProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func firewallSessionTimerProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func firewallSessionTimerProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["firewallSessionTimerProfileId"] = vapiBindings_.NewStringType() + pathParams["firewall_session_timer_profile_id"] = "firewallSessionTimerProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/firewall-session-timer-profiles/{firewallSessionTimerProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func firewallSessionTimerProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) +} + +func firewallSessionTimerProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["firewallSessionTimerProfileId"] = vapiBindings_.NewStringType() + pathParams["firewall_session_timer_profile_id"] = "firewallSessionTimerProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/firewall-session-timer-profiles/{firewallSessionTimerProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func firewallSessionTimerProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileListResultBindingType) +} + +func firewallSessionTimerProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/firewall-session-timer-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func firewallSessionTimerProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["policy_firewall_session_timer_profile"] = "PolicyFirewallSessionTimerProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func firewallSessionTimerProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["policy_firewall_session_timer_profile"] = "PolicyFirewallSessionTimerProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["firewallSessionTimerProfileId"] = vapiBindings_.NewStringType() + pathParams["firewall_session_timer_profile_id"] = "firewallSessionTimerProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_firewall_session_timer_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/firewall-session-timer-profiles/{firewallSessionTimerProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func firewallSessionTimerProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["policy_firewall_session_timer_profile"] = "PolicyFirewallSessionTimerProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) +} + +func firewallSessionTimerProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + fields["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["firewall_session_timer_profile_id"] = "FirewallSessionTimerProfileId" + fieldNameMap["policy_firewall_session_timer_profile"] = "PolicyFirewallSessionTimerProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["policy_firewall_session_timer_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["firewall_session_timer_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["firewallSessionTimerProfileId"] = vapiBindings_.NewStringType() + pathParams["firewall_session_timer_profile_id"] = "firewallSessionTimerProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_firewall_session_timer_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/firewall-session-timer-profiles/{firewallSessionTimerProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesClient.go new file mode 100644 index 000000000..9f63f815e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesClient.go @@ -0,0 +1,302 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FloodProtectionProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FloodProtectionProfilesClient interface { + + // API will delete Flood Protection Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param floodProtectionProfileIdParam Flood Protection Profile ID (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, overrideParam *bool) error + + // API will get Flood Protection Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param floodProtectionProfileIdParam Flood Protection Profile ID (required) + // @return com.vmware.nsx_policy.model.FloodProtectionProfile + // The return value will contain all the properties defined in nsx_policyModel.FloodProtectionProfile. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string) (*vapiData_.StructValue, error) + + // API will list all Flood Protection Profiles + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.FloodProtectionProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.FloodProtectionProfileListResult, error) + + // API will create/update Flood Protection Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param floodProtectionProfileIdParam Firewall Flood Protection Profile ID (required) + // @param floodProtectionProfileParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.FloodProtectionProfile. + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, floodProtectionProfileParam *vapiData_.StructValue, overrideParam *bool) error + + // API will update Firewall Flood Protection Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param floodProtectionProfileIdParam Flood Protection Profile ID (required) + // @param floodProtectionProfileParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.FloodProtectionProfile. + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.FloodProtectionProfile + // The return value will contain all the properties defined in nsx_policyModel.FloodProtectionProfile. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, floodProtectionProfileParam *vapiData_.StructValue, overrideParam *bool) (*vapiData_.StructValue, error) +} + +type floodProtectionProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFloodProtectionProfilesClient(connector vapiProtocolClient_.Connector) *floodProtectionProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := floodProtectionProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *floodProtectionProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *floodProtectionProfilesClient) Delete(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, overrideParam *bool) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FloodProtectionProfileId", floodProtectionProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfilesClient) Get(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string) (*vapiData_.StructValue, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FloodProtectionProfileId", floodProtectionProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles", "get", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *floodProtectionProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.FloodProtectionProfileListResult, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.FloodProtectionProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.FloodProtectionProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.FloodProtectionProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *floodProtectionProfilesClient) Patch(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, floodProtectionProfileParam *vapiData_.StructValue, overrideParam *bool) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FloodProtectionProfileId", floodProtectionProfileIdParam) + sv.AddStructField("FloodProtectionProfile", floodProtectionProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfilesClient) Update(orgIdParam string, projectIdParam string, floodProtectionProfileIdParam string, floodProtectionProfileParam *vapiData_.StructValue, overrideParam *bool) (*vapiData_.StructValue, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("FloodProtectionProfileId", floodProtectionProfileIdParam) + sv.AddStructField("FloodProtectionProfile", floodProtectionProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.flood_protection_profiles", "update", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesTypes.go new file mode 100644 index 000000000..88f9b0d4e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/FloodProtectionProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FloodProtectionProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func floodProtectionProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileId"] = vapiBindings_.NewStringType() + pathParams["flood_protection_profile_id"] = "floodProtectionProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/flood-protection-profiles/{floodProtectionProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) +} + +func floodProtectionProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileId"] = vapiBindings_.NewStringType() + pathParams["flood_protection_profile_id"] = "floodProtectionProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/flood-protection-profiles/{floodProtectionProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileListResultBindingType) +} + +func floodProtectionProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/flood-protection-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["flood_protection_profile"] = "FloodProtectionProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["flood_protection_profile"] = "FloodProtectionProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileId"] = vapiBindings_.NewStringType() + pathParams["flood_protection_profile_id"] = "floodProtectionProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/flood-protection-profiles/{floodProtectionProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["flood_protection_profile"] = "FloodProtectionProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) +} + +func floodProtectionProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["flood_protection_profile_id"] = "FloodProtectionProfileId" + fieldNameMap["flood_protection_profile"] = "FloodProtectionProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["flood_protection_profile"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingType)}) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileId"] = vapiBindings_.NewStringType() + pathParams["flood_protection_profile_id"] = "floodProtectionProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/flood-protection-profiles/{floodProtectionProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesClient.go new file mode 100644 index 000000000..376680d05 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayQosProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayQosProfilesClient interface { + + // Delete QoS profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, qosProfileIdParam string, overrideParam *bool) error + + // Read gateway QoS profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam (required) + // @return com.vmware.nsx_policy.model.GatewayQosProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, qosProfileIdParam string) (nsx_policyModel.GatewayQosProfile, error) + + // Paginated list of all gateway QoS profle instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.GatewayQosProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GatewayQosProfileListResult, error) + + // If profile with the qos-profile-id is not already present, create a new gateway QoS profile instance. If it already exists, update the gateway QoS profile instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam (required) + // @param gatewayQosProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, qosProfileIdParam string, gatewayQosProfileParam nsx_policyModel.GatewayQosProfile, overrideParam *bool) error + + // If profile with the qos-profile-id is not already present, create a new gateway QoS profile instance. If it already exists, replace the gateway QoS profile instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam (required) + // @param gatewayQosProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.GatewayQosProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, qosProfileIdParam string, gatewayQosProfileParam nsx_policyModel.GatewayQosProfile, overrideParam *bool) (nsx_policyModel.GatewayQosProfile, error) +} + +type gatewayQosProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayQosProfilesClient(connector vapiProtocolClient_.Connector) *gatewayQosProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayQosProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayQosProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayQosProfilesClient) Delete(orgIdParam string, projectIdParam string, qosProfileIdParam string, overrideParam *bool) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayQosProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayQosProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *gatewayQosProfilesClient) Get(orgIdParam string, projectIdParam string, qosProfileIdParam string) (nsx_policyModel.GatewayQosProfile, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayQosProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayQosProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayQosProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayQosProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayQosProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayQosProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *gatewayQosProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GatewayQosProfileListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayQosProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayQosProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayQosProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayQosProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayQosProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayQosProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *gatewayQosProfilesClient) Patch(orgIdParam string, projectIdParam string, qosProfileIdParam string, gatewayQosProfileParam nsx_policyModel.GatewayQosProfile, overrideParam *bool) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayQosProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayQosProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("GatewayQosProfile", gatewayQosProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *gatewayQosProfilesClient) Update(orgIdParam string, projectIdParam string, qosProfileIdParam string, gatewayQosProfileParam nsx_policyModel.GatewayQosProfile, overrideParam *bool) (nsx_policyModel.GatewayQosProfile, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayQosProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayQosProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("GatewayQosProfile", gatewayQosProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayQosProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.gateway_qos_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayQosProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayQosProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayQosProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesTypes.go new file mode 100644 index 000000000..b96d8ddc5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GatewayQosProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayQosProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func gatewayQosProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayQosProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func gatewayQosProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/gateway-qos-profiles/{qosProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayQosProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayQosProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) +} + +func gatewayQosProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/gateway-qos-profiles/{qosProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayQosProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayQosProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileListResultBindingType) +} + +func gatewayQosProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/gateway-qos-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayQosProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["gateway_qos_profile"] = "GatewayQosProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayQosProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func gatewayQosProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["gateway_qos_profile"] = "GatewayQosProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "gateway_qos_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/gateway-qos-profiles/{qosProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayQosProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["gateway_qos_profile"] = "GatewayQosProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayQosProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) +} + +func gatewayQosProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["gateway_qos_profile"] = "GatewayQosProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayQosProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "gateway_qos_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/gateway-qos-profiles/{qosProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsClient.go new file mode 100644 index 000000000..b14bba363 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsClient.go @@ -0,0 +1,109 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GroupAssociations +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GroupAssociationsClient interface { + + // Get policy groups for which the given object is a member. In Federation environment, if the given object is a global entity (eg: global segment) and if the entity is not stretched to the site specified in the enforcement_point_path parameter,then the following is returned:- 1)If the entity is a member of any global group and that group is stretched to the enforcement_point_path site,then the API returns an empty list. 2)If the entity is not a member of any global group,this API returns an 'invalid path' error message. 3)If both the entity and its corresponding groups are stretched to the enforcement_point_path site , then the API returns the groups list. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param intentPathParam String path of the intent object (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyResourceReferenceForEPListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, intentPathParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) +} + +type groupAssociationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGroupAssociationsClient(connector vapiProtocolClient_.Connector) *groupAssociationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.group_associations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := groupAssociationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *groupAssociationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *groupAssociationsClient) List(orgIdParam string, projectIdParam string, intentPathParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupAssociationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupAssociationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IntentPath", intentPathParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.group_associations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GroupAssociationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyResourceReferenceForEPListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsTypes.go new file mode 100644 index 000000000..fa4fd709a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupAssociationsTypes.go @@ -0,0 +1,124 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GroupAssociations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func groupAssociationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupAssociationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyResourceReferenceForEPListResultBindingType) +} + +func groupAssociationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["intent_path"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["intent_path"] = "intent_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/group-associations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsClient.go new file mode 100644 index 000000000..3da1ef00c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsClient.go @@ -0,0 +1,107 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GroupServiceAssociations +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GroupServiceAssociationsClient interface { + + // The API returns all the services associated with the given Group. It also returns the services associated with the parent groups of the given group. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param intentPathParam Path of the entity (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyResourceReferenceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, intentPathParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceListResult, error) +} + +type groupServiceAssociationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGroupServiceAssociationsClient(connector vapiProtocolClient_.Connector) *groupServiceAssociationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.group_service_associations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := groupServiceAssociationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *groupServiceAssociationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *groupServiceAssociationsClient) List(orgIdParam string, projectIdParam string, intentPathParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupServiceAssociationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupServiceAssociationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IntentPath", intentPathParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyResourceReferenceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.group_service_associations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyResourceReferenceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GroupServiceAssociationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyResourceReferenceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsTypes.go new file mode 100644 index 000000000..551282a62 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/GroupServiceAssociationsTypes.go @@ -0,0 +1,118 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GroupServiceAssociations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func groupServiceAssociationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupServiceAssociationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyResourceReferenceListResultBindingType) +} + +func groupServiceAssociationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["intent_path"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["intent_path"] = "intent_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/group-service-associations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/InfraPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/InfraPackageTypes.go new file mode 100644 index 000000000..8e75518bc --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/InfraPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsClient.go new file mode 100644 index 000000000..c70054920 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsClient.go @@ -0,0 +1,109 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpAddressGroupAssociations +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpAddressGroupAssociationsClient interface { + + // Get policy groups for which the given IP address is a member. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipAddressParam IPAddress (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyResourceReferenceForEPListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, ipAddressParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) +} + +type ipAddressGroupAssociationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpAddressGroupAssociationsClient(connector vapiProtocolClient_.Connector) *ipAddressGroupAssociationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_address_group_associations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipAddressGroupAssociationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipAddressGroupAssociationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipAddressGroupAssociationsClient) List(orgIdParam string, projectIdParam string, ipAddressParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAddressGroupAssociationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAddressGroupAssociationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpAddress", ipAddressParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_address_group_associations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpAddressGroupAssociationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyResourceReferenceForEPListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsTypes.go new file mode 100644 index 000000000..f476bad2f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpAddressGroupAssociationsTypes.go @@ -0,0 +1,124 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpAddressGroupAssociations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipAddressGroupAssociationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_address"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_address"] = "IpAddress" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAddressGroupAssociationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyResourceReferenceForEPListResultBindingType) +} + +func ipAddressGroupAssociationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_address"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_address"] = "IpAddress" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["ip_address"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["ip_address"] = "ip_address" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-address-group-associations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksClient.go new file mode 100644 index 000000000..6499dcd28 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpBlocks +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpBlocksClient interface { + + // Delete the IpAddressBlock with the given id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipBlockIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ipBlockIdParam string) error + + // Read IpAddressBlock with given Id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipBlockIdParam (required) + // @return com.vmware.nsx_policy.model.IpAddressBlock + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ipBlockIdParam string) (nsx_policyModel.IpAddressBlock, error) + + // Paginated list of IpAddressBlocks. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.IpAddressBlockListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressBlockListResult, error) + + // Creates a new IpAddressBlock with specified ID if not already present. If IpAddressBlock of given ID is already present, then the instance is updated with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipBlockIdParam (required) + // @param ipAddressBlockParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ipBlockIdParam string, ipAddressBlockParam nsx_policyModel.IpAddressBlock) error + + // Create a new IpAddressBlock with given ID if it does not exist. If IpAddressBlock with given ID already exists, it will update existing instance. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipBlockIdParam (required) + // @param ipAddressBlockParam (required) + // @return com.vmware.nsx_policy.model.IpAddressBlock + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ipBlockIdParam string, ipAddressBlockParam nsx_policyModel.IpAddressBlock) (nsx_policyModel.IpAddressBlock, error) +} + +type ipBlocksClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpBlocksClient(connector vapiProtocolClient_.Connector) *ipBlocksClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipBlocksClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipBlocksClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipBlocksClient) Delete(orgIdParam string, projectIdParam string, ipBlockIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipBlocksDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipBlocksDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpBlockId", ipBlockIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipBlocksClient) Get(orgIdParam string, projectIdParam string, ipBlockIdParam string) (nsx_policyModel.IpAddressBlock, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipBlocksGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipBlocksGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpBlockId", ipBlockIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressBlock + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressBlock + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpBlocksGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressBlock), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipBlocksClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressBlockListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipBlocksListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipBlocksListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressBlockListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressBlockListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpBlocksListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressBlockListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipBlocksClient) Patch(orgIdParam string, projectIdParam string, ipBlockIdParam string, ipAddressBlockParam nsx_policyModel.IpAddressBlock) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipBlocksPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipBlocksPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpBlockId", ipBlockIdParam) + sv.AddStructField("IpAddressBlock", ipAddressBlockParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipBlocksClient) Update(orgIdParam string, projectIdParam string, ipBlockIdParam string, ipAddressBlockParam nsx_policyModel.IpAddressBlock) (nsx_policyModel.IpAddressBlock, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipBlocksUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipBlocksUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpBlockId", ipBlockIdParam) + sv.AddStructField("IpAddressBlock", ipAddressBlockParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressBlock + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_blocks", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressBlock + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpBlocksUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressBlock), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksTypes.go new file mode 100644 index 000000000..1e76031c3 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpBlocksTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpBlocks. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipBlocksDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpBlocksDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipBlocksDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + paramsTypeMap["ip_block_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipBlockId"] = vapiBindings_.NewStringType() + pathParams["ip_block_id"] = "ipBlockId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-blocks/{ipBlockId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipBlocksGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpBlocksGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) +} + +func ipBlocksGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + paramsTypeMap["ip_block_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipBlockId"] = vapiBindings_.NewStringType() + pathParams["ip_block_id"] = "ipBlockId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-blocks/{ipBlockId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipBlocksListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpBlocksListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockListResultBindingType) +} + +func ipBlocksListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-blocks", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipBlocksPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fields["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + fieldNameMap["ip_address_block"] = "IpAddressBlock" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpBlocksPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipBlocksPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fields["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + fieldNameMap["ip_address_block"] = "IpAddressBlock" + paramsTypeMap["ip_block_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipBlockId"] = vapiBindings_.NewStringType() + pathParams["ip_block_id"] = "ipBlockId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_block", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-blocks/{ipBlockId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipBlocksUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fields["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + fieldNameMap["ip_address_block"] = "IpAddressBlock" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpBlocksUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) +} + +func ipBlocksUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_block_id"] = vapiBindings_.NewStringType() + fields["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_block_id"] = "IpBlockId" + fieldNameMap["ip_address_block"] = "IpAddressBlock" + paramsTypeMap["ip_block_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_block"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressBlockBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipBlockId"] = vapiBindings_.NewStringType() + pathParams["ip_block_id"] = "ipBlockId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_block", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-blocks/{ipBlockId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesClient.go new file mode 100644 index 000000000..a70bea3ba --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpDiscoveryProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpDiscoveryProfilesClient interface { + + // API will delete IP Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipDiscoveryProfileIdParam IP Discovery Profile ID (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, overrideParam *bool) error + + // API will get IP Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipDiscoveryProfileIdParam IP Discovery Profile ID (required) + // @return com.vmware.nsx_policy.model.IPDiscoveryProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string) (nsx_policyModel.IPDiscoveryProfile, error) + + // API will list all IP Discovery Profiles active in current discovery profile id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.IPDiscoveryProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IPDiscoveryProfileListResult, error) + + // API will create IP Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipDiscoveryProfileIdParam IP Discovery Profile ID (required) + // @param ipDiscoveryProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam nsx_policyModel.IPDiscoveryProfile, overrideParam *bool) error + + // API will update IP Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipDiscoveryProfileIdParam IP Discovery Profile ID (required) + // @param ipDiscoveryProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.IPDiscoveryProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam nsx_policyModel.IPDiscoveryProfile, overrideParam *bool) (nsx_policyModel.IPDiscoveryProfile, error) +} + +type ipDiscoveryProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpDiscoveryProfilesClient(connector vapiProtocolClient_.Connector) *ipDiscoveryProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipDiscoveryProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipDiscoveryProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipDiscoveryProfilesClient) Delete(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipDiscoveryProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipDiscoveryProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpDiscoveryProfileId", ipDiscoveryProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipDiscoveryProfilesClient) Get(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string) (nsx_policyModel.IPDiscoveryProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipDiscoveryProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipDiscoveryProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpDiscoveryProfileId", ipDiscoveryProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IPDiscoveryProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IPDiscoveryProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpDiscoveryProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IPDiscoveryProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipDiscoveryProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IPDiscoveryProfileListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipDiscoveryProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipDiscoveryProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IPDiscoveryProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IPDiscoveryProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpDiscoveryProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IPDiscoveryProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipDiscoveryProfilesClient) Patch(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam nsx_policyModel.IPDiscoveryProfile, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipDiscoveryProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipDiscoveryProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpDiscoveryProfileId", ipDiscoveryProfileIdParam) + sv.AddStructField("IpDiscoveryProfile", ipDiscoveryProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipDiscoveryProfilesClient) Update(orgIdParam string, projectIdParam string, ipDiscoveryProfileIdParam string, ipDiscoveryProfileParam nsx_policyModel.IPDiscoveryProfile, overrideParam *bool) (nsx_policyModel.IPDiscoveryProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipDiscoveryProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipDiscoveryProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpDiscoveryProfileId", ipDiscoveryProfileIdParam) + sv.AddStructField("IpDiscoveryProfile", ipDiscoveryProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IPDiscoveryProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_discovery_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IPDiscoveryProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpDiscoveryProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IPDiscoveryProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesTypes.go new file mode 100644 index 000000000..b7fd47628 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpDiscoveryProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpDiscoveryProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipDiscoveryProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpDiscoveryProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipDiscoveryProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["ip_discovery_profile_id"] = "ipDiscoveryProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-discovery-profiles/{ipDiscoveryProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipDiscoveryProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpDiscoveryProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) +} + +func ipDiscoveryProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + paramsTypeMap["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["ip_discovery_profile_id"] = "ipDiscoveryProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-discovery-profiles/{ipDiscoveryProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipDiscoveryProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpDiscoveryProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileListResultBindingType) +} + +func ipDiscoveryProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-discovery-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipDiscoveryProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["ip_discovery_profile"] = "IpDiscoveryProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpDiscoveryProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipDiscoveryProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["ip_discovery_profile"] = "IpDiscoveryProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["ip_discovery_profile_id"] = "ipDiscoveryProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_discovery_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-discovery-profiles/{ipDiscoveryProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipDiscoveryProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["ip_discovery_profile"] = "IpDiscoveryProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpDiscoveryProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) +} + +func ipDiscoveryProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_discovery_profile_id"] = "IpDiscoveryProfileId" + fieldNameMap["ip_discovery_profile"] = "IpDiscoveryProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["ip_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.IPDiscoveryProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["ip_discovery_profile_id"] = "ipDiscoveryProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_discovery_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-discovery-profiles/{ipDiscoveryProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsClient.go new file mode 100644 index 000000000..7707223b2 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpPools +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpPoolsClient interface { + + // Delete the IpAddressPool with the given id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string) error + + // Read IpAddressPool with given Id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @return com.vmware.nsx_policy.model.IpAddressPool + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ipPoolIdParam string) (nsx_policyModel.IpAddressPool, error) + + // Paginated list of IpAddressPools. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.IpAddressPoolListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressPoolListResult, error) + + // Creates a new IpAddressPool with specified ID if not already present. If IpAddressPool of given ID is already present, then the instance is updated. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAddressPoolParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAddressPoolParam nsx_policyModel.IpAddressPool) error + + // Create a new IpAddressPool with given ID if it does not exist. If IpAddressPool with given ID already exists, it will update existing instance. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAddressPoolParam (required) + // @return com.vmware.nsx_policy.model.IpAddressPool + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAddressPoolParam nsx_policyModel.IpAddressPool) (nsx_policyModel.IpAddressPool, error) +} + +type ipPoolsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpPoolsClient(connector vapiProtocolClient_.Connector) *ipPoolsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_pools") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipPoolsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipPoolsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipPoolsClient) Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipPoolsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipPoolsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipPoolsClient) Get(orgIdParam string, projectIdParam string, ipPoolIdParam string) (nsx_policyModel.IpAddressPool, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipPoolsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipPoolsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressPool + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressPool + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpPoolsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressPool), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipPoolsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressPoolListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipPoolsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipPoolsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressPoolListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressPoolListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpPoolsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressPoolListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipPoolsClient) Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAddressPoolParam nsx_policyModel.IpAddressPool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipPoolsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipPoolsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAddressPool", ipAddressPoolParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipPoolsClient) Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAddressPoolParam nsx_policyModel.IpAddressPool) (nsx_policyModel.IpAddressPool, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipPoolsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipPoolsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAddressPool", ipAddressPoolParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressPool + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressPool + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpPoolsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressPool), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsTypes.go new file mode 100644 index 000000000..83bf1af26 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/IpPoolsTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpPools. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipPoolsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpPoolsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipPoolsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipPoolsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpPoolsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) +} + +func ipPoolsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipPoolsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpPoolsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolListResultBindingType) +} + +func ipPoolsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipPoolsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_address_pool"] = "IpAddressPool" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpPoolsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipPoolsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_address_pool"] = "IpAddressPool" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_pool", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipPoolsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_address_pool"] = "IpAddressPool" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpPoolsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) +} + +func ipPoolsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_address_pool"] = "IpAddressPool" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_pool"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_pool", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesClient.go new file mode 100644 index 000000000..797ccb947 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Ipv6DadProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type Ipv6DadProfilesClient interface { + + // Delete IPv6 DAD profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dadProfileIdParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, dadProfileIdParam string, overrideParam *bool) error + + // Read IPv6 DAD profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dadProfileIdParam (required) + // @return com.vmware.nsx_policy.model.Ipv6DadProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, dadProfileIdParam string) (nsx_policyModel.Ipv6DadProfile, error) + + // Paginated list of all IPv6 DAD profile instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.Ipv6DadProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Ipv6DadProfileListResult, error) + + // If profile with the dad-profile-id is not already present, create a new IPv6 DAD profile instance. If it already exists, update the IPv6 DAD profile instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dadProfileIdParam (required) + // @param ipv6DadProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, dadProfileIdParam string, ipv6DadProfileParam nsx_policyModel.Ipv6DadProfile, overrideParam *bool) error + + // If profile with the dad-profile-id is not already present, create a new IPv6 DAD profile instance. If it already exists, replace the IPv6 DAD profile instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param dadProfileIdParam (required) + // @param ipv6DadProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.Ipv6DadProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, dadProfileIdParam string, ipv6DadProfileParam nsx_policyModel.Ipv6DadProfile, overrideParam *bool) (nsx_policyModel.Ipv6DadProfile, error) +} + +type ipv6DadProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpv6DadProfilesClient(connector vapiProtocolClient_.Connector) *ipv6DadProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipv6DadProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipv6DadProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipv6DadProfilesClient) Delete(orgIdParam string, projectIdParam string, dadProfileIdParam string, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6DadProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6DadProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DadProfileId", dadProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipv6DadProfilesClient) Get(orgIdParam string, projectIdParam string, dadProfileIdParam string) (nsx_policyModel.Ipv6DadProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6DadProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6DadProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DadProfileId", dadProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6DadProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6DadProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6DadProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6DadProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipv6DadProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Ipv6DadProfileListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6DadProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6DadProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6DadProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6DadProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6DadProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6DadProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipv6DadProfilesClient) Patch(orgIdParam string, projectIdParam string, dadProfileIdParam string, ipv6DadProfileParam nsx_policyModel.Ipv6DadProfile, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6DadProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6DadProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DadProfileId", dadProfileIdParam) + sv.AddStructField("Ipv6DadProfile", ipv6DadProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipv6DadProfilesClient) Update(orgIdParam string, projectIdParam string, dadProfileIdParam string, ipv6DadProfileParam nsx_policyModel.Ipv6DadProfile, overrideParam *bool) (nsx_policyModel.Ipv6DadProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6DadProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6DadProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DadProfileId", dadProfileIdParam) + sv.AddStructField("Ipv6DadProfile", ipv6DadProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6DadProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_dad_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6DadProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6DadProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6DadProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesTypes.go new file mode 100644 index 000000000..126400419 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6DadProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Ipv6DadProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipv6DadProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6DadProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipv6DadProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dad_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dadProfileId"] = vapiBindings_.NewStringType() + pathParams["dad_profile_id"] = "dadProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-dad-profiles/{dadProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6DadProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6DadProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) +} + +func ipv6DadProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dad_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dadProfileId"] = vapiBindings_.NewStringType() + pathParams["dad_profile_id"] = "dadProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-dad-profiles/{dadProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6DadProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6DadProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileListResultBindingType) +} + +func ipv6DadProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-dad-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6DadProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["ipv6_dad_profile"] = "Ipv6DadProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6DadProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipv6DadProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["ipv6_dad_profile"] = "Ipv6DadProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + paramsTypeMap["dad_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dadProfileId"] = vapiBindings_.NewStringType() + pathParams["dad_profile_id"] = "dadProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ipv6_dad_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-dad-profiles/{dadProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6DadProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["ipv6_dad_profile"] = "Ipv6DadProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6DadProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) +} + +func ipv6DadProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["dad_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["dad_profile_id"] = "DadProfileId" + fieldNameMap["ipv6_dad_profile"] = "Ipv6DadProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ipv6_dad_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6DadProfileBindingType) + paramsTypeMap["dad_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["dadProfileId"] = vapiBindings_.NewStringType() + pathParams["dad_profile_id"] = "dadProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ipv6_dad_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-dad-profiles/{dadProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesClient.go new file mode 100644 index 000000000..35ec6babb --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Ipv6NdraProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type Ipv6NdraProfilesClient interface { + + // Delete IPv6 NDRA profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ndraProfileIdParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ndraProfileIdParam string, overrideParam *bool) error + + // Read IPv6 NDRA profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ndraProfileIdParam (required) + // @return com.vmware.nsx_policy.model.Ipv6NdraProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ndraProfileIdParam string) (nsx_policyModel.Ipv6NdraProfile, error) + + // Paginated list of all IPv6 NDRA profile instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.Ipv6NdraProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Ipv6NdraProfileListResult, error) + + // If profile with the ndra-profile-id is not already present, create a new IPv6 NDRA profile instance. If it already exists, update the IPv6 NDRA profile instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ndraProfileIdParam (required) + // @param ipv6NdraProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ndraProfileIdParam string, ipv6NdraProfileParam nsx_policyModel.Ipv6NdraProfile, overrideParam *bool) error + + // If profile with the ndra-profile-id is not already present, create a new IPv6 NDRA profile instance. If it already exists, replace the IPv6 NDRA profile instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ndraProfileIdParam (required) + // @param ipv6NdraProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.Ipv6NdraProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ndraProfileIdParam string, ipv6NdraProfileParam nsx_policyModel.Ipv6NdraProfile, overrideParam *bool) (nsx_policyModel.Ipv6NdraProfile, error) +} + +type ipv6NdraProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpv6NdraProfilesClient(connector vapiProtocolClient_.Connector) *ipv6NdraProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipv6NdraProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipv6NdraProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipv6NdraProfilesClient) Delete(orgIdParam string, projectIdParam string, ndraProfileIdParam string, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6NdraProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6NdraProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("NdraProfileId", ndraProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipv6NdraProfilesClient) Get(orgIdParam string, projectIdParam string, ndraProfileIdParam string) (nsx_policyModel.Ipv6NdraProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6NdraProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6NdraProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("NdraProfileId", ndraProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6NdraProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6NdraProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6NdraProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6NdraProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipv6NdraProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Ipv6NdraProfileListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6NdraProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6NdraProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6NdraProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6NdraProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6NdraProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6NdraProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipv6NdraProfilesClient) Patch(orgIdParam string, projectIdParam string, ndraProfileIdParam string, ipv6NdraProfileParam nsx_policyModel.Ipv6NdraProfile, overrideParam *bool) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6NdraProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6NdraProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("NdraProfileId", ndraProfileIdParam) + sv.AddStructField("Ipv6NdraProfile", ipv6NdraProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipv6NdraProfilesClient) Update(orgIdParam string, projectIdParam string, ndraProfileIdParam string, ipv6NdraProfileParam nsx_policyModel.Ipv6NdraProfile, overrideParam *bool) (nsx_policyModel.Ipv6NdraProfile, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipv6NdraProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipv6NdraProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("NdraProfileId", ndraProfileIdParam) + sv.AddStructField("Ipv6NdraProfile", ipv6NdraProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Ipv6NdraProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ipv6_ndra_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Ipv6NdraProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Ipv6NdraProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Ipv6NdraProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesTypes.go new file mode 100644 index 000000000..85291ca63 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Ipv6NdraProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Ipv6NdraProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipv6NdraProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6NdraProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipv6NdraProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["ndra_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ndraProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["ndra_profile_id"] = "ndraProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-ndra-profiles/{ndraProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6NdraProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6NdraProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) +} + +func ipv6NdraProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + paramsTypeMap["ndra_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ndraProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["ndra_profile_id"] = "ndraProfileId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-ndra-profiles/{ndraProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6NdraProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6NdraProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileListResultBindingType) +} + +func ipv6NdraProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-ndra-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6NdraProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["ipv6_ndra_profile"] = "Ipv6NdraProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6NdraProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipv6NdraProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["ipv6_ndra_profile"] = "Ipv6NdraProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["ndra_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ndraProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["ndra_profile_id"] = "ndraProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ipv6_ndra_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-ndra-profiles/{ndraProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipv6NdraProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["ipv6_ndra_profile"] = "Ipv6NdraProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Ipv6NdraProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) +} + +func ipv6NdraProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ndra_profile_id"] = vapiBindings_.NewStringType() + fields["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ndra_profile_id"] = "NdraProfileId" + fieldNameMap["ipv6_ndra_profile"] = "Ipv6NdraProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["ndra_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ipv6_ndra_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.Ipv6NdraProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ndraProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["ndra_profile_id"] = "ndraProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ipv6_ndra_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ipv6-ndra-profiles/{ndraProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesClient.go new file mode 100644 index 000000000..2f27915d4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesClient.go @@ -0,0 +1,306 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: L7AccessProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type L7AccessProfilesClient interface { + + // API will delete L7 Access Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param l7AccessProfileIdParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, overrideParam *bool) error + + // API will get L7 Access Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param l7AccessProfileIdParam (required) + // @return com.vmware.nsx_policy.model.L7AccessProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string) (nsx_policyModel.L7AccessProfile, error) + + // API will list all l7 access Profiles + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeEntryCountParam Include the count of entries in L7 Profile (optional, default to false) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.L7AccessProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeEntryCountParam *bool, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L7AccessProfileListResult, error) + + // API will create/update L7 Access Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param l7AccessProfileIdParam L7 Access Profile ID (required) + // @param l7AccessProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.L7AccessProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, l7AccessProfileParam nsx_policyModel.L7AccessProfile, overrideParam *bool) (nsx_policyModel.L7AccessProfile, error) + + // API will update L7 Access Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param l7AccessProfileIdParam (required) + // @param l7AccessProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.L7AccessProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, l7AccessProfileParam nsx_policyModel.L7AccessProfile, overrideParam *bool) (nsx_policyModel.L7AccessProfile, error) +} + +type l7AccessProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewL7AccessProfilesClient(connector vapiProtocolClient_.Connector) *l7AccessProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + lIface := l7AccessProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &lIface +} + +func (lIface *l7AccessProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := lIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (lIface *l7AccessProfilesClient) Delete(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, overrideParam *bool) error { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := l7AccessProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(l7AccessProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("L7AccessProfileId", l7AccessProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (lIface *l7AccessProfilesClient) Get(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string) (nsx_policyModel.L7AccessProfile, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := l7AccessProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(l7AccessProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("L7AccessProfileId", l7AccessProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L7AccessProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L7AccessProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), L7AccessProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L7AccessProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *l7AccessProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeEntryCountParam *bool, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L7AccessProfileListResult, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := l7AccessProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(l7AccessProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeEntryCount", includeEntryCountParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L7AccessProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L7AccessProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), L7AccessProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L7AccessProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *l7AccessProfilesClient) Patch(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, l7AccessProfileParam nsx_policyModel.L7AccessProfile, overrideParam *bool) (nsx_policyModel.L7AccessProfile, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := l7AccessProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(l7AccessProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("L7AccessProfileId", l7AccessProfileIdParam) + sv.AddStructField("L7AccessProfile", l7AccessProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L7AccessProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles", "patch", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L7AccessProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), L7AccessProfilesPatchOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L7AccessProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *l7AccessProfilesClient) Update(orgIdParam string, projectIdParam string, l7AccessProfileIdParam string, l7AccessProfileParam nsx_policyModel.L7AccessProfile, overrideParam *bool) (nsx_policyModel.L7AccessProfile, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := l7AccessProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(l7AccessProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("L7AccessProfileId", l7AccessProfileIdParam) + sv.AddStructField("L7AccessProfile", l7AccessProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L7AccessProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.l7_access_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L7AccessProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), L7AccessProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L7AccessProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesTypes.go new file mode 100644 index 000000000..192b76328 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/L7AccessProfilesTypes.go @@ -0,0 +1,402 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: L7AccessProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func l7AccessProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func L7AccessProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func l7AccessProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["l7AccessProfileId"] = vapiBindings_.NewStringType() + pathParams["l7_access_profile_id"] = "l7AccessProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/l7-access-profiles/{l7AccessProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func l7AccessProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func L7AccessProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) +} + +func l7AccessProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["l7AccessProfileId"] = vapiBindings_.NewStringType() + pathParams["l7_access_profile_id"] = "l7AccessProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/l7-access-profiles/{l7AccessProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func l7AccessProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_entry_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_entry_count"] = "IncludeEntryCount" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func L7AccessProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileListResultBindingType) +} + +func l7AccessProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_entry_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_entry_count"] = "IncludeEntryCount" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_entry_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["include_entry_count"] = "include_entry_count" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/l7-access-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func l7AccessProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["l7_access_profile"] = "L7AccessProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func L7AccessProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) +} + +func l7AccessProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["l7_access_profile"] = "L7AccessProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["l7AccessProfileId"] = vapiBindings_.NewStringType() + pathParams["l7_access_profile_id"] = "l7AccessProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l7_access_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/l7-access-profiles/{l7AccessProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func l7AccessProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["l7_access_profile"] = "L7AccessProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func L7AccessProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) +} + +func l7AccessProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile_id"] = vapiBindings_.NewStringType() + fields["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["l7_access_profile_id"] = "L7AccessProfileId" + fieldNameMap["l7_access_profile"] = "L7AccessProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l7_access_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.L7AccessProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["l7AccessProfileId"] = vapiBindings_.NewStringType() + pathParams["l7_access_profile_id"] = "l7AccessProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l7_access_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/l7-access-profiles/{l7AccessProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsClient.go new file mode 100644 index 000000000..22aa3d9ac --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsClient.go @@ -0,0 +1,291 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Labels +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type LabelsClient interface { + + // Delete PolicyLabel object + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param labelIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, labelIdParam string) error + + // Read a label. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param labelIdParam (required) + // @return com.vmware.nsx_policy.model.PolicyLabel + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, labelIdParam string) (nsx_policyModel.PolicyLabel, error) + + // Paginated list of all labels for infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyLabelListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyLabelListResult, error) + + // Create label if not exists, otherwise take the partial updates. Note, once the label is created type attribute can not be changed. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param labelIdParam (required) + // @param policyLabelParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, labelIdParam string, policyLabelParam nsx_policyModel.PolicyLabel) error + + // Create label if not exists, otherwise replaces the existing label. If label already exists then type attribute cannot be changed. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param labelIdParam (required) + // @param policyLabelParam (required) + // @return com.vmware.nsx_policy.model.PolicyLabel + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, labelIdParam string, policyLabelParam nsx_policyModel.PolicyLabel) (nsx_policyModel.PolicyLabel, error) +} + +type labelsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewLabelsClient(connector vapiProtocolClient_.Connector) *labelsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.labels") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + lIface := labelsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &lIface +} + +func (lIface *labelsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := lIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (lIface *labelsClient) Delete(orgIdParam string, projectIdParam string, labelIdParam string) error { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := labelsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(labelsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("LabelId", labelIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.labels", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (lIface *labelsClient) Get(orgIdParam string, projectIdParam string, labelIdParam string) (nsx_policyModel.PolicyLabel, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := labelsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(labelsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("LabelId", labelIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyLabel + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.labels", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyLabel + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LabelsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyLabel), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *labelsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyLabelListResult, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := labelsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(labelsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyLabelListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.labels", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyLabelListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LabelsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyLabelListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *labelsClient) Patch(orgIdParam string, projectIdParam string, labelIdParam string, policyLabelParam nsx_policyModel.PolicyLabel) error { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := labelsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(labelsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("LabelId", labelIdParam) + sv.AddStructField("PolicyLabel", policyLabelParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.labels", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (lIface *labelsClient) Update(orgIdParam string, projectIdParam string, labelIdParam string, policyLabelParam nsx_policyModel.PolicyLabel) (nsx_policyModel.PolicyLabel, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := labelsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(labelsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("LabelId", labelIdParam) + sv.AddStructField("PolicyLabel", policyLabelParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyLabel + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.labels", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyLabel + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LabelsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyLabel), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsTypes.go new file mode 100644 index 000000000..b7e632d0a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/LabelsTypes.go @@ -0,0 +1,378 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Labels. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func labelsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LabelsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func labelsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["label_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["labelId"] = vapiBindings_.NewStringType() + pathParams["label_id"] = "labelId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/labels/{labelId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func labelsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LabelsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) +} + +func labelsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["label_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["labelId"] = vapiBindings_.NewStringType() + pathParams["label_id"] = "labelId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/labels/{labelId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func labelsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LabelsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelListResultBindingType) +} + +func labelsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/labels", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func labelsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fields["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + fieldNameMap["policy_label"] = "PolicyLabel" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LabelsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func labelsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fields["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + fieldNameMap["policy_label"] = "PolicyLabel" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + paramsTypeMap["label_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["labelId"] = vapiBindings_.NewStringType() + pathParams["label_id"] = "labelId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_label", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/labels/{labelId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func labelsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fields["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + fieldNameMap["policy_label"] = "PolicyLabel" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LabelsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) +} + +func labelsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["label_id"] = vapiBindings_.NewStringType() + fields["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["label_id"] = "LabelId" + fieldNameMap["policy_label"] = "PolicyLabel" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_label"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyLabelBindingType) + paramsTypeMap["label_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["labelId"] = vapiBindings_.NewStringType() + pathParams["label_id"] = "labelId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_label", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/labels/{labelId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesClient.go new file mode 100644 index 000000000..0d042abf5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: MacDiscoveryProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type MacDiscoveryProfilesClient interface { + + // API will delete Mac Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param macDiscoveryProfileIdParam Mac Discovery Profile ID (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, overrideParam *bool) error + + // API will get Mac Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param macDiscoveryProfileIdParam Mac Discovery Profile ID (required) + // @return com.vmware.nsx_policy.model.MacDiscoveryProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string) (nsx_policyModel.MacDiscoveryProfile, error) + + // API will list all Mac Discovery Profiles active in current discovery profile id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.MacDiscoveryProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.MacDiscoveryProfileListResult, error) + + // API will create Mac Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param macDiscoveryProfileIdParam Mac Discovery Profile ID (required) + // @param macDiscoveryProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, macDiscoveryProfileParam nsx_policyModel.MacDiscoveryProfile, overrideParam *bool) error + + // API will update Mac Discovery profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param macDiscoveryProfileIdParam Mac Discovery Profile ID (required) + // @param macDiscoveryProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.MacDiscoveryProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, macDiscoveryProfileParam nsx_policyModel.MacDiscoveryProfile, overrideParam *bool) (nsx_policyModel.MacDiscoveryProfile, error) +} + +type macDiscoveryProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewMacDiscoveryProfilesClient(connector vapiProtocolClient_.Connector) *macDiscoveryProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + mIface := macDiscoveryProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &mIface +} + +func (mIface *macDiscoveryProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := mIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (mIface *macDiscoveryProfilesClient) Delete(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, overrideParam *bool) error { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macDiscoveryProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macDiscoveryProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("MacDiscoveryProfileId", macDiscoveryProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (mIface *macDiscoveryProfilesClient) Get(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string) (nsx_policyModel.MacDiscoveryProfile, error) { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macDiscoveryProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macDiscoveryProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("MacDiscoveryProfileId", macDiscoveryProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.MacDiscoveryProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.MacDiscoveryProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), MacDiscoveryProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.MacDiscoveryProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (mIface *macDiscoveryProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.MacDiscoveryProfileListResult, error) { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macDiscoveryProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macDiscoveryProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.MacDiscoveryProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.MacDiscoveryProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), MacDiscoveryProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.MacDiscoveryProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (mIface *macDiscoveryProfilesClient) Patch(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, macDiscoveryProfileParam nsx_policyModel.MacDiscoveryProfile, overrideParam *bool) error { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macDiscoveryProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macDiscoveryProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("MacDiscoveryProfileId", macDiscoveryProfileIdParam) + sv.AddStructField("MacDiscoveryProfile", macDiscoveryProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (mIface *macDiscoveryProfilesClient) Update(orgIdParam string, projectIdParam string, macDiscoveryProfileIdParam string, macDiscoveryProfileParam nsx_policyModel.MacDiscoveryProfile, overrideParam *bool) (nsx_policyModel.MacDiscoveryProfile, error) { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macDiscoveryProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macDiscoveryProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("MacDiscoveryProfileId", macDiscoveryProfileIdParam) + sv.AddStructField("MacDiscoveryProfile", macDiscoveryProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.MacDiscoveryProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.mac_discovery_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.MacDiscoveryProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), MacDiscoveryProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.MacDiscoveryProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesTypes.go new file mode 100644 index 000000000..d62d5991c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/MacDiscoveryProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: MacDiscoveryProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func macDiscoveryProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacDiscoveryProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func macDiscoveryProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["macDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["mac_discovery_profile_id"] = "macDiscoveryProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/mac-discovery-profiles/{macDiscoveryProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func macDiscoveryProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacDiscoveryProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) +} + +func macDiscoveryProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["macDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["mac_discovery_profile_id"] = "macDiscoveryProfileId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/mac-discovery-profiles/{macDiscoveryProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func macDiscoveryProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacDiscoveryProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileListResultBindingType) +} + +func macDiscoveryProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/mac-discovery-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func macDiscoveryProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["mac_discovery_profile"] = "MacDiscoveryProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacDiscoveryProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func macDiscoveryProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["mac_discovery_profile"] = "MacDiscoveryProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["macDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["mac_discovery_profile_id"] = "macDiscoveryProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "mac_discovery_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/mac-discovery-profiles/{macDiscoveryProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func macDiscoveryProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["mac_discovery_profile"] = "MacDiscoveryProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacDiscoveryProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) +} + +func macDiscoveryProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + fields["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["mac_discovery_profile_id"] = "MacDiscoveryProfileId" + fieldNameMap["mac_discovery_profile"] = "MacDiscoveryProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["mac_discovery_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["mac_discovery_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.MacDiscoveryProfileBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["macDiscoveryProfileId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["mac_discovery_profile_id"] = "macDiscoveryProfileId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "mac_discovery_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/mac-discovery-profiles/{macDiscoveryProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesClient.go new file mode 100644 index 000000000..c55a214f8 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesClient.go @@ -0,0 +1,295 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: QosProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type QosProfilesClient interface { + + // API will delete QoS profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam QoS profile Id (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, qosProfileIdParam string, overrideParam *bool) error + + // API will return details of QoS profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam QoS profile Id (required) + // @return com.vmware.nsx_policy.model.QoSProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, qosProfileIdParam string) (nsx_policyModel.QosProfile, error) + + // API will list all QoS profiles. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.QoSProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.QosProfileListResult, error) + + // Create a new QoS profile if the QoS profile with given id does not already exist. If the QoS profile with the given id already exists, patch with the existing QoS profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam QoS profile Id (required) + // @param qosProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, qosProfileIdParam string, qosProfileParam nsx_policyModel.QosProfile, overrideParam *bool) error + + // Create or Replace QoS profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param qosProfileIdParam QoS profile Id (required) + // @param qosProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.QoSProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, qosProfileIdParam string, qosProfileParam nsx_policyModel.QosProfile, overrideParam *bool) (nsx_policyModel.QosProfile, error) +} + +type qosProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewQosProfilesClient(connector vapiProtocolClient_.Connector) *qosProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + qIface := qosProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &qIface +} + +func (qIface *qosProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := qIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (qIface *qosProfilesClient) Delete(orgIdParam string, projectIdParam string, qosProfileIdParam string, overrideParam *bool) error { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := qosProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(qosProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (qIface *qosProfilesClient) Get(orgIdParam string, projectIdParam string, qosProfileIdParam string) (nsx_policyModel.QosProfile, error) { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := qosProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(qosProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.QosProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.QosProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), QosProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.QosProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (qIface *qosProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.QosProfileListResult, error) { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := qosProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(qosProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.QosProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.QosProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), QosProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.QosProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (qIface *qosProfilesClient) Patch(orgIdParam string, projectIdParam string, qosProfileIdParam string, qosProfileParam nsx_policyModel.QosProfile, overrideParam *bool) error { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := qosProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(qosProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("QosProfile", qosProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (qIface *qosProfilesClient) Update(orgIdParam string, projectIdParam string, qosProfileIdParam string, qosProfileParam nsx_policyModel.QosProfile, overrideParam *bool) (nsx_policyModel.QosProfile, error) { + typeConverter := qIface.connector.TypeConverter() + executionContext := qIface.connector.NewExecutionContext() + operationRestMetaData := qosProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(qosProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("QosProfileId", qosProfileIdParam) + sv.AddStructField("QosProfile", qosProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.QosProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := qIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.qos_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.QosProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), QosProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.QosProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), qIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesTypes.go new file mode 100644 index 000000000..0459ed66a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/QosProfilesTypes.go @@ -0,0 +1,390 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: QosProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func qosProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QosProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func qosProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/qos-profiles/{qosProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func qosProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QosProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) +} + +func qosProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/qos-profiles/{qosProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func qosProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QosProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileListResultBindingType) +} + +func qosProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/qos-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func qosProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["qos_profile"] = "QosProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QosProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func qosProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["qos_profile"] = "QosProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "qos_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/qos-profiles/{qosProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func qosProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["qos_profile"] = "QosProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func QosProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) +} + +func qosProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["qos_profile_id"] = vapiBindings_.NewStringType() + fields["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["qos_profile_id"] = "QosProfileId" + fieldNameMap["qos_profile"] = "QosProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["qos_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["qos_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.QosProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["qosProfileId"] = vapiBindings_.NewStringType() + pathParams["qos_profile_id"] = "qosProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "qos_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/qos-profiles/{qosProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesClient.go new file mode 100644 index 000000000..67d3823fc --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SegmentSecurityProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentSecurityProfilesClient interface { + + // API will delete segment security profile with the given id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentSecurityProfileIdParam Segment security profile id (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, overrideParam *bool) error + + // API will return details of the segment security profile with given id. If the profile does not exist, it will return 404. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentSecurityProfileIdParam Segment security profile id (required) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string) (nsx_policyModel.SegmentSecurityProfile, error) + + // API will list all segment security profiles. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentSecurityProfileListResult, error) + + // Create a new segment security profile if the segment security profile with given id does not exist. Otherwise, PATCH the existing segment security profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentSecurityProfileIdParam Segment security profile id (required) + // @param segmentSecurityProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, segmentSecurityProfileParam nsx_policyModel.SegmentSecurityProfile, overrideParam *bool) error + + // Create or replace a segment security profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentSecurityProfileIdParam Segment security profile id (required) + // @param segmentSecurityProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, segmentSecurityProfileParam nsx_policyModel.SegmentSecurityProfile, overrideParam *bool) (nsx_policyModel.SegmentSecurityProfile, error) +} + +type segmentSecurityProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentSecurityProfilesClient(connector vapiProtocolClient_.Connector) *segmentSecurityProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentSecurityProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentSecurityProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentSecurityProfilesClient) Delete(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, overrideParam *bool) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentSecurityProfileId", segmentSecurityProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentSecurityProfilesClient) Get(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string) (nsx_policyModel.SegmentSecurityProfile, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentSecurityProfileId", segmentSecurityProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentSecurityProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentSecurityProfileListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentSecurityProfilesClient) Patch(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, segmentSecurityProfileParam nsx_policyModel.SegmentSecurityProfile, overrideParam *bool) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentSecurityProfileId", segmentSecurityProfileIdParam) + sv.AddStructField("SegmentSecurityProfile", segmentSecurityProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentSecurityProfilesClient) Update(orgIdParam string, projectIdParam string, segmentSecurityProfileIdParam string, segmentSecurityProfileParam nsx_policyModel.SegmentSecurityProfile, overrideParam *bool) (nsx_policyModel.SegmentSecurityProfile, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentSecurityProfileId", segmentSecurityProfileIdParam) + sv.AddStructField("SegmentSecurityProfile", segmentSecurityProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segment_security_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesTypes.go new file mode 100644 index 000000000..7978c20c5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentSecurityProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SegmentSecurityProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func segmentSecurityProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentSecurityProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileId"] = vapiBindings_.NewStringType() + pathParams["segment_security_profile_id"] = "segmentSecurityProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segment-security-profiles/{segmentSecurityProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) +} + +func segmentSecurityProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileId"] = vapiBindings_.NewStringType() + pathParams["segment_security_profile_id"] = "segmentSecurityProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segment-security-profiles/{segmentSecurityProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileListResultBindingType) +} + +func segmentSecurityProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segment-security-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["segment_security_profile"] = "SegmentSecurityProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentSecurityProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["segment_security_profile"] = "SegmentSecurityProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileId"] = vapiBindings_.NewStringType() + pathParams["segment_security_profile_id"] = "segmentSecurityProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_security_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segment-security-profiles/{segmentSecurityProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["segment_security_profile"] = "SegmentSecurityProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) +} + +func segmentSecurityProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_security_profile_id"] = "SegmentSecurityProfileId" + fieldNameMap["segment_security_profile"] = "SegmentSecurityProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingType) + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileId"] = vapiBindings_.NewStringType() + pathParams["segment_security_profile_id"] = "segmentSecurityProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_security_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segment-security-profiles/{segmentSecurityProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsClient.go new file mode 100644 index 000000000..e3f1bc59f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsClient.go @@ -0,0 +1,478 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Segments +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentsClient interface { + + // Delete infra segment + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentIdParam string) error + + // Force delete bypasses validations during segment deletion. This may result in an inconsistent connectivity. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cascadeParam Flag to specify whether to delete related segment ports (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete0(orgIdParam string, projectIdParam string, segmentIdParam string, cascadeParam *bool) error + + // Delete one or multiple DHCP lease(s) specified by IP and MAC. If there is a DHCP server running upon the given segment, or this segment is using a DHCP server running in its connected Tier-0 or Tier-1, the DHCP lease(s) which match exactly the IP address and the MAC address will be deleted. If no such lease matches, the deletion for this lease will be ignored. The DHCP lease to be deleted will be removed by the system from both active and standby node. The system will report error if the DHCP lease could not be removed from both nodes. If the DHCP lease could not be removed on either node, please check the DHCP server status. Once the DHCP server status is UP, please invoke the deletion API again to ensure the lease gets deleted from both nodes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param dhcpDeleteLeasesParam (required) + // @param enforcementPointPathParam Enforcement point path (optional) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Deletedhcpleases(orgIdParam string, projectIdParam string, segmentIdParam string, dhcpDeleteLeasesParam nsx_policyModel.DhcpDeleteLeases, enforcementPointPathParam *string) error + + // Read infra segment Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PATCH API payload, the path returned in the GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @return com.vmware.nsx_policy.model.Segment + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string) (nsx_policyModel.Segment, error) + + // Paginated list of all segments under infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param segmentTypeParam Segment type (optional) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentListResult, error) + + // If segment with the segment-id is not already present, create a new segment. If it already exists, update the segment with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error + + // If segment with the segment-id is not already present, create a new segment. If it already exists, update the segment with specified attributes. Force parameter is required when workload connectivity is indirectly impacted with the current update. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch0(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error + + // If segment with the segment-id is not already present, create a new segment. If it already exists, replace the segment with this object. Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PATCH API payload, the path returned in the GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the Alarm, GPRR, error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentParam (required) + // @return com.vmware.nsx_policy.model.Segment + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) + + // If segment with the segment-id is not already present, create a new segment. If it already exists, replace the segment with this object. Force parameter is required when workload connectivity is indirectly impacted with the current replacement. Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PATCH API payload, the path returned in the GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the Alarm, GPRR, error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentParam (required) + // @return com.vmware.nsx_policy.model.Segment + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update0(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) +} + +type segmentsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentsClient(connector vapiProtocolClient_.Connector) *segmentsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "delete_0": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete_0"), + "deletedhcpleases": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "deletedhcpleases"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "patch_0": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch_0"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + "update_0": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update_0"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentsClient) Delete(orgIdParam string, projectIdParam string, segmentIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Delete0(orgIdParam string, projectIdParam string, segmentIdParam string, cascadeParam *bool) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDelete0RestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDelete0InputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cascade", cascadeParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "delete_0", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Deletedhcpleases(orgIdParam string, projectIdParam string, segmentIdParam string, dhcpDeleteLeasesParam nsx_policyModel.DhcpDeleteLeases, enforcementPointPathParam *string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDeletedhcpleasesRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDeletedhcpleasesInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("DhcpDeleteLeases", dhcpDeleteLeasesParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "deletedhcpleases", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string) (nsx_policyModel.Segment, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Segment + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Segment + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Segment), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SegmentType", segmentTypeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentsClient) Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Patch0(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsPatch0RestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsPatch0InputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "patch_0", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Segment + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Segment + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Segment), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentsClient) Update0(orgIdParam string, projectIdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsUpdate0RestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsUpdate0InputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Segment + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments", "update_0", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Segment + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsUpdate0OutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Segment), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsTypes.go new file mode 100644 index 000000000..28d411a41 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SegmentsTypes.go @@ -0,0 +1,673 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Segments. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``segmentType`` of method Segments#list. +const Segments_LIST_SEGMENT_TYPE_DVPORTGROUP = "DVPortgroup" + +// Possible value for ``segmentType`` of method Segments#list. +const Segments_LIST_SEGMENT_TYPE_ALL = "ALL" + +func segmentsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsDelete0InputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cascade"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cascade"] = "Cascade" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDelete0OutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDelete0RestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cascade"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cascade"] = "Cascade" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["cascade"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cascade"] = "cascade" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "force=true", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsDeletedhcpleasesInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["dhcp_delete_leases"] = "DhcpDeleteLeases" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDeletedhcpleasesOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDeletedhcpleasesRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["dhcp_delete_leases"] = "DhcpDeleteLeases" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=delete_dhcp_leases", + "dhcp_delete_leases", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) +} + +func segmentsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["segment_type"] = "SegmentType" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentListResultBindingType) +} + +func segmentsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["segment_type"] = "SegmentType" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["segment_type"] = "segment_type" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsPatch0InputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsPatch0OutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsPatch0RestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "force=true", + "segment", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) +} + +func segmentsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsUpdate0InputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsUpdate0OutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) +} + +func segmentsUpdate0RestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "force=true", + "segment", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesClient.go new file mode 100644 index 000000000..78b482c18 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesClient.go @@ -0,0 +1,293 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Services +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ServicesClient interface { + + // Delete Service + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param serviceIdParam Service ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, serviceIdParam string) error + + // Read a service + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param serviceIdParam Service ID (required) + // @return com.vmware.nsx_policy.model.Service + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, serviceIdParam string) (nsx_policyModel.Service, error) + + // Paginated list of Services for infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param defaultServiceParam Fetch all default services (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.ServiceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, defaultServiceParam *bool, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ServiceListResult, error) + + // Create a new service if a service with the given ID does not already exist. Creates new service entries if populated in the service. If a service with the given ID already exists, patch the service including the nested service entries. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param serviceIdParam Service ID (required) + // @param serviceParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, serviceIdParam string, serviceParam nsx_policyModel.Service) error + + // Create a new service if a service with the given ID does not already exist. Creates new service entries if populated in the service. If a service with the given ID already exists, update the service including the nested service entries. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param serviceIdParam Service ID (required) + // @param serviceParam (required) + // @return com.vmware.nsx_policy.model.Service + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, serviceIdParam string, serviceParam nsx_policyModel.Service) (nsx_policyModel.Service, error) +} + +type servicesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewServicesClient(connector vapiProtocolClient_.Connector) *servicesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.services") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := servicesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *servicesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *servicesClient) Delete(orgIdParam string, projectIdParam string, serviceIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := servicesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(servicesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ServiceId", serviceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.services", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *servicesClient) Get(orgIdParam string, projectIdParam string, serviceIdParam string) (nsx_policyModel.Service, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := servicesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(servicesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ServiceId", serviceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Service + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.services", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Service + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServicesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Service), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *servicesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, defaultServiceParam *bool, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ServiceListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := servicesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(servicesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("DefaultService", defaultServiceParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ServiceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.services", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ServiceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServicesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ServiceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *servicesClient) Patch(orgIdParam string, projectIdParam string, serviceIdParam string, serviceParam nsx_policyModel.Service) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := servicesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(servicesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("Service", serviceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.services", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *servicesClient) Update(orgIdParam string, projectIdParam string, serviceIdParam string, serviceParam nsx_policyModel.Service) (nsx_policyModel.Service, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := servicesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(servicesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("Service", serviceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Service + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.services", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Service + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServicesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Service), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesTypes.go new file mode 100644 index 000000000..9c7c6f62d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ServicesTypes.go @@ -0,0 +1,384 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Services. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func servicesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServicesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func servicesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["service_id"] = "serviceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/services/{serviceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func servicesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServicesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) +} + +func servicesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["service_id"] = "serviceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/services/{serviceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func servicesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["default_service"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["default_service"] = "DefaultService" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServicesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceListResultBindingType) +} + +func servicesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["default_service"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["default_service"] = "DefaultService" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["default_service"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["default_service"] = "default_service" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/services", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func servicesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["service"] = "Service" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServicesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func servicesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["service"] = "Service" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["service_id"] = "serviceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "service", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/services/{serviceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func servicesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["service"] = "Service" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServicesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) +} + +func servicesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["service"] = "Service" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceBindingType) + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["service_id"] = "serviceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "service", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/services/{serviceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesClient.go new file mode 100644 index 000000000..2e87b21b1 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesClient.go @@ -0,0 +1,297 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SpoofguardProfiles +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SpoofguardProfilesClient interface { + + // API will delete SpoofGuard profile with the given id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param spoofguardProfileIdParam SpoofGuard profile id (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, overrideParam *bool) error + + // API will return details of the SpoofGuard profile with given id. If the profile does not exist, it will return 404. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param spoofguardProfileIdParam SpoofGuard profile id (required) + // @return com.vmware.nsx_policy.model.SpoofGuardProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string) (nsx_policyModel.SpoofGuardProfile, error) + + // API will list all SpoofGuard profiles. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SpoofGuardProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SpoofGuardProfileListResult, error) + + // Create a new SpoofGuard profile if the SpoofGuard profile with the given id does not exist. Otherwise, patch with the existing SpoofGuard profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param spoofguardProfileIdParam SpoofGuard profile id (required) + // @param spoofGuardProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, spoofGuardProfileParam nsx_policyModel.SpoofGuardProfile, overrideParam *bool) error + + // API will create or replace SpoofGuard profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param spoofguardProfileIdParam SpoofGuard profile id (required) + // @param spoofGuardProfileParam (required) + // @param overrideParam Locally override the global object (optional, default to false) + // @return com.vmware.nsx_policy.model.SpoofGuardProfile + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, spoofGuardProfileParam nsx_policyModel.SpoofGuardProfile, overrideParam *bool) (nsx_policyModel.SpoofGuardProfile, error) +} + +type spoofguardProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSpoofguardProfilesClient(connector vapiProtocolClient_.Connector) *spoofguardProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := spoofguardProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *spoofguardProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *spoofguardProfilesClient) Delete(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, overrideParam *bool) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := spoofguardProfilesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(spoofguardProfilesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SpoofguardProfileId", spoofguardProfileIdParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *spoofguardProfilesClient) Get(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string) (nsx_policyModel.SpoofGuardProfile, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := spoofguardProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(spoofguardProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SpoofguardProfileId", spoofguardProfileIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SpoofGuardProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SpoofGuardProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SpoofguardProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SpoofGuardProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *spoofguardProfilesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SpoofGuardProfileListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := spoofguardProfilesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(spoofguardProfilesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SpoofGuardProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SpoofGuardProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SpoofguardProfilesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SpoofGuardProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *spoofguardProfilesClient) Patch(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, spoofGuardProfileParam nsx_policyModel.SpoofGuardProfile, overrideParam *bool) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := spoofguardProfilesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(spoofguardProfilesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SpoofguardProfileId", spoofguardProfileIdParam) + sv.AddStructField("SpoofGuardProfile", spoofGuardProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *spoofguardProfilesClient) Update(orgIdParam string, projectIdParam string, spoofguardProfileIdParam string, spoofGuardProfileParam nsx_policyModel.SpoofGuardProfile, overrideParam *bool) (nsx_policyModel.SpoofGuardProfile, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := spoofguardProfilesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(spoofguardProfilesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SpoofguardProfileId", spoofguardProfileIdParam) + sv.AddStructField("SpoofGuardProfile", spoofGuardProfileParam) + sv.AddStructField("Override", overrideParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SpoofGuardProfile + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.spoofguard_profiles", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SpoofGuardProfile + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SpoofguardProfilesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SpoofGuardProfile), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesTypes.go new file mode 100644 index 000000000..736203c51 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/SpoofguardProfilesTypes.go @@ -0,0 +1,396 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SpoofguardProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func spoofguardProfilesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SpoofguardProfilesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func spoofguardProfilesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["override"] = "Override" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["spoofguard_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["spoofguardProfileId"] = vapiBindings_.NewStringType() + pathParams["spoofguard_profile_id"] = "spoofguardProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/spoofguard-profiles/{spoofguardProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func spoofguardProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SpoofguardProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) +} + +func spoofguardProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["spoofguard_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["spoofguardProfileId"] = vapiBindings_.NewStringType() + pathParams["spoofguard_profile_id"] = "spoofguardProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/spoofguard-profiles/{spoofguardProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func spoofguardProfilesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SpoofguardProfilesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileListResultBindingType) +} + +func spoofguardProfilesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/spoofguard-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func spoofguardProfilesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["spoof_guard_profile"] = "SpoofGuardProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SpoofguardProfilesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func spoofguardProfilesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["spoof_guard_profile"] = "SpoofGuardProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["spoofguard_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["spoofguardProfileId"] = vapiBindings_.NewStringType() + pathParams["spoofguard_profile_id"] = "spoofguardProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "spoof_guard_profile", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/spoofguard-profiles/{spoofguardProfileId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func spoofguardProfilesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["spoof_guard_profile"] = "SpoofGuardProfile" + fieldNameMap["override"] = "Override" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SpoofguardProfilesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) +} + +func spoofguardProfilesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["spoofguard_profile_id"] = vapiBindings_.NewStringType() + fields["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + fields["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["spoofguard_profile_id"] = "SpoofguardProfileId" + fieldNameMap["spoof_guard_profile"] = "SpoofGuardProfile" + fieldNameMap["override"] = "Override" + paramsTypeMap["spoof_guard_profile"] = vapiBindings_.NewReferenceType(nsx_policyModel.SpoofGuardProfileBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["override"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["spoofguard_profile_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["spoofguardProfileId"] = vapiBindings_.NewStringType() + pathParams["spoofguard_profile_id"] = "spoofguardProfileId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["override"] = "override" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "spoof_guard_profile", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/spoofguard-profiles/{spoofguardProfileId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsClient.go new file mode 100644 index 000000000..0b16bcbea --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsClient.go @@ -0,0 +1,113 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Tags +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type TagsClient interface { + + // Returns paginated list of all unique tags. Supports filtering by scope, tag and source from which tags are synched. Supports starts with, equals and contains operators on scope and tag values. To filter tags by starts with on scope or tag, use '\*' as prefix before the value. To filter tags by ends with on scope or tag, use '\*' as suffix after the value. To filter tags by contain on scope or tag, use '\*' as prefix and suffix on the value. Below special characters in the filter value needs to be escaped with hex values. - Character '&' needs to be escaped as '%26' - Character '[' needs to be escaped as '%5B' - Character ']' needs to be escaped as '%5D' - Character '+' needs to be escaped as '%2B' - Character '#' needs to be escaped as '%23' Sort option for list of unique tags is available only on tag and scope properties. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param scopeParam Tag scope (optional) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Source from which tags are synced. (optional) + // @param tagParam Tag value (optional) + // @return com.vmware.nsx_policy.model.TagInfoListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, scopeParam *string, sortAscendingParam *bool, sortByParam *string, sourceParam *string, tagParam *string) (nsx_policyModel.TagInfoListResult, error) +} + +type tagsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewTagsClient(connector vapiProtocolClient_.Connector) *tagsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tags") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + tIface := tagsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &tIface +} + +func (tIface *tagsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := tIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (tIface *tagsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, scopeParam *string, sortAscendingParam *bool, sortByParam *string, sourceParam *string, tagParam *string) (nsx_policyModel.TagInfoListResult, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tagsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tagsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("Scope", scopeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("Tag", tagParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.TagInfoListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tags", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.TagInfoListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TagsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.TagInfoListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsTypes.go new file mode 100644 index 000000000..f2c8b1b69 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TagsTypes.go @@ -0,0 +1,148 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Tags. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method Tags#list. +const Tags_LIST_SOURCE_AMAZON = "Amazon" + +// Possible value for ``source`` of method Tags#list. +const Tags_LIST_SOURCE_AZURE = "Azure" + +// Possible value for ``source`` of method Tags#list. +const Tags_LIST_SOURCE_NSX = "NSX" + +// Possible value for ``source`` of method Tags#list. +const Tags_LIST_SOURCE_ANY = "ANY" + +func tagsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["scope"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["tag"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["scope"] = "Scope" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["tag"] = "Tag" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TagsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.TagInfoListResultBindingType) +} + +func tagsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["scope"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["tag"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["scope"] = "Scope" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["tag"] = "Tag" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["scope"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["tag"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["scope"] = "scope" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["tag"] = "tag" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tags", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sClient.go new file mode 100644 index 000000000..8fadbcdc1 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sClient.go @@ -0,0 +1,335 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Tier1s +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type Tier1sClient interface { + + // Delete Tier-1 configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string) error + + // Read Tier-1 configuration + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @return com.vmware.nsx_policy.model.Tier1 + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.Tier1, error) + + // Paginated list of all Tier-1 instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.Tier1ListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1ListResult, error) + + // If Tier-1 with the tier-1-id is not already present, create a new Tier-1 instance. If it already exists, update the tier-1 instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param tier1Param (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, tier1Param nsx_policyModel.Tier1) error + + // Reprocess Tier1 gateway configuration and configuration of related entities like Tier1 interfaces and static routes, etc. Any missing Updates are published to NSX controller. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Reprocess(orgIdParam string, projectIdParam string, tier1IdParam string, enforcementPointPathParam *string) error + + // If Tier-1 with the tier-1-id is not already present, create a new Tier-1 instance. If it already exists, replace the Tier-1 instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param tier1Param (required) + // @return com.vmware.nsx_policy.model.Tier1 + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, tier1Param nsx_policyModel.Tier1) (nsx_policyModel.Tier1, error) +} + +type tier1sClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewTier1sClient(connector vapiProtocolClient_.Connector) *tier1sClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier1s") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "reprocess": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "reprocess"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + tIface := tier1sClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &tIface +} + +func (tIface *tier1sClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := tIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (tIface *tier1sClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string) error { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (tIface *tier1sClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.Tier1, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1 + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1 + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Tier1sGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (tIface *tier1sClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1ListResult, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1ListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1ListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Tier1sListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1ListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (tIface *tier1sClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, tier1Param nsx_policyModel.Tier1) error { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Tier1", tier1Param) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (tIface *tier1sClient) Reprocess(orgIdParam string, projectIdParam string, tier1IdParam string, enforcementPointPathParam *string) error { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sReprocessRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sReprocessInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "reprocess", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (tIface *tier1sClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, tier1Param nsx_policyModel.Tier1) (nsx_policyModel.Tier1, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tier1sUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tier1sUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Tier1", tier1Param) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1 + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier1s", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1 + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), Tier1sUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sTypes.go new file mode 100644 index 000000000..5df20d767 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/Tier1sTypes.go @@ -0,0 +1,448 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Tier1s. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func tier1sDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func tier1sDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func tier1sGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) +} + +func tier1sGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func tier1sListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1ListResultBindingType) +} + +func tier1sListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func tier1sPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["tier1"] = "Tier1" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func tier1sPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["tier1"] = "Tier1" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func tier1sReprocessInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sReprocessOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func tier1sReprocessRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=reprocess", + "", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func tier1sUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["tier1"] = "Tier1" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func Tier1sUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) +} + +func tier1sUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["tier1"] = "Tier1" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1BindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsClient.go new file mode 100644 index 000000000..61d3d51f6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsClient.go @@ -0,0 +1,346 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Traceflows +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type TraceflowsClient interface { + + // This will retrace even if current traceflow has observations. Current observations will be lost. Traceflow configuration will be cleaned up by the system after two hours of inactivity. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param traceflowIdParam (required) + // @param actionParam Action to be performed (optional) + // @return com.vmware.nsx_policy.model.TraceflowConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Create(orgIdParam string, projectIdParam string, traceflowIdParam string, actionParam *string) (nsx_policyModel.TraceflowConfig, error) + + // Delete traceflow config with id traceflow-id + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param traceflowIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, traceflowIdParam string) error + + // Read traceflow config with id traceflow-id. This configuration will be cleaned up by the system after two hours of inactivity. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param traceflowIdParam (required) + // @return com.vmware.nsx_policy.model.TraceflowConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, traceflowIdParam string) (nsx_policyModel.TraceflowConfig, error) + + // Paginated list of all TraceflowConfig for infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.TraceflowConfigListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.TraceflowConfigListResult, error) + + // If a traceflow config with the traceflow-id is not already present, create a new traceflow config. If it already exists, update the traceflow config. This is a full replace. This configuration will be cleaned up by the system after two hours of inactivity. To start traceflow on a DHCP port in a custom project, enforcement point path is required. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param traceflowIdParam (required) + // @param traceflowConfigParam (required) + // @param enforcementPointPathParam Enforcement point path (optional) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, traceflowIdParam string, traceflowConfigParam nsx_policyModel.TraceflowConfig, enforcementPointPathParam *string) error + + // If a traceflow config with the traceflow-id is not already present, create a new traceflow config. If it already exists, update the traceflow config. This is a full replace. This configuration will be cleaned up by the system after two hours of inactivity. To start traceflow on a DHCP port in a custom project, enforcement point path is required. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param traceflowIdParam (required) + // @param traceflowConfigParam (required) + // @param enforcementPointPathParam Enforcement point path (optional) + // @return com.vmware.nsx_policy.model.TraceflowConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, traceflowIdParam string, traceflowConfigParam nsx_policyModel.TraceflowConfig, enforcementPointPathParam *string) (nsx_policyModel.TraceflowConfig, error) +} + +type traceflowsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewTraceflowsClient(connector vapiProtocolClient_.Connector) *traceflowsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.traceflows") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "create": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "create"), + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + tIface := traceflowsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &tIface +} + +func (tIface *traceflowsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := tIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (tIface *traceflowsClient) Create(orgIdParam string, projectIdParam string, traceflowIdParam string, actionParam *string) (nsx_policyModel.TraceflowConfig, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsCreateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsCreateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("TraceflowId", traceflowIdParam) + sv.AddStructField("Action", actionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.TraceflowConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "create", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.TraceflowConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TraceflowsCreateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.TraceflowConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (tIface *traceflowsClient) Delete(orgIdParam string, projectIdParam string, traceflowIdParam string) error { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("TraceflowId", traceflowIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (tIface *traceflowsClient) Get(orgIdParam string, projectIdParam string, traceflowIdParam string) (nsx_policyModel.TraceflowConfig, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("TraceflowId", traceflowIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.TraceflowConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.TraceflowConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TraceflowsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.TraceflowConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (tIface *traceflowsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.TraceflowConfigListResult, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.TraceflowConfigListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.TraceflowConfigListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TraceflowsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.TraceflowConfigListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (tIface *traceflowsClient) Patch(orgIdParam string, projectIdParam string, traceflowIdParam string, traceflowConfigParam nsx_policyModel.TraceflowConfig, enforcementPointPathParam *string) error { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("TraceflowId", traceflowIdParam) + sv.AddStructField("TraceflowConfig", traceflowConfigParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (tIface *traceflowsClient) Update(orgIdParam string, projectIdParam string, traceflowIdParam string, traceflowConfigParam nsx_policyModel.TraceflowConfig, enforcementPointPathParam *string) (nsx_policyModel.TraceflowConfig, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := traceflowsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(traceflowsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("TraceflowId", traceflowIdParam) + sv.AddStructField("TraceflowConfig", traceflowConfigParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.TraceflowConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.traceflows", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.TraceflowConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TraceflowsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.TraceflowConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsTypes.go new file mode 100644 index 000000000..d38747ce6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/TraceflowsTypes.go @@ -0,0 +1,460 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Traceflows. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func traceflowsCreateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["action"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["action"] = "Action" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsCreateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) +} + +func traceflowsCreateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["action"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["action"] = "Action" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["action"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflowId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["traceflow_id"] = "traceflowId" + queryParams["action"] = "action" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows/{traceflowId}", + "", + resultHeaders, + 201, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func traceflowsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func traceflowsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflowId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["traceflow_id"] = "traceflowId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows/{traceflowId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func traceflowsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) +} + +func traceflowsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflowId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["traceflow_id"] = "traceflowId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows/{traceflowId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func traceflowsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigListResultBindingType) +} + +func traceflowsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func traceflowsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["traceflow_config"] = "TraceflowConfig" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func traceflowsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["traceflow_config"] = "TraceflowConfig" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflowId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["traceflow_id"] = "traceflowId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "traceflow_config", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows/{traceflowId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func traceflowsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["traceflow_config"] = "TraceflowConfig" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TraceflowsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) +} + +func traceflowsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["traceflow_id"] = vapiBindings_.NewStringType() + fields["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["traceflow_id"] = "TraceflowId" + fieldNameMap["traceflow_config"] = "TraceflowConfig" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_id"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflow_config"] = vapiBindings_.NewReferenceType(nsx_policyModel.TraceflowConfigBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["traceflowId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["traceflow_id"] = "traceflowId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "traceflow_config", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/traceflows/{traceflowId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsClient.go new file mode 100644 index 000000000..63b11312c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsClient.go @@ -0,0 +1,109 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: VirtualMachineGroupAssociations +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type VirtualMachineGroupAssociationsClient interface { + + // Get policy groups for which the given VM is a member. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param vmExternalIdParam Virtual machine external ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyResourceReferenceForEPListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, vmExternalIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) +} + +type virtualMachineGroupAssociationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewVirtualMachineGroupAssociationsClient(connector vapiProtocolClient_.Connector) *virtualMachineGroupAssociationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.virtual_machine_group_associations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + vIface := virtualMachineGroupAssociationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &vIface +} + +func (vIface *virtualMachineGroupAssociationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := vIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (vIface *virtualMachineGroupAssociationsClient) List(orgIdParam string, projectIdParam string, vmExternalIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) { + typeConverter := vIface.connector.TypeConverter() + executionContext := vIface.connector.NewExecutionContext() + operationRestMetaData := virtualMachineGroupAssociationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(virtualMachineGroupAssociationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("VmExternalId", vmExternalIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := vIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.virtual_machine_group_associations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), VirtualMachineGroupAssociationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyResourceReferenceForEPListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), vIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsTypes.go new file mode 100644 index 000000000..d8705ad6a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualMachineGroupAssociationsTypes.go @@ -0,0 +1,124 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: VirtualMachineGroupAssociations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func virtualMachineGroupAssociationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["vm_external_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["vm_external_id"] = "VmExternalId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func VirtualMachineGroupAssociationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyResourceReferenceForEPListResultBindingType) +} + +func virtualMachineGroupAssociationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["vm_external_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["vm_external_id"] = "VmExternalId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["vm_external_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["vm_external_id"] = "vm_external_id" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/virtual-machine-group-associations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsClient.go new file mode 100644 index 000000000..877e8e49c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsClient.go @@ -0,0 +1,109 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: VirtualNetworkInterfaceGroupAssociations +// Used by client-side stubs. + +package infra + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type VirtualNetworkInterfaceGroupAssociationsClient interface { + + // Get policy groups for which the given VIF is a member. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param vifExternalIdParam Virtual network interface external ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyResourceReferenceForEPListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, vifExternalIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) +} + +type virtualNetworkInterfaceGroupAssociationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewVirtualNetworkInterfaceGroupAssociationsClient(connector vapiProtocolClient_.Connector) *virtualNetworkInterfaceGroupAssociationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.virtual_network_interface_group_associations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + vIface := virtualNetworkInterfaceGroupAssociationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &vIface +} + +func (vIface *virtualNetworkInterfaceGroupAssociationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := vIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (vIface *virtualNetworkInterfaceGroupAssociationsClient) List(orgIdParam string, projectIdParam string, vifExternalIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyResourceReferenceForEPListResult, error) { + typeConverter := vIface.connector.TypeConverter() + executionContext := vIface.connector.NewExecutionContext() + operationRestMetaData := virtualNetworkInterfaceGroupAssociationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(virtualNetworkInterfaceGroupAssociationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("VifExternalId", vifExternalIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := vIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.virtual_network_interface_group_associations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyResourceReferenceForEPListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), VirtualNetworkInterfaceGroupAssociationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyResourceReferenceForEPListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), vIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsTypes.go new file mode 100644 index 000000000..af5d8339d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/VirtualNetworkInterfaceGroupAssociationsTypes.go @@ -0,0 +1,124 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: VirtualNetworkInterfaceGroupAssociations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package infra + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func virtualNetworkInterfaceGroupAssociationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["vif_external_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["vif_external_id"] = "VifExternalId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func VirtualNetworkInterfaceGroupAssociationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyResourceReferenceForEPListResultBindingType) +} + +func virtualNetworkInterfaceGroupAssociationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["vif_external_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["vif_external_id"] = "VifExternalId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["vif_external_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["vif_external_id"] = "vif_external_id" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/virtual-network-interface-group-associations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/CustomAttributesPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/CustomAttributesPackageTypes.go new file mode 100644 index 000000000..3840d87b4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/CustomAttributesPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.context_profiles.custom_attributes. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package custom_attributes diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultClient.go new file mode 100644 index 000000000..a572d3788 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultClient.go @@ -0,0 +1,195 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Default +// Used by client-side stubs. + +package custom_attributes + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DefaultClient interface { + + // This API adds/removes custom attribute values from list for a given attribute key. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param policyCustomAttributesParam (required) + // @param actionParam Add or Remove Custom Context Profile Attribute values. (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Create(orgIdParam string, projectIdParam string, policyCustomAttributesParam nsx_policyModel.PolicyCustomAttributes, actionParam string) error + + // This API updates custom attribute value list for given key. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param attributeKeyParam Fetch attributes and sub-attributes for the given attribute key (optional) + // @param attributeSourceParam Source of the attribute, System Defined or custom (optional, default to SYSTEM) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyContextProfileListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, attributeKeyParam *string, attributeSourceParam *string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyContextProfileListResult, error) + + // This API updates custom attribute value list for given key. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param policyCustomAttributesParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, policyCustomAttributesParam nsx_policyModel.PolicyCustomAttributes) error +} + +type defaultClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDefaultClient(connector vapiProtocolClient_.Connector) *defaultClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.context_profiles.custom_attributes.default") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "create": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "create"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := defaultClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *defaultClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *defaultClient) Create(orgIdParam string, projectIdParam string, policyCustomAttributesParam nsx_policyModel.PolicyCustomAttributes, actionParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := defaultCreateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(defaultCreateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("PolicyCustomAttributes", policyCustomAttributesParam) + sv.AddStructField("Action", actionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles.custom_attributes.default", "create", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *defaultClient) List(orgIdParam string, projectIdParam string, attributeKeyParam *string, attributeSourceParam *string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyContextProfileListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := defaultListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(defaultListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("AttributeKey", attributeKeyParam) + sv.AddStructField("AttributeSource", attributeSourceParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyContextProfileListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles.custom_attributes.default", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyContextProfileListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DefaultListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyContextProfileListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *defaultClient) Patch(orgIdParam string, projectIdParam string, policyCustomAttributesParam nsx_policyModel.PolicyCustomAttributes) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := defaultPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(defaultPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("PolicyCustomAttributes", policyCustomAttributesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.context_profiles.custom_attributes.default", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultTypes.go new file mode 100644 index 000000000..7e1a8c92a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes/DefaultTypes.go @@ -0,0 +1,269 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Default. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package custom_attributes + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``action`` of method Default#create. +const Default_CREATE_ACTION_ADD = "add" + +// Possible value for ``action`` of method Default#create. +const Default_CREATE_ACTION_REMOVE = "remove" + +// Possible value for ``attributeSource`` of method Default#list. +const Default_LIST_ATTRIBUTE_SOURCE_ALL = "ALL" + +// Possible value for ``attributeSource`` of method Default#list. +const Default_LIST_ATTRIBUTE_SOURCE_CUSTOM = "CUSTOM" + +// Possible value for ``attributeSource`` of method Default#list. +const Default_LIST_ATTRIBUTE_SOURCE_SYSTEM = "SYSTEM" + +func defaultCreateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + fields["action"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["policy_custom_attributes"] = "PolicyCustomAttributes" + fieldNameMap["action"] = "Action" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DefaultCreateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func defaultCreateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + fields["action"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["policy_custom_attributes"] = "PolicyCustomAttributes" + fieldNameMap["action"] = "Action" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["action"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["action"] = "action" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_custom_attributes", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/custom-attributes/default", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func defaultListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["attribute_key"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["attribute_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["attribute_key"] = "AttributeKey" + fieldNameMap["attribute_source"] = "AttributeSource" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DefaultListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyContextProfileListResultBindingType) +} + +func defaultListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["attribute_key"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["attribute_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["attribute_key"] = "AttributeKey" + fieldNameMap["attribute_source"] = "AttributeSource" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["attribute_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["attribute_key"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["attribute_source"] = "attribute_source" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["attribute_key"] = "attribute_key" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/custom-attributes/default", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func defaultPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["policy_custom_attributes"] = "PolicyCustomAttributes" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DefaultPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func defaultPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["policy_custom_attributes"] = "PolicyCustomAttributes" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_custom_attributes"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyCustomAttributesBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_custom_attributes", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/context-profiles/custom-attributes/default", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/DomainsPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/DomainsPackageTypes.go new file mode 100644 index 000000000..ccdaff0fe --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/DomainsPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.domains. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsClient.go new file mode 100644 index 000000000..f5ca6e7ca --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsClient.go @@ -0,0 +1,105 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FirewallFloodProtectionProfileBindingMaps +// Used by client-side stubs. + +package domains + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FirewallFloodProtectionProfileBindingMapsClient interface { + + // API will list all Firewall Flood Protection Profile Binding Maps across all domains. This API returns the binding maps order by the sequence number. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyFirewallFloodProtectionProfileBindingMapListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResult, error) +} + +type firewallFloodProtectionProfileBindingMapsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFirewallFloodProtectionProfileBindingMapsClient(connector vapiProtocolClient_.Connector) *firewallFloodProtectionProfileBindingMapsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains.firewall_flood_protection_profile_binding_maps") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := firewallFloodProtectionProfileBindingMapsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *firewallFloodProtectionProfileBindingMapsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *firewallFloodProtectionProfileBindingMapsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResult, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallFloodProtectionProfileBindingMapsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallFloodProtectionProfileBindingMapsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.firewall_flood_protection_profile_binding_maps", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FirewallFloodProtectionProfileBindingMapsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsTypes.go new file mode 100644 index 000000000..1888df36f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallFloodProtectionProfileBindingMapsTypes.go @@ -0,0 +1,112 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FirewallFloodProtectionProfileBindingMaps. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func firewallFloodProtectionProfileBindingMapsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallFloodProtectionProfileBindingMapsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallFloodProtectionProfileBindingMapListResultBindingType) +} + +func firewallFloodProtectionProfileBindingMapsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/firewall-flood-protection-profile-binding-maps", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsClient.go new file mode 100644 index 000000000..c874612aa --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsClient.go @@ -0,0 +1,105 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FirewallSessionTimerProfileBindingMaps +// Used by client-side stubs. + +package domains + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FirewallSessionTimerProfileBindingMapsClient interface { + + // API will list all Firewall Session Timer Profile Binding Maps across all domains. This API returns the binding maps order by the sequence number. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyFirewallSessionTimerProfileBindingMapListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResult, error) +} + +type firewallSessionTimerProfileBindingMapsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFirewallSessionTimerProfileBindingMapsClient(connector vapiProtocolClient_.Connector) *firewallSessionTimerProfileBindingMapsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains.firewall_session_timer_profile_binding_maps") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := firewallSessionTimerProfileBindingMapsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *firewallSessionTimerProfileBindingMapsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *firewallSessionTimerProfileBindingMapsClient) List(orgIdParam string, projectIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResult, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := firewallSessionTimerProfileBindingMapsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(firewallSessionTimerProfileBindingMapsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.firewall_session_timer_profile_binding_maps", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FirewallSessionTimerProfileBindingMapsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsTypes.go new file mode 100644 index 000000000..1259043d4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/FirewallSessionTimerProfileBindingMapsTypes.go @@ -0,0 +1,112 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FirewallSessionTimerProfileBindingMaps. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func firewallSessionTimerProfileBindingMapsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FirewallSessionTimerProfileBindingMapsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyFirewallSessionTimerProfileBindingMapListResultBindingType) +} + +func firewallSessionTimerProfileBindingMapsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/firewall-session-timer-profile-binding-maps", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesClient.go new file mode 100644 index 000000000..704cee7d8 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesClient.go @@ -0,0 +1,360 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayPolicies +// Used by client-side stubs. + +package domains + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayPoliciesClient interface { + + // Delete GatewayPolicy + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param gatewayPolicyIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string) error + + // Read gateway policy for a domain. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param gatewayPolicyIdParam (required) + // @return com.vmware.nsx_policy.model.GatewayPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string) (nsx_policyModel.GatewayPolicy, error) + + // List all gateway policies for specified Domain. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includeRuleCountParam Include the count of rules in policy (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.GatewayPolicyListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GatewayPolicyListResult, error) + + // Update the gateway policy for a domain. This is a full replace. All the rules are replaced. Performance Note: If you want to edit several rules in a gateway policy use this API. It will perform better than several individual rule APIs. Just pass all the rules which you wish to edit as embedded rules to it. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param gatewayPolicyIdParam (required) + // @param gatewayPolicyParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy) error + + // This is used to set a precedence of a gateway policy w.r.t others. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param gatewayPolicyIdParam (required) + // @param gatewayPolicyParam (required) + // @param anchorPathParam The security policy/rule path if operation is 'insert_after' or 'insert_before' (optional) + // @param operationParam Operation (optional, default to insert_top) + // @return com.vmware.nsx_policy.model.GatewayPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Revise(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy, anchorPathParam *string, operationParam *string) (nsx_policyModel.GatewayPolicy, error) + + // Update the gateway policy for a domain. This is a full replace. All the rules are replaced. Performance Note: If you want to edit several rules in a gateway policy, use this API. It will perform better than several individual rule APIs. Just pass all the rules which you wish to edit as embedded rules to it. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param gatewayPolicyIdParam (required) + // @param gatewayPolicyParam (required) + // @return com.vmware.nsx_policy.model.GatewayPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy) (nsx_policyModel.GatewayPolicy, error) +} + +type gatewayPoliciesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayPoliciesClient(connector vapiProtocolClient_.Connector) *gatewayPoliciesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "revise": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "revise"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayPoliciesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayPoliciesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayPoliciesClient) Delete(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GatewayPolicyId", gatewayPolicyIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *gatewayPoliciesClient) Get(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string) (nsx_policyModel.GatewayPolicy, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GatewayPolicyId", gatewayPolicyIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayPoliciesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *gatewayPoliciesClient) List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GatewayPolicyListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludeRuleCount", includeRuleCountParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicyListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicyListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayPoliciesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicyListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *gatewayPoliciesClient) Patch(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GatewayPolicyId", gatewayPolicyIdParam) + sv.AddStructField("GatewayPolicy", gatewayPolicyParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *gatewayPoliciesClient) Revise(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy, anchorPathParam *string, operationParam *string) (nsx_policyModel.GatewayPolicy, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesReviseRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesReviseInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GatewayPolicyId", gatewayPolicyIdParam) + sv.AddStructField("GatewayPolicy", gatewayPolicyParam) + sv.AddStructField("AnchorPath", anchorPathParam) + sv.AddStructField("Operation", operationParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "revise", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayPoliciesReviseOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *gatewayPoliciesClient) Update(orgIdParam string, projectIdParam string, domainIdParam string, gatewayPolicyIdParam string, gatewayPolicyParam nsx_policyModel.GatewayPolicy) (nsx_policyModel.GatewayPolicy, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayPoliciesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayPoliciesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GatewayPolicyId", gatewayPolicyIdParam) + sv.AddStructField("GatewayPolicy", gatewayPolicyParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.gateway_policies", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayPoliciesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesTypes.go new file mode 100644 index 000000000..d9916af64 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GatewayPoliciesTypes.go @@ -0,0 +1,519 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayPolicies. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``operation`` of method GatewayPolicies#revise. +const GatewayPolicies_REVISE_OPERATION_TOP = "insert_top" + +// Possible value for ``operation`` of method GatewayPolicies#revise. +const GatewayPolicies_REVISE_OPERATION_BOTTOM = "insert_bottom" + +// Possible value for ``operation`` of method GatewayPolicies#revise. +const GatewayPolicies_REVISE_OPERATION_AFTER = "insert_after" + +// Possible value for ``operation`` of method GatewayPolicies#revise. +const GatewayPolicies_REVISE_OPERATION_BEFORE = "insert_before" + +func gatewayPoliciesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func gatewayPoliciesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["gatewayPolicyId"] = vapiBindings_.NewStringType() + pathParams["gateway_policy_id"] = "gatewayPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies/{gatewayPolicyId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayPoliciesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) +} + +func gatewayPoliciesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["gatewayPolicyId"] = vapiBindings_.NewStringType() + pathParams["gateway_policy_id"] = "gatewayPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies/{gatewayPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayPoliciesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["include_rule_count"] = "IncludeRuleCount" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyListResultBindingType) +} + +func gatewayPoliciesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["include_rule_count"] = "IncludeRuleCount" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["cursor"] = "cursor" + queryParams["include_rule_count"] = "include_rule_count" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayPoliciesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func gatewayPoliciesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["gatewayPolicyId"] = vapiBindings_.NewStringType() + pathParams["gateway_policy_id"] = "gatewayPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "gateway_policy", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies/{gatewayPolicyId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayPoliciesReviseInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fields["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + fieldNameMap["anchor_path"] = "AnchorPath" + fieldNameMap["operation"] = "Operation" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesReviseOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) +} + +func gatewayPoliciesReviseRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fields["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + fieldNameMap["anchor_path"] = "AnchorPath" + fieldNameMap["operation"] = "Operation" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["gatewayPolicyId"] = vapiBindings_.NewStringType() + pathParams["gateway_policy_id"] = "gatewayPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["anchor_path"] = "anchor_path" + queryParams["operation"] = "operation" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=revise", + "gateway_policy", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies/{gatewayPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func gatewayPoliciesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayPoliciesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) +} + +func gatewayPoliciesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["gateway_policy_id"] = vapiBindings_.NewStringType() + fields["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["gateway_policy_id"] = "GatewayPolicyId" + fieldNameMap["gateway_policy"] = "GatewayPolicy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyBindingType) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["gateway_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["gatewayPolicyId"] = vapiBindings_.NewStringType() + pathParams["gateway_policy_id"] = "gatewayPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "gateway_policy", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/gateway-policies/{gatewayPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsClient.go new file mode 100644 index 000000000..b4d4ae326 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsClient.go @@ -0,0 +1,307 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Groups +// Used by client-side stubs. + +package domains + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GroupsClient interface { + + // Delete Group + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @param groupIdParam Group ID (required) + // @param failIfSubtreeExistsParam Do not delete if the group subtree has any entities (optional, default to false) + // @param forceParam Force delete the resource even if it is being used somewhere (optional, default to false) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, failIfSubtreeExistsParam *bool, forceParam *bool) error + + // Read group + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @param groupIdParam Group ID (required) + // @return com.vmware.nsx_policy.model.Group + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string) (nsx_policyModel.Group, error) + + // List Groups for a domain. Groups can be filtered using member_types query parameter, which returns the groups that contains the specified member types. Multiple member types can be provided as comma separated values. The API also return groups having member type that are subset of provided member_types. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param memberTypesParam Comma Seperated Member types (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.GroupListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, memberTypesParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GroupListResult, error) + + // If a group with the group-id is not already present, create a new group. If it already exists, patch the group. Group created with Kubernetes membership criteria includes only Antrea reported inventory as its members. Once created, Groups with Identity (Directory) Group members should be updated with the new Distinguished Name in case it is changed on AD Server. Maximum of 500 malicious IP Groups (i.e Group with criteria having IPAddress equals All MALICIOUS_IP) should be created. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @param groupIdParam Group ID (required) + // @param groupParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, groupParam nsx_policyModel.Group) error + + // If a group with the group-id is not already present, create a new group. If it already exists, update the group. Avoid creating groups with multiple MACAddressExpression and IPAddressExpression. In future releases, group will be restricted to contain a single MACAddressExpression and IPAddressExpression along with other expressions. To group IPAddresses or MACAddresses, use nested groups instead of multiple IPAddressExpressions/MACAddressExpression. Group created with Kubernetes membership criteria includes only Antrea reported inventory as its members. Once created, Groups with Identity (Directory) Group members should be updated with the new Distinguished Name in case it is changed on AD Server. Maximum of 500 malicious IP Groups (i.e Group with criteria having IPAddress equals All MALICIOUS_IP) should be created. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam Domain ID (required) + // @param groupIdParam Group ID (required) + // @param groupParam (required) + // @return com.vmware.nsx_policy.model.Group + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, groupParam nsx_policyModel.Group) (nsx_policyModel.Group, error) +} + +type groupsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGroupsClient(connector vapiProtocolClient_.Connector) *groupsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains.groups") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := groupsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *groupsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *groupsClient) Delete(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, failIfSubtreeExistsParam *bool, forceParam *bool) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GroupId", groupIdParam) + sv.AddStructField("FailIfSubtreeExists", failIfSubtreeExistsParam) + sv.AddStructField("Force", forceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.groups", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *groupsClient) Get(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string) (nsx_policyModel.Group, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GroupId", groupIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Group + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.groups", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Group + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GroupsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Group), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *groupsClient) List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, memberTypesParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.GroupListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("MemberTypes", memberTypesParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GroupListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.groups", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GroupListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GroupsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GroupListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (gIface *groupsClient) Patch(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, groupParam nsx_policyModel.Group) error { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GroupId", groupIdParam) + sv.AddStructField("Group", groupParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.groups", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (gIface *groupsClient) Update(orgIdParam string, projectIdParam string, domainIdParam string, groupIdParam string, groupParam nsx_policyModel.Group) (nsx_policyModel.Group, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := groupsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(groupsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("GroupId", groupIdParam) + sv.AddStructField("Group", groupParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Group + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.groups", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Group + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GroupsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Group), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsTypes.go new file mode 100644 index 000000000..ffd109e89 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/GroupsTypes.go @@ -0,0 +1,431 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Groups. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func groupsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["fail_if_subtree_exists"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["fail_if_subtree_exists"] = "FailIfSubtreeExists" + fieldNameMap["force"] = "Force" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func groupsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["fail_if_subtree_exists"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["fail_if_subtree_exists"] = "FailIfSubtreeExists" + fieldNameMap["force"] = "Force" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["fail_if_subtree_exists"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["force"] = "force" + queryParams["fail_if_subtree_exists"] = "fail_if_subtree_exists" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/groups/{groupId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func groupsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) +} + +func groupsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/groups/{groupId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func groupsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["member_types"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["member_types"] = "MemberTypes" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GroupListResultBindingType) +} + +func groupsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["member_types"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["member_types"] = "MemberTypes" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["member_types"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["member_types"] = "member_types" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/groups", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func groupsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["group"] = "Group" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func groupsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["group"] = "Group" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "group", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/groups/{groupId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func groupsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["group"] = "Group" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GroupsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) +} + +func groupsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["group"] = "Group" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group"] = vapiBindings_.NewReferenceType(nsx_policyModel.GroupBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "group", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/groups/{groupId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesClient.go new file mode 100644 index 000000000..517a6fa24 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesClient.go @@ -0,0 +1,360 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SecurityPolicies +// Used by client-side stubs. + +package domains + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SecurityPoliciesClient interface { + + // Deletes the security policy along with all the rules + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param securityPolicyIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string) error + + // Read security policy for a domain. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param securityPolicyIdParam (required) + // @return com.vmware.nsx_policy.model.SecurityPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string) (nsx_policyModel.SecurityPolicy, error) + + // List all security policies for a domain. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includeRuleCountParam Include the count of rules in policy (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SecurityPolicyListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SecurityPolicyListResult, error) + + // Patch the security policy for a domain. If a security policy for the given security-policy-id is not present, the object will get created and if it is present it will be updated. This is a full replace. Performance Note: If you want to edit several rules in a security policy use this API. It will perform better than several individual rule APIs. Just pass all the rules which you wish to edit as embedded rules to it. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param securityPolicyIdParam (required) + // @param securityPolicyParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy) error + + // This is used to set a precedence of a security policy w.r.t others. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param securityPolicyIdParam (required) + // @param securityPolicyParam (required) + // @param anchorPathParam The security policy/rule path if operation is 'insert_after' or 'insert_before' (optional) + // @param operationParam Operation (optional, default to insert_top) + // @return com.vmware.nsx_policy.model.SecurityPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Revise(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy, anchorPathParam *string, operationParam *string) (nsx_policyModel.SecurityPolicy, error) + + // Create or Update the security policy for a domain. This is a full replace. All the rules are replaced. Performance Note: If you want to edit several rules in a security policy, use this API. It will perform better than several individual rule APIs. Just pass all the rules which you wish to edit as embedded rules to it. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param domainIdParam (required) + // @param securityPolicyIdParam (required) + // @param securityPolicyParam (required) + // @return com.vmware.nsx_policy.model.SecurityPolicy + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy) (nsx_policyModel.SecurityPolicy, error) +} + +type securityPoliciesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSecurityPoliciesClient(connector vapiProtocolClient_.Connector) *securityPoliciesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "revise": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "revise"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := securityPoliciesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *securityPoliciesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *securityPoliciesClient) Delete(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("SecurityPolicyId", securityPolicyIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *securityPoliciesClient) Get(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string) (nsx_policyModel.SecurityPolicy, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("SecurityPolicyId", securityPolicyIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityPoliciesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *securityPoliciesClient) List(orgIdParam string, projectIdParam string, domainIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includeRuleCountParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SecurityPolicyListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludeRuleCount", includeRuleCountParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityPolicyListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityPolicyListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityPoliciesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityPolicyListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *securityPoliciesClient) Patch(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("SecurityPolicyId", securityPolicyIdParam) + sv.AddStructField("SecurityPolicy", securityPolicyParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *securityPoliciesClient) Revise(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy, anchorPathParam *string, operationParam *string) (nsx_policyModel.SecurityPolicy, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesReviseRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesReviseInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("SecurityPolicyId", securityPolicyIdParam) + sv.AddStructField("SecurityPolicy", securityPolicyParam) + sv.AddStructField("AnchorPath", anchorPathParam) + sv.AddStructField("Operation", operationParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "revise", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityPoliciesReviseOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *securityPoliciesClient) Update(orgIdParam string, projectIdParam string, domainIdParam string, securityPolicyIdParam string, securityPolicyParam nsx_policyModel.SecurityPolicy) (nsx_policyModel.SecurityPolicy, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityPoliciesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityPoliciesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("DomainId", domainIdParam) + sv.AddStructField("SecurityPolicyId", securityPolicyIdParam) + sv.AddStructField("SecurityPolicy", securityPolicyParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityPolicy + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.domains.security_policies", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityPolicy + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityPoliciesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityPolicy), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesTypes.go new file mode 100644 index 000000000..bc49bdb53 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains/SecurityPoliciesTypes.go @@ -0,0 +1,519 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SecurityPolicies. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package domains + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``operation`` of method SecurityPolicies#revise. +const SecurityPolicies_REVISE_OPERATION_TOP = "insert_top" + +// Possible value for ``operation`` of method SecurityPolicies#revise. +const SecurityPolicies_REVISE_OPERATION_BOTTOM = "insert_bottom" + +// Possible value for ``operation`` of method SecurityPolicies#revise. +const SecurityPolicies_REVISE_OPERATION_AFTER = "insert_after" + +// Possible value for ``operation`` of method SecurityPolicies#revise. +const SecurityPolicies_REVISE_OPERATION_BEFORE = "insert_before" + +func securityPoliciesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func securityPoliciesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["securityPolicyId"] = vapiBindings_.NewStringType() + pathParams["security_policy_id"] = "securityPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies/{securityPolicyId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityPoliciesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) +} + +func securityPoliciesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["securityPolicyId"] = vapiBindings_.NewStringType() + pathParams["security_policy_id"] = "securityPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies/{securityPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityPoliciesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["include_rule_count"] = "IncludeRuleCount" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyListResultBindingType) +} + +func securityPoliciesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["include_rule_count"] = "IncludeRuleCount" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_rule_count"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["cursor"] = "cursor" + queryParams["include_rule_count"] = "include_rule_count" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityPoliciesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func securityPoliciesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["securityPolicyId"] = vapiBindings_.NewStringType() + pathParams["security_policy_id"] = "securityPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "security_policy", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies/{securityPolicyId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityPoliciesReviseInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fields["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + fieldNameMap["anchor_path"] = "AnchorPath" + fieldNameMap["operation"] = "Operation" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesReviseOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) +} + +func securityPoliciesReviseRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fields["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + fieldNameMap["anchor_path"] = "AnchorPath" + fieldNameMap["operation"] = "Operation" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["anchor_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["operation"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["securityPolicyId"] = vapiBindings_.NewStringType() + pathParams["security_policy_id"] = "securityPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + queryParams["anchor_path"] = "anchor_path" + queryParams["operation"] = "operation" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=revise", + "security_policy", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies/{securityPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityPoliciesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityPoliciesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) +} + +func securityPoliciesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["domain_id"] = vapiBindings_.NewStringType() + fields["security_policy_id"] = vapiBindings_.NewStringType() + fields["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["domain_id"] = "DomainId" + fieldNameMap["security_policy_id"] = "SecurityPolicyId" + fieldNameMap["security_policy"] = "SecurityPolicy" + paramsTypeMap["domain_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityPolicyBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_policy_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["domainId"] = vapiBindings_.NewStringType() + paramsTypeMap["securityPolicyId"] = vapiBindings_.NewStringType() + pathParams["security_policy_id"] = "securityPolicyId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["domain_id"] = "domainId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "security_policy", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/domains/{domainId}/security-policies/{securityPolicyId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsClient.go new file mode 100644 index 000000000..f4bb65dc8 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsClient.go @@ -0,0 +1,301 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpAllocations +// Used by client-side stubs. + +package ip_pools + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpAllocationsClient interface { + + // Releases the IP that was allocated for this allocation request + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAllocationIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string) error + + // Read a previously created allocation + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAllocationIdParam (required) + // @return com.vmware.nsx_policy.model.IpAddressAllocation + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string) (nsx_policyModel.IpAddressAllocation, error) + + // Returns information about which addresses have been allocated from a specified IP address pool in policy. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.IpAddressAllocationListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressAllocationListResult, error) + + // If allocation of the same ID is found, this is a no-op. If no allocation of the specified ID is found, then a new allocation is created. An allocation cannot be updated once created. When an allocation is requested from an IpAddressPool, the IP could be allocated from any subnet in the pool that has the available capacity. Request to allocate an IP will fail if no subnet was previously created. If specific IP was requested, the status of allocation is reflected in the realized state. If any IP is requested, the IP finally allocated is obtained by polling on the realized state until the allocated IP is returned in the extended attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAllocationIdParam (required) + // @param ipAddressAllocationParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam nsx_policyModel.IpAddressAllocation) error + + // If allocation of the same ID is found, this is a no-op. If no allocation of the specified ID is found, then a new allocation is created. An allocation cannot be updated once created. When an IP allocation is requested from an IpAddressPool, the IP could be allocated from any subnet in the pool that has the available capacity. Request to allocate an IP will fail if no subnet was previously created. If specific IP was requested, the status of allocation is reflected in the realized state. If any IP is requested, the IP finally allocated is obtained by polling on the realized state until the allocated IP is returned in the extended attributes. An allocation cannot be updated once created. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipAllocationIdParam (required) + // @param ipAddressAllocationParam (required) + // @return com.vmware.nsx_policy.model.IpAddressAllocation + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam nsx_policyModel.IpAddressAllocation) (nsx_policyModel.IpAddressAllocation, error) +} + +type ipAllocationsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpAllocationsClient(connector vapiProtocolClient_.Connector) *ipAllocationsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipAllocationsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipAllocationsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipAllocationsClient) Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAllocationsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAllocationsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAllocationId", ipAllocationIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipAllocationsClient) Get(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string) (nsx_policyModel.IpAddressAllocation, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAllocationsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAllocationsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAllocationId", ipAllocationIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressAllocation + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressAllocation + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpAllocationsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressAllocation), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipAllocationsClient) List(orgIdParam string, projectIdParam string, ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressAllocationListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAllocationsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAllocationsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressAllocationListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressAllocationListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpAllocationsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressAllocationListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipAllocationsClient) Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam nsx_policyModel.IpAddressAllocation) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAllocationsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAllocationsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAllocationId", ipAllocationIdParam) + sv.AddStructField("IpAddressAllocation", ipAddressAllocationParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipAllocationsClient) Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipAllocationIdParam string, ipAddressAllocationParam nsx_policyModel.IpAddressAllocation) (nsx_policyModel.IpAddressAllocation, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipAllocationsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipAllocationsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpAllocationId", ipAllocationIdParam) + sv.AddStructField("IpAddressAllocation", ipAddressAllocationParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressAllocation + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_allocations", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressAllocation + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpAllocationsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressAllocation), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsTypes.go new file mode 100644 index 000000000..b675e18ab --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpAllocationsTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpAllocations. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package ip_pools + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipAllocationsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAllocationsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipAllocationsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + paramsTypeMap["ip_allocation_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipAllocationId"] = vapiBindings_.NewStringType() + pathParams["ip_allocation_id"] = "ipAllocationId" + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-allocations/{ipAllocationId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipAllocationsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAllocationsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) +} + +func ipAllocationsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + paramsTypeMap["ip_allocation_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipAllocationId"] = vapiBindings_.NewStringType() + pathParams["ip_allocation_id"] = "ipAllocationId" + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-allocations/{ipAllocationId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipAllocationsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAllocationsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationListResultBindingType) +} + +func ipAllocationsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-allocations", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipAllocationsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fields["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + fieldNameMap["ip_address_allocation"] = "IpAddressAllocation" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAllocationsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipAllocationsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fields["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + fieldNameMap["ip_address_allocation"] = "IpAddressAllocation" + paramsTypeMap["ip_allocation_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipAllocationId"] = vapiBindings_.NewStringType() + pathParams["ip_allocation_id"] = "ipAllocationId" + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_allocation", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-allocations/{ipAllocationId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipAllocationsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fields["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + fieldNameMap["ip_address_allocation"] = "IpAddressAllocation" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpAllocationsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) +} + +func ipAllocationsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_allocation_id"] = vapiBindings_.NewStringType() + fields["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_allocation_id"] = "IpAllocationId" + fieldNameMap["ip_address_allocation"] = "IpAddressAllocation" + paramsTypeMap["ip_allocation_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_allocation"] = vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressAllocationBindingType) + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipAllocationId"] = vapiBindings_.NewStringType() + pathParams["ip_allocation_id"] = "ipAllocationId" + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_allocation", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-allocations/{ipAllocationId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpPoolsPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpPoolsPackageTypes.go new file mode 100644 index 000000000..7aa7a6f04 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpPoolsPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.ip_pools. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package ip_pools diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsClient.go new file mode 100644 index 000000000..3021fea62 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsClient.go @@ -0,0 +1,306 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: IpSubnets +// Used by client-side stubs. + +package ip_pools + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type IpSubnetsClient interface { + + // Delete the IpAddressPoolSubnet with the given id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipSubnetIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string) error + + // Read IpAddressPoolSubnet with given Id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipSubnetIdParam (required) + // @return com.vmware.nsx_policy.model.IpAddressPoolSubnet + // The return value will contain all the properties defined in nsx_policyModel.IpAddressPoolSubnet. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string) (*vapiData_.StructValue, error) + + // Paginated list of IpAddressPoolSubnets. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.IpAddressPoolSubnetListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressPoolSubnetListResult, error) + + // Creates a new IpAddressPoolSubnet with the specified ID if it does not already exist. If a IpAddressPoolSubnet of the given ID already exists, IpAddressPoolSubnet will be updated. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipSubnetIdParam (required) + // @param ipAddressPoolSubnetParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.IpAddressPoolSubnet. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *vapiData_.StructValue) error + + // Creates a new IpAddressPoolSubnet with the specified ID if it does not already exist. If a IpAddressPoolSubnet of the given ID already exists, IpAddressPoolSubnet will be updated. This is a full replace. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param ipPoolIdParam (required) + // @param ipSubnetIdParam (required) + // @param ipAddressPoolSubnetParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.IpAddressPoolSubnet. + // @return com.vmware.nsx_policy.model.IpAddressPoolSubnet + // The return value will contain all the properties defined in nsx_policyModel.IpAddressPoolSubnet. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *vapiData_.StructValue) (*vapiData_.StructValue, error) +} + +type ipSubnetsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewIpSubnetsClient(connector vapiProtocolClient_.Connector) *ipSubnetsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := ipSubnetsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *ipSubnetsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *ipSubnetsClient) Delete(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipSubnetsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipSubnetsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpSubnetId", ipSubnetIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipSubnetsClient) Get(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string) (*vapiData_.StructValue, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipSubnetsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipSubnetsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpSubnetId", ipSubnetIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets", "get", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpSubnetsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipSubnetsClient) List(orgIdParam string, projectIdParam string, ipPoolIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.IpAddressPoolSubnetListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipSubnetsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipSubnetsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.IpAddressPoolSubnetListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.IpAddressPoolSubnetListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpSubnetsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.IpAddressPoolSubnetListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *ipSubnetsClient) Patch(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *vapiData_.StructValue) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipSubnetsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipSubnetsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpSubnetId", ipSubnetIdParam) + sv.AddStructField("IpAddressPoolSubnet", ipAddressPoolSubnetParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *ipSubnetsClient) Update(orgIdParam string, projectIdParam string, ipPoolIdParam string, ipSubnetIdParam string, ipAddressPoolSubnetParam *vapiData_.StructValue) (*vapiData_.StructValue, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := ipSubnetsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(ipSubnetsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IpPoolId", ipPoolIdParam) + sv.AddStructField("IpSubnetId", ipSubnetIdParam) + sv.AddStructField("IpAddressPoolSubnet", ipAddressPoolSubnetParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.ip_pools.ip_subnets", "update", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), IpSubnetsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsTypes.go new file mode 100644 index 000000000..dda9f85ef --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools/IpSubnetsTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: IpSubnets. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package ip_pools + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func ipSubnetsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpSubnetsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipSubnetsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_subnet_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipSubnetId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["ip_subnet_id"] = "ipSubnetId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-subnets/{ipSubnetId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipSubnetsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpSubnetsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) +} + +func ipSubnetsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_subnet_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipSubnetId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["ip_subnet_id"] = "ipSubnetId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-subnets/{ipSubnetId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipSubnetsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpSubnetsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetListResultBindingType) +} + +func ipSubnetsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-subnets", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipSubnetsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + fieldNameMap["ip_address_pool_subnet"] = "IpAddressPoolSubnet" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpSubnetsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func ipSubnetsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + fieldNameMap["ip_address_pool_subnet"] = "IpAddressPoolSubnet" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_subnet_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipSubnetId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["ip_subnet_id"] = "ipSubnetId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_pool_subnet", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-subnets/{ipSubnetId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func ipSubnetsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + fieldNameMap["ip_address_pool_subnet"] = "IpAddressPoolSubnet" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func IpSubnetsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) +} + +func ipSubnetsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["ip_pool_id"] = vapiBindings_.NewStringType() + fields["ip_subnet_id"] = vapiBindings_.NewStringType() + fields["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["ip_pool_id"] = "IpPoolId" + fieldNameMap["ip_subnet_id"] = "IpSubnetId" + fieldNameMap["ip_address_pool_subnet"] = "IpAddressPoolSubnet" + paramsTypeMap["ip_pool_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_subnet_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["ip_address_pool_subnet"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.IpAddressPoolSubnetBindingType)}) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipPoolId"] = vapiBindings_.NewStringType() + paramsTypeMap["ipSubnetId"] = vapiBindings_.NewStringType() + pathParams["ip_pool_id"] = "ipPoolId" + pathParams["ip_subnet_id"] = "ipSubnetId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "ip_address_pool_subnet", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/ip-pools/{ipPoolId}/ip-subnets/{ipSubnetId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesClient.go new file mode 100644 index 000000000..aff090ee4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesClient.go @@ -0,0 +1,97 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: RealizedEntities +// Used by client-side stubs. + +package realized_state + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type RealizedEntitiesClient interface { + + // Get list of realized entities associated with intent object, specified by path in query parameter + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param intentPathParam String Path of the intent object (required) + // @param sitePathParam Policy Path of the site (optional) + // @return com.vmware.nsx_policy.model.GenericPolicyRealizedResourceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, intentPathParam string, sitePathParam *string) (nsx_policyModel.GenericPolicyRealizedResourceListResult, error) +} + +type realizedEntitiesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewRealizedEntitiesClient(connector vapiProtocolClient_.Connector) *realizedEntitiesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.realized_state.realized_entities") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + rIface := realizedEntitiesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &rIface +} + +func (rIface *realizedEntitiesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := rIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (rIface *realizedEntitiesClient) List(orgIdParam string, projectIdParam string, intentPathParam string, sitePathParam *string) (nsx_policyModel.GenericPolicyRealizedResourceListResult, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := realizedEntitiesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(realizedEntitiesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IntentPath", intentPathParam) + sv.AddStructField("SitePath", sitePathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GenericPolicyRealizedResourceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.realized_state.realized_entities", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GenericPolicyRealizedResourceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RealizedEntitiesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GenericPolicyRealizedResourceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesTypes.go new file mode 100644 index 000000000..7f7aeb488 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntitiesTypes.go @@ -0,0 +1,88 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: RealizedEntities. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package realized_state + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func realizedEntitiesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["site_path"] = "SitePath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RealizedEntitiesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GenericPolicyRealizedResourceListResultBindingType) +} + +func realizedEntitiesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["site_path"] = "SitePath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["intent_path"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["site_path"] = "site_path" + queryParams["intent_path"] = "intent_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/realized-state/realized-entities", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityClient.go new file mode 100644 index 000000000..6d8cf6d28 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityClient.go @@ -0,0 +1,89 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: RealizedEntity +// Used by client-side stubs. + +package realized_state + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type RealizedEntityClient interface { + + // Refresh the status and statistics of all realized entities associated with given intent path synchronously. The vmw-async: True HTTP header cannot be used with this API. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param intentPathParam String Path of the intent object (required) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Refresh(orgIdParam string, projectIdParam string, intentPathParam string, enforcementPointPathParam *string) error +} + +type realizedEntityClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewRealizedEntityClient(connector vapiProtocolClient_.Connector) *realizedEntityClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.realized_state.realized_entity") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "refresh": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "refresh"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + rIface := realizedEntityClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &rIface +} + +func (rIface *realizedEntityClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := rIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (rIface *realizedEntityClient) Refresh(orgIdParam string, projectIdParam string, intentPathParam string, enforcementPointPathParam *string) error { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := realizedEntityRefreshRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(realizedEntityRefreshInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IntentPath", intentPathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.realized_state.realized_entity", "refresh", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityTypes.go new file mode 100644 index 000000000..830a3514a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedEntityTypes.go @@ -0,0 +1,87 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: RealizedEntity. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package realized_state + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + "reflect" +) + +func realizedEntityRefreshInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RealizedEntityRefreshOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func realizedEntityRefreshRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["intent_path"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["intent_path"] = "intent_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=refresh", + "", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/realized-state/realized-entity", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedStatePackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedStatePackageTypes.go new file mode 100644 index 000000000..dcd8d8621 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/RealizedStatePackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.realized_state. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package realized_state diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusClient.go new file mode 100644 index 000000000..889bfe4d4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusClient.go @@ -0,0 +1,99 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Status +// Used by client-side stubs. + +package realized_state + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StatusClient interface { + + // Get Consolidated Status of an intent object (with or without enforcement specific status details). The request is evaluated as follows: - : the request is evaluated on all enforcement points for the given intent without enforcement point specific details. - : the request is evaluated on all enforcement points for the given intent with enforcement point specific details. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param intentPathParam Policy Path of the intent object (required) + // @param includeEnforcedStatusParam Include Enforced Status Flag (optional, default to false) + // @param sitePathParam Policy Path of the site from where the realization status needs to be fetched (optional) + // @return com.vmware.nsx_policy.model.ConsolidatedRealizedStatus + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, intentPathParam string, includeEnforcedStatusParam *bool, sitePathParam *string) (nsx_policyModel.ConsolidatedRealizedStatus, error) +} + +type statusClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStatusClient(connector vapiProtocolClient_.Connector) *statusClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.realized_state.status") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := statusClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *statusClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *statusClient) Get(orgIdParam string, projectIdParam string, intentPathParam string, includeEnforcedStatusParam *bool, sitePathParam *string) (nsx_policyModel.ConsolidatedRealizedStatus, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := statusGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(statusGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("IntentPath", intentPathParam) + sv.AddStructField("IncludeEnforcedStatus", includeEnforcedStatusParam) + sv.AddStructField("SitePath", sitePathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ConsolidatedRealizedStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.realized_state.status", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ConsolidatedRealizedStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StatusGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ConsolidatedRealizedStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusTypes.go new file mode 100644 index 000000000..8588912fa --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/StatusTypes.go @@ -0,0 +1,94 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Status. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package realized_state + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func statusGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["include_enforced_status"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["include_enforced_status"] = "IncludeEnforcedStatus" + fieldNameMap["site_path"] = "SitePath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StatusGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ConsolidatedRealizedStatusBindingType) +} + +func statusGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["intent_path"] = vapiBindings_.NewStringType() + fields["include_enforced_status"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["intent_path"] = "IntentPath" + fieldNameMap["include_enforced_status"] = "IncludeEnforcedStatus" + fieldNameMap["site_path"] = "SitePath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["site_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["intent_path"] = vapiBindings_.NewStringType() + paramsTypeMap["include_enforced_status"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["site_path"] = "site_path" + queryParams["intent_path"] = "intent_path" + queryParams["include_enforced_status"] = "include_enforced_status" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/realized-state/status", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesClient.go new file mode 100644 index 000000000..a072c8b07 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesClient.go @@ -0,0 +1,107 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: VirtualMachines +// Used by client-side stubs. + +package realized_state + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type VirtualMachinesClient interface { + + // This API filters objects of type virtual machine. This API also gives some VM details such as VM name, IDs and the current state of the VMs. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.VirtualMachineListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.VirtualMachineListResult, error) +} + +type virtualMachinesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewVirtualMachinesClient(connector vapiProtocolClient_.Connector) *virtualMachinesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.realized_state.virtual_machines") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + vIface := virtualMachinesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &vIface +} + +func (vIface *virtualMachinesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := vIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (vIface *virtualMachinesClient) List(orgIdParam string, projectIdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.VirtualMachineListResult, error) { + typeConverter := vIface.connector.TypeConverter() + executionContext := vIface.connector.NewExecutionContext() + operationRestMetaData := virtualMachinesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(virtualMachinesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.VirtualMachineListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := vIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.realized_state.virtual_machines", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.VirtualMachineListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), VirtualMachinesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.VirtualMachineListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), vIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesTypes.go new file mode 100644 index 000000000..03c085d4e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state/VirtualMachinesTypes.go @@ -0,0 +1,118 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: VirtualMachines. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package realized_state + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func virtualMachinesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func VirtualMachinesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.VirtualMachineListResultBindingType) +} + +func virtualMachinesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/realized-state/virtual-machines", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyClient.go new file mode 100644 index 000000000..3411f6ffd --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ArpProxy +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ArpProxyClient interface { + + // Returns ARP proxy table for downlink port on connected to the segment + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Data source type. (optional) + // @param transportNodeIdParam TransportNode Id (optional) + // @return com.vmware.nsx_policy.model.PolicyArpProxyTableListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) +} + +type arpProxyClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewArpProxyClient(connector vapiProtocolClient_.Connector) *arpProxyClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.arp_proxy") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := arpProxyClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *arpProxyClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *arpProxyClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := arpProxyListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(arpProxyListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("TransportNodeId", transportNodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.arp_proxy", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ArpProxyListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyArpProxyTableListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyTypes.go new file mode 100644 index 000000000..f30426f37 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpProxyTypes.go @@ -0,0 +1,137 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ArpProxy. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method ArpProxy#list. +const ArpProxy_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method ArpProxy#list. +const ArpProxy_LIST_SOURCE_CACHED = "cached" + +func arpProxyListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ArpProxyListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyArpProxyTableListResultBindingType) +} + +func arpProxyListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["transport_node_id"] = "transport_node_id" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/arp-proxy", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableClient.go new file mode 100644 index 000000000..843665d28 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ArpTable +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ArpTableClient interface { + + // Returns ARP table (IPv4) or Neighbor Discovery table (IPv6) for the interface (downlink) attaching segment to tier-0/tier-1 gateway, on a edge node specified in edge_path parameter. The edge_path parameter is mandatory. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam Enforcement point path (optional) + // @param hostTransportNodePathParam Policy path of host transport node (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.InterfaceArpTable + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.InterfaceArpTable, error) +} + +type arpTableClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewArpTableClient(connector vapiProtocolClient_.Connector) *arpTableClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.arp_table") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := arpTableClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *arpTableClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *arpTableClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.InterfaceArpTable, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := arpTableListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(arpTableListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("HostTransportNodePath", hostTransportNodePathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.InterfaceArpTable + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.arp_table", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.InterfaceArpTable + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ArpTableListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.InterfaceArpTable), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableTypes.go new file mode 100644 index 000000000..f66e5481d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/ArpTableTypes.go @@ -0,0 +1,131 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ArpTable. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func arpTableListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ArpTableListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.InterfaceArpTableBindingType) +} + +func arpTableListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["host_transport_node_path"] = "host_transport_node_path" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/arp-table", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsClient.go new file mode 100644 index 000000000..eb130f16e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsClient.go @@ -0,0 +1,306 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DhcpStaticBindingConfigs +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DhcpStaticBindingConfigsClient interface { + + // Delete DHCP static binding + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param bindingIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string) error + + // Read DHCP static binding + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param bindingIdParam (required) + // @return com.vmware.nsx_policy.model.DhcpStaticBindingConfig + // The return value will contain all the properties defined in nsx_policyModel.DhcpStaticBindingConfig. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string) (*vapiData_.StructValue, error) + + // Paginated list of all DHCP static binding instances + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.DhcpStaticBindingConfigListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpStaticBindingConfigListResult, error) + + // If binding with the binding-id is not already present, create a new DHCP static binding instance. If it already exists, replace the existing DHCP static binding instance with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param bindingIdParam (required) + // @param dhcpStaticBindingConfigParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.DhcpStaticBindingConfig. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *vapiData_.StructValue) error + + // If binding with the binding-id is not already present, create a new DHCP static binding instance. If it already exists, replace the existing DHCP static binding instance with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param bindingIdParam (required) + // @param dhcpStaticBindingConfigParam (required) + // The parameter must contain all the properties defined in nsx_policyModel.DhcpStaticBindingConfig. + // @return com.vmware.nsx_policy.model.DhcpStaticBindingConfig + // The return value will contain all the properties defined in nsx_policyModel.DhcpStaticBindingConfig. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *vapiData_.StructValue) (*vapiData_.StructValue, error) +} + +type dhcpStaticBindingConfigsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDhcpStaticBindingConfigsClient(connector vapiProtocolClient_.Connector) *dhcpStaticBindingConfigsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dhcpStaticBindingConfigsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dhcpStaticBindingConfigsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dhcpStaticBindingConfigsClient) Delete(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpStaticBindingConfigsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpStaticBindingConfigsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("BindingId", bindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpStaticBindingConfigsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string) (*vapiData_.StructValue, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpStaticBindingConfigsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpStaticBindingConfigsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("BindingId", bindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs", "get", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpStaticBindingConfigsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpStaticBindingConfigsClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.DhcpStaticBindingConfigListResult, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpStaticBindingConfigsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpStaticBindingConfigsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.DhcpStaticBindingConfigListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.DhcpStaticBindingConfigListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpStaticBindingConfigsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.DhcpStaticBindingConfigListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dhcpStaticBindingConfigsClient) Patch(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *vapiData_.StructValue) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpStaticBindingConfigsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpStaticBindingConfigsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("BindingId", bindingIdParam) + sv.AddStructField("DhcpStaticBindingConfig", dhcpStaticBindingConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dhcpStaticBindingConfigsClient) Update(orgIdParam string, projectIdParam string, segmentIdParam string, bindingIdParam string, dhcpStaticBindingConfigParam *vapiData_.StructValue) (*vapiData_.StructValue, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dhcpStaticBindingConfigsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dhcpStaticBindingConfigsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("BindingId", bindingIdParam) + sv.AddStructField("DhcpStaticBindingConfig", dhcpStaticBindingConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput *vapiData_.StructValue + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.dhcp_static_binding_configs", "update", inputDataValue, executionContext) + var emptyOutput *vapiData_.StructValue + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DhcpStaticBindingConfigsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(*vapiData_.StructValue), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsTypes.go new file mode 100644 index 000000000..982edbb8c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/DhcpStaticBindingConfigsTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DhcpStaticBindingConfigs. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func dhcpStaticBindingConfigsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpStaticBindingConfigsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpStaticBindingConfigsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["bindingId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["binding_id"] = "bindingId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/dhcp-static-binding-configs/{bindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpStaticBindingConfigsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpStaticBindingConfigsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) +} + +func dhcpStaticBindingConfigsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["bindingId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["binding_id"] = "bindingId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/dhcp-static-binding-configs/{bindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpStaticBindingConfigsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpStaticBindingConfigsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigListResultBindingType) +} + +func dhcpStaticBindingConfigsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/dhcp-static-binding-configs", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpStaticBindingConfigsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fields["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + fieldNameMap["dhcp_static_binding_config"] = "DhcpStaticBindingConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpStaticBindingConfigsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dhcpStaticBindingConfigsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fields["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + fieldNameMap["dhcp_static_binding_config"] = "DhcpStaticBindingConfig" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["bindingId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["binding_id"] = "bindingId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_static_binding_config", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/dhcp-static-binding-configs/{bindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dhcpStaticBindingConfigsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fields["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + fieldNameMap["dhcp_static_binding_config"] = "DhcpStaticBindingConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DhcpStaticBindingConfigsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) +} + +func dhcpStaticBindingConfigsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["binding_id"] = vapiBindings_.NewStringType() + fields["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["binding_id"] = "BindingId" + fieldNameMap["dhcp_static_binding_config"] = "DhcpStaticBindingConfig" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["dhcp_static_binding_config"] = vapiBindings_.NewDynamicStructType([]vapiBindings_.ReferenceType{vapiBindings_.NewReferenceType(nsx_policyModel.DhcpStaticBindingConfigBindingType)}) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["bindingId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["binding_id"] = "bindingId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "dhcp_static_binding_config", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/dhcp-static-binding-configs/{bindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesClient.go new file mode 100644 index 000000000..469d0ff62 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesClient.go @@ -0,0 +1,97 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: EffectiveProfiles +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type EffectiveProfilesClient interface { + + // List all effective profiles for this segment on given enforcement point. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param enforcementPointPathParam Enforcement point path (optional) + // @return com.vmware.nsx_policy.model.EffectiveProfilesResponse + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, enforcementPointPathParam *string) (nsx_policyModel.EffectiveProfilesResponse, error) +} + +type effectiveProfilesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewEffectiveProfilesClient(connector vapiProtocolClient_.Connector) *effectiveProfilesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.effective_profiles") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + eIface := effectiveProfilesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &eIface +} + +func (eIface *effectiveProfilesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := eIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (eIface *effectiveProfilesClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, enforcementPointPathParam *string) (nsx_policyModel.EffectiveProfilesResponse, error) { + typeConverter := eIface.connector.TypeConverter() + executionContext := eIface.connector.NewExecutionContext() + operationRestMetaData := effectiveProfilesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(effectiveProfilesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.EffectiveProfilesResponse + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := eIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.effective_profiles", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.EffectiveProfilesResponse + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), EffectiveProfilesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.EffectiveProfilesResponse), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), eIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesTypes.go new file mode 100644 index 000000000..01525caf8 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/EffectiveProfilesTypes.go @@ -0,0 +1,89 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: EffectiveProfiles. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func effectiveProfilesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func EffectiveProfilesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.EffectiveProfilesResponseBindingType) +} + +func effectiveProfilesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/effective-profiles", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableClient.go new file mode 100644 index 000000000..e4771a3ae --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableClient.go @@ -0,0 +1,114 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayInterfaceArpTable +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayInterfaceArpTableClient interface { + + // Get ARP table for downlink router port on tier-0 router. + // This API is deprecated because it is duplicate. Please use /infra/segments//arp-table Segment ID is the ID of the segment that is connected to the the tier-0 + // + // Deprecated: This API element is deprecated. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam Enforcement point path (optional) + // @param hostTransportNodePathParam Policy path of host transport node (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.InterfaceArpTable + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.InterfaceArpTable, error) +} + +type gatewayInterfaceArpTableClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayInterfaceArpTableClient(connector vapiProtocolClient_.Connector) *gatewayInterfaceArpTableClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_arp_table") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayInterfaceArpTableClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayInterfaceArpTableClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayInterfaceArpTableClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.InterfaceArpTable, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayInterfaceArpTableListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayInterfaceArpTableListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("HostTransportNodePath", hostTransportNodePathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.InterfaceArpTable + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_arp_table", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.InterfaceArpTable + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayInterfaceArpTableListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.InterfaceArpTable), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableTypes.go new file mode 100644 index 000000000..ad0662539 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceArpTableTypes.go @@ -0,0 +1,131 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayInterfaceArpTable. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func gatewayInterfaceArpTableListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayInterfaceArpTableListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.InterfaceArpTableBindingType) +} + +func gatewayInterfaceArpTableListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["host_transport_node_path"] = "host_transport_node_path" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/gateway-interface-arp-table", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateClient.go new file mode 100644 index 000000000..7b23e8acf --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateClient.go @@ -0,0 +1,99 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayInterfaceDadState +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayInterfaceDadStateClient interface { + + // Segment ID is the ID of the segment that is connected to the the tier-0 + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param sourceParam Data source type. (optional) + // @return com.vmware.nsx_policy.model.InterfaceDADState + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, enforcementPointPathParam *string, sourceParam *string) (nsx_policyModel.InterfaceDADState, error) +} + +type gatewayInterfaceDadStateClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayInterfaceDadStateClient(connector vapiProtocolClient_.Connector) *gatewayInterfaceDadStateClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_dad_state") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayInterfaceDadStateClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayInterfaceDadStateClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayInterfaceDadStateClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, enforcementPointPathParam *string, sourceParam *string) (nsx_policyModel.InterfaceDADState, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayInterfaceDadStateGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayInterfaceDadStateGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("Source", sourceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.InterfaceDADState + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_dad_state", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.InterfaceDADState + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayInterfaceDadStateGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.InterfaceDADState), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateTypes.go new file mode 100644 index 000000000..201d90dd5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceDadStateTypes.go @@ -0,0 +1,101 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayInterfaceDadState. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method GatewayInterfaceDadState#get. +const GatewayInterfaceDadState_GET_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method GatewayInterfaceDadState#get. +const GatewayInterfaceDadState_GET_SOURCE_CACHED = "cached" + +func gatewayInterfaceDadStateGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["source"] = "Source" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayInterfaceDadStateGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.InterfaceDADStateBindingType) +} + +func gatewayInterfaceDadStateGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["source"] = "Source" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["source"] = "source" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/gateway-interface-dad-state", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsClient.go new file mode 100644 index 000000000..6a6b68cc5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayInterfaceStatistics +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayInterfaceStatisticsClient interface { + + // Segment ID is the ID of the segment that is connected to the the tier-0 + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam Enforcement point path (optional) + // @param hostTransportNodePathParam Policy path of host transport node (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyInterfaceStatistics + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyInterfaceStatistics, error) +} + +type gatewayInterfaceStatisticsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayInterfaceStatisticsClient(connector vapiProtocolClient_.Connector) *gatewayInterfaceStatisticsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_statistics") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayInterfaceStatisticsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayInterfaceStatisticsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayInterfaceStatisticsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, hostTransportNodePathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyInterfaceStatistics, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayInterfaceStatisticsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayInterfaceStatisticsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("HostTransportNodePath", hostTransportNodePathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyInterfaceStatistics + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.gateway_interface_statistics", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyInterfaceStatistics + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayInterfaceStatisticsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyInterfaceStatistics), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsTypes.go new file mode 100644 index 000000000..92a53ab7f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/GatewayInterfaceStatisticsTypes.go @@ -0,0 +1,131 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayInterfaceStatistics. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func gatewayInterfaceStatisticsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayInterfaceStatisticsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyInterfaceStatisticsBindingType) +} + +func gatewayInterfaceStatisticsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["host_transport_node_path"] = "HostTransportNodePath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["host_transport_node_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["host_transport_node_path"] = "host_transport_node_path" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/gateway-interface-statistics", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableClient.go new file mode 100644 index 000000000..7ab92f726 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: MacTable +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type MacTableClient interface { + + // Returns MAC table for a segment + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Data source type. (optional) + // @param transportNodeIdParam TransportNode Id (optional) + // @return com.vmware.nsx_policy.model.SegmentMacAddressListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.SegmentMacAddressListResult, error) +} + +type macTableClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewMacTableClient(connector vapiProtocolClient_.Connector) *macTableClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.mac_table") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + mIface := macTableClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &mIface +} + +func (mIface *macTableClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := mIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (mIface *macTableClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.SegmentMacAddressListResult, error) { + typeConverter := mIface.connector.TypeConverter() + executionContext := mIface.connector.NewExecutionContext() + operationRestMetaData := macTableListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(macTableListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("TransportNodeId", transportNodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentMacAddressListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := mIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.mac_table", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentMacAddressListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), MacTableListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentMacAddressListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), mIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableTypes.go new file mode 100644 index 000000000..d6e1ba979 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/MacTableTypes.go @@ -0,0 +1,137 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: MacTable. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method MacTable#list. +const MacTable_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method MacTable#list. +const MacTable_LIST_SOURCE_CACHED = "cached" + +func macTableListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func MacTableListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentMacAddressListResultBindingType) +} + +func macTableListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["transport_node_id"] = "transport_node_id" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/mac-table", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsClient.go new file mode 100644 index 000000000..d5cbc97e4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsClient.go @@ -0,0 +1,301 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Ports +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type PortsClient interface { + + // Delete an infra segment port by giving ID. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param portIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string) error + + // Get detail information on an infra segment port by giving ID. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param portIdParam (required) + // @return com.vmware.nsx_policy.model.SegmentPort + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string) (nsx_policyModel.SegmentPort, error) + + // List all the ports for an infra. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentPortListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentPortListResult, error) + + // Create an infra segment port if it does not exist based on the IDs, or update existing port information by replacing the port object fields which presents in the request body. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param portIdParam (required) + // @param segmentPortParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string, segmentPortParam nsx_policyModel.SegmentPort) error + + // Create an infra segment port if it does not exist based on the IDs, or update existing port information by replacing the port object already exists. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param portIdParam (required) + // @param segmentPortParam (required) + // @return com.vmware.nsx_policy.model.SegmentPort + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string, segmentPortParam nsx_policyModel.SegmentPort) (nsx_policyModel.SegmentPort, error) +} + +type portsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewPortsClient(connector vapiProtocolClient_.Connector) *portsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.ports") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + pIface := portsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &pIface +} + +func (pIface *portsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := pIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (pIface *portsClient) Delete(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string) error { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := portsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(portsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("PortId", portIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.ports", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (pIface *portsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string) (nsx_policyModel.SegmentPort, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := portsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(portsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("PortId", portIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentPort + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.ports", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentPort + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), PortsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentPort), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (pIface *portsClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentPortListResult, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := portsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(portsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentPortListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.ports", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentPortListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), PortsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentPortListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (pIface *portsClient) Patch(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string, segmentPortParam nsx_policyModel.SegmentPort) error { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := portsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(portsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("PortId", portIdParam) + sv.AddStructField("SegmentPort", segmentPortParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.ports", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (pIface *portsClient) Update(orgIdParam string, projectIdParam string, segmentIdParam string, portIdParam string, segmentPortParam nsx_policyModel.SegmentPort) (nsx_policyModel.SegmentPort, error) { + typeConverter := pIface.connector.TypeConverter() + executionContext := pIface.connector.NewExecutionContext() + operationRestMetaData := portsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(portsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("PortId", portIdParam) + sv.AddStructField("SegmentPort", segmentPortParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentPort + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := pIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.ports", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentPort + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), PortsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentPort), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), pIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsTypes.go new file mode 100644 index 000000000..bd685025d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/PortsTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Ports. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func portsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func PortsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func portsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["port_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["portId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["port_id"] = "portId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/ports/{portId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func portsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func PortsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) +} + +func portsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["port_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["portId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["port_id"] = "portId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/ports/{portId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func portsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func PortsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortListResultBindingType) +} + +func portsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/ports", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func portsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fields["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + fieldNameMap["segment_port"] = "SegmentPort" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func PortsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func portsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fields["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + fieldNameMap["segment_port"] = "SegmentPort" + paramsTypeMap["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["port_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["portId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["port_id"] = "portId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_port", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/ports/{portId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func portsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fields["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + fieldNameMap["segment_port"] = "SegmentPort" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func PortsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) +} + +func portsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["port_id"] = vapiBindings_.NewStringType() + fields["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["port_id"] = "PortId" + fieldNameMap["segment_port"] = "SegmentPort" + paramsTypeMap["segment_port"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentPortBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["port_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["portId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["port_id"] = "portId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_port", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/ports/{portId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsClient.go new file mode 100644 index 000000000..9a6983346 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsClient.go @@ -0,0 +1,301 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SegmentDiscoveryProfileBindingMaps +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentDiscoveryProfileBindingMapsClient interface { + + // API will delete Segment Discovery Profile Binding Profile + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraSegmentIdParam Infra Segment ID (required) + // @param segmentDiscoveryProfileBindingMapIdParam Segment Discovery Profile Binding Map ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) error + + // API will get Infra Segment Discovery Profile Binding Map + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraSegmentIdParam Infra Segment ID (required) + // @param segmentDiscoveryProfileBindingMapIdParam Segment Discovery Profile Binding Map ID (required) + // @return com.vmware.nsx_policy.model.SegmentDiscoveryProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) (nsx_policyModel.SegmentDiscoveryProfileBindingMap, error) + + // API will list all Infra Segment Discovery Profile Binding Maps in current segment id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraSegmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentDiscoveryProfileBindingMapListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, infraSegmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentDiscoveryProfileBindingMapListResult, error) + + // API will create Infra Segment Discovery Profile Binding Map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraSegmentIdParam Infra Segment ID (required) + // @param segmentDiscoveryProfileBindingMapIdParam Segment Discovery Profile Binding Map ID (required) + // @param segmentDiscoveryProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam nsx_policyModel.SegmentDiscoveryProfileBindingMap) error + + // API will update Infra Segment Discovery Profile Binding Map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param infraSegmentIdParam Infra Segment ID (required) + // @param segmentDiscoveryProfileBindingMapIdParam Segment Discovery Profile Binding Map ID (required) + // @param segmentDiscoveryProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.SegmentDiscoveryProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam nsx_policyModel.SegmentDiscoveryProfileBindingMap) (nsx_policyModel.SegmentDiscoveryProfileBindingMap, error) +} + +type segmentDiscoveryProfileBindingMapsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentDiscoveryProfileBindingMapsClient(connector vapiProtocolClient_.Connector) *segmentDiscoveryProfileBindingMapsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentDiscoveryProfileBindingMapsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) Delete(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentDiscoveryProfileBindingMapsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentDiscoveryProfileBindingMapsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("InfraSegmentId", infraSegmentIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMapId", segmentDiscoveryProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) Get(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string) (nsx_policyModel.SegmentDiscoveryProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentDiscoveryProfileBindingMapsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentDiscoveryProfileBindingMapsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("InfraSegmentId", infraSegmentIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMapId", segmentDiscoveryProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentDiscoveryProfileBindingMapsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentDiscoveryProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) List(orgIdParam string, projectIdParam string, infraSegmentIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentDiscoveryProfileBindingMapListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentDiscoveryProfileBindingMapsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentDiscoveryProfileBindingMapsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("InfraSegmentId", infraSegmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMapListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMapListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentDiscoveryProfileBindingMapsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentDiscoveryProfileBindingMapListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) Patch(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam nsx_policyModel.SegmentDiscoveryProfileBindingMap) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentDiscoveryProfileBindingMapsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentDiscoveryProfileBindingMapsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("InfraSegmentId", infraSegmentIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMapId", segmentDiscoveryProfileBindingMapIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMap", segmentDiscoveryProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentDiscoveryProfileBindingMapsClient) Update(orgIdParam string, projectIdParam string, infraSegmentIdParam string, segmentDiscoveryProfileBindingMapIdParam string, segmentDiscoveryProfileBindingMapParam nsx_policyModel.SegmentDiscoveryProfileBindingMap) (nsx_policyModel.SegmentDiscoveryProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentDiscoveryProfileBindingMapsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentDiscoveryProfileBindingMapsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("InfraSegmentId", infraSegmentIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMapId", segmentDiscoveryProfileBindingMapIdParam) + sv.AddStructField("SegmentDiscoveryProfileBindingMap", segmentDiscoveryProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_discovery_profile_binding_maps", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentDiscoveryProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentDiscoveryProfileBindingMapsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentDiscoveryProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsTypes.go new file mode 100644 index 000000000..bf29c43f1 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentDiscoveryProfileBindingMapsTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SegmentDiscoveryProfileBindingMaps. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func segmentDiscoveryProfileBindingMapsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentDiscoveryProfileBindingMapsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentDiscoveryProfileBindingMapsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + paramsTypeMap["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra_segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["infraSegmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentDiscoveryProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_discovery_profile_binding_map_id"] = "segmentDiscoveryProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["infra_segment_id"] = "infraSegmentId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{infraSegmentId}/segment-discovery-profile-binding-maps/{segmentDiscoveryProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentDiscoveryProfileBindingMapsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentDiscoveryProfileBindingMapsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) +} + +func segmentDiscoveryProfileBindingMapsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + paramsTypeMap["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra_segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["infraSegmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentDiscoveryProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_discovery_profile_binding_map_id"] = "segmentDiscoveryProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["infra_segment_id"] = "infraSegmentId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{infraSegmentId}/segment-discovery-profile-binding-maps/{segmentDiscoveryProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentDiscoveryProfileBindingMapsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentDiscoveryProfileBindingMapsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapListResultBindingType) +} + +func segmentDiscoveryProfileBindingMapsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra_segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["infraSegmentId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["infra_segment_id"] = "infraSegmentId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{infraSegmentId}/segment-discovery-profile-binding-maps", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentDiscoveryProfileBindingMapsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + fieldNameMap["segment_discovery_profile_binding_map"] = "SegmentDiscoveryProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentDiscoveryProfileBindingMapsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentDiscoveryProfileBindingMapsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + fieldNameMap["segment_discovery_profile_binding_map"] = "SegmentDiscoveryProfileBindingMap" + paramsTypeMap["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra_segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["infraSegmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentDiscoveryProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_discovery_profile_binding_map_id"] = "segmentDiscoveryProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["infra_segment_id"] = "infraSegmentId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_discovery_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{infraSegmentId}/segment-discovery-profile-binding-maps/{segmentDiscoveryProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentDiscoveryProfileBindingMapsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + fieldNameMap["segment_discovery_profile_binding_map"] = "SegmentDiscoveryProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentDiscoveryProfileBindingMapsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) +} + +func segmentDiscoveryProfileBindingMapsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["infra_segment_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["infra_segment_id"] = "InfraSegmentId" + fieldNameMap["segment_discovery_profile_binding_map_id"] = "SegmentDiscoveryProfileBindingMapId" + fieldNameMap["segment_discovery_profile_binding_map"] = "SegmentDiscoveryProfileBindingMap" + paramsTypeMap["segment_discovery_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["infra_segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_discovery_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentDiscoveryProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["infraSegmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentDiscoveryProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_discovery_profile_binding_map_id"] = "segmentDiscoveryProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["infra_segment_id"] = "infraSegmentId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_discovery_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{infraSegmentId}/segment-discovery-profile-binding-maps/{segmentDiscoveryProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsClient.go new file mode 100644 index 000000000..9fc617879 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsClient.go @@ -0,0 +1,299 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SegmentQosProfileBindingMaps +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentQosProfileBindingMapsClient interface { + + // API will delete Segment QoS Profile Binding Profile. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentQosProfileBindingMapIdParam Segment QoS Profile Binding Map ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string) error + + // API will get Segment QoS Profile Binding Map. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentQosProfileBindingMapIdParam Segment QoS Profile Binding Map ID (required) + // @return com.vmware.nsx_policy.model.SegmentQoSProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string) (nsx_policyModel.SegmentQosProfileBindingMap, error) + + // API will list all Segment QoS Profile Binding Maps in current segment id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentQoSProfileBindingMapListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentQosProfileBindingMapListResult, error) + + // API will create segment QoS profile binding map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentQosProfileBindingMapIdParam Segment QoS Profile Binding Map ID (required) + // @param segmentQosProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam nsx_policyModel.SegmentQosProfileBindingMap) error + + // API will update Segment QoS Profile Binding Map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam Segment ID (required) + // @param segmentQosProfileBindingMapIdParam Segment QoS Profile Binding Map ID (required) + // @param segmentQosProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.SegmentQoSProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam nsx_policyModel.SegmentQosProfileBindingMap) (nsx_policyModel.SegmentQosProfileBindingMap, error) +} + +type segmentQosProfileBindingMapsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentQosProfileBindingMapsClient(connector vapiProtocolClient_.Connector) *segmentQosProfileBindingMapsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentQosProfileBindingMapsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentQosProfileBindingMapsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentQosProfileBindingMapsClient) Delete(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentQosProfileBindingMapsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentQosProfileBindingMapsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentQosProfileBindingMapId", segmentQosProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentQosProfileBindingMapsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string) (nsx_policyModel.SegmentQosProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentQosProfileBindingMapsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentQosProfileBindingMapsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentQosProfileBindingMapId", segmentQosProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentQosProfileBindingMapsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentQosProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentQosProfileBindingMapsClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentQosProfileBindingMapListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentQosProfileBindingMapsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentQosProfileBindingMapsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMapListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMapListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentQosProfileBindingMapsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentQosProfileBindingMapListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentQosProfileBindingMapsClient) Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam nsx_policyModel.SegmentQosProfileBindingMap) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentQosProfileBindingMapsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentQosProfileBindingMapsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentQosProfileBindingMapId", segmentQosProfileBindingMapIdParam) + sv.AddStructField("SegmentQosProfileBindingMap", segmentQosProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentQosProfileBindingMapsClient) Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentQosProfileBindingMapIdParam string, segmentQosProfileBindingMapParam nsx_policyModel.SegmentQosProfileBindingMap) (nsx_policyModel.SegmentQosProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentQosProfileBindingMapsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentQosProfileBindingMapsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentQosProfileBindingMapId", segmentQosProfileBindingMapIdParam) + sv.AddStructField("SegmentQosProfileBindingMap", segmentQosProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_qos_profile_binding_maps", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentQosProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentQosProfileBindingMapsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentQosProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsTypes.go new file mode 100644 index 000000000..0b2104d2e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentQosProfileBindingMapsTypes.go @@ -0,0 +1,407 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SegmentQosProfileBindingMaps. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func segmentQosProfileBindingMapsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentQosProfileBindingMapsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentQosProfileBindingMapsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + paramsTypeMap["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentQosProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_qos_profile_binding_map_id"] = "segmentQosProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-qos-profile-binding-maps/{segmentQosProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentQosProfileBindingMapsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentQosProfileBindingMapsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) +} + +func segmentQosProfileBindingMapsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + paramsTypeMap["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentQosProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_qos_profile_binding_map_id"] = "segmentQosProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-qos-profile-binding-maps/{segmentQosProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentQosProfileBindingMapsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentQosProfileBindingMapsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapListResultBindingType) +} + +func segmentQosProfileBindingMapsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-qos-profile-binding-maps", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentQosProfileBindingMapsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + fieldNameMap["segment_qos_profile_binding_map"] = "SegmentQosProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentQosProfileBindingMapsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentQosProfileBindingMapsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + fieldNameMap["segment_qos_profile_binding_map"] = "SegmentQosProfileBindingMap" + paramsTypeMap["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentQosProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_qos_profile_binding_map_id"] = "segmentQosProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_qos_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-qos-profile-binding-maps/{segmentQosProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentQosProfileBindingMapsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + fieldNameMap["segment_qos_profile_binding_map"] = "SegmentQosProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentQosProfileBindingMapsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) +} + +func segmentQosProfileBindingMapsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_qos_profile_binding_map_id"] = "SegmentQosProfileBindingMapId" + fieldNameMap["segment_qos_profile_binding_map"] = "SegmentQosProfileBindingMap" + paramsTypeMap["segment_qos_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_qos_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentQosProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentQosProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_qos_profile_binding_map_id"] = "segmentQosProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_qos_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-qos-profile-binding-maps/{segmentQosProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsClient.go new file mode 100644 index 000000000..2682a8c10 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsClient.go @@ -0,0 +1,299 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SegmentSecurityProfileBindingMaps +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentSecurityProfileBindingMapsClient interface { + + // API will delete segment security profile binding map. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam segment id (required) + // @param segmentSecurityProfileBindingMapIdParam segment security profile binding map id (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) error + + // API will return details of the segment security profile binding map. If the binding map does not exist, it will return 404. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam segment id (required) + // @param segmentSecurityProfileBindingMapIdParam segment security profile binding map id (required) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) (nsx_policyModel.SegmentSecurityProfileBindingMap, error) + + // API will list all segment security profile binding maps. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam segment id (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfileBindingMapListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentSecurityProfileBindingMapListResult, error) + + // Create a new segment security profile binding map if the given security profile binding map does not exist. Otherwise, patch the existing segment security profile binding map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam segment id (required) + // @param segmentSecurityProfileBindingMapIdParam segment security profile binding map id (required) + // @param segmentSecurityProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam nsx_policyModel.SegmentSecurityProfileBindingMap) error + + // API will create or replace segment security profile binding map. For objects with no binding maps, default profile is applied. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam segment id (required) + // @param segmentSecurityProfileBindingMapIdParam segment security profile binding map id (required) + // @param segmentSecurityProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.SegmentSecurityProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam nsx_policyModel.SegmentSecurityProfileBindingMap) (nsx_policyModel.SegmentSecurityProfileBindingMap, error) +} + +type segmentSecurityProfileBindingMapsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentSecurityProfileBindingMapsClient(connector vapiProtocolClient_.Connector) *segmentSecurityProfileBindingMapsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentSecurityProfileBindingMapsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentSecurityProfileBindingMapsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentSecurityProfileBindingMapsClient) Delete(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfileBindingMapsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfileBindingMapsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMapId", segmentSecurityProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentSecurityProfileBindingMapsClient) Get(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string) (nsx_policyModel.SegmentSecurityProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfileBindingMapsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfileBindingMapsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMapId", segmentSecurityProfileBindingMapIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfileBindingMapsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentSecurityProfileBindingMapsClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentSecurityProfileBindingMapListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfileBindingMapsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfileBindingMapsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMapListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMapListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfileBindingMapsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfileBindingMapListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentSecurityProfileBindingMapsClient) Patch(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam nsx_policyModel.SegmentSecurityProfileBindingMap) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfileBindingMapsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfileBindingMapsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMapId", segmentSecurityProfileBindingMapIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMap", segmentSecurityProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentSecurityProfileBindingMapsClient) Update(orgIdParam string, projectIdParam string, segmentIdParam string, segmentSecurityProfileBindingMapIdParam string, segmentSecurityProfileBindingMapParam nsx_policyModel.SegmentSecurityProfileBindingMap) (nsx_policyModel.SegmentSecurityProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentSecurityProfileBindingMapsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentSecurityProfileBindingMapsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMapId", segmentSecurityProfileBindingMapIdParam) + sv.AddStructField("SegmentSecurityProfileBindingMap", segmentSecurityProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.segment_security_profile_binding_maps", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentSecurityProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentSecurityProfileBindingMapsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentSecurityProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsTypes.go new file mode 100644 index 000000000..4dba871f6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentSecurityProfileBindingMapsTypes.go @@ -0,0 +1,407 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SegmentSecurityProfileBindingMaps. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func segmentSecurityProfileBindingMapsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfileBindingMapsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentSecurityProfileBindingMapsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_security_profile_binding_map_id"] = "segmentSecurityProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-security-profile-binding-maps/{segmentSecurityProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfileBindingMapsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfileBindingMapsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) +} + +func segmentSecurityProfileBindingMapsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_security_profile_binding_map_id"] = "segmentSecurityProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-security-profile-binding-maps/{segmentSecurityProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfileBindingMapsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfileBindingMapsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapListResultBindingType) +} + +func segmentSecurityProfileBindingMapsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-security-profile-binding-maps", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfileBindingMapsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + fieldNameMap["segment_security_profile_binding_map"] = "SegmentSecurityProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfileBindingMapsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentSecurityProfileBindingMapsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + fieldNameMap["segment_security_profile_binding_map"] = "SegmentSecurityProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_security_profile_binding_map_id"] = "segmentSecurityProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_security_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-security-profile-binding-maps/{segmentSecurityProfileBindingMapId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentSecurityProfileBindingMapsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + fieldNameMap["segment_security_profile_binding_map"] = "SegmentSecurityProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentSecurityProfileBindingMapsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) +} + +func segmentSecurityProfileBindingMapsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + fields["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment_security_profile_binding_map_id"] = "SegmentSecurityProfileBindingMapId" + fieldNameMap["segment_security_profile_binding_map"] = "SegmentSecurityProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_security_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentSecurityProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentSecurityProfileBindingMapId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["segment_security_profile_binding_map_id"] = "segmentSecurityProfileBindingMapId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment_security_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/segment-security-profile-binding-maps/{segmentSecurityProfileBindingMapId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentsPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentsPackageTypes.go new file mode 100644 index 000000000..e4a1fb228 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/SegmentsPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.segments. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateClient.go new file mode 100644 index 000000000..062a4099a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateClient.go @@ -0,0 +1,164 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: State +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StateClient interface { + + // Get infra segment state information. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentsIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentConfigurationState + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentConfigurationState, error) + + // Returns all infra segments with configuration state on the enforcement point specified in the request + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param configurationStateParam Configuration state of the segment on enforcement point (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param sourceParam Data source type. (optional) + // @return com.vmware.nsx_policy.model.SegmentConfigurationStateListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, configurationStateParam *string, enforcementPointPathParam *string, sourceParam *string) (nsx_policyModel.SegmentConfigurationStateListResult, error) +} + +type stateClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStateClient(connector vapiProtocolClient_.Connector) *stateClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.state") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := stateClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *stateClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *stateClient) Get(orgIdParam string, projectIdParam string, segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentConfigurationState, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := stateGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(stateGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentsId", segmentsIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentConfigurationState + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.state", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentConfigurationState + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StateGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentConfigurationState), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *stateClient) List(orgIdParam string, projectIdParam string, configurationStateParam *string, enforcementPointPathParam *string, sourceParam *string) (nsx_policyModel.SegmentConfigurationStateListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := stateListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(stateListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("ConfigurationState", configurationStateParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("Source", sourceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentConfigurationStateListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.state", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentConfigurationStateListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StateListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentConfigurationStateListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateTypes.go new file mode 100644 index 000000000..d5732aa2e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StateTypes.go @@ -0,0 +1,233 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: State. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_PENDING = "pending" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_IN_PROGRESS = "in_progress" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_SUCCESS = "success" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_FAILED = "failed" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_PARTIAL_SUCCESS = "partial_success" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_ORPHANED = "orphaned" + +// Possible value for ``configurationState`` of method State#list. +const State_LIST_CONFIGURATION_STATE_UNKNOWN = "unknown" + +// Possible value for ``source`` of method State#list. +const State_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method State#list. +const State_LIST_SOURCE_CACHED = "cached" + +func stateGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segments_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segments_id"] = "SegmentsId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StateGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentConfigurationStateBindingType) +} + +func stateGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segments_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segments_id"] = "SegmentsId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segments_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentsId"] = vapiBindings_.NewStringType() + pathParams["segments_id"] = "segmentsId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentsId}/state", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func stateListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["configuration_state"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["configuration_state"] = "ConfigurationState" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["source"] = "Source" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StateListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentConfigurationStateListResultBindingType) +} + +func stateListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["configuration_state"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["configuration_state"] = "ConfigurationState" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["source"] = "Source" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["configuration_state"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["configuration_state"] = "configuration_state" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["source"] = "source" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/state", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsClient.go new file mode 100644 index 000000000..3ae88a132 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Statistics +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StatisticsClient interface { + + // Get infra segment statistics information. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentsIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentStatistics + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentStatistics, error) +} + +type statisticsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStatisticsClient(connector vapiProtocolClient_.Connector) *statisticsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.statistics") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := statisticsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *statisticsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *statisticsClient) Get(orgIdParam string, projectIdParam string, segmentsIdParam string, cursorParam *string, edgePathParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentStatistics, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := statisticsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(statisticsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentsId", segmentsIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentStatistics + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.statistics", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentStatistics + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StatisticsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentStatistics), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsTypes.go new file mode 100644 index 000000000..ed4b4f0de --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/StatisticsTypes.go @@ -0,0 +1,131 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Statistics. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func statisticsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segments_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segments_id"] = "SegmentsId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StatisticsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentStatisticsBindingType) +} + +func statisticsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segments_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segments_id"] = "SegmentsId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segments_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentsId"] = vapiBindings_.NewStringType() + pathParams["segments_id"] = "segmentsId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentsId}/statistics", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableClient.go new file mode 100644 index 000000000..d710edc97 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: TepTable +// Used by client-side stubs. + +package segments + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type TepTableClient interface { + + // Returns TEP table for a segment + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param segmentIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Data source type. (optional) + // @param transportNodeIdParam TransportNode Id (optional) + // @return com.vmware.nsx_policy.model.PolicyTepListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyTepListResult, error) +} + +type tepTableClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewTepTableClient(connector vapiProtocolClient_.Connector) *tepTableClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.segments.tep_table") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + tIface := tepTableClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &tIface +} + +func (tIface *tepTableClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := tIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (tIface *tepTableClient) List(orgIdParam string, projectIdParam string, segmentIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyTepListResult, error) { + typeConverter := tIface.connector.TypeConverter() + executionContext := tIface.connector.NewExecutionContext() + operationRestMetaData := tepTableListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(tepTableListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("TransportNodeId", transportNodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyTepListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := tIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.segments.tep_table", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyTepListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), TepTableListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyTepListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), tIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableTypes.go new file mode 100644 index 000000000..ffd37ed8d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments/TepTableTypes.go @@ -0,0 +1,137 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: TepTable. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package segments + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method TepTable#list. +const TepTable_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method TepTable#list. +const TepTable_LIST_SOURCE_CACHED = "cached" + +func tepTableListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func TepTableListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyTepListResultBindingType) +} + +func tepTableListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["transport_node_id"] = "transport_node_id" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/segments/{segmentId}/tep-table", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesClient.go new file mode 100644 index 000000000..dc8b136b6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ArpProxies +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ArpProxiesClient interface { + + // Returns ARP proxy table for a tier-1 + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Data source type. (optional) + // @param transportNodeIdParam TransportNode Id (optional) + // @return com.vmware.nsx_policy.model.PolicyArpProxyTableListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) +} + +type arpProxiesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewArpProxiesClient(connector vapiProtocolClient_.Connector) *arpProxiesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.arp_proxies") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := arpProxiesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *arpProxiesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *arpProxiesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := arpProxiesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(arpProxiesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("TransportNodeId", transportNodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.arp_proxies", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ArpProxiesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyArpProxyTableListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesTypes.go new file mode 100644 index 000000000..939732a7b --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ArpProxiesTypes.go @@ -0,0 +1,137 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ArpProxies. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method ArpProxies#list. +const ArpProxies_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method ArpProxies#list. +const ArpProxies_LIST_SOURCE_CACHED = "cached" + +func arpProxiesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ArpProxiesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyArpProxyTableListResultBindingType) +} + +func arpProxiesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["transport_node_id"] = "transport_node_id" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/arp-proxies", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderClient.go new file mode 100644 index 000000000..888760e81 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderClient.go @@ -0,0 +1,278 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: DnsForwarder +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type DnsForwarderClient interface { + + // Perform the specified action for Tier0 DNS forwarder on specified enforcement point. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param actionParam An action to be performed for DNS forwarder on EP (required) + // @param enforcementPointPathParam An enforcement point path, on which the action is to be performed (optional, default to /infra/sites/default/enforcement-points/default) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Create(orgIdParam string, projectIdParam string, tier1IdParam string, actionParam string, enforcementPointPathParam *string) error + + // Delete DNS configuration for tier-1 instance + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string) error + + // Read the DNS Forwarder for the given tier-1 instance + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @return com.vmware.nsx_policy.model.PolicyDnsForwarder + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.PolicyDnsForwarder, error) + + // Create or update the DNS Forwarder + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param policyDnsForwarderParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, policyDnsForwarderParam nsx_policyModel.PolicyDnsForwarder) error + + // Create or update the DNS Forwarder + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param policyDnsForwarderParam (required) + // @return com.vmware.nsx_policy.model.PolicyDnsForwarder + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, policyDnsForwarderParam nsx_policyModel.PolicyDnsForwarder) (nsx_policyModel.PolicyDnsForwarder, error) +} + +type dnsForwarderClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewDnsForwarderClient(connector vapiProtocolClient_.Connector) *dnsForwarderClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "create": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "create"), + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + dIface := dnsForwarderClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &dIface +} + +func (dIface *dnsForwarderClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := dIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (dIface *dnsForwarderClient) Create(orgIdParam string, projectIdParam string, tier1IdParam string, actionParam string, enforcementPointPathParam *string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderCreateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderCreateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Action", actionParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder", "create", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsForwarderClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsForwarderClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.PolicyDnsForwarder, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyDnsForwarder + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyDnsForwarder + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsForwarderGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyDnsForwarder), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (dIface *dnsForwarderClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, policyDnsForwarderParam nsx_policyModel.PolicyDnsForwarder) error { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("PolicyDnsForwarder", policyDnsForwarderParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (dIface *dnsForwarderClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, policyDnsForwarderParam nsx_policyModel.PolicyDnsForwarder) (nsx_policyModel.PolicyDnsForwarder, error) { + typeConverter := dIface.connector.TypeConverter() + executionContext := dIface.connector.NewExecutionContext() + operationRestMetaData := dnsForwarderUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(dnsForwarderUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("PolicyDnsForwarder", policyDnsForwarderParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyDnsForwarder + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := dIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.dns_forwarder", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyDnsForwarder + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), DnsForwarderUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyDnsForwarder), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), dIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderTypes.go new file mode 100644 index 000000000..f1e54b682 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/DnsForwarderTypes.go @@ -0,0 +1,364 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: DnsForwarder. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``action`` of method DnsForwarder#create. +const DnsForwarder_CREATE_ACTION_CACHE = "clear_cache" + +func dnsForwarderCreateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["action"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["action"] = "Action" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderCreateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsForwarderCreateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["action"] = vapiBindings_.NewStringType() + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["action"] = "Action" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["action"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["action"] = "action" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/dns-forwarder", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsForwarderDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/dns-forwarder", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) +} + +func dnsForwarderGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/dns-forwarder", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["policy_dns_forwarder"] = "PolicyDnsForwarder" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func dnsForwarderPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["policy_dns_forwarder"] = "PolicyDnsForwarder" + paramsTypeMap["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_dns_forwarder", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/dns-forwarder", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func dnsForwarderUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["policy_dns_forwarder"] = "PolicyDnsForwarder" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func DnsForwarderUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) +} + +func dnsForwarderUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["policy_dns_forwarder"] = "PolicyDnsForwarder" + paramsTypeMap["policy_dns_forwarder"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyDnsForwarderBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_dns_forwarder", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/dns-forwarder", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsClient.go new file mode 100644 index 000000000..0f5da74a7 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsClient.go @@ -0,0 +1,240 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FloodProtectionProfileBindings +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FloodProtectionProfileBindingsClient interface { + + // API will delete Flood Protection Profile Binding for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string) error + + // API will get Flood Protection Profile Binding Map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @return com.vmware.nsx_policy.model.FloodProtectionProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string) (nsx_policyModel.FloodProtectionProfileBindingMap, error) + + // API will create or update Flood Protection profile binding map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @param floodProtectionProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) error + + // API will create or update Flood Protection profile binding map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @param floodProtectionProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.FloodProtectionProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) (nsx_policyModel.FloodProtectionProfileBindingMap, error) +} + +type floodProtectionProfileBindingsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFloodProtectionProfileBindingsClient(connector vapiProtocolClient_.Connector) *floodProtectionProfileBindingsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.flood_protection_profile_bindings") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := floodProtectionProfileBindingsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *floodProtectionProfileBindingsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *floodProtectionProfileBindingsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.flood_protection_profile_bindings", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string) (nsx_policyModel.FloodProtectionProfileBindingMap, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.flood_protection_profile_bindings", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfileBindingsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.FloodProtectionProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + sv.AddStructField("FloodProtectionProfileBindingMap", floodProtectionProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.flood_protection_profile_bindings", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) (nsx_policyModel.FloodProtectionProfileBindingMap, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + sv.AddStructField("FloodProtectionProfileBindingMap", floodProtectionProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.flood_protection_profile_bindings", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfileBindingsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.FloodProtectionProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsTypes.go new file mode 100644 index 000000000..2c8c7784c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/FloodProtectionProfileBindingsTypes.go @@ -0,0 +1,313 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FloodProtectionProfileBindings. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func floodProtectionProfileBindingsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfileBindingsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) +} + +func floodProtectionProfileBindingsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfileBindingsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) +} + +func floodProtectionProfileBindingsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableClient.go new file mode 100644 index 000000000..df064f75c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableClient.go @@ -0,0 +1,115 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ForwardingTable +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ForwardingTableClient interface { + + // Get forwarding table from tier-1 + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param edgeIdParam UUID of edge node (optional) + // @param edgePathParam Policy path of edge node (optional) + // @param enforcementPointPathParam Enforcement point path (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param networkPrefixParam IPAddress or CIDR Block (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param routeSourceParam Filter routes based on the source from which route is learned (optional) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.RoutingTableListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, edgeIdParam *string, edgePathParam *string, enforcementPointPathParam *string, includedFieldsParam *string, networkPrefixParam *string, pageSizeParam *int64, routeSourceParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.RoutingTableListResult, error) +} + +type forwardingTableClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewForwardingTableClient(connector vapiProtocolClient_.Connector) *forwardingTableClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.forwarding_table") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := forwardingTableClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *forwardingTableClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *forwardingTableClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, edgeIdParam *string, edgePathParam *string, enforcementPointPathParam *string, includedFieldsParam *string, networkPrefixParam *string, pageSizeParam *int64, routeSourceParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.RoutingTableListResult, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := forwardingTableListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(forwardingTableListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EdgeId", edgeIdParam) + sv.AddStructField("EdgePath", edgePathParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("NetworkPrefix", networkPrefixParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("RouteSource", routeSourceParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.RoutingTableListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.forwarding_table", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.RoutingTableListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ForwardingTableListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.RoutingTableListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableTypes.go new file mode 100644 index 000000000..5b8edf43d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/ForwardingTableTypes.go @@ -0,0 +1,155 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ForwardingTable. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``routeSource`` of method ForwardingTable#list. +const ForwardingTable_LIST_ROUTE_SOURCE_BGP = "BGP" + +// Possible value for ``routeSource`` of method ForwardingTable#list. +const ForwardingTable_LIST_ROUTE_SOURCE_STATIC = "STATIC" + +// Possible value for ``routeSource`` of method ForwardingTable#list. +const ForwardingTable_LIST_ROUTE_SOURCE_CONNECTED = "CONNECTED" + +// Possible value for ``routeSource`` of method ForwardingTable#list. +const ForwardingTable_LIST_ROUTE_SOURCE_OSPF = "OSPF" + +func forwardingTableListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["network_prefix"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["route_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_id"] = "EdgeId" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["network_prefix"] = "NetworkPrefix" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["route_source"] = "RouteSource" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ForwardingTableListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.RoutingTableListResultBindingType) +} + +func forwardingTableListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["network_prefix"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["route_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["edge_id"] = "EdgeId" + fieldNameMap["edge_path"] = "EdgePath" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["network_prefix"] = "NetworkPrefix" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["route_source"] = "RouteSource" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["network_prefix"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["edge_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["route_source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["network_prefix"] = "network_prefix" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["edge_path"] = "edge_path" + queryParams["edge_id"] = "edge_id" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["route_source"] = "route_source" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/forwarding-table", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallClient.go new file mode 100644 index 000000000..30b9c3966 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallClient.go @@ -0,0 +1,95 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayFirewall +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayFirewallClient interface { + + // Get filtered view of Gateway Firewall rules associated with the Tier-1. The gateway policies are returned in the order of category and sequence number. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @return com.vmware.nsx_policy.model.GatewayPolicyListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.GatewayPolicyListResult, error) +} + +type gatewayFirewallClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayFirewallClient(connector vapiProtocolClient_.Connector) *gatewayFirewallClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.gateway_firewall") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayFirewallClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayFirewallClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayFirewallClient) List(orgIdParam string, projectIdParam string, tier1IdParam string) (nsx_policyModel.GatewayPolicyListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayFirewallListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayFirewallListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicyListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.gateway_firewall", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicyListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayFirewallListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicyListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallTypes.go new file mode 100644 index 000000000..8899ddaae --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/GatewayFirewallTypes.go @@ -0,0 +1,83 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayFirewall. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func gatewayFirewallListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayFirewallListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyListResultBindingType) +} + +func gatewayFirewallListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/gateway-firewall", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesClient.go new file mode 100644 index 000000000..e3b8efd95 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesClient.go @@ -0,0 +1,301 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: LocaleServices +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type LocaleServicesClient interface { + + // Delete Tier-1 locale-services + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) error + + // Read Tier-1 locale-services + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @return com.vmware.nsx_policy.model.LocaleServices + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) (nsx_policyModel.LocaleServices, error) + + // Paginated list of all Tier-1 locale-services + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.LocaleServicesListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.LocaleServicesListResult, error) + + // If a Tier-1 locale services with the locale-services-id is not already present, create a new locale services. If it already exists, update Tier-1 locale services with specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param localeServicesParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, localeServicesParam nsx_policyModel.LocaleServices) error + + // If a Tier-1 locale services with the locale-services-id is not already present, create a new locale-services. If it already exists, replace the Tier-1 locale services instance with the new object. Modifying edge cluster re-allocates NSX service routers of TIER1 to a different edge cluster. You can also place edge nodes manually and provide maximum two indices for HA mode ACTIVE_STANDBY. To re-allocating edge cluster is a disruptive operation and all existing statistics of Tier1 gateway will be removed. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param localeServicesParam (required) + // @return com.vmware.nsx_policy.model.LocaleServices + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, localeServicesParam nsx_policyModel.LocaleServices) (nsx_policyModel.LocaleServices, error) +} + +type localeServicesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewLocaleServicesClient(connector vapiProtocolClient_.Connector) *localeServicesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + lIface := localeServicesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &lIface +} + +func (lIface *localeServicesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := lIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (lIface *localeServicesClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) error { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := localeServicesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(localeServicesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (lIface *localeServicesClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) (nsx_policyModel.LocaleServices, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := localeServicesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(localeServicesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.LocaleServices + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.LocaleServices + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LocaleServicesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.LocaleServices), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *localeServicesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.LocaleServicesListResult, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := localeServicesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(localeServicesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.LocaleServicesListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.LocaleServicesListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LocaleServicesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.LocaleServicesListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (lIface *localeServicesClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, localeServicesParam nsx_policyModel.LocaleServices) error { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := localeServicesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(localeServicesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("LocaleServices", localeServicesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (lIface *localeServicesClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, localeServicesParam nsx_policyModel.LocaleServices) (nsx_policyModel.LocaleServices, error) { + typeConverter := lIface.connector.TypeConverter() + executionContext := lIface.connector.NewExecutionContext() + operationRestMetaData := localeServicesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(localeServicesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("LocaleServices", localeServicesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.LocaleServices + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.LocaleServices + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LocaleServicesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.LocaleServices), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesTypes.go new file mode 100644 index 000000000..6dfbf4f8f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/LocaleServicesTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: LocaleServices. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func localeServicesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LocaleServicesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func localeServicesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func localeServicesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LocaleServicesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) +} + +func localeServicesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func localeServicesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LocaleServicesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesListResultBindingType) +} + +func localeServicesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func localeServicesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["locale_services"] = "LocaleServices" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LocaleServicesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func localeServicesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["locale_services"] = "LocaleServices" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "locale_services", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func localeServicesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["locale_services"] = "LocaleServices" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func LocaleServicesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) +} + +func localeServicesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["locale_services"] = "LocaleServices" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services"] = vapiBindings_.NewReferenceType(nsx_policyModel.LocaleServicesBindingType) + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "locale_services", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatClient.go new file mode 100644 index 000000000..3ca1837a3 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatClient.go @@ -0,0 +1,107 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Nat +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type NatClient interface { + + // List all NAT sections under the given Tier-1 ID. For more details related to NAT section please refer to PolicyNAT schema. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyNatListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatListResult, error) +} + +type natClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewNatClient(connector vapiProtocolClient_.Connector) *natClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + nIface := natClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &nIface +} + +func (nIface *natClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := nIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (nIface *natClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatListResult, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyNatListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyNatListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NatListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyNatListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatTypes.go new file mode 100644 index 000000000..1ef296326 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/NatTypes.go @@ -0,0 +1,119 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Nat. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func natListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatListResultBindingType) +} + +func natListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigClient.go new file mode 100644 index 000000000..0c19f45e4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigClient.go @@ -0,0 +1,209 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SecurityConfig +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SecurityConfigClient interface { + + // Read Security Feature. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam tier1 id (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param featureParam Collection of T1 supported security features (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SecurityFeatures + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, featureParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SecurityFeatures, error) + + // Create a security configuration if it is not already present, otherwise update the security configuration. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam tier1 id (required) + // @param securityFeaturesParam (required) + // @return com.vmware.nsx_policy.model.SecurityFeatures + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, securityFeaturesParam nsx_policyModel.SecurityFeatures) (nsx_policyModel.SecurityFeatures, error) + + // Create or update security configuration. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam tier1 id (required) + // @param securityFeaturesParam (required) + // @return com.vmware.nsx_policy.model.SecurityFeatures + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, securityFeaturesParam nsx_policyModel.SecurityFeatures) (nsx_policyModel.SecurityFeatures, error) +} + +type securityConfigClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSecurityConfigClient(connector vapiProtocolClient_.Connector) *securityConfigClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.security_config") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := securityConfigClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *securityConfigClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *securityConfigClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, featureParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SecurityFeatures, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityConfigGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityConfigGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("Feature", featureParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityFeatures + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.security_config", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityFeatures + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityConfigGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityFeatures), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *securityConfigClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, securityFeaturesParam nsx_policyModel.SecurityFeatures) (nsx_policyModel.SecurityFeatures, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityConfigPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityConfigPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SecurityFeatures", securityFeaturesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityFeatures + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.security_config", "patch", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityFeatures + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityConfigPatchOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityFeatures), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *securityConfigClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, securityFeaturesParam nsx_policyModel.SecurityFeatures) (nsx_policyModel.SecurityFeatures, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := securityConfigUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(securityConfigUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SecurityFeatures", securityFeaturesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SecurityFeatures + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.security_config", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SecurityFeatures + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SecurityConfigUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SecurityFeatures), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigTypes.go new file mode 100644 index 000000000..fa4423bcb --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SecurityConfigTypes.go @@ -0,0 +1,269 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SecurityConfig. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``feature`` of method SecurityConfig#get. +const SecurityConfig_GET_FEATURE_MALWAREPREVENTION = "MALWAREPREVENTION" + +// Possible value for ``feature`` of method SecurityConfig#get. +const SecurityConfig_GET_FEATURE_IDFW = "IDFW" + +// Possible value for ``feature`` of method SecurityConfig#get. +const SecurityConfig_GET_FEATURE_IDPS = "IDPS" + +// Possible value for ``feature`` of method SecurityConfig#get. +const SecurityConfig_GET_FEATURE_TLS = "TLS" + +func securityConfigGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["feature"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["feature"] = "Feature" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityConfigGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) +} + +func securityConfigGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["feature"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["feature"] = "Feature" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["feature"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["feature"] = "feature" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/security-config", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityConfigPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["security_features"] = "SecurityFeatures" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityConfigPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) +} + +func securityConfigPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["security_features"] = "SecurityFeatures" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "security_features", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/security-config", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func securityConfigUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["security_features"] = "SecurityFeatures" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SecurityConfigUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) +} + +func securityConfigUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["security_features"] = "SecurityFeatures" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["security_features"] = vapiBindings_.NewReferenceType(nsx_policyModel.SecurityFeaturesBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "security_features", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/security-config", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsClient.go new file mode 100644 index 000000000..86ebb5b54 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsClient.go @@ -0,0 +1,395 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Segments +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SegmentsClient interface { + + // Delete segment + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) error + + // Force delete bypasses validations during segment deletion. This may result in an inconsistent connectivity. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete0(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) error + + // Delete one or multiple DHCP lease(s) specified by IP and MAC under a Tier-1. If there is a DHCP server running upon the given segment, or this segment is using a DHCP server running in its connected Tier-1, the DHCP lease(s) which match exactly the IP address and the MAC address will be deleted. If no such lease matches, the deletion for this lease will be ignored. The DHCP lease to be deleted will be removed by the system from both active and standby node. The system will report error if the DHCP lease could not be removed from both nodes. If the DHCP lease could not be removed on either node, please check the DHCP server status. Once the DHCP server status is UP, please invoke the deletion API again to ensure the lease gets deleted from both nodes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // @param dhcpDeleteLeasesParam (required) + // @param enforcementPointPathParam Enforcement point path (optional) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Deletedhcpleases(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, dhcpDeleteLeasesParam nsx_policyModel.DhcpDeleteLeases, enforcementPointPathParam *string) error + + // Read segment Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PUT/PATCH API payload, the path returned in the GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // @return com.vmware.nsx_policy.model.Segment + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) (nsx_policyModel.Segment, error) + + // + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param segmentTypeParam Segment type (optional) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.SegmentListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentListResult, error) + + // If segment with the segment-id is not already present, create a new segment. If it already exists, update the segment with specified attributes. Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PATCH API payload, the path returned in the GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the Alarm, GPRR, error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // @param segmentParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error + + // If segment with the segment-id is not already present, create a new segment. If it already exists, replace the segment with this object. Note: Extended Segment: Please note that old vpn path deprecated. If user specify old l2vpn path in the \"l2_extension\" object in the PUT API payload, the path returned in the PUT/GET response payload may include the new path instead of the deprecated l2vpn path. Both old and new l2vpn path refer to same resource. there is no functional impact. Also note that l2vpn path included in the Alarm, GPRR, error messages returned from validation may include the new VPN path instead of the deprecated l2vpn path. Both new path and old vpn path refer to same resource. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param segmentIdParam (required) + // @param segmentParam (required) + // @return com.vmware.nsx_policy.model.Segment + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) +} + +type segmentsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSegmentsClient(connector vapiProtocolClient_.Connector) *segmentsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "delete_0": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete_0"), + "deletedhcpleases": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "deletedhcpleases"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := segmentsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *segmentsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *segmentsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Delete0(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDelete0RestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDelete0InputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "delete_0", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Deletedhcpleases(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, dhcpDeleteLeasesParam nsx_policyModel.DhcpDeleteLeases, enforcementPointPathParam *string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsDeletedhcpleasesRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsDeletedhcpleasesInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("DhcpDeleteLeases", dhcpDeleteLeasesParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "deletedhcpleases", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string) (nsx_policyModel.Segment, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Segment + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Segment + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Segment), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentsClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, segmentTypeParam *string, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.SegmentListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SegmentType", segmentTypeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SegmentListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SegmentListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SegmentListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *segmentsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *segmentsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, segmentIdParam string, segmentParam nsx_policyModel.Segment) (nsx_policyModel.Segment, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := segmentsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(segmentsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SegmentId", segmentIdParam) + sv.AddStructField("Segment", segmentParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Segment + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.segments", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Segment + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SegmentsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Segment), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsTypes.go new file mode 100644 index 000000000..c591017a9 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SegmentsTypes.go @@ -0,0 +1,578 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Segments. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``segmentType`` of method Segments#list. +const Segments_LIST_SEGMENT_TYPE_DVPORTGROUP = "DVPortgroup" + +// Possible value for ``segmentType`` of method Segments#list. +const Segments_LIST_SEGMENT_TYPE_ALL = "ALL" + +func segmentsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsDelete0InputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDelete0OutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDelete0RestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "force=true", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsDeletedhcpleasesInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["dhcp_delete_leases"] = "DhcpDeleteLeases" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsDeletedhcpleasesOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsDeletedhcpleasesRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["dhcp_delete_leases"] = "DhcpDeleteLeases" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + paramsTypeMap["dhcp_delete_leases"] = vapiBindings_.NewReferenceType(nsx_policyModel.DhcpDeleteLeasesBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["enforcement_point_path"] = "enforcement_point_path" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=delete_dhcp_leases", + "dhcp_delete_leases", + "POST", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) +} + +func segmentsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["segment_type"] = "SegmentType" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentListResultBindingType) +} + +func segmentsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["segment_type"] = "SegmentType" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment_type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["segment_type"] = "segment_type" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func segmentsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func segmentsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SegmentsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) +} + +func segmentsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["segment_id"] = vapiBindings_.NewStringType() + fields["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["segment_id"] = "SegmentId" + fieldNameMap["segment"] = "Segment" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["segment"] = vapiBindings_.NewReferenceType(nsx_policyModel.SegmentBindingType) + paramsTypeMap["segment_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["segmentId"] = vapiBindings_.NewStringType() + pathParams["segment_id"] = "segmentId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "segment", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/segments/{segmentId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsClient.go new file mode 100644 index 000000000..6507bf0f3 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsClient.go @@ -0,0 +1,240 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SessionTimerProfileBindings +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SessionTimerProfileBindingsClient interface { + + // API will delete Session Timer Profile Binding for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string) error + + // API will get Session Timer Profile Binding Map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @return com.vmware.nsx_policy.model.SessionTimerProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string) (nsx_policyModel.SessionTimerProfileBindingMap, error) + + // API will create or update Session Timer profile binding map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @param sessionTimerProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) error + + // API will create or update Session Timer profile binding map for Tier-1 Logical Router. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @param sessionTimerProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.SessionTimerProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) (nsx_policyModel.SessionTimerProfileBindingMap, error) +} + +type sessionTimerProfileBindingsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSessionTimerProfileBindingsClient(connector vapiProtocolClient_.Connector) *sessionTimerProfileBindingsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.session_timer_profile_bindings") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := sessionTimerProfileBindingsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sessionTimerProfileBindingsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sessionTimerProfileBindingsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.session_timer_profile_bindings", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string) (nsx_policyModel.SessionTimerProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.session_timer_profile_bindings", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionTimerProfileBindingsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SessionTimerProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + sv.AddStructField("SessionTimerProfileBindingMap", sessionTimerProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.session_timer_profile_bindings", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) (nsx_policyModel.SessionTimerProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + sv.AddStructField("SessionTimerProfileBindingMap", sessionTimerProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.session_timer_profile_bindings", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionTimerProfileBindingsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SessionTimerProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsTypes.go new file mode 100644 index 000000000..2edda3793 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/SessionTimerProfileBindingsTypes.go @@ -0,0 +1,313 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SessionTimerProfileBindings. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func sessionTimerProfileBindingsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionTimerProfileBindingsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) +} + +func sessionTimerProfileBindingsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionTimerProfileBindingsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "session_timer_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) +} + +func sessionTimerProfileBindingsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "session_timer_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateClient.go new file mode 100644 index 000000000..383891c05 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateClient.go @@ -0,0 +1,111 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: State +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StateClient interface { + + // Returns + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam Enforcement point path (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param interfacePathParam Interface path for interface specific state such as IPv6 DAD state (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param type_Param Returns specific information based on the value specified. (optional) + // @return com.vmware.nsx_policy.model.Tier1GatewayState + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, interfacePathParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, type_Param *string) (nsx_policyModel.Tier1GatewayState, error) +} + +type stateClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStateClient(connector vapiProtocolClient_.Connector) *stateClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.state") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := stateClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *stateClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *stateClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, interfacePathParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, type_Param *string) (nsx_policyModel.Tier1GatewayState, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := stateGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(stateGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("InterfacePath", interfacePathParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Type_", type_Param) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1GatewayState + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.state", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1GatewayState + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StateGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1GatewayState), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateTypes.go new file mode 100644 index 000000000..95e6c9c01 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StateTypes.go @@ -0,0 +1,140 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: State. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``type`` of method State#get. +const State_GET_TYPE_GATEWAY_STATE = "GATEWAY_STATE" + +// Possible value for ``type`` of method State#get. +const State_GET_TYPE_GATEWAY_STATUS = "GATEWAY_STATUS" + +// Possible value for ``type`` of method State#get. +const State_GET_TYPE_IPV6_STATUS = "IPV6_STATUS" + +func stateGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["interface_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["interface_path"] = "InterfacePath" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["type"] = "Type_" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StateGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1GatewayStateBindingType) +} + +func stateGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["interface_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["interface_path"] = "InterfacePath" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["type"] = "Type_" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["interface_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["type"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["interface_path"] = "interface_path" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["type"] = "type" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/state", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesClient.go new file mode 100644 index 000000000..4c5ae575d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesClient.go @@ -0,0 +1,301 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: StaticRoutes +// Used by client-side stubs. + +package tier_1s + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StaticRoutesClient interface { + + // Delete Tier-1 static routes + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param routeIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string) error + + // Read Tier-1 static routes + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param routeIdParam (required) + // @return com.vmware.nsx_policy.model.StaticRoutes + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string) (nsx_policyModel.StaticRoutes, error) + + // Paginated list of all Tier-1 Static Routes + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.StaticRoutesListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.StaticRoutesListResult, error) + + // If static routes for route-id are not already present, create static routes. If it already exists, update static routes for route-id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param routeIdParam (required) + // @param staticRoutesParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string, staticRoutesParam nsx_policyModel.StaticRoutes) error + + // If static routes for route-id are not already present, create static routes. If it already exists, replace the static routes for route-id. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param routeIdParam (required) + // @param staticRoutesParam (required) + // @return com.vmware.nsx_policy.model.StaticRoutes + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string, staticRoutesParam nsx_policyModel.StaticRoutes) (nsx_policyModel.StaticRoutes, error) +} + +type staticRoutesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStaticRoutesClient(connector vapiProtocolClient_.Connector) *staticRoutesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := staticRoutesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *staticRoutesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *staticRoutesClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := staticRoutesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(staticRoutesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("RouteId", routeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *staticRoutesClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string) (nsx_policyModel.StaticRoutes, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := staticRoutesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(staticRoutesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("RouteId", routeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.StaticRoutes + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.StaticRoutes + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StaticRoutesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.StaticRoutes), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *staticRoutesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.StaticRoutesListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := staticRoutesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(staticRoutesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.StaticRoutesListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.StaticRoutesListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StaticRoutesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.StaticRoutesListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *staticRoutesClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string, staticRoutesParam nsx_policyModel.StaticRoutes) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := staticRoutesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(staticRoutesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("RouteId", routeIdParam) + sv.AddStructField("StaticRoutes", staticRoutesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *staticRoutesClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, routeIdParam string, staticRoutesParam nsx_policyModel.StaticRoutes) (nsx_policyModel.StaticRoutes, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := staticRoutesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(staticRoutesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("RouteId", routeIdParam) + sv.AddStructField("StaticRoutes", staticRoutesParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.StaticRoutes + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.static_routes", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.StaticRoutes + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StaticRoutesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.StaticRoutes), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesTypes.go new file mode 100644 index 000000000..9e191c064 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/StaticRoutesTypes.go @@ -0,0 +1,413 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: StaticRoutes. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func staticRoutesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StaticRoutesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func staticRoutesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + paramsTypeMap["route_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["routeId"] = vapiBindings_.NewStringType() + pathParams["route_id"] = "routeId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/static-routes/{routeId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func staticRoutesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StaticRoutesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) +} + +func staticRoutesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + paramsTypeMap["route_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["routeId"] = vapiBindings_.NewStringType() + pathParams["route_id"] = "routeId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/static-routes/{routeId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func staticRoutesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StaticRoutesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesListResultBindingType) +} + +func staticRoutesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/static-routes", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func staticRoutesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fields["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + fieldNameMap["static_routes"] = "StaticRoutes" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StaticRoutesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func staticRoutesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fields["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + fieldNameMap["static_routes"] = "StaticRoutes" + paramsTypeMap["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + paramsTypeMap["route_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["routeId"] = vapiBindings_.NewStringType() + pathParams["route_id"] = "routeId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "static_routes", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/static-routes/{routeId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func staticRoutesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fields["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + fieldNameMap["static_routes"] = "StaticRoutes" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StaticRoutesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) +} + +func staticRoutesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["route_id"] = vapiBindings_.NewStringType() + fields["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["route_id"] = "RouteId" + fieldNameMap["static_routes"] = "StaticRoutes" + paramsTypeMap["static_routes"] = vapiBindings_.NewReferenceType(nsx_policyModel.StaticRoutesBindingType) + paramsTypeMap["route_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["routeId"] = vapiBindings_.NewStringType() + pathParams["route_id"] = "routeId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "static_routes", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/static-routes/{routeId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/Tier1sPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/Tier1sPackageTypes.go new file mode 100644 index 000000000..9a4b1a787 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/Tier1sPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.tier_1s. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package tier_1s diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesClient.go new file mode 100644 index 000000000..f5c735e6d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesClient.go @@ -0,0 +1,116 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ArpProxies +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ArpProxiesClient interface { + + // Get Tier-1 Address Resolution Protocol Proxies. + // This API is deprecated. Please use /infra/tier-1s//arp-proxies Returns ARP proxy table for a tier-1 + // + // Deprecated: This API element is deprecated. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @param sourceParam Data source type. (optional) + // @param transportNodeIdParam TransportNode Id (optional) + // @return com.vmware.nsx_policy.model.PolicyArpProxyTableListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) +} + +type arpProxiesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewArpProxiesClient(connector vapiProtocolClient_.Connector) *arpProxiesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.arp_proxies") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := arpProxiesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *arpProxiesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *arpProxiesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, enforcementPointPathParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string, sourceParam *string, transportNodeIdParam *string) (nsx_policyModel.PolicyArpProxyTableListResult, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := arpProxiesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(arpProxiesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + sv.AddStructField("Source", sourceParam) + sv.AddStructField("TransportNodeId", transportNodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.arp_proxies", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyArpProxyTableListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ArpProxiesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyArpProxyTableListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesTypes.go new file mode 100644 index 000000000..77243afa3 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ArpProxiesTypes.go @@ -0,0 +1,144 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ArpProxies. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +// Possible value for ``source`` of method ArpProxies#list. +const ArpProxies_LIST_SOURCE_REALTIME = "realtime" + +// Possible value for ``source`` of method ArpProxies#list. +const ArpProxies_LIST_SOURCE_CACHED = "cached" + +func arpProxiesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ArpProxiesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyArpProxyTableListResultBindingType) +} + +func arpProxiesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + fieldNameMap["source"] = "Source" + fieldNameMap["transport_node_id"] = "TransportNodeId" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["source"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["transport_node_id"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["source"] = "source" + queryParams["transport_node_id"] = "transport_node_id" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/arp-proxies", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsClient.go new file mode 100644 index 000000000..705ff509f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsClient.go @@ -0,0 +1,248 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: FloodProtectionProfileBindings +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type FloodProtectionProfileBindingsClient interface { + + // API will delete Flood Protection Profile Binding for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) error + + // API will get Flood Protection Profile Binding Map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @return com.vmware.nsx_policy.model.FloodProtectionProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) (nsx_policyModel.FloodProtectionProfileBindingMap, error) + + // API will create or update Flood Protection profile binding map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @param floodProtectionProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) error + + // API will create or update Flood Protection profile binding map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param floodProtectionProfileBindingIdParam (required) + // @param floodProtectionProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.FloodProtectionProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) (nsx_policyModel.FloodProtectionProfileBindingMap, error) +} + +type floodProtectionProfileBindingsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewFloodProtectionProfileBindingsClient(connector vapiProtocolClient_.Connector) *floodProtectionProfileBindingsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.flood_protection_profile_bindings") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + fIface := floodProtectionProfileBindingsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &fIface +} + +func (fIface *floodProtectionProfileBindingsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := fIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (fIface *floodProtectionProfileBindingsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.flood_protection_profile_bindings", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string) (nsx_policyModel.FloodProtectionProfileBindingMap, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.flood_protection_profile_bindings", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfileBindingsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.FloodProtectionProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) error { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + sv.AddStructField("FloodProtectionProfileBindingMap", floodProtectionProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.flood_protection_profile_bindings", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (fIface *floodProtectionProfileBindingsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, floodProtectionProfileBindingIdParam string, floodProtectionProfileBindingMapParam nsx_policyModel.FloodProtectionProfileBindingMap) (nsx_policyModel.FloodProtectionProfileBindingMap, error) { + typeConverter := fIface.connector.TypeConverter() + executionContext := fIface.connector.NewExecutionContext() + operationRestMetaData := floodProtectionProfileBindingsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(floodProtectionProfileBindingsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("FloodProtectionProfileBindingId", floodProtectionProfileBindingIdParam) + sv.AddStructField("FloodProtectionProfileBindingMap", floodProtectionProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := fIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.flood_protection_profile_bindings", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.FloodProtectionProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), FloodProtectionProfileBindingsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.FloodProtectionProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), fIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsTypes.go new file mode 100644 index 000000000..d444b544b --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/FloodProtectionProfileBindingsTypes.go @@ -0,0 +1,341 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: FloodProtectionProfileBindings. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func floodProtectionProfileBindingsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfileBindingsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) +} + +func floodProtectionProfileBindingsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func floodProtectionProfileBindingsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func floodProtectionProfileBindingsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func FloodProtectionProfileBindingsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) +} + +func floodProtectionProfileBindingsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + fields["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["flood_protection_profile_binding_id"] = "FloodProtectionProfileBindingId" + fieldNameMap["flood_protection_profile_binding_map"] = "FloodProtectionProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["flood_protection_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.FloodProtectionProfileBindingMapBindingType) + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["floodProtectionProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["flood_protection_profile_binding_id"] = "floodProtectionProfileBindingId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "flood_protection_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/flood-protection-profile-bindings/{floodProtectionProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallClient.go new file mode 100644 index 000000000..04ab40cbc --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallClient.go @@ -0,0 +1,97 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: GatewayFirewall +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type GatewayFirewallClient interface { + + // Get filtered view of Gateway Firewall rules associated with the Tier-1 Locale Services. The gateway policies are returned in the order of category and sequence number. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @return com.vmware.nsx_policy.model.GatewayPolicyListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) (nsx_policyModel.GatewayPolicyListResult, error) +} + +type gatewayFirewallClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewGatewayFirewallClient(connector vapiProtocolClient_.Connector) *gatewayFirewallClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.gateway_firewall") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + gIface := gatewayFirewallClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &gIface +} + +func (gIface *gatewayFirewallClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := gIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (gIface *gatewayFirewallClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string) (nsx_policyModel.GatewayPolicyListResult, error) { + typeConverter := gIface.connector.TypeConverter() + executionContext := gIface.connector.NewExecutionContext() + operationRestMetaData := gatewayFirewallListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(gatewayFirewallListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.GatewayPolicyListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := gIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.gateway_firewall", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.GatewayPolicyListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), GatewayFirewallListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.GatewayPolicyListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), gIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallTypes.go new file mode 100644 index 000000000..86eebbef5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/GatewayFirewallTypes.go @@ -0,0 +1,90 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: GatewayFirewall. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func gatewayFirewallListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func GatewayFirewallListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.GatewayPolicyListResultBindingType) +} + +func gatewayFirewallListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/gateway-firewall", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsClient.go new file mode 100644 index 000000000..cf5d92011 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsClient.go @@ -0,0 +1,311 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: InterfaceGroups +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type InterfaceGroupsClient interface { + + // Delete Tier-1 Interface group + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param groupIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string) error + + // Read Tier-1 Interface group + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param groupIdParam (required) + // @return com.vmware.nsx_policy.model.Tier1InterfaceGroup + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string) (nsx_policyModel.Tier1InterfaceGroup, error) + + // Paginated list of all Tier-1 Interface groups under locale service. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.Tier1InterfaceGroupListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1InterfaceGroupListResult, error) + + // If an Interface group with the label-id is not already present, create a new Interface group. If it already exists, update the Interface group for specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param groupIdParam (required) + // @param tier1InterfaceGroupParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string, tier1InterfaceGroupParam nsx_policyModel.Tier1InterfaceGroup) error + + // Update the Interface group for specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param groupIdParam (required) + // @param tier1InterfaceGroupParam (required) + // @return com.vmware.nsx_policy.model.Tier1InterfaceGroup + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string, tier1InterfaceGroupParam nsx_policyModel.Tier1InterfaceGroup) (nsx_policyModel.Tier1InterfaceGroup, error) +} + +type interfaceGroupsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewInterfaceGroupsClient(connector vapiProtocolClient_.Connector) *interfaceGroupsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := interfaceGroupsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *interfaceGroupsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *interfaceGroupsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfaceGroupsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfaceGroupsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("GroupId", groupIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *interfaceGroupsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string) (nsx_policyModel.Tier1InterfaceGroup, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfaceGroupsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfaceGroupsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("GroupId", groupIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1InterfaceGroup + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1InterfaceGroup + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfaceGroupsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1InterfaceGroup), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *interfaceGroupsClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1InterfaceGroupListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfaceGroupsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfaceGroupsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1InterfaceGroupListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1InterfaceGroupListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfaceGroupsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1InterfaceGroupListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *interfaceGroupsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string, tier1InterfaceGroupParam nsx_policyModel.Tier1InterfaceGroup) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfaceGroupsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfaceGroupsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("GroupId", groupIdParam) + sv.AddStructField("Tier1InterfaceGroup", tier1InterfaceGroupParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *interfaceGroupsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, groupIdParam string, tier1InterfaceGroupParam nsx_policyModel.Tier1InterfaceGroup) (nsx_policyModel.Tier1InterfaceGroup, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfaceGroupsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfaceGroupsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("GroupId", groupIdParam) + sv.AddStructField("Tier1InterfaceGroup", tier1InterfaceGroupParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1InterfaceGroup + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interface_groups", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1InterfaceGroup + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfaceGroupsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1InterfaceGroup), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsTypes.go new file mode 100644 index 000000000..3348bccd5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfaceGroupsTypes.go @@ -0,0 +1,448 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: InterfaceGroups. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func interfaceGroupsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfaceGroupsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func interfaceGroupsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/interface-groups/{groupId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfaceGroupsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfaceGroupsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) +} + +func interfaceGroupsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/interface-groups/{groupId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfaceGroupsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfaceGroupsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupListResultBindingType) +} + +func interfaceGroupsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/interface-groups", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfaceGroupsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["tier1_interface_group"] = "Tier1InterfaceGroup" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfaceGroupsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func interfaceGroupsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["tier1_interface_group"] = "Tier1InterfaceGroup" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1_interface_group", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/interface-groups/{groupId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfaceGroupsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["tier1_interface_group"] = "Tier1InterfaceGroup" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfaceGroupsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) +} + +func interfaceGroupsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["group_id"] = vapiBindings_.NewStringType() + fields["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["group_id"] = "GroupId" + fieldNameMap["tier1_interface_group"] = "Tier1InterfaceGroup" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["group_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_interface_group"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceGroupBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["groupId"] = vapiBindings_.NewStringType() + pathParams["group_id"] = "groupId" + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1_interface_group", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/interface-groups/{groupId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesClient.go new file mode 100644 index 000000000..9c51f53d5 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesClient.go @@ -0,0 +1,311 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Interfaces +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type InterfacesClient interface { + + // Delete Tier-1 interface + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param interfaceIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) error + + // Read Tier-1 interface + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param interfaceIdParam (required) + // @return com.vmware.nsx_policy.model.Tier1Interface + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) (nsx_policyModel.Tier1Interface, error) + + // Paginated list of all Tier-1 interfaces + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.Tier1InterfaceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1InterfaceListResult, error) + + // If an interface with the interface-id is not already present, create a new interface. If it already exists, update the interface for specified attributes. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param interfaceIdParam (required) + // @param tier1InterfaceParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam nsx_policyModel.Tier1Interface) error + + // If an interface with the interface-id is not already present, create a new interface. If it already exists, replace the interface with this object. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param interfaceIdParam (required) + // @param tier1InterfaceParam (required) + // @return com.vmware.nsx_policy.model.Tier1Interface + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam nsx_policyModel.Tier1Interface) (nsx_policyModel.Tier1Interface, error) +} + +type interfacesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewInterfacesClient(connector vapiProtocolClient_.Connector) *interfacesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + iIface := interfacesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &iIface +} + +func (iIface *interfacesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := iIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (iIface *interfacesClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfacesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfacesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *interfacesClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string) (nsx_policyModel.Tier1Interface, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfacesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfacesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1Interface + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1Interface + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfacesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1Interface), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *interfacesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.Tier1InterfaceListResult, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfacesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfacesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1InterfaceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1InterfaceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfacesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1InterfaceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (iIface *interfacesClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam nsx_policyModel.Tier1Interface) error { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfacesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfacesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + sv.AddStructField("Tier1Interface", tier1InterfaceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (iIface *interfacesClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, interfaceIdParam string, tier1InterfaceParam nsx_policyModel.Tier1Interface) (nsx_policyModel.Tier1Interface, error) { + typeConverter := iIface.connector.TypeConverter() + executionContext := iIface.connector.NewExecutionContext() + operationRestMetaData := interfacesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(interfacesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + sv.AddStructField("Tier1Interface", tier1InterfaceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.Tier1Interface + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := iIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.interfaces", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.Tier1Interface + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), InterfacesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.Tier1Interface), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), iIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesTypes.go new file mode 100644 index 000000000..c2f88f4c6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/InterfacesTypes.go @@ -0,0 +1,448 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Interfaces. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func interfacesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfacesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func interfacesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/interfaces/{interfaceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfacesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfacesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) +} + +func interfacesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/interfaces/{interfaceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfacesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfacesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceListResultBindingType) +} + +func interfacesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/interfaces", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfacesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["tier1_interface"] = "Tier1Interface" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfacesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func interfacesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["tier1_interface"] = "Tier1Interface" + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1_interface", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/interfaces/{interfaceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func interfacesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["tier1_interface"] = "Tier1Interface" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func InterfacesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) +} + +func interfacesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["tier1_interface"] = "Tier1Interface" + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.Tier1InterfaceBindingType) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "tier1_interface", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/interfaces/{interfaceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/LocaleServicesPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/LocaleServicesPackageTypes.go new file mode 100644 index 000000000..c0a5f7657 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/LocaleServicesPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesClient.go new file mode 100644 index 000000000..42053e1d4 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesClient.go @@ -0,0 +1,311 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ServiceInterfaces +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ServiceInterfacesClient interface { + + // Delete Tier 1 service interface + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param interfaceIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string) error + + // Read Tier 1 service interface + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param interfaceIdParam (required) + // @return com.vmware.nsx_policy.model.ServiceInterface + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string) (nsx_policyModel.ServiceInterface, error) + + // Paginated list of all Tier 1 Service Interfaces + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.ServiceInterfaceListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ServiceInterfaceListResult, error) + + // If a Tier1 service interface with the interface-id is not already present, create a new Tier1 service interface. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param interfaceIdParam (required) + // @param serviceInterfaceParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string, serviceInterfaceParam nsx_policyModel.ServiceInterface) error + + // If a Tier1 service interface with the interface-id is not already present, create a new Tier1 service interface. Modification of Tier 1 service interface is not allowed. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServiceIdParam (required) + // @param interfaceIdParam (required) + // @param serviceInterfaceParam (required) + // @return com.vmware.nsx_policy.model.ServiceInterface + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string, serviceInterfaceParam nsx_policyModel.ServiceInterface) (nsx_policyModel.ServiceInterface, error) +} + +type serviceInterfacesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewServiceInterfacesClient(connector vapiProtocolClient_.Connector) *serviceInterfacesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := serviceInterfacesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *serviceInterfacesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *serviceInterfacesClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := serviceInterfacesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(serviceInterfacesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *serviceInterfacesClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string) (nsx_policyModel.ServiceInterface, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := serviceInterfacesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(serviceInterfacesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ServiceInterface + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ServiceInterface + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServiceInterfacesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ServiceInterface), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *serviceInterfacesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.ServiceInterfaceListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := serviceInterfacesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(serviceInterfacesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ServiceInterfaceListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ServiceInterfaceListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServiceInterfacesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ServiceInterfaceListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *serviceInterfacesClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string, serviceInterfaceParam nsx_policyModel.ServiceInterface) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := serviceInterfacesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(serviceInterfacesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + sv.AddStructField("ServiceInterface", serviceInterfaceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *serviceInterfacesClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServiceIdParam string, interfaceIdParam string, serviceInterfaceParam nsx_policyModel.ServiceInterface) (nsx_policyModel.ServiceInterface, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := serviceInterfacesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(serviceInterfacesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServiceId", localeServiceIdParam) + sv.AddStructField("InterfaceId", interfaceIdParam) + sv.AddStructField("ServiceInterface", serviceInterfaceParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.ServiceInterface + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.service_interfaces", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.ServiceInterface + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ServiceInterfacesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.ServiceInterface), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesTypes.go new file mode 100644 index 000000000..dd2402b9d --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/ServiceInterfacesTypes.go @@ -0,0 +1,448 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ServiceInterfaces. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func serviceInterfacesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServiceInterfacesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func serviceInterfacesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/service-interfaces/{interfaceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func serviceInterfacesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServiceInterfacesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) +} + +func serviceInterfacesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/service-interfaces/{interfaceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func serviceInterfacesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServiceInterfacesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceListResultBindingType) +} + +func serviceInterfacesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/service-interfaces", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func serviceInterfacesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["service_interface"] = "ServiceInterface" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServiceInterfacesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func serviceInterfacesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["service_interface"] = "ServiceInterface" + paramsTypeMap["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "service_interface", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/service-interfaces/{interfaceId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func serviceInterfacesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["service_interface"] = "ServiceInterface" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ServiceInterfacesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) +} + +func serviceInterfacesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_service_id"] = vapiBindings_.NewStringType() + fields["interface_id"] = vapiBindings_.NewStringType() + fields["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_service_id"] = "LocaleServiceId" + fieldNameMap["interface_id"] = "InterfaceId" + fieldNameMap["service_interface"] = "ServiceInterface" + paramsTypeMap["service_interface"] = vapiBindings_.NewReferenceType(nsx_policyModel.ServiceInterfaceBindingType) + paramsTypeMap["locale_service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["interface_id"] = vapiBindings_.NewStringType() + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServiceId"] = vapiBindings_.NewStringType() + paramsTypeMap["interfaceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["interface_id"] = "interfaceId" + pathParams["locale_service_id"] = "localeServiceId" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "service_interface", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServiceId}/service-interfaces/{interfaceId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsClient.go new file mode 100644 index 000000000..7a94ac70e --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsClient.go @@ -0,0 +1,248 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: SessionTimerProfileBindings +// Used by client-side stubs. + +package locale_services + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type SessionTimerProfileBindingsClient interface { + + // API will delete Session Timer Profile Binding for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string) error + + // API will get Session Timer Profile Binding Map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @return com.vmware.nsx_policy.model.SessionTimerProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string) (nsx_policyModel.SessionTimerProfileBindingMap, error) + + // API will create or update Session Timer profile binding map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @param sessionTimerProfileBindingMapParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) error + + // API will create or update Session Timer profile binding map for Tier-1 Logical Router LocaleServices. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam (required) + // @param localeServicesIdParam (required) + // @param sessionTimerProfileBindingIdParam (required) + // @param sessionTimerProfileBindingMapParam (required) + // @return com.vmware.nsx_policy.model.SessionTimerProfileBindingMap + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) (nsx_policyModel.SessionTimerProfileBindingMap, error) +} + +type sessionTimerProfileBindingsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSessionTimerProfileBindingsClient(connector vapiProtocolClient_.Connector) *sessionTimerProfileBindingsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.session_timer_profile_bindings") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := sessionTimerProfileBindingsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sessionTimerProfileBindingsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sessionTimerProfileBindingsClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.session_timer_profile_bindings", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string) (nsx_policyModel.SessionTimerProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.session_timer_profile_bindings", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionTimerProfileBindingsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SessionTimerProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + sv.AddStructField("SessionTimerProfileBindingMap", sessionTimerProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.session_timer_profile_bindings", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (sIface *sessionTimerProfileBindingsClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, localeServicesIdParam string, sessionTimerProfileBindingIdParam string, sessionTimerProfileBindingMapParam nsx_policyModel.SessionTimerProfileBindingMap) (nsx_policyModel.SessionTimerProfileBindingMap, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionTimerProfileBindingsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionTimerProfileBindingsUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("LocaleServicesId", localeServicesIdParam) + sv.AddStructField("SessionTimerProfileBindingId", sessionTimerProfileBindingIdParam) + sv.AddStructField("SessionTimerProfileBindingMap", sessionTimerProfileBindingMapParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.locale_services.session_timer_profile_bindings", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.SessionTimerProfileBindingMap + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionTimerProfileBindingsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.SessionTimerProfileBindingMap), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsTypes.go new file mode 100644 index 000000000..f0b914f0f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services/SessionTimerProfileBindingsTypes.go @@ -0,0 +1,341 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: SessionTimerProfileBindings. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package locale_services + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func sessionTimerProfileBindingsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionTimerProfileBindingsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) +} + +func sessionTimerProfileBindingsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionTimerProfileBindingsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "session_timer_profile_binding_map", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func sessionTimerProfileBindingsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionTimerProfileBindingsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) +} + +func sessionTimerProfileBindingsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["locale_services_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + fields["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["locale_services_id"] = "LocaleServicesId" + fieldNameMap["session_timer_profile_binding_id"] = "SessionTimerProfileBindingId" + fieldNameMap["session_timer_profile_binding_map"] = "SessionTimerProfileBindingMap" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["locale_services_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_timer_profile_binding_map"] = vapiBindings_.NewReferenceType(nsx_policyModel.SessionTimerProfileBindingMapBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["localeServicesId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionTimerProfileBindingId"] = vapiBindings_.NewStringType() + pathParams["locale_services_id"] = "localeServicesId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + pathParams["session_timer_profile_binding_id"] = "sessionTimerProfileBindingId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "session_timer_profile_binding_map", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/locale-services/{localeServicesId}/session-timer-profile-bindings/{sessionTimerProfileBindingId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatPackageTypes.go new file mode 100644 index 000000000..9b37fcade --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package nat diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesClient.go new file mode 100644 index 000000000..049d2aa6f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesClient.go @@ -0,0 +1,311 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: NatRules +// Used by client-side stubs. + +package nat + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type NatRulesClient interface { + + // Delete NAT Rule from Tier-1 denoted by Tier-1 ID, under NAT section denoted by . Under tier-1 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param natIdParam NAT id (required) + // @param natRuleIdParam Rule ID (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string) error + + // Get NAT Rule from Tier-1 denoted by Tier-1 ID, under NAT section denoted by . Under tier-1 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. Note: IPSecVpnSession as Scope: Please note that old IPSecVpnSession policy path deprecated. If user specifiy old IPSecVpnSession path in the scope property in the PATCH/PUT PoliycNatRule API, the path returned in the GET response payload will be a new path instead of the deprecated IPSecVpnSession path Both old and new IPSecVpnSession path refer to same resource. there is no functional impact. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param natIdParam NAT id (required) + // @param natRuleIdParam Rule ID (required) + // @return com.vmware.nsx_policy.model.PolicyNatRule + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string) (nsx_policyModel.PolicyNatRule, error) + + // List NAT Rules from Tier-1 denoted by Tier-1 ID, under NAT section denoted by . Under tier-1 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. Note: IPSecVpnSession as Scope: Please note that old IPSecVpnSession policy path deprecated. If user specifiy old IPSecVpnSession path in the scope property in the PATCH/PUT PoliycNatRule API, the path returned in the GET response payload will be a new path instead of the deprecated IPSecVpnSession path Both old and new IPSecVpnSession path refer to same resource. there is no functional impact. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param natIdParam NAT id (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyNatRuleListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatRuleListResult, error) + + // If a NAT Rule is not already present on Tier-1 denoted by Tier-1 ID, under NAT section denoted by , create a new NAT Rule. If it already exists, update the NAT Rule. Under tier-1 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. Note: IPSecVpnSession as Scope: Please note that old IPSecVpnSession policy path deprecated. If user specifiy old IPSecVpnSession path in the scope property, the path returned in the GET response payload will be a new path instead of the deprecated IPSecVpnSession path Both old and new IPSecVpnSession path refer to same resource. there is no functional impact. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param natIdParam NAT id (required) + // @param natRuleIdParam Rule ID (required) + // @param policyNatRuleParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam nsx_policyModel.PolicyNatRule) error + + // Update NAT Rule on Tier-1 denoted by Tier-1 ID, under NAT section denoted by . Under tier-1 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. Note: IPSecVpnSession as Scope: Please note that old IPSecVpnSession policy path deprecated. If user specifiy old IPSecVpnSession path in the scope property in the PUT API, the path returned in the GET/PUT response payload will be a new path instead of the deprecated IPSecVpnSession path Both old and new IPSecVpnSession path refer to same resource. there is no functional impact. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param natIdParam NAT id (required) + // @param natRuleIdParam Rule ID (required) + // @param policyNatRuleParam (required) + // @return com.vmware.nsx_policy.model.PolicyNatRule + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam nsx_policyModel.PolicyNatRule) (nsx_policyModel.PolicyNatRule, error) +} + +type natRulesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewNatRulesClient(connector vapiProtocolClient_.Connector) *natRulesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + "patch": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "patch"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + nIface := natRulesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &nIface +} + +func (nIface *natRulesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := nIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (nIface *natRulesClient) Delete(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string) error { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natRulesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natRulesDeleteInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("NatId", natIdParam) + sv.AddStructField("NatRuleId", natRuleIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (nIface *natRulesClient) Get(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string) (nsx_policyModel.PolicyNatRule, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natRulesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natRulesGetInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("NatId", natIdParam) + sv.AddStructField("NatRuleId", natRuleIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyNatRule + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyNatRule + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NatRulesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyNatRule), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (nIface *natRulesClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatRuleListResult, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natRulesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natRulesListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("NatId", natIdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyNatRuleListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyNatRuleListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NatRulesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyNatRuleListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (nIface *natRulesClient) Patch(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam nsx_policyModel.PolicyNatRule) error { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natRulesPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natRulesPatchInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("NatId", natIdParam) + sv.AddStructField("NatRuleId", natRuleIdParam) + sv.AddStructField("PolicyNatRule", policyNatRuleParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules", "patch", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (nIface *natRulesClient) Update(orgIdParam string, projectIdParam string, tier1IdParam string, natIdParam string, natRuleIdParam string, policyNatRuleParam nsx_policyModel.PolicyNatRule) (nsx_policyModel.PolicyNatRule, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := natRulesUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(natRulesUpdateInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("NatId", natIdParam) + sv.AddStructField("NatRuleId", natRuleIdParam) + sv.AddStructField("PolicyNatRule", policyNatRuleParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyNatRule + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.nat_rules", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyNatRule + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NatRulesUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyNatRule), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesTypes.go new file mode 100644 index 000000000..3e5933d31 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/NatRulesTypes.go @@ -0,0 +1,448 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: NatRules. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package nat + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func natRulesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatRulesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func natRulesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_rule_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["natId"] = vapiBindings_.NewStringType() + paramsTypeMap["natRuleId"] = vapiBindings_.NewStringType() + pathParams["nat_rule_id"] = "natRuleId" + pathParams["nat_id"] = "natId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/{natId}/nat-rules/{natRuleId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func natRulesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatRulesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) +} + +func natRulesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_rule_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_id"] = vapiBindings_.NewStringType() + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["natId"] = vapiBindings_.NewStringType() + paramsTypeMap["natRuleId"] = vapiBindings_.NewStringType() + pathParams["nat_rule_id"] = "natRuleId" + pathParams["nat_id"] = "natId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/{natId}/nat-rules/{natRuleId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func natRulesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatRulesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleListResultBindingType) +} + +func natRulesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["natId"] = vapiBindings_.NewStringType() + pathParams["nat_id"] = "natId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/{natId}/nat-rules", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func natRulesPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fields["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + fieldNameMap["policy_nat_rule"] = "PolicyNatRule" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatRulesPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func natRulesPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fields["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + fieldNameMap["policy_nat_rule"] = "PolicyNatRule" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_rule_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["natId"] = vapiBindings_.NewStringType() + paramsTypeMap["natRuleId"] = vapiBindings_.NewStringType() + pathParams["nat_rule_id"] = "natRuleId" + pathParams["nat_id"] = "natId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_nat_rule", + "PATCH", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/{natId}/nat-rules/{natRuleId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func natRulesUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fields["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + fieldNameMap["policy_nat_rule"] = "PolicyNatRule" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NatRulesUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) +} + +func natRulesUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["nat_id"] = vapiBindings_.NewStringType() + fields["nat_rule_id"] = vapiBindings_.NewStringType() + fields["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["nat_id"] = "NatId" + fieldNameMap["nat_rule_id"] = "NatRuleId" + fieldNameMap["policy_nat_rule"] = "PolicyNatRule" + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_rule_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nat_id"] = vapiBindings_.NewStringType() + paramsTypeMap["policy_nat_rule"] = vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleBindingType) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["natId"] = vapiBindings_.NewStringType() + paramsTypeMap["natRuleId"] = vapiBindings_.NewStringType() + pathParams["nat_rule_id"] = "natRuleId" + pathParams["nat_id"] = "natId" + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "policy_nat_rule", + "PUT", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/{natId}/nat-rules/{natRuleId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsClient.go new file mode 100644 index 000000000..aebeac1d6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsClient.go @@ -0,0 +1,109 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Statistics +// Used by client-side stubs. + +package nat + +import ( + vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors" + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core" + vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StatisticsClient interface { + + // List NAT Rules Statistics from Tier-1 denoted by Tier-1 ID. + // + // @param orgIdParam The organization ID (required) + // @param projectIdParam The project ID (required) + // @param tier1IdParam Tier-1 ID (required) + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param enforcementPointPathParam String Path of the enforcement point (optional) + // @param includeMarkForDeleteObjectsParam Include objects that are marked for deletion in results (optional, default to false) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx_policy.model.PolicyNatRuleStatisticsPerLogicalRouterListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResult, error) +} + +type statisticsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStatisticsClient(connector vapiProtocolClient_.Connector) *statisticsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.statistics") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := statisticsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *statisticsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *statisticsClient) List(orgIdParam string, projectIdParam string, tier1IdParam string, cursorParam *string, enforcementPointPathParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := statisticsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(statisticsListInputType(), typeConverter) + sv.AddStructField("OrgId", orgIdParam) + sv.AddStructField("ProjectId", projectIdParam) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("EnforcementPointPath", enforcementPointPathParam) + sv.AddStructField("IncludeMarkForDeleteObjects", includeMarkForDeleteObjectsParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.orgs.projects.infra.tier_1s.nat.statistics", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StatisticsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsTypes.go new file mode 100644 index 000000000..edcaa20a6 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat/StatisticsTypes.go @@ -0,0 +1,125 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Statistics. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package nat + +import ( + vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" + vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data" + vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol" + nsx_policyModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" + "reflect" +) + +func statisticsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StatisticsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.PolicyNatRuleStatisticsPerLogicalRouterListResultBindingType) +} + +func statisticsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["org_id"] = vapiBindings_.NewStringType() + fields["project_id"] = vapiBindings_.NewStringType() + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["org_id"] = "OrgId" + fieldNameMap["project_id"] = "ProjectId" + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["enforcement_point_path"] = "EnforcementPointPath" + fieldNameMap["include_mark_for_delete_objects"] = "IncludeMarkForDeleteObjects" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["project_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["org_id"] = vapiBindings_.NewStringType() + paramsTypeMap["enforcement_point_path"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["include_mark_for_delete_objects"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + paramsTypeMap["orgId"] = vapiBindings_.NewStringType() + paramsTypeMap["projectId"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["project_id"] = "projectId" + pathParams["org_id"] = "orgId" + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["enforcement_point_path"] = "enforcement_point_path" + queryParams["sort_by"] = "sort_by" + queryParams["include_mark_for_delete_objects"] = "include_mark_for_delete_objects" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/policy/api/v1/orgs/{orgId}/projects/{projectId}/infra/tier-1s/{tier1Id}/nat/statistics", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 04d9ead53..dd80920c3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -277,6 +277,16 @@ github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/nat github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/segments github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/context_profiles/custom_attributes +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/domains +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/ip_pools +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/realized_state +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/segments +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/locale_services +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects/infra/tier_1s/nat github.com/vmware/vsphere-automation-sdk-go/services/nsxt/search # github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm v0.8.0 ## explicit; go 1.17 diff --git a/website/docs/d/policy_context_profile.html.markdown b/website/docs/d/policy_context_profile.html.markdown index 7d1b84b4b..5c2294488 100644 --- a/website/docs/d/policy_context_profile.html.markdown +++ b/website/docs/d/policy_context_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_context_profile" "diameter" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_context_profile" "demoprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demoprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_dhcp_server.html.markdown b/website/docs/d/policy_dhcp_server.html.markdown index 6e076d922..4a5131a0d 100644 --- a/website/docs/d/policy_dhcp_server.html.markdown +++ b/website/docs/d/policy_dhcp_server.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_dhcp_server" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_dhcp_server" "demodhcp" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demodhcp" +} +``` + ## Argument Reference * `id` - (Optional) The ID of DHCP Server to retrieve. If ID is specified, no additional argument should be configured. * `display_name` - (Optional) The Display Name prefix of DHCP server to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_gateway_locale_service.html.markdown b/website/docs/d/policy_gateway_locale_service.html.markdown index 9dcaba573..f1fc0a82d 100644 --- a/website/docs/d/policy_gateway_locale_service.html.markdown +++ b/website/docs/d/policy_gateway_locale_service.html.markdown @@ -20,11 +20,29 @@ data "nsxt_policy_gateway_locale_service" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_gateway_locale_service" "demoserv" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + gateway_path = data.nsxt_policy_tier1_gateway.path + display_name = "demoserv" +} +``` + ## Argument Reference * `gateway_path` - (Required) Path for the gateway. * `id` - (Optional) The ID of locale service gateway to retrieve. * `display_name` - (Optional) The Display Name or prefix of locale service to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_gateway_policy.html.markdown b/website/docs/d/policy_gateway_policy.html.markdown index 23c3e27ab..c447a1b4a 100644 --- a/website/docs/d/policy_gateway_policy.html.markdown +++ b/website/docs/d/policy_gateway_policy.html.markdown @@ -20,12 +20,29 @@ data "nsxt_policy_gateway_policy" "predefined" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_gateway_policy" "demopolicy" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "default" +} +``` + ## Argument Reference * `id` - (Optional) The ID of the gateway policy to retrieve. * `domain` - (Optional) The domain of the policy, defaults to `default`. Needs to be specified in VMC environment. * `category` - (Optional) Category of the policy to retrieve. May be useful to retrieve default policy. * `display_name` - (Optional) The Display Name prefix of the policy to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_gateway_qos_profile.html.markdown b/website/docs/d/policy_gateway_qos_profile.html.markdown index 6615394b8..be7583ba7 100644 --- a/website/docs/d/policy_gateway_qos_profile.html.markdown +++ b/website/docs/d/policy_gateway_qos_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_gateway_qos_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_gateway_qos_profile" "qosprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "qosprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of GatewayQosProfile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Gateway QoS Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_group.html.markdown b/website/docs/d/policy_group.html.markdown index c357eb2c3..0c877359f 100644 --- a/website/docs/d/policy_group.html.markdown +++ b/website/docs/d/policy_group.html.markdown @@ -19,11 +19,28 @@ data "nsxt_policy_group" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_group" "demogroup" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demogroup" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Group to retrieve. * `display_name` - (Optional) The Display Name prefix of the Group to retrieve. * `domain` - (Optional) The domain this Group belongs to. For VMware Cloud on AWS use `cgw`. For Global Manager, please use site id for this field. If not specified, this field is default to `default`. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_ip_block.html.markdown b/website/docs/d/policy_ip_block.html.markdown index ea15b493d..6d6edaebf 100644 --- a/website/docs/d/policy_ip_block.html.markdown +++ b/website/docs/d/policy_ip_block.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_ip_block" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_ip_block" "demoblock" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demoblock" +} +``` + ## Argument Reference * `id` - (Optional) The ID of IP Block to retrieve. * `display_name` - (Optional) The Display Name prefix of the IP Block to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_ip_discovery_profile.html.markdown b/website/docs/d/policy_ip_discovery_profile.html.markdown index 012048c79..2a6f43430 100644 --- a/website/docs/d/policy_ip_discovery_profile.html.markdown +++ b/website/docs/d/policy_ip_discovery_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_ip_discovery_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_ip_discovery_profile" "demoprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demoprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_ip_pool.html.markdown b/website/docs/d/policy_ip_pool.html.markdown index 723c77a79..e4cba2c0f 100644 --- a/website/docs/d/policy_ip_pool.html.markdown +++ b/website/docs/d/policy_ip_pool.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_ip_pool" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_ip_pool" "demopool" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demopool" +} +``` + ## Argument Reference * `id` - (Optional) The ID of IP Pool Config to retrieve. * `display_name` - (Optional) The Display Name prefix of the IP Pool Config to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_ipv6_dad_profile.html.markdown b/website/docs/d/policy_ipv6_dad_profile.html.markdown index f3a48828b..0b6e8f93e 100644 --- a/website/docs/d/policy_ipv6_dad_profile.html.markdown +++ b/website/docs/d/policy_ipv6_dad_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_ipv6_dad_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_ipv6_dad_profile" "demodad6" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demodad6" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_ipv6_ndra_profile.html.markdown b/website/docs/d/policy_ipv6_ndra_profile.html.markdown index 91eb0aeca..551f8c25a 100644 --- a/website/docs/d/policy_ipv6_ndra_profile.html.markdown +++ b/website/docs/d/policy_ipv6_ndra_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_ipv6_ndra_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_ipv6_ndra_profile" "demondra" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demondra" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_mac_discovery_profile.html.markdown b/website/docs/d/policy_mac_discovery_profile.html.markdown index 4648616b0..0b108f5d6 100644 --- a/website/docs/d/policy_mac_discovery_profile.html.markdown +++ b/website/docs/d/policy_mac_discovery_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_mac_discovery_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_mac_discovery_profile" "macprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "macprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_qos_profile.html.markdown b/website/docs/d/policy_qos_profile.html.markdown index feca34fd6..d7c23ae9b 100644 --- a/website/docs/d/policy_qos_profile.html.markdown +++ b/website/docs/d/policy_qos_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_qos_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_qos_profile" "demoqosprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demoqosprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Profile to retrieve. * `display_name` - (Optional) The Display Name prefix of the Profile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_realization_info.html.markdown b/website/docs/d/policy_realization_info.html.markdown index a8b1ec34a..1fe7a9cc3 100644 --- a/website/docs/d/policy_realization_info.html.markdown +++ b/website/docs/d/policy_realization_info.html.markdown @@ -43,6 +43,27 @@ data "nsxt_policy_realization_info" "info" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_tier1_gateway" "tier1_gw" { + display_name = "tier1_gw" +} + +data "nsxt_policy_realization_info" "info" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + path = data.nsxt_policy_tier1_gateway.tier1_gw.path + entity_type = "RealizedLogicalRouter" + timeout = 60 +} +``` + ## Argument Reference * `path` - (Required) The policy path of the resource. @@ -50,6 +71,8 @@ data "nsxt_policy_realization_info" "info" { * `site_path` - (Optional) The path of the site which the resource belongs to, this configuration is required for global manager only. `path` field of the existing `nsxt_policy_site` can be used here. * `delay` - (Optional) Delay (in seconds) before realization polling is started. Default is set to 1. * `timeout` - (Optional) Timeout (in seconds) for realization polling. Default is set to 1200. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_security_policy.html.markdown b/website/docs/d/policy_security_policy.html.markdown index 71bb86770..d9aac65e8 100644 --- a/website/docs/d/policy_security_policy.html.markdown +++ b/website/docs/d/policy_security_policy.html.markdown @@ -21,6 +21,23 @@ data "nsxt_policy_security_policy" "predefined" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_security_policy" "predefined" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + + is_default = true + category = "Application" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Security Policy to retrieve. @@ -28,6 +45,8 @@ data "nsxt_policy_security_policy" "predefined" { * `domain` - (Optional) The domain of the policy, defaults to `default`. Needs to be specified in VMC environment. * `category` - (Optional) Category of the policy to retrieve. * `display_name` - (Optional) The Display Name of the policy to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_segment.html.markdown b/website/docs/d/policy_segment.html.markdown index f0d67b41a..33f7cb144 100644 --- a/website/docs/d/policy_segment.html.markdown +++ b/website/docs/d/policy_segment.html.markdown @@ -18,10 +18,27 @@ data "nsxt_policy_segment" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_segment" "demoseg" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demoseg" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Segment to retrieve. If ID is specified, no additional argument should be configured. * `display_name` - (Optional) The Display Name prefix of the Segment to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_segment_realization.html.markdown b/website/docs/d/policy_segment_realization.html.markdown index 4f10ef657..a235419b3 100644 --- a/website/docs/d/policy_segment_realization.html.markdown +++ b/website/docs/d/policy_segment_realization.html.markdown @@ -33,9 +33,39 @@ data "vsphere_network" "net" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_segment" "s1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "segment1" +} + +data "nsxt_policy_segment_realization" "s1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + path = nsxt_policy_segment.s1.path +} + +# usage in vsphere provider +data "vsphere_network" "net" { + name = nsxt_policy_segment_realization.s1.network_name + datacenter_id = data.vsphere_datacenter.datacenter.id +} +``` + ## Argument Reference * `path` - (Required) The policy path of the segment. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_segment_security_profile.html.markdown b/website/docs/d/policy_segment_security_profile.html.markdown index 67d050132..ec1478e4f 100644 --- a/website/docs/d/policy_segment_security_profile.html.markdown +++ b/website/docs/d/policy_segment_security_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_segment_security_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_segment_security_profile" "demosegprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demosegprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of SegmentSecurityProfile to retrieve. * `display_name` - (Optional) The Display Name prefix of the SegmentSecurityProfile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_service.html.markdown b/website/docs/d/policy_service.html.markdown index b69724681..406a828a6 100644 --- a/website/docs/d/policy_service.html.markdown +++ b/website/docs/d/policy_service.html.markdown @@ -17,10 +17,27 @@ data "nsxt_policy_service" "dns_service" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_service" "demodnssvc" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demodnssvc" +} +``` + ## Argument Reference * `id` - (Optional) The ID of service to retrieve. * `display_name` - (Optional) The Display Name prefix of the service to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_spoofguard_profile.html.markdown b/website/docs/d/policy_spoofguard_profile.html.markdown index 24c07b39a..459160113 100644 --- a/website/docs/d/policy_spoofguard_profile.html.markdown +++ b/website/docs/d/policy_spoofguard_profile.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_spoofguard_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_spoofguard_profile" "demosgprof" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demosgprof" +} +``` + ## Argument Reference * `id` - (Optional) The ID of SpoofGuardProfile to retrieve. * `display_name` - (Optional) The Display Name prefix of the SpoofGuardProfile to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/d/policy_tier1_gateway.html.markdown b/website/docs/d/policy_tier1_gateway.html.markdown index ce0dddfc0..5efe592c9 100644 --- a/website/docs/d/policy_tier1_gateway.html.markdown +++ b/website/docs/d/policy_tier1_gateway.html.markdown @@ -19,10 +19,27 @@ data "nsxt_policy_tier1_gateway" "tier1_router" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_tier1_gateway" "demotier1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "demotier1" +} +``` + ## Argument Reference * `id` - (Optional) The ID of Tier-1 gateway to retrieve. * `display_name` - (Optional) The Display Name prefix of the Tier-1 gateway to retrieve. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/r/policy_context_profile.html.markdown b/website/docs/r/policy_context_profile.html.markdown index c60f3e152..030089f9f 100644 --- a/website/docs/r/policy_context_profile.html.markdown +++ b/website/docs/r/policy_context_profile.html.markdown @@ -28,7 +28,6 @@ resource "nsxt_policy_context_profile" "test" { } } } - ``` With a custom attribute: @@ -50,6 +49,33 @@ resource "nsxt_policy_context_profile" "test2" { ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_context_profile" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned ContextProfile" + domain_name { + description = "test-domain-name-attribute" + value = ["*-myfiles.sharepoint.com"] + } + app_id { + description = "test-app-id-attribute" + value = ["SSL"] + sub_attribute { + tls_version = ["SSL_V3"] + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -59,6 +85,8 @@ Note: At least one of `app_id`, `custom_url`, domain_name`, or `url_category` mu * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `app_id` - (Optional) A block to specify app id attributes for the context profile. Only one block is allowed. * `description` - (Optional) Description of the attribute. * `value` - (Required) A list of string indicating values for the `app_id`. Must be a subset of valid values for `app_id` on NSX. diff --git a/website/docs/r/policy_context_profile_custom_attribute.html.markdown b/website/docs/r/policy_context_profile_custom_attribute.html.markdown index 8100234a9..e6151d9ab 100644 --- a/website/docs/r/policy_context_profile_custom_attribute.html.markdown +++ b/website/docs/r/policy_context_profile_custom_attribute.html.markdown @@ -20,6 +20,22 @@ resource "nsxt_policy_context_profile_custom_attribute" "test" { ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_context_profile_custom_attribute" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + key = "DOMAIN_NAME" + attribute = "test.somesite.com" +} +``` + ## Argument Reference The following arguments are supported: @@ -27,6 +43,8 @@ Note: `key`, `attribute` must be present. * `key` - (Required) Policy Custom Attribute Key. Valid values are "DOMAIN_NAME" and "CUSTOM_URL" * `attribute` - (Required) FQDN or URL to be used as custom attribute. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Importing diff --git a/website/docs/r/policy_dhcp_relay.html.markdown b/website/docs/r/policy_dhcp_relay.html.markdown index c594507c4..7931c6c16 100644 --- a/website/docs/r/policy_dhcp_relay.html.markdown +++ b/website/docs/r/policy_dhcp_relay.html.markdown @@ -21,6 +21,23 @@ resource "nsxt_policy_dhcp_relay" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_dhcp_relay" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned Dhcp Relay" + server_addresses = ["10.0.0.2", "7001::2"] +} +``` + ## Argument Reference The following arguments are supported: @@ -29,6 +46,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `server_addresses` - (Required) List of DHCP server addresses. diff --git a/website/docs/r/policy_dhcp_server.html.markdown b/website/docs/r/policy_dhcp_server.html.markdown index d3fe36631..06d8be79e 100644 --- a/website/docs/r/policy_dhcp_server.html.markdown +++ b/website/docs/r/policy_dhcp_server.html.markdown @@ -25,6 +25,25 @@ resource "nsxt_policy_dhcp_server" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_dhcp_server" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned DhcpServerConfig" + edge_cluster_path = data.nsxt_policy_edge_cluster.ec1.path + lease_time = 200 + server_addresses = ["110.64.0.1/16", "2001::1234:abcd:ffff:c0a8:101/64"] +} +``` + ## Argument Reference The following arguments are supported: @@ -33,6 +52,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `edge_cluster_path` - (Optional) The Policy path to the edge cluster for this DHCP Server. * `lease_time` - (Optional) IP address lease time in seconds. Valid values from `60` to `4294967295`. Default is `86400`. * `preferred_edge_paths` - (Optional) Policy paths to edge nodes. The first edge node is assigned as active edge, and second one as standby edge. diff --git a/website/docs/r/policy_dns_forwarder_zone.html.markdown b/website/docs/r/policy_dns_forwarder_zone.html.markdown index b31c7c20d..3f212dfc3 100644 --- a/website/docs/r/policy_dns_forwarder_zone.html.markdown +++ b/website/docs/r/policy_dns_forwarder_zone.html.markdown @@ -22,6 +22,24 @@ resource "nsxt_policy_dns_forwarder_zone" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_dns_forwarder_zone" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned Zone" + dns_domain_names = ["test.domain.org"] + upstream_servers = ["33.14.0.2"] +} +``` + ## Argument Reference The following arguments are supported: @@ -30,6 +48,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `upstream_servers` - (Required) List of server IP addresses for this Forwarder Zone. * `dns_domain_names` - (Optional) For conditional (FQDN) zones, a list of maximum 5 domains. For Default Forwarder Zone, this attribute should not be specified. * `source_ip` - (Optional) The source IP address used by the DNS Forwarder zone. diff --git a/website/docs/r/policy_fixed_segment.html.markdown b/website/docs/r/policy_fixed_segment.html.markdown index a61c9957a..dbf9b6664 100644 --- a/website/docs/r/policy_fixed_segment.html.markdown +++ b/website/docs/r/policy_fixed_segment.html.markdown @@ -43,6 +43,43 @@ resource "nsxt_policy_fixed_segment" "segment1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_fixed_segment" "segment1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "segment1" + description = "Terraform provisioned Segment" + connectivity_path = nsxt_policy_tier1_gateway.mygateway.path + + subnet { + cidr = "12.12.2.1/24" + dhcp_ranges = ["12.12.2.100-12.12.2.160"] + + dhcp_v4_config { + server_address = "12.12.2.2/24" + lease_time = 36000 + + dhcp_option_121 { + network = "6.6.6.0/24" + next_hop = "1.1.1.21" + } + + dhcp_generic_option { + code = "119" + values = ["abc"] + } + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -52,6 +89,8 @@ The following arguments are supported: * `tag` - (Optional) A list of scope + tag pairs to associate with this policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. * `connectivity_path` - (Required) Policy path to the connecting Tier-0 or Tier-1. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `domain_name`- (Optional) DNS domain names. * `overlay_id` - (Optional) Overlay connectivity ID for this Segment. * `vlan_ids` - (Optional) List of VLAN IDs or ranges. Specifying vlan ids can be useful for overlay segments, f.e. for EVPN. diff --git a/website/docs/r/policy_gateway_dns_forwarder.html.markdown b/website/docs/r/policy_gateway_dns_forwarder.html.markdown index b27829e76..ff1c75aad 100644 --- a/website/docs/r/policy_gateway_dns_forwarder.html.markdown +++ b/website/docs/r/policy_gateway_dns_forwarder.html.markdown @@ -32,6 +32,30 @@ resource "nsxt_policy_gateway_dns_forwarder" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_gateway_dns_forwarder" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned Zone" + gateway_path = nsxt_policy_tier1_gateway.test.path + listener_ip = "122.30.0.13" + enabled = true + log_level = "DEBUG" + cache_size = 2048 + + default_forwarder_zone_path = nsxt_policy_forwarder_zone.default.path + conditional_forwarder_zone_paths = [nsxt_policy_forwarder_zone.oranges.path, nsxt_policy_forwarder_zone.apples.path] +} +``` + ## Argument Reference The following arguments are supported: @@ -41,6 +65,8 @@ The following arguments are supported: * `listener_ip` - (Required) IP address on which the DNS Forwarder listens. * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `default_forwarder_zone_path` - (Required) Path of Default Forwarder Zone. * `conditional_forwarder_zone_paths` - (Optional) List of conditional (FQDN) Zone Paths (Maximum 5 zones). * `enabled` - (Optional) Flag to indicate whether this DNS Forwarder is enabled. Defaults to `true`. diff --git a/website/docs/r/policy_gateway_policy.html.markdown b/website/docs/r/policy_gateway_policy.html.markdown index 8e52b5834..f1d67c57a 100644 --- a/website/docs/r/policy_gateway_policy.html.markdown +++ b/website/docs/r/policy_gateway_policy.html.markdown @@ -81,6 +81,45 @@ resource "nsxt_policy_gateway_policy" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_gateway_policy" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "tf-gw-policy" + description = "Terraform provisioned Gateway Policy" + category = "LocalGatewayRules" + locked = false + sequence_number = 3 + stateful = true + tcp_strict = false + + tag { + scope = "color" + tag = "orange" + } + + rule { + display_name = "rule1" + destination_groups = [nsxt_policy_group.group1.path, nsxt_policy_group.group2.path] + disabled = true + action = "DROP" + logged = true + scope = [nsxt_policy_tier1_gateway.policygateway.path] + } + + lifecycle { + create_before_destroy = true + } +} +``` + -> We recommend using `lifecycle` directive as in samples above, in order to avoid dependency issues when updating groups/services simultaneously with the rule. ## Argument Reference @@ -93,6 +132,8 @@ The following arguments are supported: * `domain` - (Optional) The domain to use for the Gateway Policy. This domain must already exist. For VMware Cloud on AWS use `cgw`. * `tag` - (Optional) A list of scope + tag pairs to associate with this Gateway Policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the Gateway Policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `comments` - (Optional) Comments for this Gateway Policy including lock/unlock comments. * `locked` - (Optional) A boolean value indicating if the policy is locked. If locked, no other users can update the resource. * `sequence_number` - (Optional) An int value used to resolve conflicts between security policies across domains diff --git a/website/docs/r/policy_group.html.markdown b/website/docs/r/policy_group.html.markdown index 13644264b..804548f91 100644 --- a/website/docs/r/policy_group.html.markdown +++ b/website/docs/r/policy_group.html.markdown @@ -153,6 +153,38 @@ resource "nsxt_policy_group" "group1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_group" "group1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + + display_name = "tf-group1" + description = "Terraform provisioned Group" + + criteria { + condition { + key = "Name" + member_type = "VirtualMachine" + operator = "STARTSWITH" + value = "public" + } + condition { + key = "OSName" + member_type = "VirtualMachine" + operator = "CONTAINS" + value = "Ubuntu" + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -162,6 +194,8 @@ The following arguments are supported: * `domain` - (Optional) The domain to use for the Group. This domain must already exist. For VMware Cloud on AWS use `cgw`. For Global Manager, please use site id for this field. If not specified, this field is default to `default`. * `tag` - (Optional) A list of scope + tag pairs to associate with this Group. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the group resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `criteria` - (Optional) A repeatable block to specify criteria for members of this Group. If more than 1 criteria block is specified, it must be separated by a `conjunction`. In a `criteria` block the following membership selection expressions can be used: * `ipaddress_expression` - (Optional) An expression block to specify individual IP Addresses, ranges of IP Addresses or subnets for this Group. * `ip_addresses` - (Required) This list can consist of a single IP address, IP address range or a subnet. Its type can be of either IPv4 or IPv6. Both IPv4 and IPv6 addresses within one expression is not allowed. diff --git a/website/docs/r/policy_ip_address_allocation.html.markdown b/website/docs/r/policy_ip_address_allocation.html.markdown index 6933763c5..560aed9bb 100644 --- a/website/docs/r/policy_ip_address_allocation.html.markdown +++ b/website/docs/r/policy_ip_address_allocation.html.markdown @@ -21,6 +21,24 @@ resource "nsxt_policy_ip_address_allocation" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_address_allocation" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned IpAddressAllocation" + pool_path = nsxt_policy_ip_pool.pool1.path + allocation_ip = "12.12.12.12" +} +``` + ## Argument Reference The following arguments are supported: @@ -29,6 +47,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `allocation_ip` - (Optional) The IP Address to allocate. If unspecified any free IP in the pool will be allocated. * `pool_path` - (Required) The policy path to the IP Pool for this Allocation. diff --git a/website/docs/r/policy_ip_block.html.markdown b/website/docs/r/policy_ip_block.html.markdown index e35a81401..bc4c646d1 100644 --- a/website/docs/r/policy_ip_block.html.markdown +++ b/website/docs/r/policy_ip_block.html.markdown @@ -30,6 +30,32 @@ resource "nsxt_policy_ip_block" "block1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_block" "block1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "ip-block1" + cidr = "192.168.1.0/24" + + tag { + scope = "color" + tag = "blue" + } + + tag { + scope = "env" + tag = "test" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -39,6 +65,8 @@ The following arguments are supported: * `cidr` - (Required) Network address and the prefix length which will be associated with a layer-2 broadcast domain. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this IP Block. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/r/policy_ip_discovery_profile.html.markdown b/website/docs/r/policy_ip_discovery_profile.html.markdown index dee603f1f..923780f72 100644 --- a/website/docs/r/policy_ip_discovery_profile.html.markdown +++ b/website/docs/r/policy_ip_discovery_profile.html.markdown @@ -39,6 +39,41 @@ resource "nsxt_policy_ip_discovery_profile" "ip_discovery_profile" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_discovery_profile" "ip_discovery_profile" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + description = "ip discovery profile provisioned by Terraform" + display_name = "ip_discovery_profile1" + + arp_nd_binding_timeout = 20 + duplicate_ip_detection_enabled = false + + arp_binding_limit = 140 + arp_snooping_enabled = false + dhcp_snooping_enabled = false + vmtools_enabled = false + + dhcp_snooping_v6_enabled = false + nd_snooping_enabled = false + nd_snooping_limit = 12 + vmtools_v6_enabled = false + tofu_enabled = false + + tag { + scope = "color" + tag = "red" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -47,6 +82,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `arp_nd_binding_timeout` - (Optional) ARP and ND cache timeout (in minutes) * `duplicate_ip_detection_enabled` - (Optional) Duplicate IP detection * `arp_binding_limit` - (Optional) Maximum number of ARP bindings diff --git a/website/docs/r/policy_ip_pool.html.markdown b/website/docs/r/policy_ip_pool.html.markdown index ae4ac24e5..3a4242477 100644 --- a/website/docs/r/policy_ip_pool.html.markdown +++ b/website/docs/r/policy_ip_pool.html.markdown @@ -29,6 +29,31 @@ resource "nsxt_policy_ip_pool" "pool1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_pool" "pool1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "ip-pool1" + + tag { + scope = "color" + tag = "blue" + } + + tag { + scope = "env" + tag = "test" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -37,6 +62,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this IP Pool. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to ## Attributes Reference diff --git a/website/docs/r/policy_ip_pool_block_subnet.html.markdown b/website/docs/r/policy_ip_pool_block_subnet.html.markdown index 5bc94b1a1..4f9468935 100644 --- a/website/docs/r/policy_ip_pool_block_subnet.html.markdown +++ b/website/docs/r/policy_ip_pool_block_subnet.html.markdown @@ -33,6 +33,35 @@ resource "nsxt_policy_ip_pool_block_subnet" "block_subnet1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_pool_block_subnet" "block_subnet1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "block-subnet1" + pool_path = nsxt_policy_ip_pool.pool1.path + block_path = nsxt_policy_ip_block.block1.path + size = 8 + auto_assign_gateway = false + + tag { + scope = "color" + tag = "blue" + } + + tag { + scope = "env" + tag = "test" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -41,6 +70,8 @@ The following arguments are supported: * `pool_path` - (Required) The Policy path to the IP Pool for this Block Subnet. * `block_path` - (Required) The Policy path to the IP Block for this Block Subnet. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `size` - (Required) The size of this Block Subnet. Must be a power of 2 * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this Block Subnet. diff --git a/website/docs/r/policy_ip_pool_static_subnet.html.markdown b/website/docs/r/policy_ip_pool_static_subnet.html.markdown index aa938ac07..ac9a3123d 100644 --- a/website/docs/r/policy_ip_pool_static_subnet.html.markdown +++ b/website/docs/r/policy_ip_pool_static_subnet.html.markdown @@ -41,11 +41,50 @@ resource "nsxt_policy_ip_pool_static_subnet" "static_subnet1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_ip_pool_static_subnet" "static_subnet1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "static-subnet1" + pool_path = nsxt_policy_ip_pool.pool1.path + cidr = "12.12.12.0/24" + gateway = "12.12.12.1" + + allocation_range { + start = "12.12.12.10" + end = "12.12.12.20" + } + allocation_range { + start = "12.12.12.100" + end = "12.12.12.120" + } + + tag { + scope = "color" + tag = "blue" + } + + tag { + scope = "env" + tag = "test" + } +} +``` + ## Argument Reference The following arguments are supported: * `display_name` - (Required) The display name for the Static Subnet. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `pool_path` - (Required) The Policy path to the IP Pool for this Static Subnet. * `cidr` - (Required) The network CIDR * `allocation_range` - (Required) One or more IP allocation ranges for the Subnet. diff --git a/website/docs/r/policy_mac_discovery_profile.html.markdown b/website/docs/r/policy_mac_discovery_profile.html.markdown index 993578a9c..8b78d4796 100644 --- a/website/docs/r/policy_mac_discovery_profile.html.markdown +++ b/website/docs/r/policy_mac_discovery_profile.html.markdown @@ -26,6 +26,28 @@ resource "nsxt_policy_mac_discovery_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_mac_discovery_profile" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned" + mac_change_enabled = true + mac_learning_enabled = true + mac_limit = 4096 + mac_limit_policy = "ALLOW" + remote_overlay_mac_limit = 2048 + unknown_unicast_flooding_enabled = true +} +``` + ## Argument Reference The following arguments are supported: @@ -34,6 +56,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `mac_change_enabled` - (Optional) MAC address change feature. * `mac_learning_enabled` - (Optional) MAC learning feature. * `mac_limit` - (Optional) The maximum number of MAC addresses that can be learned on this port. diff --git a/website/docs/r/policy_nat_rule.html.markdown b/website/docs/r/policy_nat_rule.html.markdown index b36577188..960df8892 100644 --- a/website/docs/r/policy_nat_rule.html.markdown +++ b/website/docs/r/policy_nat_rule.html.markdown @@ -31,6 +31,33 @@ resource "nsxt_policy_nat_rule" "dnat1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_nat_rule" "dnat1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "dnat_rule1" + action = "DNAT" + source_networks = ["9.1.1.1", "9.2.1.1"] + destination_networks = ["11.1.1.1"] + translated_networks = ["10.1.1.1"] + gateway_path = nsxt_policy_tier1_gateway.t1gateway.path + logging = false + firewall_match = "MATCH_INTERNAL_ADDRESS" + + tag { + scope = "color" + tag = "blue" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -39,6 +66,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this NAT Rule. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `gateway_path` - (Required) The NSX Policy path to the Tier0 or Tier1 Gateway for this NAT Rule. * `action` - (Required) The action for the NAT Rule. One of `SNAT`, `DNAT`, `REFLEXIVE`, `NO_SNAT`, `NO_DNAT`, `NAT64`. * `destination_networks` - (Optional) A list of destination network IP addresses or CIDR. diff --git a/website/docs/r/policy_predefined_gateway_policy.html.markdown b/website/docs/r/policy_predefined_gateway_policy.html.markdown index c40bdb53c..4558ff482 100644 --- a/website/docs/r/policy_predefined_gateway_policy.html.markdown +++ b/website/docs/r/policy_predefined_gateway_policy.html.markdown @@ -71,6 +71,37 @@ resource "nsxt_policy_predefined_gateway_policy" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_gateway_policy" "default" { + category = "Default" +} + +resource "nsxt_policy_predefined_gateway_policy" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + path = data.nsxt_policy_gateway_policy.default.path + + tag { + scope = "color" + tag = "orange" + } + + default_rule { + scope = nsxt_policy_tier0_gateway.main.path + logged = true + log_label = "orange default" + action = "ALLOW" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -78,6 +109,8 @@ The following arguments are supported: * `path` - (Required) Policy path for the predefined Gateway Policy to modify. * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this Gateway Policy. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `rule` (Optional) A repeatable block to specify rules for the Gateway Policy. This setting is not applicable to policy belonging to `DEFAULT` category. Each rule includes the following fields: * `display_name` - (Required) Display name of the resource. * `description` - (Optional) Description of the resource. diff --git a/website/docs/r/policy_predefined_security_policy.html.markdown b/website/docs/r/policy_predefined_security_policy.html.markdown index b4e3d2e01..87afafe67 100644 --- a/website/docs/r/policy_predefined_security_policy.html.markdown +++ b/website/docs/r/policy_predefined_security_policy.html.markdown @@ -57,6 +57,54 @@ resource "nsxt_policy_predefined_security_policy" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +data "nsxt_policy_security_policy" "default_l3" { + is_default = true + category = "Application" +} + +resource "nsxt_policy_predefined_security_policy" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + path = data.nsxt_policy_security_policy.default_l3.path + + tag { + scope = "color" + tag = "orange" + } + + rule { + display_name = "allow_icmp" + destination_groups = [nsxt_policy_group.cats.path, nsxt_policy_group.dogs.path] + action = "ALLOW" + services = [nsxt_policy_service.icmp.path] + logged = true + } + + rule { + display_name = "allow_udp" + source_groups = [nsxt_policy_group.fish.path] + sources_excluded = true + scope = [nsxt_policy_group.aquarium.path] + action = "ALLOW" + services = [nsxt_policy_service.udp.path] + logged = true + disabled = true + } + + default_rule { + action = "DROP" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -64,6 +112,8 @@ The following arguments are supported: * `path` - (Required) Policy path for the predefined Security Policy to modify. * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this Security Policy. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `rule` (Optional) A repeatable block to specify rules for the Security Policy. This setting is applicable to non-Default policies only. Each rule includes the following fields: * `display_name` - (Required) Display name of the resource. * `description` - (Optional) Description of the resource. diff --git a/website/docs/r/policy_qos_profile.html.markdown b/website/docs/r/policy_qos_profile.html.markdown index dd2fb2022..49156b169 100644 --- a/website/docs/r/policy_qos_profile.html.markdown +++ b/website/docs/r/policy_qos_profile.html.markdown @@ -49,6 +49,51 @@ resource "nsxt_policy_qos_profile" "qos_profile" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_qos_profile" "qos_profile" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + description = "qos profile provisioned by Terraform" + display_name = "qos_profile1" + class_of_service = "5" + dscp_trusted = "true" + dscp_priority = "53" + + ingress_rate_shaper { + enabled = "true" + peak_bw_mbps = "800" + burst_size = "200" + average_bw_mbps = "100" + } + + egress_rate_shaper { + enabled = "true" + peak_bw_mbps = "800" + burst_size = "200" + average_bw_mbps = "100" + } + + ingress_broadcast_rate_shaper { + enabled = "true" + average_bw_kbps = "111" + burst_size = "222" + peak_bw_kbps = "500" + } + + tag { + scope = "color" + tag = "red" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -57,6 +102,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `class_of_service` - (Optional) Class of service. * `dscp_trusted` - (Optional) Trust mode for DSCP (False by default) * `dscp_priority` - (Optional) DSCP Priority (0-63) diff --git a/website/docs/r/policy_security_policy.html.markdown b/website/docs/r/policy_security_policy.html.markdown index 807ad9bd4..7035d35f1 100644 --- a/website/docs/r/policy_security_policy.html.markdown +++ b/website/docs/r/policy_security_policy.html.markdown @@ -91,6 +91,51 @@ resource "nsxt_policy_security_policy" "policy1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_security_policy" "policy1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "policy1" + description = "Terraform provisioned Security Policy" + category = "Application" + locked = false + stateful = true + tcp_strict = false + scope = [nsxt_policy_group.pets.path] + + rule { + display_name = "block_icmp" + destination_groups = [nsxt_policy_group.cats.path, nsxt_policy_group.dogs.path] + action = "DROP" + services = [nsxt_policy_service.icmp.path] + logged = true + } + + rule { + display_name = "allow_udp" + source_groups = [nsxt_policy_group.fish.path] + sources_excluded = true + scope = [nsxt_policy_group.aquarium.path] + action = "ALLOW" + services = [nsxt_policy_service.udp.path] + logged = true + disabled = true + notes = "Disabled by starfish for debugging" + } + + lifecycle { + create_before_destroy = true + } +} +``` + -> We recommend using `lifecycle` directive as in samples above, in order to avoid dependency issues when updating groups/services simultaneously with the rule. ## Argument Reference @@ -102,6 +147,8 @@ The following arguments are supported: * `domain` - (Optional) The domain to use for the resource. This domain must already exist. For VMware Cloud on AWS use `cgw`. For Global Manager, please use site id for this field. If not specified, this field is default to `default`. * `tag` - (Optional) A list of scope + tag pairs to associate with this policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `category` - (Required) Category of this policy. For local manager must be one of `Ethernet`, `Emergency`, `Infrastructure`, `Environment`, `Application`. For global manager must be one of: `Infrastructure`, `Environment`, `Application`. * `comments` - (Optional) Comments for security policy lock/unlock. * `locked` - (Optional) Indicates whether a security policy should be locked. If locked by a user, no other user would be able to modify this policy. diff --git a/website/docs/r/policy_segment.html.markdown b/website/docs/r/policy_segment.html.markdown index 8ce808879..4a8af43df 100644 --- a/website/docs/r/policy_segment.html.markdown +++ b/website/docs/r/policy_segment.html.markdown @@ -17,10 +17,30 @@ This resource is applicable to NSX Global Manager, NSX Policy Manager and VMC. ```hcl resource "nsxt_policy_segment" "segment1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } display_name = "segment1" description = "Terraform provisioned Segment" - connectivity_path = nsxt_policy_tier1_gateway.mygateway.path - transport_zone_path = data.nsxt_policy_transport_zone.overlay_tz.path + transport_zone_path = data.nsxt_policy_transport_zone.tz1.path + +} +``` + +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_segment" "segment1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "segment1" + description = "Terraform provisioned Segment" + connectivity_path = data.nsxt_policy_tier1_gateway.tier1_gw.path subnet { cidr = "12.12.2.1/24" @@ -41,12 +61,6 @@ resource "nsxt_policy_segment" "segment1" { } } } - - security_profile { - spoofguard_profile_path = data.nsxt_policy_spoofguard_profile.myprofile.path - security_profile_path = data.nsxt_policy_segment_security_profile.myprofile.path - } - } ``` @@ -59,6 +73,8 @@ The following arguments are supported: * `tag` - (Optional) A list of scope + tag pairs to associate with this policy. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. * `connectivity_path` - (Optional) Policy path to the connecting Tier-0 or Tier-1. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `domain_name`- (Optional) DNS domain names. * `overlay_id` - (Optional) Overlay connectivity ID for this Segment. * `vlan_ids` - (Optional) List of VLAN IDs or ranges. Specifying vlan ids can be useful for overlay segments, f.e. for EVPN. diff --git a/website/docs/r/policy_segment_security_profile.html.markdown b/website/docs/r/policy_segment_security_profile.html.markdown index abca73093..897362a6d 100644 --- a/website/docs/r/policy_segment_security_profile.html.markdown +++ b/website/docs/r/policy_segment_security_profile.html.markdown @@ -33,6 +33,35 @@ resource "nsxt_policy_segment_security_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_segment_security_profile" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned Segment Security Profile" + bpdu_filter_allow = ["01:80:c2:00:00:05"] + bpdu_filter_enable = true + dhcp_client_block_enabled = true + dhcp_client_block_v6_enabled = true + dhcp_server_block_enabled = false + dhcp_server_block_v6_enabled = true + non_ip_traffic_block_enabled = true + ra_guard_enabled = true + rate_limits_enabled = true + + rate_limit { + rx_broadcast = 1800 + } +} +``` + ## Argument Reference The following arguments are supported: @@ -41,6 +70,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `bpdu_filter_allow` - (Optional) List of allowed MAC addresses to be excluded from BPDU filtering. List of allowed MACs - `01:80:c2:00:00:00`, `01:80:c2:00:00:01`, `01:80:c2:00:00:02`, `01:80:c2:00:00:03`, `01:80:c2:00:00:04`, `01:80:c2:00:00:05`, `01:80:c2:00:00:06`, `01:80:c2:00:00:07`, `01:80:c2:00:00:08`, `01:80:c2:00:00:09`, `01:80:c2:00:00:0a`, `01:80:c2:00:00:0b`, `01:80:c2:00:00:0c`, `01:80:c2:00:00:0d`, `01:80:c2:00:00:0e`, `01:80:c2:00:00:0f`, `00:e0:2b:00:00:00`, `00:e0:2b:00:00:04`, `00:e0:2b:00:00:06`, `01:00:0c:00:00:00`, `01:00:0c:cc:cc:cc`, `01:00:0c:cc:cc:cd`, `01:00:0c:cd:cd:cd`, `01:00:0c:cc:cc:c0`, `01:00:0c:cc:cc:c1`, `01:00:0c:cc:cc:c2`, `01:00:0c:cc:cc:c3`, `01:00:0c:cc:cc:c4`, `01:00:0c:cc:cc:c5`, `01:00:0c:cc:cc:c6`, `01:00:0c:cc:cc:c7`. * `bpdu_filter_enable` - (Optional) Indicates whether BPDU filter is enabled. Default is `True`. * `dhcp_client_block_enabled` - (Optional) Filters DHCP server and/or client traffic. Default is `False`. diff --git a/website/docs/r/policy_service.html.markdown b/website/docs/r/policy_service.html.markdown index 067578616..e3ff82977 100644 --- a/website/docs/r/policy_service.html.markdown +++ b/website/docs/r/policy_service.html.markdown @@ -48,8 +48,34 @@ resource "nsxt_policy_service" "service_l4port" { tag = "pink" } } +``` + +## Example Usage - Multi-Tenancy +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} +resource "nsxt_policy_service" "service_l4port" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + description = "L4 ports service provisioned by Terraform" + display_name = "S1" + + l4_port_set_entry { + display_name = "TCP80" + description = "TCP port 80 entry" + protocol = "TCP" + destination_ports = ["80"] + } + + tag { + scope = "color" + tag = "pink" + } +} ``` ## Argument Reference @@ -60,6 +86,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to The service must contain at least 1 entry (of at least one of the types), and possibly more. * `icmp_entry` - (Optional) Set of ICMP type service entries. Each with the following attributes: * `display_name` - (Optional) Display name of the service entry. diff --git a/website/docs/r/policy_spoof_guard_profile.html.markdown b/website/docs/r/policy_spoof_guard_profile.html.markdown index aa98acf0f..8b63ecceb 100644 --- a/website/docs/r/policy_spoof_guard_profile.html.markdown +++ b/website/docs/r/policy_spoof_guard_profile.html.markdown @@ -21,6 +21,23 @@ resource "nsxt_policy_spoof_guard_profile" "test" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_spoof_guard_profile" "test" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "test" + description = "Terraform provisioned SpoofGuardProfile" + address_binding_allowlist = true +} +``` + ## Argument Reference The following arguments are supported: @@ -29,6 +46,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `address_binding_allowlist` - (Optional) If true, enable the SpoofGuard, which only allows IPs listed in address bindings. diff --git a/website/docs/r/policy_static_route.html.markdown b/website/docs/r/policy_static_route.html.markdown index f838d2241..fa8e10f0b 100644 --- a/website/docs/r/policy_static_route.html.markdown +++ b/website/docs/r/policy_static_route.html.markdown @@ -36,6 +36,38 @@ resource "nsxt_policy_static_route" "route1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_static_route" "route1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "sroute" + gateway_path = nsxt_policy_tier1_gateway.tier1_gw.path + network = "13.1.1.0/24" + + next_hop { + admin_distance = "2" + ip_address = "11.10.10.1" + } + + next_hop { + admin_distance = "4" + ip_address = "12.10.10.1" + } + + tag { + scope = "color" + tag = "blue" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -44,6 +76,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this Tier-0 gateway. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `network` - (Required) The network address in CIDR format for the route. * `gateway_path` (Required) The NSX Policy path to the Tier0 or Tier1 Gateway for this Static Route. * `next_hop` - (Required) One or more next hops for the static route. diff --git a/website/docs/r/policy_tier1_gateway.html.markdown b/website/docs/r/policy_tier1_gateway.html.markdown index 905559b37..f08728ac9 100644 --- a/website/docs/r/policy_tier1_gateway.html.markdown +++ b/website/docs/r/policy_tier1_gateway.html.markdown @@ -76,6 +76,36 @@ resource "nsxt_policy_tier1_gateway" "tier1_gw" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_tier1_gateway" "tier1_gw" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + description = "Tier-1 provisioned by Terraform" + display_name = "Tier1-gw1" + nsx_id = "predefined_id" + edge_cluster_path = data.nsxt_policy_edge_cluster.EC.path + failover_mode = "PREEMPTIVE" + default_rule_logging = "false" + enable_firewall = "true" + enable_standby_relocation = "false" + tier0_path = data.nsxt_policy_tier0_gateway.T0.path + route_advertisement_types = ["TIER1_STATIC_ROUTES", "TIER1_CONNECTED"] + pool_allocation = "ROUTING" + + tag { + scope = "color" + tag = "blue" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -84,6 +114,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this Tier-1 gateway. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `edge_cluster_path` - (Optional) The path of the edge cluster where the Tier-1 is placed.For advanced configuration, use `locale_service` clause instead. * `locale_service` - (Optional) This argument is required on NSX Global Manager. Multiple locale services can be specified for multiple locations. * `edge_cluster_path` - (Required) The path of the edge cluster where the Tier-0 is placed. diff --git a/website/docs/r/policy_tier1_gateway_interface.html.markdown b/website/docs/r/policy_tier1_gateway_interface.html.markdown index 1bd01c7d5..991fdb471 100644 --- a/website/docs/r/policy_tier1_gateway_interface.html.markdown +++ b/website/docs/r/policy_tier1_gateway_interface.html.markdown @@ -38,6 +38,27 @@ resource "nsxt_policy_tier1_gateway_interface" "if1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_tier1_gateway_interface" "if1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "segment1_interface" + description = "connection to segment1" + gateway_path = data.nsxt_policy_tier1_gateway.gw1.path + segment_path = nsxt_policy_vlan_segment.segment1.path + subnets = ["12.12.2.13/24"] + mtu = 1500 + ipv6_ndra_profile_path = data.nsxt_policy_ipv6_ndra_profile.slaac.path +} +``` + ## Argument Reference The following arguments are supported: @@ -46,6 +67,8 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `gateway_path` - (Required) Policy path for the Tier-1 Gateway. * `segment_path` - (Required) Policy path for segment to be connected with this Tier1 Gateway. * `subnets` - (Required) list of Ip Addresses/Prefixes in CIDR format, to be associated with this interface. diff --git a/website/docs/r/policy_vlan_segment.html.markdown b/website/docs/r/policy_vlan_segment.html.markdown index ffaf81d34..440efe2c3 100644 --- a/website/docs/r/policy_vlan_segment.html.markdown +++ b/website/docs/r/policy_vlan_segment.html.markdown @@ -55,6 +55,49 @@ resource "nsxt_policy_vlan_segment" "vlansegment1" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_vlan_segment" "vlansegment1" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + display_name = "vlansegment1" + description = "Terraform provisioned VLAN Segment" + transport_zone_path = data.nsxt_policy_transport_zone.vlantz.path + domain_name = "tftest2.org" + vlan_ids = ["101", "102"] + + subnet { + cidr = "12.12.2.1/24" + dhcp_ranges = ["12.12.2.100-12.12.2.160"] + + dhcp_v4_config { + server_address = "12.12.2.2/24" + lease_time = 36000 + + dhcp_option_121 { + network = "6.6.6.0/24" + next_hop = "1.1.1.21" + } + + dhcp_generic_option { + code = "119" + values = ["abc"] + } + } + } + + advanced_config { + connectivity = "ON" + } +} +``` + ## Argument Reference The following arguments are supported: diff --git a/website/docs/r/policy_vm_tags.html.markdown b/website/docs/r/policy_vm_tags.html.markdown index 1016e5adb..534c2e82a 100644 --- a/website/docs/r/policy_vm_tags.html.markdown +++ b/website/docs/r/policy_vm_tags.html.markdown @@ -41,12 +41,44 @@ resource "nsxt_policy_vm_tags" "vm1_tags" { } ``` +## Example Usage - Multi-Tenancy + +```hcl +data "nsxt_policy_project" "demoproj" { + display_name = "demoproj" +} + +resource "nsxt_policy_vm_tags" "vm1_tags" { + context { + project_id = data.nsxt_policy_project.demoproj.id + } + instance_id = vsphere_virtual_machine.vm1.id + + tag { + scope = "color" + tag = "blue" + } + + port { + segment_path = nsxt_policy_segment.seg1.path + tag { + tag { + scope = "color" + tag = "green" + } + } + } +} +``` + ## Argument Reference The following arguments are supported: * `instance_id` - (Required) ID of the Virtual Machine. Can be the instance UUID or BIOS UUID. * `tag` - (Optional) A list of scope + tag pairs to associate with this Virtual Machine. +* `context` - (Optional) The context which the object belongs to + * `project_id` - The ID of the project which the object belongs to * `port` - (Optional) Option to tag segment port auto-created for the VM on specified segment. * `segment_path` - (Required) Segment where the port is to be tagged. * `tag` - (Optional) A list of scope + tag pairs to associate with this segment port.