From ec2ec23795b1991b5a274b761602ea5143ba551e Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Tue, 2 Jul 2024 22:35:14 +0000 Subject: [PATCH] Rename VPC data source according to convention Signed-off-by: Anna Khmelnitsky --- ...t_policy_vpc.go => data_source_nsxt_vpc.go} | 6 +++--- ...pc_test.go => data_source_nsxt_vpc_test.go} | 18 +++++++++--------- nsxt/provider.go | 2 +- ...icy_vpc.html.markdown => vpc.html.markdown} | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) rename nsxt/{data_source_nsxt_policy_vpc.go => data_source_nsxt_vpc.go} (86%) rename nsxt/{data_source_policy_vpc_test.go => data_source_nsxt_vpc_test.go} (85%) rename website/docs/d/{policy_vpc.html.markdown => vpc.html.markdown} (83%) diff --git a/nsxt/data_source_nsxt_policy_vpc.go b/nsxt/data_source_nsxt_vpc.go similarity index 86% rename from nsxt/data_source_nsxt_policy_vpc.go rename to nsxt/data_source_nsxt_vpc.go index 036ed07d5..04b7a25a3 100644 --- a/nsxt/data_source_nsxt_policy_vpc.go +++ b/nsxt/data_source_nsxt_vpc.go @@ -9,9 +9,9 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" ) -func dataSourceNsxtPolicyVPC() *schema.Resource { +func dataSourceNsxtVPC() *schema.Resource { return &schema.Resource{ - Read: dataSourceNsxtPolicyVPCRead, + Read: dataSourceNsxtVPCRead, Schema: map[string]*schema.Schema{ "id": getDataSourceIDSchema(), "display_name": getDataSourceDisplayNameSchema(), @@ -26,7 +26,7 @@ func dataSourceNsxtPolicyVPC() *schema.Resource { } } -func dataSourceNsxtPolicyVPCRead(d *schema.ResourceData, m interface{}) error { +func dataSourceNsxtVPCRead(d *schema.ResourceData, m interface{}) error { obj, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Vpc", nil) if err != nil { return err diff --git a/nsxt/data_source_policy_vpc_test.go b/nsxt/data_source_nsxt_vpc_test.go similarity index 85% rename from nsxt/data_source_policy_vpc_test.go rename to nsxt/data_source_nsxt_vpc_test.go index 23d7caa0b..60741b436 100644 --- a/nsxt/data_source_policy_vpc_test.go +++ b/nsxt/data_source_nsxt_vpc_test.go @@ -14,9 +14,9 @@ import ( "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects" ) -func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) { +func TestAccDataSourceNsxtVPC_basic_multitenancy(t *testing.T) { name := getAccTestDataSourceName() - testResourceName := "data.nsxt_policy_vpc.test" + testResourceName := "data.nsxt_vpc.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -26,16 +26,16 @@ func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) { }, Providers: testAccProviders, CheckDestroy: func(state *terraform.State) error { - return testAccDataSourceNsxtPolicyVPCDeleteByName(name) + return testAccDataSourceNsxtVPCDeleteByName(name) }, Steps: []resource.TestStep{ { PreConfig: func() { - if err := testAccDataSourceNsxtPolicyVPCCreate(name); err != nil { + if err := testAccDataSourceNsxtVPCCreate(name); err != nil { t.Error(err) } }, - Config: testAccNsxtPolicyVPCReadTemplate(name), + Config: testAccNsxtVPCReadTemplate(name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(testResourceName, "display_name", name), resource.TestCheckResourceAttr(testResourceName, "description", name), @@ -47,7 +47,7 @@ func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) { }) } -func testAccDataSourceNsxtPolicyVPCCreate(name string) error { +func testAccDataSourceNsxtVPCCreate(name string) error { connector, err := testAccGetPolicyConnector() if err != nil { @@ -87,7 +87,7 @@ func testAccDataSourceNsxtPolicyVPCCreate(name string) error { return nil } -func testAccDataSourceNsxtPolicyVPCDeleteByName(name string) error { +func testAccDataSourceNsxtVPCDeleteByName(name string) error { connector, err := testAccGetPolicyConnector() if err != nil { return fmt.Errorf("error during test client initialization: %v", err) @@ -113,14 +113,14 @@ func testAccDataSourceNsxtPolicyVPCDeleteByName(name string) error { return fmt.Errorf("error while deleting VPC '%s': resource not found", name) } -func testAccNsxtPolicyVPCReadTemplate(name string) string { +func testAccNsxtVPCReadTemplate(name string) string { context := testAccNsxtPolicyMultitenancyContext() return fmt.Sprintf(` data "nsxt_policy_ip_block" "test" { %s display_name = "%s" } -data "nsxt_policy_vpc" "test" { +data "nsxt_vpc" "test" { %s display_name = "%s" }`, context, name, context, name) diff --git a/nsxt/provider.go b/nsxt/provider.go index d50f7eec1..4aaa2dfb3 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -327,7 +327,7 @@ func Provider() *schema.Provider { "nsxt_policy_distributed_flood_protection_profile": dataSourceNsxtPolicyDistributedFloodProtectionProfile(), "nsxt_policy_gateway_flood_protection_profile": dataSourceNsxtPolicyGatewayFloodProtectionProfile(), "nsxt_manager_info": dataSourceNsxtManagerInfo(), - "nsxt_policy_vpc": dataSourceNsxtPolicyVPC(), + "nsxt_vpc": dataSourceNsxtVPC(), }, ResourcesMap: map[string]*schema.Resource{ diff --git a/website/docs/d/policy_vpc.html.markdown b/website/docs/d/vpc.html.markdown similarity index 83% rename from website/docs/d/policy_vpc.html.markdown rename to website/docs/d/vpc.html.markdown index 7001fd3fd..cf4e960a3 100644 --- a/website/docs/d/policy_vpc.html.markdown +++ b/website/docs/d/vpc.html.markdown @@ -1,13 +1,13 @@ --- subcategory: "Multitenancy" layout: "nsxt" -page_title: "NSXT: policy_vpc" -description: Policy VPC data source. +page_title: "NSXT: vpc" +description: VPC data source. --- -# nsxt_policy_vpc +# nsxt_vpc -This data source provides information about policy VPC configured on NSX. +This data source provides information about VPC configured on NSX. This data source is applicable to NSX Policy Manager. ## Example Usage @@ -17,7 +17,7 @@ data "nsxt_policy_project" "demoproj" { display_name = "demoproj" } -data "nsxt_policy_vpc" "test" { +data "nsxt_vpc" "test" { context { project_id = data.nsxt_policy_project.demoproj.id }