From aca6719f355e428725a180cc8e6435a8282c6582 Mon Sep 17 00:00:00 2001 From: Shizhao Liu Date: Thu, 6 Apr 2023 00:29:16 +0000 Subject: [PATCH] API Refactoring for VPN resources NSX API that uses locale service path of VPN resources will be deprecated this PR adds support for the new API that uses gateway path. Also change data_source_nsxt_policy_ipsec_vpn_local_endpoint to use regex-based search API. Signed-off-by: Shizhao Liu --- ...ce_nsxt_policy_ipsec_vpn_local_endpoint.go | 44 +- .../resource_nsxt_policy_ipsec_vpn_service.go | 71 ++- ...urce_nsxt_policy_ipsec_vpn_service_test.go | 127 ++++- .../resource_nsxt_policy_ipsec_vpn_session.go | 3 +- nsxt/resource_nsxt_policy_l2_vpn_service.go | 62 ++- ...esource_nsxt_policy_l2_vpn_service_test.go | 146 +++++- nsxt/resource_nsxt_policy_l2_vpn_session.go | 105 +++- .../L2vpnServicesPackageTypes.go | 11 + .../tier_0s/l2vpn_services/SessionsClient.go | 335 +++++++++++++ .../tier_0s/l2vpn_services/SessionsTypes.go | 447 ++++++++++++++++++ .../L2vpnServicesPackageTypes.go | 11 + .../tier_1s/l2vpn_services/SessionsClient.go | 335 +++++++++++++ .../tier_1s/l2vpn_services/SessionsTypes.go | 447 ++++++++++++++++++ vendor/modules.txt | 2 + 14 files changed, 2037 insertions(+), 109 deletions(-) create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/L2vpnServicesPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/L2vpnServicesPackageTypes.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsClient.go create mode 100644 vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsTypes.go 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 014f0e12f..e7ed4f2da 100644 --- a/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go +++ b/nsxt/data_source_nsxt_policy_ipsec_vpn_local_endpoint.go @@ -5,6 +5,7 @@ package nsxt import ( "fmt" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" @@ -36,42 +37,17 @@ func dataSourceNsxtPolicyIPSecVpnLocalEndpointRead(d *schema.ResourceData, m int servicePath := d.Get("service_path").(string) query := make(map[string]string) if len(servicePath) > 0 { - // In newer NSX versions, NSX removes locale service from the parent path when search API is concerned - objID := d.Get("id").(string) - objName := d.Get("display_name").(string) - client, err := newLocalEndpointClient(servicePath) - if err != nil { - return err + s := strings.Split(servicePath, "/") + if len(s) != 8 && len(s) != 6 { + // The policy path of IPSec VPN Service should be like /infra/tier-0s/aaa/locale-services/bbb/ipsec-vpn-services/ccc + // or /infra/tier-0s/aaa/ipsec-vpn-services/bbb + return fmt.Errorf("Invalid IPSec Vpn Service path: %s", servicePath) } - if objID != "" { - obj, err := client.Get(connector, objID) - if err != nil { - return fmt.Errorf("Failed to locate Local Endpoint %s/%s: %v", servicePath, objID, err) - } - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) - d.Set("local_address", obj.LocalAddress) - return nil + if len(s) == 8 { + // search API does not recognized the locale-services part in the VPN service path + servicePath = strings.Join(append(s[:4], s[6:]...), "/") } - - objList, err := client.List(connector) - if err != nil { - return fmt.Errorf("Failed to list local endpoints: %v", err) - } - - for _, obj := range objList { - if *obj.DisplayName == objName { - d.SetId(*obj.Id) - d.Set("display_name", obj.DisplayName) - d.Set("description", obj.Description) - d.Set("path", obj.Path) - d.Set("local_address", obj.LocalAddress) - return nil - } - } - return fmt.Errorf("Failed to locate Local Endpoint under %s named %s", servicePath, objName) + query["parent_path"] = fmt.Sprintf("%s*", servicePath) } objInt, err := policyDataSourceResourceReadWithValidation(d, connector, isPolicyGlobalManager(m), "IPSecVpnLocalEndpoint", query, false) if err != nil { diff --git a/nsxt/resource_nsxt_policy_ipsec_vpn_service.go b/nsxt/resource_nsxt_policy_ipsec_vpn_service.go index 10b45620b..bdbe1b970 100644 --- a/nsxt/resource_nsxt_policy_ipsec_vpn_service.go +++ b/nsxt/resource_nsxt_policy_ipsec_vpn_service.go @@ -11,7 +11,9 @@ 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/tier_0s" t0_locale_service "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" t1_locale_service "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) @@ -41,7 +43,8 @@ func resourceNsxtPolicyIPSecVpnService() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "locale_service_path": getPolicyPathSchema(true, false, "Polciy path for the locale service."), + "locale_service_path": getPolicyPathSchema(false, false, "Polciy path for the locale service."), + "gateway_path": getPolicyPathSchema(false, true, "Policy path for the gateway."), "enabled": { Type: schema.TypeBool, Description: "Enable/Disable IPSec VPN service.", @@ -77,6 +80,14 @@ func getNsxtPolicyIPSecVpnServiceByID(connector client.Connector, gwID string, i func patchNsxtPolicyIPSecVpnService(connector client.Connector, gwID string, localeServiceID string, ipSecVpnService model.IPSecVpnService, isT0 bool) error { id := *ipSecVpnService.Id + if localeServiceID == "" { + if isT0 { + client := tier_0s.NewIpsecVpnServicesClient(connector) + return client.Patch(gwID, id, ipSecVpnService) + } + client := tier_1s.NewIpsecVpnServicesClient(connector) + return client.Patch(gwID, id, ipSecVpnService) + } if isT0 { client := t0_locale_service.NewIpsecVpnServicesClient(connector) return client.Patch(gwID, localeServiceID, id, ipSecVpnService) @@ -87,6 +98,16 @@ func patchNsxtPolicyIPSecVpnService(connector client.Connector, gwID string, loc func updateNsxtPolicyIPSecVpnService(connector client.Connector, gwID string, localeServiceID string, ipSecVpnService model.IPSecVpnService, isT0 bool) error { id := *ipSecVpnService.Id + if localeServiceID == "" { + if isT0 { + client := tier_0s.NewIpsecVpnServicesClient(connector) + _, err := client.Update(gwID, id, ipSecVpnService) + return err + } + client := tier_1s.NewIpsecVpnServicesClient(connector) + _, err := client.Update(gwID, id, ipSecVpnService) + return err + } if isT0 { client := t0_locale_service.NewIpsecVpnServicesClient(connector) _, err := client.Update(gwID, localeServiceID, id, ipSecVpnService) @@ -102,15 +123,21 @@ func resourceNsxtPolicyIPSecVpnServiceImport(d *schema.ResourceData, m interface s := strings.Split(importID, "/") err := fmt.Errorf("Expected policy path for the IPSec VPN Service, got %s", importID) // The policy path of IPSec VPN Service should be like /infra/tier-0s/aaa/locale-services/bbb/ipsec-vpn-services/ccc - if len(s) != 8 { + // or /infra/tier-0s/aaa/ipsec-vpn-services/bbb + if len(s) != 8 && len(s) != 6 { return nil, err } - d.SetId(s[7]) + useLocaleService := len(s) == 8 + d.SetId(s[len(s)-1]) s = strings.Split(importID, "/ipsec-vpn-services/") if len(s) != 2 { return []*schema.ResourceData{d}, err } - d.Set("locale_service_path", s[0]) + if useLocaleService { + d.Set("locale_service_path", s[0]) + } else { + d.Set("gateway_path", s[0]) + } return []*schema.ResourceData{d}, nil } @@ -203,11 +230,18 @@ func resourceNsxtPolicyIPSecVpnServiceRead(d *schema.ResourceData, m interface{} if id == "" { return fmt.Errorf("Error obtaining IPSecVpnService ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } obj, err := getNsxtPolicyIPSecVpnServiceByID(connector, gwID, isT0, localeServiceID, id, isPolicyGlobalManager(m)) if err != nil { return handleReadError(d, "IPSecVpnService", id, err) @@ -229,11 +263,18 @@ func resourceNsxtPolicyIPSecVpnServiceRead(d *schema.ResourceData, m interface{} func resourceNsxtPolicyIPSecVpnServiceCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } isGlobalManager := isPolicyGlobalManager(m) id := d.Get("nsx_id").(string) if id == "" { @@ -285,11 +326,18 @@ func resourceNsxtPolicyIPSecVpnServiceUpdate(d *schema.ResourceData, m interface if id == "" { return fmt.Errorf("Error obtaining IPSec VPN Service ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -329,11 +377,18 @@ func resourceNsxtPolicyIPSecVpnServiceDelete(d *schema.ResourceData, m interface return fmt.Errorf("Error obtaining IPSec VPN Service ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } err = deleteNsxtPolicyIPSecVpnService(getPolicyConnector(m), gwID, localeServiceID, isT0, id) if err != nil { diff --git a/nsxt/resource_nsxt_policy_ipsec_vpn_service_test.go b/nsxt/resource_nsxt_policy_ipsec_vpn_service_test.go index 17aff117d..22bb8ca29 100644 --- a/nsxt/resource_nsxt_policy_ipsec_vpn_service_test.go +++ b/nsxt/resource_nsxt_policy_ipsec_vpn_service_test.go @@ -44,7 +44,7 @@ func TestAccResourceNsxtPolicyIPSecVpnService_basic(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyIPSecVpnServiceTemplate(true), + Config: testAccNsxtPolicyIPSecVpnServiceTemplate(true, false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceCreateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyIPSecVpnServiceCreateAttributes["display_name"]), @@ -64,7 +64,7 @@ func TestAccResourceNsxtPolicyIPSecVpnService_basic(t *testing.T) { ), }, { - Config: testAccNsxtPolicyIPSecVpnServiceTemplate(false), + Config: testAccNsxtPolicyIPSecVpnServiceTemplate(false, false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"]), @@ -84,7 +84,7 @@ func TestAccResourceNsxtPolicyIPSecVpnService_basic(t *testing.T) { ), }, { - Config: testAccNsxtPolicyIPSecVpnServiceMinimalistic(), + Config: testAccNsxtPolicyIPSecVpnServiceMinimalistic(false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceCreateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "description", ""), @@ -100,6 +100,73 @@ func TestAccResourceNsxtPolicyIPSecVpnService_basic(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPSecVpnService_GatewayPath(t *testing.T) { + testResourceName := "nsxt_policy_ipsec_vpn_service.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyLocalManager(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyIPSecVpnServiceCheckDestroy(state, accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"]) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyIPSecVpnServiceTemplate(true, true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceCreateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyIPSecVpnServiceCreateAttributes["display_name"]), + resource.TestCheckResourceAttr(testResourceName, "description", accTestPolicyIPSecVpnServiceCreateAttributes["description"]), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "enabled", accTestPolicyIPSecVpnServiceCreateAttributes["enabled"]), + resource.TestCheckResourceAttr(testResourceName, "ha_sync", accTestPolicyIPSecVpnServiceCreateAttributes["ha_sync"]), + resource.TestCheckResourceAttr(testResourceName, "ike_log_level", accTestPolicyIPSecVpnServiceCreateAttributes["ike_log_level"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.#", "1"), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.sources.0", accTestPolicyIPSecVpnServiceCreateAttributes["sources"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.destinations.0", accTestPolicyIPSecVpnServiceCreateAttributes["destinations"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.action", accTestPolicyIPSecVpnServiceCreateAttributes["action"]), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "1"), + ), + }, + { + Config: testAccNsxtPolicyIPSecVpnServiceTemplate(false, true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"]), + resource.TestCheckResourceAttr(testResourceName, "description", accTestPolicyIPSecVpnServiceUpdateAttributes["description"]), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "enabled", accTestPolicyIPSecVpnServiceUpdateAttributes["enabled"]), + resource.TestCheckResourceAttr(testResourceName, "ha_sync", accTestPolicyIPSecVpnServiceUpdateAttributes["ha_sync"]), + resource.TestCheckResourceAttr(testResourceName, "ike_log_level", accTestPolicyIPSecVpnServiceUpdateAttributes["ike_log_level"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.#", "1"), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.sources.0", accTestPolicyIPSecVpnServiceUpdateAttributes["sources"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.destinations.0", accTestPolicyIPSecVpnServiceUpdateAttributes["destinations"]), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.0.action", accTestPolicyIPSecVpnServiceUpdateAttributes["action"]), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "1"), + ), + }, + { + Config: testAccNsxtPolicyIPSecVpnServiceMinimalistic(true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyIPSecVpnServiceExists(accTestPolicyIPSecVpnServiceCreateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "description", ""), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "bypass_rule.#", "0"), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "0"), + ), + }, + }, + }) +} + func TestAccResourceNsxtPolicyIPSecVpnService_Import(t *testing.T) { resourceName := "nsxt_policy_ipsec_vpn_service.test" @@ -111,7 +178,7 @@ func TestAccResourceNsxtPolicyIPSecVpnService_Import(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyIPSecVpnServiceTemplate(true), + Config: testAccNsxtPolicyIPSecVpnServiceTemplate(true, false), }, { ResourceName: resourceName, @@ -134,7 +201,14 @@ func testAccNsxtPolicyIPSecVpnServiceImporterGetID(s *terraform.State) (string, return "", fmt.Errorf("Policy IPSecVpnService resource ID not set in resources") } localeServicePath := rs.Primary.Attributes["locale_service_path"] - return fmt.Sprintf("%s/ipsec-vpn-services/%s", localeServicePath, resourceID), nil + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return "", fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } + if localeServicePath != "" { + return fmt.Sprintf("%s/ipsec-vpn-services/%s", localeServicePath, resourceID), nil + } + return fmt.Sprintf("%s/ipsec-vpn-services/%s", gatewayPath, resourceID), nil } func testAccNsxtPolicyIPSecVpnServiceExists(displayName string, resourceName string) resource.TestCheckFunc { @@ -153,10 +227,16 @@ func testAccNsxtPolicyIPSecVpnServiceExists(displayName string, resourceName str } localeServicePath := rs.Primary.Attributes["locale_service_path"] + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - - if err != nil { - return nil + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } + if err != nil && gatewayPath == "" { + return fmt.Errorf("Invalid locale service path %s", localeServicePath) } _, err1 := getNsxtPolicyIPSecVpnServiceByID(connector, gwID, isT0, localeServiceID, resourceID, testAccIsGlobalManager()) if err1 != nil { @@ -177,9 +257,15 @@ func testAccNsxtPolicyIPSecVpnServiceCheckDestroy(state *terraform.State, displa resourceID := rs.Primary.Attributes["id"] localeServicePath := rs.Primary.Attributes["locale_service_path"] + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - - if err != nil { + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } + if err != nil && gatewayPath == "" { return nil } @@ -191,19 +277,20 @@ func testAccNsxtPolicyIPSecVpnServiceCheckDestroy(state *terraform.State, displa return nil } -func testAccNsxtPolicyIPSecVpnServiceTemplate(createFlow bool) string { +func testAccNsxtPolicyIPSecVpnServiceTemplate(createFlow bool, useGatewayPath bool) string { var attrMap map[string]string if createFlow { attrMap = accTestPolicyIPSecVpnServiceCreateAttributes } else { attrMap = accTestPolicyIPSecVpnServiceUpdateAttributes } + gatewayOrLocaleServicePath := getGatewayOrLocaleServicePath(useGatewayPath) return testAccNsxtPolicyEdgeClusterReadTemplate(getEdgeClusterName()) + testAccNsxtPolicyTier0WithEdgeClusterForVPN("test") + fmt.Sprintf(` resource "nsxt_policy_ipsec_vpn_service" "test" { display_name = "%s" description = "%s" - locale_service_path = one(nsxt_policy_tier0_gateway.test.locale_service).path + %s enabled = "%s" ha_sync = "%s" ike_log_level = "%s" @@ -217,14 +304,22 @@ resource "nsxt_policy_ipsec_vpn_service" "test" { scope = "scope1" tag = "tag1" } - }`, attrMap["display_name"], attrMap["description"], attrMap["enabled"], attrMap["ha_sync"], attrMap["ike_log_level"], attrMap["sources"], attrMap["destinations"], attrMap["action"]) + }`, attrMap["display_name"], attrMap["description"], gatewayOrLocaleServicePath, attrMap["enabled"], attrMap["ha_sync"], attrMap["ike_log_level"], attrMap["sources"], attrMap["destinations"], attrMap["action"]) +} + +func getGatewayOrLocaleServicePath(useGatewayPath bool) string { + if useGatewayPath { + return "gateway_path = nsxt_policy_tier0_gateway.test.path" + } + return "locale_service_path = one(nsxt_policy_tier0_gateway.test.locale_service).path" } -func testAccNsxtPolicyIPSecVpnServiceMinimalistic() string { +func testAccNsxtPolicyIPSecVpnServiceMinimalistic(useGatewayPath bool) string { + gatewayOrLocaleServicePath := getGatewayOrLocaleServicePath(useGatewayPath) return testAccNsxtPolicyEdgeClusterReadTemplate(getEdgeClusterName()) + testAccNsxtPolicyTier0WithEdgeClusterForVPN("test") + fmt.Sprintf(` resource "nsxt_policy_ipsec_vpn_service" "test" { display_name = "%s" - locale_service_path = one(nsxt_policy_tier0_gateway.test.locale_service).path - }`, accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"]) + %s + }`, accTestPolicyIPSecVpnServiceUpdateAttributes["display_name"], gatewayOrLocaleServicePath) } diff --git a/nsxt/resource_nsxt_policy_ipsec_vpn_session.go b/nsxt/resource_nsxt_policy_ipsec_vpn_session.go index 1d333dd63..f4327a9f2 100644 --- a/nsxt/resource_nsxt_policy_ipsec_vpn_session.go +++ b/nsxt/resource_nsxt_policy_ipsec_vpn_session.go @@ -418,7 +418,7 @@ func (c *ipsecSessionClient) Delete(connector client.Connector, id string) error func parseIPSecVPNServicePolicyPath(path string) (bool, string, string, string, error) { segs := strings.Split(path, "/") // Path should be like /infra/tier-1s/aaa/locale-services/default/ipsec-vpn-services/ccc - // or /infra/tier-0s/vmc/ipsec-vpn-services/default for VMC + // or /infra/tier-0s/aaa/ipsec-vpn-services/bbb segCount := len(segs) if segCount < 6 || segCount > 8 || (segs[segCount-2] != "ipsec-vpn-services") { // error - this is not a segment path @@ -430,7 +430,6 @@ func parseIPSecVPNServicePolicyPath(path string) (bool, string, string, string, localeServiceID := "" if segCount == 8 { - // not VMC localeServiceID = segs[5] } diff --git a/nsxt/resource_nsxt_policy_l2_vpn_service.go b/nsxt/resource_nsxt_policy_l2_vpn_service.go index 3e4107469..2f4c7bd82 100644 --- a/nsxt/resource_nsxt_policy_l2_vpn_service.go +++ b/nsxt/resource_nsxt_policy_l2_vpn_service.go @@ -11,7 +11,9 @@ 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/tier_0s" t0_locale_service "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s" t1_locale_service "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) @@ -38,7 +40,8 @@ func resourceNsxtPolicyL2VpnService() *schema.Resource { "description": getDescriptionSchema(), "revision": getRevisionSchema(), "tag": getTagsSchema(), - "locale_service_path": getPolicyPathSchema(true, false, "Policy path for the locale service."), + "locale_service_path": getPolicyPathSchema(false, false, "Polciy path for the locale service."), + "gateway_path": getPolicyPathSchema(false, true, "Policy path for the gateway."), "enable_hub": { Type: schema.TypeBool, Description: "This property applies only in SERVER mode. If set to true, traffic from any client will be replicated to all other clients. If set to false, traffic received from clients is only replicated to the local VPN endpoint.", @@ -76,12 +79,21 @@ func getNsxtPolicyL2VpnServiceByID(connector client.Connector, gwID string, isT0 func patchNsxtPolicyL2VpnService(connector client.Connector, gwID string, localeServiceID string, l2VpnService model.L2VPNService, isT0 bool) error { id := *l2VpnService.Id + if localeServiceID == "" { + if isT0 { + client := tier_0s.NewL2vpnServicesClient(connector) + return client.Patch(gwID, id, l2VpnService) + } + client := tier_1s.NewL2vpnServicesClient(connector) + return client.Patch(gwID, id, l2VpnService) + } if isT0 { client := t0_locale_service.NewL2vpnServicesClient(connector) return client.Patch(gwID, localeServiceID, id, l2VpnService) } client := t1_locale_service.NewL2vpnServicesClient(connector) return client.Patch(gwID, localeServiceID, id, l2VpnService) + } func deleteNsxtPolicyL2VpnService(connector client.Connector, gwID string, localeServiceID string, isT0 bool, id string) error { @@ -98,15 +110,21 @@ func resourceNsxtPolicyL2VpnServiceImport(d *schema.ResourceData, m interface{}) s := strings.Split(importID, "/") err := fmt.Errorf("Expected policy path for the L2 VPN Service, got %s", importID) // The policy path of L2 VPN Service should be like /infra/tier-0s/aaa/locale-services/bbb/l2vpn-services/ccc - if len(s) != 8 { + // or /infra/tier-0s/aaa/l2vpn-services/bbb + if len(s) != 8 && len(s) != 6 { return nil, err } - d.SetId(s[7]) + useLocaleService := (len(s) == 8) + d.SetId(s[len(s)-1]) s = strings.Split(importID, "/l2vpn-services/") if len(s) != 2 { return []*schema.ResourceData{d}, err } - d.Set("locale_service_path", s[0]) + if useLocaleService { + d.Set("locale_service_path", s[0]) + } else { + d.Set("gateway_path", s[0]) + } return []*schema.ResourceData{d}, nil } @@ -117,11 +135,18 @@ func resourceNsxtPolicyL2VpnServiceRead(d *schema.ResourceData, m interface{}) e if id == "" { return fmt.Errorf("Error obtaining L2VpnService ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } obj, err := getNsxtPolicyL2VpnServiceByID(connector, gwID, isT0, localeServiceID, id, isPolicyGlobalManager(m)) if err != nil { return handleReadError(d, "L2VpnService", id, err) @@ -143,11 +168,18 @@ func resourceNsxtPolicyL2VpnServiceRead(d *schema.ResourceData, m interface{}) e func resourceNsxtPolicyL2VpnServiceCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } isGlobalManager := isPolicyGlobalManager(m) id := d.Get("nsx_id").(string) if id == "" { @@ -201,11 +233,18 @@ func resourceNsxtPolicyL2VpnServiceUpdate(d *schema.ResourceData, m interface{}) if id == "" { return fmt.Errorf("Error obtaining L2 VPN Service ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -249,11 +288,18 @@ func resourceNsxtPolicyL2VpnServiceDelete(d *schema.ResourceData, m interface{}) return fmt.Errorf("Error obtaining L2 VPN Service ID") } + gatewayPath := d.Get("gateway_path").(string) localeServicePath := d.Get("locale_service_path").(string) + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - if err != nil { + if err != nil && gatewayPath == "" { return err } + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } err = deleteNsxtPolicyL2VpnService(getPolicyConnector(m), gwID, localeServiceID, isT0, id) if err != nil { diff --git a/nsxt/resource_nsxt_policy_l2_vpn_service_test.go b/nsxt/resource_nsxt_policy_l2_vpn_service_test.go index 925a27d49..1f1a393d0 100644 --- a/nsxt/resource_nsxt_policy_l2_vpn_service_test.go +++ b/nsxt/resource_nsxt_policy_l2_vpn_service_test.go @@ -46,7 +46,7 @@ func TestAccResourceNsxtPolicyL2VpnService_basic(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyL2VpnServiceMinimalistic(), + Config: testAccNsxtPolicyL2VpnServiceMinimalistic(false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "description", ""), @@ -58,7 +58,7 @@ func TestAccResourceNsxtPolicyL2VpnService_basic(t *testing.T) { ), }, { - Config: testAccNsxtPolicyL2VpnServiceTemplate(true, false), + Config: testAccNsxtPolicyL2VpnServiceTemplate(true, false, false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceCreateAttributes["display_name"]), @@ -75,7 +75,7 @@ func TestAccResourceNsxtPolicyL2VpnService_basic(t *testing.T) { ), }, { - Config: testAccNsxtPolicyL2VpnServiceTemplate(false, false), + Config: testAccNsxtPolicyL2VpnServiceTemplate(false, false, false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceUpdateAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceUpdateAttributes["display_name"]), @@ -95,6 +95,66 @@ func TestAccResourceNsxtPolicyL2VpnService_basic(t *testing.T) { }) } +func TestAccResourceNsxtPolicyL2VpnService_GatewayPath(t *testing.T) { + testResourceName := "nsxt_policy_l2_vpn_service.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyLocalManager(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyL2VpnServiceCheckDestroy(state, accTestPolicyL2VpnServiceUpdateAttributes["display_name"]) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyL2VpnServiceMinimalistic(true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "description", ""), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "0"), + ), + }, + { + Config: testAccNsxtPolicyL2VpnServiceTemplate(true, false, true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceCreateAttributes["display_name"]), + resource.TestCheckResourceAttr(testResourceName, "description", accTestPolicyL2VpnServiceCreateAttributes["description"]), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "enable_hub", accTestPolicyL2VpnServiceCreateAttributes["enable_hub"]), + resource.TestCheckResourceAttr(testResourceName, "mode", accTestPolicyL2VpnServiceCreateAttributes["mode"]), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.#", "1"), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.0", accTestPolicyL2VpnServiceCreateAttributes["encap_ip_pool"]), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "1"), + ), + }, + { + Config: testAccNsxtPolicyL2VpnServiceTemplate(false, false, true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceUpdateAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceUpdateAttributes["display_name"]), + resource.TestCheckResourceAttr(testResourceName, "description", accTestPolicyL2VpnServiceUpdateAttributes["description"]), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "enable_hub", accTestPolicyL2VpnServiceUpdateAttributes["enable_hub"]), + resource.TestCheckResourceAttr(testResourceName, "mode", accTestPolicyL2VpnServiceUpdateAttributes["mode"]), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.#", "1"), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.0", accTestPolicyL2VpnServiceUpdateAttributes["encap_ip_pool"]), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "1"), + ), + }, + }, + }) +} + func TestAccResourceNsxtPolicyL2VpnService_ClientMode(t *testing.T) { testResourceName := "nsxt_policy_l2_vpn_service.test" @@ -106,7 +166,7 @@ func TestAccResourceNsxtPolicyL2VpnService_ClientMode(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyL2VpnServiceTemplate(false, true), + Config: testAccNsxtPolicyL2VpnServiceTemplate(false, true, false), Check: resource.ComposeTestCheckFunc( testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateClientModeAttributes["display_name"], testResourceName), resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceCreateClientModeAttributes["display_name"]), @@ -126,6 +186,37 @@ func TestAccResourceNsxtPolicyL2VpnService_ClientMode(t *testing.T) { }) } +func TestAccResourceNsxtPolicyL2VpnService_ClientMode_GatewayPath(t *testing.T) { + testResourceName := "nsxt_policy_l2_vpn_service.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyLocalManager(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyL2VpnServiceCheckDestroy(state, accTestPolicyL2VpnServiceCreateClientModeAttributes["display_name"]) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyL2VpnServiceTemplate(false, true, true), + Check: resource.ComposeTestCheckFunc( + testAccNsxtPolicyL2VpnServiceExists(accTestPolicyL2VpnServiceCreateClientModeAttributes["display_name"], testResourceName), + resource.TestCheckResourceAttr(testResourceName, "display_name", accTestPolicyL2VpnServiceCreateClientModeAttributes["display_name"]), + resource.TestCheckResourceAttr(testResourceName, "description", accTestPolicyL2VpnServiceCreateClientModeAttributes["description"]), + resource.TestCheckResourceAttrSet(testResourceName, "gateway_path"), + resource.TestCheckResourceAttr(testResourceName, "enable_hub", accTestPolicyL2VpnServiceCreateClientModeAttributes["enable_hub"]), + resource.TestCheckResourceAttr(testResourceName, "mode", accTestPolicyL2VpnServiceCreateClientModeAttributes["mode"]), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.#", "1"), + resource.TestCheckResourceAttr(testResourceName, "encap_ip_pool.0", accTestPolicyL2VpnServiceCreateClientModeAttributes["encap_ip_pool"]), + resource.TestCheckResourceAttrSet(testResourceName, "nsx_id"), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "revision"), + resource.TestCheckResourceAttr(testResourceName, "tag.#", "1"), + ), + }, + }, + }) +} + func TestAccResourceNsxtPolicyL2VpnService_Import(t *testing.T) { resourceName := "nsxt_policy_l2_vpn_service.test" @@ -137,7 +228,7 @@ func TestAccResourceNsxtPolicyL2VpnService_Import(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyL2VpnServiceTemplate(true, false), + Config: testAccNsxtPolicyL2VpnServiceTemplate(true, false, false), }, { ResourceName: resourceName, @@ -160,7 +251,14 @@ func testAccNsxtPolicyL2VpnServiceImporterGetID(s *terraform.State) (string, err return "", fmt.Errorf("Policy L2VpnService resource ID not set in resources") } localeServicePath := rs.Primary.Attributes["locale_service_path"] - return fmt.Sprintf("%s/l2vpn-services/%s", localeServicePath, resourceID), nil + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return "", fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } + if localeServicePath != "" { + return fmt.Sprintf("%s/l2vpn-services/%s", localeServicePath, resourceID), nil + } + return fmt.Sprintf("%s/l2vpn-services/%s", gatewayPath, resourceID), nil } func testAccNsxtPolicyL2VpnServiceExists(displayName string, resourceName string) resource.TestCheckFunc { @@ -179,10 +277,16 @@ func testAccNsxtPolicyL2VpnServiceExists(displayName string, resourceName string } localeServicePath := rs.Primary.Attributes["locale_service_path"] + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - - if err != nil { - return nil + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } + if err != nil && gatewayPath == "" { + return fmt.Errorf("Invalid locale service path %s", localeServicePath) } _, err1 := getNsxtPolicyL2VpnServiceByID(connector, gwID, isT0, localeServiceID, resourceID, testAccIsGlobalManager()) if err1 != nil { @@ -203,9 +307,15 @@ func testAccNsxtPolicyL2VpnServiceCheckDestroy(state *terraform.State, displayNa resourceID := rs.Primary.Attributes["id"] localeServicePath := rs.Primary.Attributes["locale_service_path"] + gatewayPath := rs.Primary.Attributes["gateway_path"] + if gatewayPath == "" && localeServicePath == "" { + return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") + } isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) - - if err != nil { + if localeServiceID == "" { + isT0, gwID = parseGatewayPolicyPath(gatewayPath) + } + if err != nil && gatewayPath == "" { return nil } @@ -217,7 +327,7 @@ func testAccNsxtPolicyL2VpnServiceCheckDestroy(state *terraform.State, displayNa return nil } -func testAccNsxtPolicyL2VpnServiceTemplate(createFlow bool, clientMode bool) string { +func testAccNsxtPolicyL2VpnServiceTemplate(createFlow bool, clientMode bool, useGatewayPath bool) string { var attrMap map[string]string if clientMode { attrMap = accTestPolicyL2VpnServiceCreateClientModeAttributes @@ -228,12 +338,13 @@ func testAccNsxtPolicyL2VpnServiceTemplate(createFlow bool, clientMode bool) str attrMap = accTestPolicyL2VpnServiceUpdateAttributes } } + gatewayOrLocaleServicePath := getGatewayOrLocaleServicePath(useGatewayPath) return testAccNsxtPolicyEdgeClusterReadTemplate(getEdgeClusterName()) + testAccNsxtPolicyTier0WithEdgeClusterForVPN("test") + fmt.Sprintf(` resource "nsxt_policy_l2_vpn_service" "test" { display_name = "%s" description = "%s" - locale_service_path = one(nsxt_policy_tier0_gateway.test.locale_service).path + %s enable_hub = "%s" mode = "%s" encap_ip_pool = ["%s"] @@ -241,14 +352,15 @@ func testAccNsxtPolicyL2VpnServiceTemplate(createFlow bool, clientMode bool) str scope = "scope1" tag = "tag1" } - }`, attrMap["display_name"], attrMap["description"], attrMap["enable_hub"], attrMap["mode"], attrMap["encap_ip_pool"]) + }`, attrMap["display_name"], attrMap["description"], gatewayOrLocaleServicePath, attrMap["enable_hub"], attrMap["mode"], attrMap["encap_ip_pool"]) } -func testAccNsxtPolicyL2VpnServiceMinimalistic() string { +func testAccNsxtPolicyL2VpnServiceMinimalistic(useGatewayPath bool) string { + gatewayOrLocaleServicePath := getGatewayOrLocaleServicePath(useGatewayPath) return testAccNsxtPolicyEdgeClusterReadTemplate(getEdgeClusterName()) + testAccNsxtPolicyTier0WithEdgeClusterForVPN("test") + fmt.Sprintf(` resource "nsxt_policy_l2_vpn_service" "test" { display_name = "%s" - locale_service_path = one(nsxt_policy_tier0_gateway.test.locale_service).path - }`, accTestPolicyL2VpnServiceUpdateAttributes["display_name"]) + %s + }`, accTestPolicyL2VpnServiceUpdateAttributes["display_name"], gatewayOrLocaleServicePath) } diff --git a/nsxt/resource_nsxt_policy_l2_vpn_session.go b/nsxt/resource_nsxt_policy_l2_vpn_session.go index 6d37aef9b..e4ff737c6 100644 --- a/nsxt/resource_nsxt_policy_l2_vpn_session.go +++ b/nsxt/resource_nsxt_policy_l2_vpn_session.go @@ -10,8 +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" - t0_l2vpn_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services/l2vpn_services" - t1_l2vpn_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services/l2vpn_services" + t0_l2vpn_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services" + t0_l2vpn_nested_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services/l2vpn_services" + t1_l2vpn_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services" + t1_l2vpn_nested_services "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services/l2vpn_services" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) @@ -146,11 +148,21 @@ func resourceNsxtPolicyL2VPNSessionCreate(d *schema.ResourceData, m interface{}) } if isT0 { - client := t0_l2vpn_services.NewSessionsClient(connector) - err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + if localeServiceID == "" { + client := t0_l2vpn_services.NewSessionsClient(connector) + err = client.Patch(gwID, serviceID, id, obj) + } else { + client := t0_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + } } else { - client := t1_l2vpn_services.NewSessionsClient(connector) - err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + if localeServiceID == "" { + client := t1_l2vpn_services.NewSessionsClient(connector) + err = client.Patch(gwID, serviceID, id, obj) + } else { + client := t1_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + } } if err != nil { return handleCreateError("L2VPNSession", id, err) @@ -165,16 +177,21 @@ func resourceNsxtPolicyL2VPNSessionCreate(d *schema.ResourceData, m interface{}) func parseL2VPNServicePolicyPath(path string) (bool, string, string, string, error) { segs := strings.Split(path, "/") // Path should be like /infra/tier-1s/aaa/l2vpn-services/default/ipsec-vpn-services/ccc + // or /infra/tier-0s/aaa/ipsec-vpn-services/bbb segCount := len(segs) - if (segCount < 8) || (segs[segCount-2] != "l2vpn-services") { + if segCount < 6 || segCount > 8 || (segs[segCount-2] != "l2vpn-services") { // error - this is not a segment path return false, "", "", "", fmt.Errorf("Invalid L2 VPN service path %s", path) } serviceID := segs[segCount-1] - localeServiceID := segs[5] gwPath := strings.Join(segs[:4], "/") + localeServiceID := "" + if segCount == 8 { + localeServiceID = segs[5] + } + isT0, gwID := parseGatewayPolicyPath(gwPath) return isT0, gwID, localeServiceID, serviceID, nil } @@ -193,11 +210,21 @@ func resourceNsxtPolicyL2VPNSessionRead(d *schema.ResourceData, m interface{}) e var obj model.L2VPNSession if isT0 { - client := t0_l2vpn_services.NewSessionsClient(connector) - obj, err = client.Get(gwID, localeServiceID, serviceID, id) + if localeServiceID == "" { + client := t0_l2vpn_services.NewSessionsClient(connector) + obj, err = client.Get(gwID, serviceID, id) + } else { + client := t0_l2vpn_nested_services.NewSessionsClient(connector) + obj, err = client.Get(gwID, localeServiceID, serviceID, id) + } } else { - client := t1_l2vpn_services.NewSessionsClient(connector) - obj, err = client.Get(gwID, localeServiceID, serviceID, id) + if localeServiceID == "" { + client := t1_l2vpn_services.NewSessionsClient(connector) + obj, err = client.Get(gwID, serviceID, id) + } else { + client := t1_l2vpn_nested_services.NewSessionsClient(connector) + obj, err = client.Get(gwID, localeServiceID, serviceID, id) + } } if err != nil { return handleReadError(d, "L2VPNSession", id, err) @@ -238,11 +265,21 @@ func resourceNsxtPolicyL2VPNSessionRead(d *schema.ResourceData, m interface{}) e func resourceNsxtPolicyL2VpnSessionExists(isT0 bool, gwID string, localeServiceID string, serviceID string, sessionID string, connector client.Connector) (bool, error) { var err error if isT0 { - client := t0_l2vpn_services.NewSessionsClient(connector) - _, err = client.Get(gwID, localeServiceID, serviceID, sessionID) + if localeServiceID == "" { + client := t0_l2vpn_services.NewSessionsClient(connector) + _, err = client.Get(gwID, serviceID, sessionID) + } else { + client := t0_l2vpn_nested_services.NewSessionsClient(connector) + _, err = client.Get(gwID, localeServiceID, serviceID, sessionID) + } } else { - client := t1_l2vpn_services.NewSessionsClient(connector) - _, err = client.Get(gwID, localeServiceID, serviceID, sessionID) + if localeServiceID == "" { + client := t1_l2vpn_services.NewSessionsClient(connector) + _, err = client.Get(gwID, serviceID, sessionID) + } else { + client := t1_l2vpn_nested_services.NewSessionsClient(connector) + _, err = client.Get(gwID, localeServiceID, serviceID, sessionID) + } } if err == nil { @@ -307,11 +344,21 @@ func resourceNsxtPolicyL2VPNSessionUpdate(d *schema.ResourceData, m interface{}) } } if isT0 { - client := t0_l2vpn_services.NewSessionsClient(connector) - err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + if localeServiceID == "" { + client := t0_l2vpn_services.NewSessionsClient(connector) + err = client.Patch(gwID, serviceID, id, obj) + } else { + client := t0_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + } } else { - client := t1_l2vpn_services.NewSessionsClient(connector) - err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + if localeServiceID == "" { + client := t1_l2vpn_services.NewSessionsClient(connector) + err = client.Patch(gwID, serviceID, id, obj) + } else { + client := t1_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Patch(gwID, localeServiceID, serviceID, id, obj) + } } if err != nil { @@ -336,11 +383,21 @@ func resourceNsxtPolicyL2VPNSessionDelete(d *schema.ResourceData, m interface{}) connector := getPolicyConnector(m) if isT0 { - client := t0_l2vpn_services.NewSessionsClient(connector) - err = client.Delete(gwID, localeServiceID, serviceID, id) + if localeServiceID == "" { + client := t0_l2vpn_services.NewSessionsClient(connector) + err = client.Delete(gwID, serviceID, id) + } else { + client := t0_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Delete(gwID, localeServiceID, serviceID, id) + } } else { - client := t1_l2vpn_services.NewSessionsClient(connector) - err = client.Delete(gwID, localeServiceID, serviceID, id) + if localeServiceID == "" { + client := t1_l2vpn_services.NewSessionsClient(connector) + err = client.Delete(gwID, serviceID, id) + } else { + client := t1_l2vpn_nested_services.NewSessionsClient(connector) + err = client.Delete(gwID, localeServiceID, serviceID, id) + } } if err != nil { diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/L2vpnServicesPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/L2vpnServicesPackageTypes.go new file mode 100644 index 000000000..3e6183939 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/L2vpnServicesPackageTypes.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.infra.tier_0s.l2vpn_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 l2vpn_services diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsClient.go new file mode 100644 index 000000000..b03689d35 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsClient.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: Sessions +// Used by client-side stubs. + +package l2vpn_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 SessionsClient interface { + + // Create or patch an L2VPN session under Tier-0 from Peer Codes. In addition to the L2VPN Session, the IPSec VPN Session, along with the IKE, Tunnel, and DPD Profiles are created and owned by the system. IPSec VPN Service and Local Endpoint are created only when required, i.e., an IPSec VPN Service does not already exist, or an IPSec VPN Local Endpoint with same local address does not already exist. Updating the L2VPN Session can be performed only through this API by specifying new peer codes. Use of specific APIs to update the L2VPN Session and the different resources associated with it is not allowed, except for IPSec VPN Service and Local Endpoint, resources that are not system owned. API supported only when L2VPN Service is in Client Mode. + // + // @param tier0IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionDataParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Createwithpeercode(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionDataParam nsx_policyModel.L2VPNSessionData) error + + // Delete L2VPN session under Tier-0. When L2VPN Service is in CLIENT Mode, the L2VPN Session is deleted along with its transpot tunnels and related resources. + // + // @param tier0IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(tier0IdParam string, serviceIdParam string, sessionIdParam string) error + + // Get L2VPN session under Tier-0. + // + // @param tier0IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @return com.vmware.nsx_policy.model.L2VPNSession + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(tier0IdParam string, serviceIdParam string, sessionIdParam string) (nsx_policyModel.L2VPNSession, error) + + // Get paginated list of all L2VPN sessions under Tier-0. + // + // @param tier0IdParam (required) + // @param serviceIdParam (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.L2VPNSessionListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(tier0IdParam string, serviceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L2VPNSessionListResult, error) + + // Create or patch an L2VPN session under Tier-0. API supported only when L2VPN Service is in Server Mode. + // + // @param tier0IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) error + + // Create or fully replace L2VPN session under Tier-0. API supported only when L2VPN Service is in Server Mode. Revision is optional for creation and required for update. + // + // @param tier0IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionParam (required) + // @return com.vmware.nsx_policy.model.L2VPNSession + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) (nsx_policyModel.L2VPNSession, error) +} + +type sessionsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSessionsClient(connector vapiProtocolClient_.Connector) *sessionsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "createwithpeercode": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "createwithpeercode"), + "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 := sessionsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sessionsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sessionsClient) Createwithpeercode(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionDataParam nsx_policyModel.L2VPNSessionData) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsCreatewithpeercodeRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsCreatewithpeercodeInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSessionData", l2VPNSessionDataParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "createwithpeercode", 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 *sessionsClient) Delete(tier0IdParam string, serviceIdParam string, sessionIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsDeleteInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "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 *sessionsClient) Get(tier0IdParam string, serviceIdParam string, sessionIdParam string) (nsx_policyModel.L2VPNSession, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsGetInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L2VPNSession + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSession + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSession), 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 *sessionsClient) List(tier0IdParam string, serviceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L2VPNSessionListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsListInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + 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.L2VPNSessionListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSessionListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSessionListResult), 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 *sessionsClient) Patch(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsPatchInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSession", l2VPNSessionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "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 *sessionsClient) Update(tier0IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) (nsx_policyModel.L2VPNSession, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsUpdateInputType(), typeConverter) + sv.AddStructField("Tier0Id", tier0IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSession", l2VPNSessionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L2VPNSession + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_0s.l2vpn_services.sessions", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSession + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSession), 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/infra/tier_0s/l2vpn_services/SessionsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsTypes.go new file mode 100644 index 000000000..fe7257737 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services/SessionsTypes.go @@ -0,0 +1,447 @@ +// 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: Sessions. +// 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 l2vpn_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 sessionsCreatewithpeercodeInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session_data"] = "L2VPNSessionData" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsCreatewithpeercodeOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsCreatewithpeercodeRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session_data"] = "L2VPNSessionData" + paramsTypeMap["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + paramsTypeMap["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=create_with_peer_code", + "l2_VPN_session_data", + "POST", + "/policy/api/v1/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + paramsTypeMap["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + 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/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) +} + +func sessionsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + paramsTypeMap["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + 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/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["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["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + 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 SessionsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionListResultBindingType) +} + +func sessionsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["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["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + 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["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["service_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["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["service_id"] = "serviceId" + 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/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions", + "", + 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 sessionsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + paramsTypeMap["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l2_VPN_session", + "PATCH", + "/policy/api/v1/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) +} + +func sessionsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier0_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier0_id"] = "Tier0Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + paramsTypeMap["tier0_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier0Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier0_id"] = "tier0Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l2_VPN_session", + "PUT", + "/policy/api/v1/infra/tier-0s/{tier0Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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/infra/tier_1s/l2vpn_services/L2vpnServicesPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/L2vpnServicesPackageTypes.go new file mode 100644 index 000000000..0ab150e77 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/L2vpnServicesPackageTypes.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.infra.tier_1s.l2vpn_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 l2vpn_services diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsClient.go new file mode 100644 index 000000000..9c79906dd --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsClient.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: Sessions +// Used by client-side stubs. + +package l2vpn_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 SessionsClient interface { + + // Create or patch an L2VPN session under Tier-1 from Peer Codes. In addition to the L2VPN Session, the IPSec VPN Session, along with the IKE, Tunnel, and DPD Profiles are created and owned by the system. IPSec VPN Service and Local Endpoint are created only when required, i.e., an IPSec VPN Service does not already exist, or an IPSec VPN Local Endpoint with same local address does not already exist. Updating the L2VPN Session can be performed only through this API by specifying new peer codes. Use of specific APIs to update the L2VPN Session and the different resources associated with it is not allowed, except for IPSec VPN Service and Local Endpoint, resources that are not system owned. API supported only when L2VPN Service is in Client Mode. + // + // @param tier1IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionDataParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Createwithpeercode(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionDataParam nsx_policyModel.L2VPNSessionData) error + + // Delete L2VPN session under Tier-1. When L2VPN Service is in CLIENT Mode, the L2VPN Session is deleted along with its transpot tunnels and related resources. + // + // @param tier1IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(tier1IdParam string, serviceIdParam string, sessionIdParam string) error + + // Get L2VPN session under Tier-1. + // + // @param tier1IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @return com.vmware.nsx_policy.model.L2VPNSession + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(tier1IdParam string, serviceIdParam string, sessionIdParam string) (nsx_policyModel.L2VPNSession, error) + + // Get paginated list of all L2VPN sessions under Tier-1. + // + // @param tier1IdParam (required) + // @param serviceIdParam (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.L2VPNSessionListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(tier1IdParam string, serviceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L2VPNSessionListResult, error) + + // Create or patch an L2VPN session under Tier-1. API supported only when L2VPN Service is in Server Mode. + // + // @param tier1IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Patch(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) error + + // Create or fully replace L2VPN session under Tier-1. API supported only when L2VPN Service is in Server Mode. Revision is optional for creation and required for update. + // + // @param tier1IdParam (required) + // @param serviceIdParam (required) + // @param sessionIdParam (required) + // @param l2VPNSessionParam (required) + // @return com.vmware.nsx_policy.model.L2VPNSession + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) (nsx_policyModel.L2VPNSession, error) +} + +type sessionsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewSessionsClient(connector vapiProtocolClient_.Connector) *sessionsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "createwithpeercode": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "createwithpeercode"), + "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 := sessionsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *sessionsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *sessionsClient) Createwithpeercode(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionDataParam nsx_policyModel.L2VPNSessionData) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsCreatewithpeercodeRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsCreatewithpeercodeInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSessionData", l2VPNSessionDataParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "createwithpeercode", 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 *sessionsClient) Delete(tier1IdParam string, serviceIdParam string, sessionIdParam string) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsDeleteInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "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 *sessionsClient) Get(tier1IdParam string, serviceIdParam string, sessionIdParam string) (nsx_policyModel.L2VPNSession, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsGetInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L2VPNSession + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "get", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSession + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSession), 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 *sessionsClient) List(tier1IdParam string, serviceIdParam string, cursorParam *string, includeMarkForDeleteObjectsParam *bool, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsx_policyModel.L2VPNSessionListResult, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsListInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + 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.L2VPNSessionListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "list", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSessionListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSessionListResult), 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 *sessionsClient) Patch(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) error { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsPatchRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsPatchInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSession", l2VPNSessionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "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 *sessionsClient) Update(tier1IdParam string, serviceIdParam string, sessionIdParam string, l2VPNSessionParam nsx_policyModel.L2VPNSession) (nsx_policyModel.L2VPNSession, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := sessionsUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(sessionsUpdateInputType(), typeConverter) + sv.AddStructField("Tier1Id", tier1IdParam) + sv.AddStructField("ServiceId", serviceIdParam) + sv.AddStructField("SessionId", sessionIdParam) + sv.AddStructField("L2VPNSession", l2VPNSessionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsx_policyModel.L2VPNSession + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx_policy.infra.tier_1s.l2vpn_services.sessions", "update", inputDataValue, executionContext) + var emptyOutput nsx_policyModel.L2VPNSession + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), SessionsUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsx_policyModel.L2VPNSession), 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/infra/tier_1s/l2vpn_services/SessionsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsTypes.go new file mode 100644 index 000000000..0f7d672d8 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services/SessionsTypes.go @@ -0,0 +1,447 @@ +// 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: Sessions. +// 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 l2vpn_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 sessionsCreatewithpeercodeInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session_data"] = "L2VPNSessionData" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsCreatewithpeercodeOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsCreatewithpeercodeRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session_data"] = "L2VPNSessionData" + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["l2_VPN_session_data"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionDataBindingType) + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=create_with_peer_code", + "l2_VPN_session_data", + "POST", + "/policy/api/v1/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + 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/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) +} + +func sessionsGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + 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/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["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["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + 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 SessionsListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionListResultBindingType) +} + +func sessionsListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["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["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + 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["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["service_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["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["service_id"] = "serviceId" + 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/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions", + "", + 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 sessionsPatchInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsPatchOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func sessionsPatchRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + paramsTypeMap["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l2_VPN_session", + "PATCH", + "/policy/api/v1/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 sessionsUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func SessionsUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) +} + +func sessionsUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + paramsTypeMap := map[string]vapiBindings_.BindingType{} + pathParams := map[string]string{} + queryParams := map[string]string{} + headerParams := map[string]string{} + dispatchHeaderParams := map[string]string{} + bodyFieldsMap := map[string]string{} + fields["tier1_id"] = vapiBindings_.NewStringType() + fields["service_id"] = vapiBindings_.NewStringType() + fields["session_id"] = vapiBindings_.NewStringType() + fields["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + fieldNameMap["tier1_id"] = "Tier1Id" + fieldNameMap["service_id"] = "ServiceId" + fieldNameMap["session_id"] = "SessionId" + fieldNameMap["l2_VPN_session"] = "L2VPNSession" + paramsTypeMap["l2_VPN_session"] = vapiBindings_.NewReferenceType(nsx_policyModel.L2VPNSessionBindingType) + paramsTypeMap["tier1_id"] = vapiBindings_.NewStringType() + paramsTypeMap["service_id"] = vapiBindings_.NewStringType() + paramsTypeMap["session_id"] = vapiBindings_.NewStringType() + paramsTypeMap["tier1Id"] = vapiBindings_.NewStringType() + paramsTypeMap["serviceId"] = vapiBindings_.NewStringType() + paramsTypeMap["sessionId"] = vapiBindings_.NewStringType() + pathParams["tier1_id"] = "tier1Id" + pathParams["session_id"] = "sessionId" + pathParams["service_id"] = "serviceId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "l2_VPN_session", + "PUT", + "/policy/api/v1/infra/tier-1s/{tier1Id}/l2vpn-services/{serviceId}/sessions/{sessionId}", + "", + 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 f7cef8832..9751b5bd3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -259,6 +259,7 @@ github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/sites/enforcemen github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/sites/enforcement_points/edge_clusters github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/ipsec_vpn_services +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/l2vpn_services github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services/bgp github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/locale_services/ipsec_vpn_services @@ -268,6 +269,7 @@ github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/nat github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_0s/static_routes github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/ipsec_vpn_services +github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/l2vpn_services github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services/ipsec_vpn_services github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/tier_1s/locale_services/l2vpn_services