From bf3909f1a1aaa07eb7e6cfd2870c368402548c51 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Mon, 30 Oct 2023 16:46:19 +0530 Subject: [PATCH] remove vpc beta sdk reference (#309) --- .../data_source_ibm_is_virtual_network_interface.go | 4 ++-- .../data_source_ibm_is_virtual_network_interfaces.go | 12 ------------ .../vpc/resource_ibm_is_security_group_target.go | 9 ++++----- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index 90a33405aa..293f2ab5ef 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -404,7 +404,7 @@ func DataSourceIBMIsVirtualNetworkInterface() *schema.Resource { } func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - vpcbetaClient, err := meta.(conns.ClientSession).VpcV1API() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return diag.FromErr(err) } @@ -413,7 +413,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceRead(context context.Context, d *sche getVirtualNetworkInterfaceOptions.SetID(d.Get("virtual_network_interface").(string)) - virtualNetworkInterface, response, err := vpcbetaClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) + virtualNetworkInterface, response, err := vpcClient.GetVirtualNetworkInterfaceWithContext(context, getVirtualNetworkInterfaceOptions) if err != nil { log.Printf("[DEBUG] GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVirtualNetworkInterfaceWithContext failed %s\n%s", err, response)) diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go index 1836a4af03..9c372095d4 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interfaces.go @@ -443,18 +443,6 @@ func dataSourceIBMIsVirtualNetworkInterfacesRead(context context.Context, d *sch return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) } - // var pager *vpcv1.VirtualNetworkInterfacesPager - // pager, err = vpcbetaClient.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptions) - // if err != nil { - // return diag.FromErr(err) - // } - - // allItems, err := pager.GetAll() - // if err != nil { - // log.Printf("[DEBUG] VirtualNetworkInterfacesPager.GetAll() failed %s", err) - // return diag.FromErr(fmt.Errorf("VirtualNetworkInterfacesPager.GetAll() failed %s", err)) - // } - d.SetId(dataSourceIBMIsVirtualNetworkInterfacesID(d)) mapSlice := []map[string]interface{}{} diff --git a/ibm/service/vpc/resource_ibm_is_security_group_target.go b/ibm/service/vpc/resource_ibm_is_security_group_target.go index 857ebccbf9..43f6a5754c 100644 --- a/ibm/service/vpc/resource_ibm_is_security_group_target.go +++ b/ibm/service/vpc/resource_ibm_is_security_group_target.go @@ -12,7 +12,6 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/vpc-beta-go-sdk/vpcbetav1" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -127,7 +126,7 @@ func resourceIBMISSecurityGroupTargetCreate(d *schema.ResourceData, meta interfa return errsgt } } else if crn != nil && *crn != "" && strings.Contains(*crn, "virtual_network_interfaces") { - vpcClient, err := meta.(conns.ClientSession).VpcV1BetaAPI() + vpcClient, err := meta.(conns.ClientSession).VpcV1API() if err != nil { return err } @@ -338,7 +337,7 @@ func isLBSgTargetRefreshFunc(sess *vpcv1.VpcV1, lbId string) resource.StateRefre } } -func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string, timeout time.Duration) (interface{}, error) { +func isWaitForVNISgTargetCreateAvailable(sess *vpcv1.VpcV1, vniId string, timeout time.Duration) (interface{}, error) { log.Printf("Waiting for virtual network interface (%s) to be available.", vniId) stateConf := &resource.StateChangeConf{ @@ -353,10 +352,10 @@ func isWaitForVNISgTargetCreateAvailable(sess *vpcbetav1.VpcbetaV1, vniId string return stateConf.WaitForState() } -func isVNISgTargetRefreshFunc(vpcClient *vpcbetav1.VpcbetaV1, vniId string) resource.StateRefreshFunc { +func isVNISgTargetRefreshFunc(vpcClient *vpcv1.VpcV1, vniId string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - getVNIOptions := &vpcbetav1.GetVirtualNetworkInterfaceOptions{ + getVNIOptions := &vpcv1.GetVirtualNetworkInterfaceOptions{ ID: &vniId, } vni, response, err := vpcClient.GetVirtualNetworkInterface(getVNIOptions)