From 558ad5b6bb4ad062a7991d313a1aaf5813126abe Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 25 Oct 2023 11:08:41 +0530 Subject: [PATCH 01/13] Add volume clone resource and data source --- ibm/acctest/acctest.go | 14 ++ ibm/provider/provider.go | 2 + .../data_source_ibm_pi_volume_clone_task.go | 76 ++++++ ...ta_source_ibm_pi_volume_clone_task_test.go | 38 +++ ibm/service/power/ibm_pi_constants.go | 8 +- .../resource_ibm_pi_volume_clone_async.go | 233 ++++++++++++++++++ ...resource_ibm_pi_volume_clone_async_test.go | 95 +++++++ .../power/resource_ibm_pi_volume_group.go | 12 +- .../resource_ibm_pi_volume_group_action.go | 2 +- website/docs/d/pi_volume_clone.html.markdown | 55 +++++ website/docs/r/pi_volume_clone.html.markdown | 78 ++++++ 11 files changed, 605 insertions(+), 8 deletions(-) create mode 100644 ibm/service/power/data_source_ibm_pi_volume_clone_task.go create mode 100644 ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go create mode 100644 ibm/service/power/resource_ibm_pi_volume_clone_async.go create mode 100644 ibm/service/power/resource_ibm_pi_volume_clone_async_test.go create mode 100644 website/docs/d/pi_volume_clone.html.markdown create mode 100644 website/docs/r/pi_volume_clone.html.markdown diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 19b72beb821..bd2c9a6d4f1 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -192,6 +192,8 @@ var ( PiStoragePool string PiStorageType string Pi_shared_processor_pool_id string + Pi_target_storage_tier string + Pi_volume_clone_task_id string ) var ( @@ -1047,6 +1049,18 @@ func init() { fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'") } + Pi_target_storage_tier = os.Getenv("PI_TARGET_STORAGE_TIER") + if Pi_target_storage_tier == "" { + Pi_target_storage_tier = "terraform-test-tier" + fmt.Println("[INFO] Set the environment variable PI_TARGET_STORAGE_TIER for testing Pi_target_storage_tier resource else it is set to default value 'terraform-test-tier'") + } + + Pi_volume_clone_task_id = os.Getenv("PI_VOLUME_CLONE_TASK_ID") + if Pi_volume_clone_task_id == "" { + Pi_volume_clone_task_id = "terraform-test-tier" + fmt.Println("[INFO] Set the environment variable PI_VOLUME_CLONE_TASK_ID for testing Pi_volume_clone_task_id resource else it is set to default value 'terraform-test-tier'") + } + WorkspaceID = os.Getenv("SCHEMATICS_WORKSPACE_ID") if WorkspaceID == "" { WorkspaceID = "us-south.workspace.tf-acc-test-schematics-state-test.392cd99f" diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 81f78432a65..2ec2052a1c2 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -609,6 +609,7 @@ func Provider() *schema.Provider { "ibm_pi_system_pools": power.DataSourceIBMPISystemPools(), "ibm_pi_tenant": power.DataSourceIBMPITenant(), "ibm_pi_volume": power.DataSourceIBMPIVolume(), + "ibm_pi_volume_clone": power.DataSourceIBMPIVolumeClone(), "ibm_pi_volume_group": power.DataSourceIBMPIVolumeGroup(), "ibm_pi_volume_groups": power.DataSourceIBMPIVolumeGroups(), "ibm_pi_volume_group_details": power.DataSourceIBMPIVolumeGroupDetails(), @@ -1134,6 +1135,7 @@ func Provider() *schema.Provider { "ibm_pi_volume": power.ResourceIBMPIVolume(), "ibm_pi_volume_onboarding": power.ResourceIBMPIVolumeOnboarding(), "ibm_pi_volume_group": power.ResourceIBMPIVolumeGroup(), + "ibm_pi_volume_clone": power.ResourceIBMPIVolumeClone(), "ibm_pi_volume_group_action": power.ResourceIBMPIVolumeGroupAction(), "ibm_pi_network": power.ResourceIBMPINetwork(), "ibm_pi_instance": power.ResourceIBMPIInstance(), diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_task.go b/ibm/service/power/data_source_ibm_pi_volume_clone_task.go new file mode 100644 index 00000000000..f76c1e3fd06 --- /dev/null +++ b/ibm/service/power/data_source_ibm_pi_volume_clone_task.go @@ -0,0 +1,76 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package power + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + + st "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" +) + +func DataSourceIBMPIVolumeClone() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMPIVolumeCloneRead, + Schema: map[string]*schema.Schema{ + PIVolumeCloneTaskID: { + Type: schema.TypeString, + Required: true, + Description: "Clone task ID", + ValidateFunc: validation.NoZeroValues, + }, + helpers.PICloudInstanceId: { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, + }, + // Computed attributes + "cloned_volumes": clonedVolumesSchema(), + "volume_clone_failure_reason": { + Type: schema.TypeString, + Computed: true, + Description: "The reason the clone volumes task has failed", + }, + "volume_clone_percent_complete": { + Type: schema.TypeInt, + Computed: true, + Description: "Clone task completion percentage", + }, + "volume_clone_status": { + Type: schema.TypeString, + Computed: true, + Description: "Status of the clone volumes task", + }, + }, + } +} + +func dataSourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + client := st.NewIBMPICloneVolumeClient(ctx, sess, cloudInstanceID) + volClone, err := client.Get(d.Get(PIVolumeCloneTaskID).(string)) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(PIVolumeCloneTaskID) + d.Set("volume_clone_status", volClone.Status) + d.Set("volume_clone_failure_reason", volClone.FailedReason) + if volClone.PercentComplete != nil { + d.Set("volume_clone_percent_complete", *volClone.PercentComplete) + } + d.Set("cloned_volumes", flattenClonedVolumes(volClone.ClonedVolumes)) + + return nil +} diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go b/ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go new file mode 100644 index 00000000000..14d9a6de066 --- /dev/null +++ b/ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go @@ -0,0 +1,38 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package power_test + +import ( + "fmt" + "testing" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccIBMPIVolumeCloneTask_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIVolumeCloneTaskConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "id"), + resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "volume_clone_status"), + ), + }, + }, + }) +} + +func testAccCheckIBMPIVolumeCloneTaskConfig() string { + return fmt.Sprintf(` +data "ibm_pi_volume_clone" "testacc_ds_volume_clone" { + pi_volume_clone_task_id = "%s" + pi_cloud_instance_id = "%s" +}`, acc.Pi_volume_clone_task_id, acc.Pi_cloud_instance_id) + +} diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 40e8dbf0a5a..eb80daf87f9 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -74,15 +74,21 @@ const ( PIPlacementGroupMembers = "members" // Volume + PIVolumeIds = "pi_volume_ids" PIAffinityPolicy = "pi_affinity_policy" PIAffinityVolume = "pi_affinity_volume" PIAffinityInstance = "pi_affinity_instance" PIAntiAffinityInstances = "pi_anti_affinity_instances" PIAntiAffinityVolumes = "pi_anti_affinity_volumes" + // Volume Clone + PIVolumeCloneName = "pi_volume_clone_name" + PIVolumeCloneTaskID = "pi_volume_clone_task_id" + PITargetStorageTier = "pi_target_storage_tier" + PITargetReplicationEnabled = "pi_target_replication_enabled" + // IBM PI Volume Group PIVolumeGroupName = "pi_volume_group_name" - PIVolumeGroupsVolumeIds = "pi_volume_ids" PIVolumeGroupConsistencyGroupName = "pi_consistency_group_name" PIVolumeGroupID = "pi_volume_group_id" PIVolumeGroupAction = "pi_volume_group_action" diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_async.go b/ibm/service/power/resource_ibm_pi_volume_clone_async.go new file mode 100644 index 00000000000..4fb22fdaa2e --- /dev/null +++ b/ibm/service/power/resource_ibm_pi_volume_clone_async.go @@ -0,0 +1,233 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package power + +import ( + "context" + "fmt" + "log" + "time" + + st "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func ResourceIBMPIVolumeClone() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceIBMPIVolumeCloneCreate, + ReadContext: resourceIBMPIVolumeCloneRead, + DeleteContext: resourceIBMPIVolumeCloneDelete, + Importer: &schema.ResourceImporter{}, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(15 * time.Minute), + Delete: schema.DefaultTimeout(15 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + helpers.PICloudInstanceId: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Cloud Instance ID - This is the service_instance_id.", + }, + PIVolumeCloneName: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Base name of the new cloned volume(s)", + }, + PIVolumeIds: { + Type: schema.TypeSet, + Required: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "List of volumes to be cloned", + }, + PITargetStorageTier: { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "Target storage tier for the cloned volumes.", + }, + PITargetReplicationEnabled: { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: "By default, cloned volume replication is determined by the source volume unless explicitly specified", + }, + + // Computed attributes + "volume_clone_task_id": { + Type: schema.TypeString, + Computed: true, + Description: "Clone task ID", + }, + "cloned_volumes": clonedVolumesSchema(), + "volume_clone_failure_reason": { + Type: schema.TypeString, + Computed: true, + Description: "The reason the clone volumes task has failed", + }, + "volume_clone_percent_complete": { + Type: schema.TypeInt, + Computed: true, + Description: "Clone task completion percentage", + }, + "volume_clone_status": { + Type: schema.TypeString, + Computed: true, + Description: "Status of the clone volumes task", + }, + }, + } +} + +func resourceIBMPIVolumeCloneCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + vcName := d.Get(PIVolumeCloneName).(string) + volids := flex.ExpandStringList((d.Get(PIVolumeIds).(*schema.Set)).List()) + + body := &models.VolumesCloneAsyncRequest{ + Name: &vcName, + VolumeIDs: volids, + } + + if v, ok := d.GetOk(PITargetStorageTier); ok { + body.TargetStorageTier = v.(string) + } + + if v, ok := d.GetOk(PITargetReplicationEnabled); ok { + value := v.(bool) + body.TargetReplicationEnabled = &value + } + + client := st.NewIBMPICloneVolumeClient(ctx, sess, cloudInstanceID) + volClone, err := client.Create(body) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(fmt.Sprintf("%s/%s", cloudInstanceID, *volClone.CloneTaskID)) + + _, err = isWaitForIBMPIVolumeCloneCompletion(ctx, client, *volClone.CloneTaskID, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return diag.FromErr(err) + } + + return resourceIBMPIVolumeCloneRead(ctx, d, meta) +} + +func resourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + + sess, err := meta.(conns.ClientSession).IBMPISession() + if err != nil { + return diag.FromErr(err) + } + + cloudInstanceID, vcTaskID, err := splitID(d.Id()) + if err != nil { + return diag.FromErr(err) + } + + client := st.NewIBMPICloneVolumeClient(ctx, sess, cloudInstanceID) + volCloneTask, err := client.Get(vcTaskID) + if err != nil { + return diag.FromErr(err) + } + + d.Set("volume_clone_task_id", vcTaskID) + d.Set("volume_clone_status", volCloneTask.Status) + d.Set("volume_clone_failure_reason", volCloneTask.FailedReason) + if volCloneTask.PercentComplete != nil { + d.Set("volume_clone_percent_complete", *volCloneTask.PercentComplete) + } + d.Set("cloned_volumes", flattenClonedVolumes(volCloneTask.ClonedVolumes)) + + return nil +} + +func resourceIBMPIVolumeCloneDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + // There is no delete or unset concept for volume clone + d.SetId("") + return nil +} + +func flattenClonedVolumes(list []*models.ClonedVolume) (cloneVolumes []map[string]interface{}) { + if list != nil { + cloneVolumes := make([]map[string]interface{}, len(list)) + for i, data := range list { + l := map[string]interface{}{ + "clone_volume_id": data.ClonedVolumeID, + "source_volume_id": data.SourceVolumeID, + } + cloneVolumes[i] = l + } + return cloneVolumes + } + return +} + +func isWaitForIBMPIVolumeCloneCompletion(ctx context.Context, client *st.IBMPICloneVolumeClient, id string, timeout time.Duration) (interface{}, error) { + log.Printf("Waiting for Volume clone (%s) to be completed.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{helpers.PIVolumeCloneRunning}, + Target: []string{helpers.PIVolumeCloneDone}, + Refresh: isIBMPIVolumeCloneRefreshFunc(client, id), + Delay: 10 * time.Second, + MinTimeout: 2 * time.Minute, + Timeout: timeout, + } + + return stateConf.WaitForStateContext(ctx) +} + +func isIBMPIVolumeCloneRefreshFunc(client *st.IBMPICloneVolumeClient, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + volClone, err := client.Get(id) + if err != nil { + return nil, "", err + } + + if *volClone.Status == "completed" { + return volClone, helpers.PIVolumeCloneDone, nil + } + + return volClone, helpers.PIVolumeCloneRunning, nil + } +} + +func clonedVolumesSchema() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "clone_volume_id": { + Type: schema.TypeString, + Computed: true, + Description: "ID of the new cloned volume", + }, + "source_volume_id": { + Type: schema.TypeString, + Computed: true, + Description: "ID of the source volume to be cloned", + }, + }, + }, + } +} diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_async_test.go b/ibm/service/power/resource_ibm_pi_volume_clone_async_test.go new file mode 100644 index 00000000000..e152891f608 --- /dev/null +++ b/ibm/service/power/resource_ibm_pi_volume_clone_async_test.go @@ -0,0 +1,95 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package power_test + +import ( + "context" + "errors" + "fmt" + "testing" + + st "github.com/IBM-Cloud/power-go-client/clients/instance" + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccIBMPIVolumeClone(t *testing.T) { + name := fmt.Sprintf("tf-pi-volume-clone-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIVolumeCloneConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIVolumeCloneExists("ibm_pi_volume_clone.power_volume_clone"), + resource.TestCheckResourceAttrSet("ibm_pi_volume_clone.power_volume_clone", "id"), + resource.TestCheckResourceAttrSet("ibm_pi_volume_clone.power_volume_clone", "volume_clone_status"), + ), + }, + }, + }) +} + +func testAccCheckIBMPIVolumeCloneExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + + rs, ok := s.RootModule().Resources[n] + + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return errors.New("No Record ID is set") + } + + sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() + if err != nil { + return err + } + + ids, err := flex.IdParts(rs.Primary.ID) + if err != nil { + return err + } + cloudInstanceID, vcTaskID := ids[0], ids[1] + client := st.NewIBMPICloneVolumeClient(context.Background(), sess, cloudInstanceID) + + _, err = client.Get(vcTaskID) + if err != nil { + return err + } + return nil + } +} + +func testAccCheckIBMPIVolumeCloneConfig(name string) string { + return volumesCloneConfig(name, true) + fmt.Sprintf(` + resource "ibm_pi_volume_clone" "power_volume_clone" { + pi_cloud_instance_id = "%[1]s" + pi_volume_clone_name = "%[2]s" + pi_volume_ids = [ibm_pi_volume.power_volume[0].volume_id,ibm_pi_volume.power_volume[1].volume_id] + pi_target_storage_tier = "%[3]s" + pi_target_replication_enabled = %[4]v + } + `, acc.Pi_cloud_instance_id, name, acc.Pi_target_storage_tier, false) +} + +func volumesCloneConfig(name string, volumeReplicationEnabled bool) string { + return fmt.Sprintf(` + resource "ibm_pi_volume" "power_volume" { + count = 2 + pi_volume_size = 2 + pi_volume_name = "%[1]s-${count.index}" + pi_volume_pool = "%[3]s" + pi_cloud_instance_id = "%[2]s" + pi_replication_enabled = %[4]v + } + `, name, acc.Pi_cloud_instance_id, acc.PiStoragePool, volumeReplicationEnabled) +} diff --git a/ibm/service/power/resource_ibm_pi_volume_group.go b/ibm/service/power/resource_ibm_pi_volume_group.go index 6e8097b8350..1b44814b704 100644 --- a/ibm/service/power/resource_ibm_pi_volume_group.go +++ b/ibm/service/power/resource_ibm_pi_volume_group.go @@ -52,7 +52,7 @@ func ResourceIBMPIVolumeGroup() *schema.Resource { Description: "The name of consistency group at storage controller level", ConflictsWith: []string{PIVolumeGroupName}, }, - PIVolumeGroupsVolumeIds: { + PIVolumeIds: { Type: schema.TypeSet, Required: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -98,7 +98,7 @@ func resourceIBMPIVolumeGroupCreate(ctx context.Context, d *schema.ResourceData, Name: vgName, } - volids := flex.ExpandStringList((d.Get(PIVolumeGroupsVolumeIds).(*schema.Set)).List()) + volids := flex.ExpandStringList((d.Get(PIVolumeIds).(*schema.Set)).List()) body.VolumeIDs = volids if v, ok := d.GetOk(PIVolumeGroupConsistencyGroupName); ok { @@ -144,7 +144,7 @@ func resourceIBMPIVolumeGroupRead(ctx context.Context, d *schema.ResourceData, m d.Set("consistency_group_name", vg.ConsistencyGroupName) d.Set("replication_status", vg.ReplicationStatus) d.Set(PIVolumeGroupName, vg.Name) - d.Set(PIVolumeGroupsVolumeIds, vg.VolumeIDs) + d.Set(PIVolumeIds, vg.VolumeIDs) d.Set("status_description_errors", flattenVolumeGroupStatusDescription(vg.StatusDescription.Errors)) return nil @@ -163,8 +163,8 @@ func resourceIBMPIVolumeGroupUpdate(ctx context.Context, d *schema.ResourceData, } client := st.NewIBMPIVolumeGroupClient(ctx, sess, cloudInstanceID) - if d.HasChanges(PIVolumeGroupsVolumeIds) { - old, new := d.GetChange(PIVolumeGroupsVolumeIds) + if d.HasChanges(PIVolumeIds) { + old, new := d.GetChange(PIVolumeIds) oldList := old.(*schema.Set) newList := new.(*schema.Set) body := &models.VolumeGroupUpdate{ @@ -196,7 +196,7 @@ func resourceIBMPIVolumeGroupDelete(ctx context.Context, d *schema.ResourceData, client := st.NewIBMPIVolumeGroupClient(ctx, sess, cloudInstanceID) - volids := flex.ExpandStringList((d.Get(PIVolumeGroupsVolumeIds).(*schema.Set)).List()) + volids := flex.ExpandStringList((d.Get(PIVolumeIds).(*schema.Set)).List()) if len(volids) > 0 { body := &models.VolumeGroupUpdate{ RemoveVolumes: volids, diff --git a/ibm/service/power/resource_ibm_pi_volume_group_action.go b/ibm/service/power/resource_ibm_pi_volume_group_action.go index 83f636eb339..6c7e7a2b4a5 100644 --- a/ibm/service/power/resource_ibm_pi_volume_group_action.go +++ b/ibm/service/power/resource_ibm_pi_volume_group_action.go @@ -176,7 +176,7 @@ func resourceIBMPIVolumeGroupActionRead(ctx context.Context, d *schema.ResourceD } func resourceIBMPIVolumeGroupActionDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - // There is no delete or unset concept for instance action + // There is no delete or unset concept for volume group action d.SetId("") return nil } diff --git a/website/docs/d/pi_volume_clone.html.markdown b/website/docs/d/pi_volume_clone.html.markdown new file mode 100644 index 00000000000..639aa7738e9 --- /dev/null +++ b/website/docs/d/pi_volume_clone.html.markdown @@ -0,0 +1,55 @@ +--- + +subcategory: "Power Systems" +layout: "ibm" +page_title: "IBM: pi_volume_clone" +description: |- + Manages IBM Volume Clone in the Power Virtual Server cloud. +--- + +# ibm_pi_volume_clone +Retrieves information about a volume clone. For more information, about managing volume clone, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). + +## Example usage +The following example creates a volume clone. + +```terraform +data "ibm_pi_volume_clone" "ds_volume_clone" { + pi_cloud_instance_id = "" + pi_volume_clone_task_id = "" +} +``` + +**Note** +* Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. +* If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: + * `region` - `lon` + * `zone` - `lon04` + + Example usage: + + ```terraform + provider "ibm" { + region = "lon" + zone = "lon04" + } + ``` + +## Argument reference +Review the argument references that you can specify for your resource. + +- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. +- `pi_volume_clone_task_id` - (Required, String) The ID of the volume clone task. + +## Attribute reference +In addition to all argument reference list, you can access the following attribute reference after your resource is created. + +- `cloned_volumes` - (List of objects) The List of cloned volumes. + Nested scheme for `cloned_volumes`: + - `clone_volume_id` - (String) The ID of the newly cloned volume. + - `source_volume_id` - (String) The ID of the source volume. +- `id` - (String) The unique identifier of the volume clone task. +- `volume_clone_failure_reason` - (String) The reason for the failure of the clone volume task. +- `volume_clone_percent_complete` - (String) The completion percentage of the volume clone task. +- `volume_clone_status` - (String) The status of the volume clone task. +- `volume_clone_task_id` - (String) The ID of the volume clone task. diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown new file mode 100644 index 00000000000..5e19ecae354 --- /dev/null +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -0,0 +1,78 @@ +--- + +subcategory: "Power Systems" +layout: "ibm" +page_title: "IBM: pi_volume_clone" +description: |- + Manages IBM Volume Clone in the Power Virtual Server cloud. +--- + +# ibm_pi_volume_clone +Create a volume clone. For more information, about managing volume clone, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). + +## Example usage +The following example creates a volume clone. + +```terraform +resource "ibm_pi_volume_clone" "testacc_volume_clone" { + pi_cloud_instance_id = "" + pi_volume_clone_name = "test-volume-clone" + pi_volume_ids = [""] + pi_target_storage_tier = "" + pi_target_replication_enabled = true +} +``` + +**Note** +* Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. +* If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: + * `region` - `lon` + * `zone` - `lon04` + + Example usage: + + ```terraform + provider "ibm" { + region = "lon" + zone = "lon04" + } + ``` + +## Timeouts + +ibm_pi_volume_clone provides the following [timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: + +- **create** - (Default 15 minutes) Used for creating volume clone. +- **delete** - (Default 15 minutes) Used for deleting volume clone. + +## Argument reference +Review the argument references that you can specify for your resource. + +- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. +- `pi_target_replication_enabled` - (Optional, Boolean) Indicates whether the cloned volume should have replication enabled. If no value is provided, it will default to the replication status of the source volume(s). +- `pi_target_storage_tier` - (Optional, String) The storage tier for the cloned volume(s). +- `pi_volume_clone_name` - (Required, String) The base name of the newly cloned volume(s). +- `pi_volume_ids` - (Required, Set of String) List of volumes to be cloned. + +## Attribute reference +In addition to all argument reference list, you can access the following attribute reference after your resource is created. + +- `cloned_volumes` - (List of objects) The List of cloned volumes. + Nested scheme for `cloned_volumes`: + - `clone_volume_id` - (String) The ID of the newly cloned volume. + - `source_volume_id` - (String) The ID of the source volume. +- `id` - (String) The unique identifier of the volume clone. The ID is composed of `/`. +- `volume_clone_failure_reason` - (String) The reason for the failure of the volume clone task. +- `volume_clone_percent_complete` - (String) The completion percentage of the volume clone task. +- `volume_clone_status` - (String) The status of the volume clone task. +- `volume_clone_task_id` - (String) The ID of the volume clone task. + +## Import + +The `ibm_pi_volume_clone` resource can be imported by using `power_instance_id` and `volume_clone_task_id`. + +**Example** + +``` +$ terraform import ibm_pi_volume_clone.example d7bec597-4726-451f-8a63-e62e6f19c32c/cea6651a-bc0a-4438-9f8a-a0770bbf3ebb +``` From b9a3573ef885263eba58a5a127af833377330dde Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 25 Oct 2023 12:28:17 +0530 Subject: [PATCH 02/13] Docs improved --- ibm/service/power/ibm_pi_constants.go | 18 ++++++++++-------- .../resource_ibm_pi_volume_clone_async.go | 8 ++++---- website/docs/d/pi_volume_clone.html.markdown | 4 ++-- website/docs/r/pi_volume_clone.html.markdown | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index eb80daf87f9..0abbca4ef70 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -146,12 +146,14 @@ const ( // status // common status states - StatusShutoff = "SHUTOFF" - StatusActive = "ACTIVE" - StatusResize = "RESIZE" - StatusError = "ERROR" - StatusBuild = "BUILD" - StatusPending = "PENDING" - SctionStart = "start" - SctionStop = "stop" + StatusShutoff = "SHUTOFF" + StatusActive = "ACTIVE" + StatusResize = "RESIZE" + StatusError = "ERROR" + StatusBuild = "BUILD" + StatusPending = "PENDING" + SctionStart = "start" + SctionStop = "stop" + PIVolumeCloneDone = "completed" + PIVolumeCloneRunning = "running" ) diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_async.go b/ibm/service/power/resource_ibm_pi_volume_clone_async.go index 4fb22fdaa2e..888296ced3b 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone_async.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone_async.go @@ -185,8 +185,8 @@ func isWaitForIBMPIVolumeCloneCompletion(ctx context.Context, client *st.IBMPICl log.Printf("Waiting for Volume clone (%s) to be completed.", id) stateConf := &resource.StateChangeConf{ - Pending: []string{helpers.PIVolumeCloneRunning}, - Target: []string{helpers.PIVolumeCloneDone}, + Pending: []string{PIVolumeCloneRunning}, + Target: []string{PIVolumeCloneDone}, Refresh: isIBMPIVolumeCloneRefreshFunc(client, id), Delay: 10 * time.Second, MinTimeout: 2 * time.Minute, @@ -204,10 +204,10 @@ func isIBMPIVolumeCloneRefreshFunc(client *st.IBMPICloneVolumeClient, id string) } if *volClone.Status == "completed" { - return volClone, helpers.PIVolumeCloneDone, nil + return volClone, PIVolumeCloneDone, nil } - return volClone, helpers.PIVolumeCloneRunning, nil + return volClone, PIVolumeCloneRunning, nil } } diff --git a/website/docs/d/pi_volume_clone.html.markdown b/website/docs/d/pi_volume_clone.html.markdown index 639aa7738e9..02d7ecb2ceb 100644 --- a/website/docs/d/pi_volume_clone.html.markdown +++ b/website/docs/d/pi_volume_clone.html.markdown @@ -11,7 +11,7 @@ description: |- Retrieves information about a volume clone. For more information, about managing volume clone, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example usage -The following example creates a volume clone. +The following example retrieves information about the volume clone task that is present in Power Systems Virtual Server. ```terraform data "ibm_pi_volume_clone" "ds_volume_clone" { @@ -50,6 +50,6 @@ In addition to all argument reference list, you can access the following attribu - `source_volume_id` - (String) The ID of the source volume. - `id` - (String) The unique identifier of the volume clone task. - `volume_clone_failure_reason` - (String) The reason for the failure of the clone volume task. -- `volume_clone_percent_complete` - (String) The completion percentage of the volume clone task. +- `volume_clone_percent_complete` - (Integer) The completion percentage of the volume clone task. - `volume_clone_status` - (String) The status of the volume clone task. - `volume_clone_task_id` - (String) The ID of the volume clone task. diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown index 5e19ecae354..a73f4281356 100644 --- a/website/docs/r/pi_volume_clone.html.markdown +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -63,7 +63,7 @@ In addition to all argument reference list, you can access the following attribu - `source_volume_id` - (String) The ID of the source volume. - `id` - (String) The unique identifier of the volume clone. The ID is composed of `/`. - `volume_clone_failure_reason` - (String) The reason for the failure of the volume clone task. -- `volume_clone_percent_complete` - (String) The completion percentage of the volume clone task. +- `volume_clone_percent_complete` - (Integer) The completion percentage of the volume clone task. - `volume_clone_status` - (String) The status of the volume clone task. - `volume_clone_task_id` - (String) The ID of the volume clone task. From 36591fe4be48e2e854e5749a5c672ef76a03b73f Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 25 Oct 2023 21:16:04 +0530 Subject: [PATCH 03/13] power-go-client update in go.mod --- go.mod | 19 +++++++----- go.sum | 92 +++++++++++++++++----------------------------------------- 2 files changed, 37 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index e69954efcd2..0097660c893 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9 - github.com/IBM-Cloud/power-go-client v1.2.4 + github.com/IBM-Cloud/power-go-client v1.5.3 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f @@ -97,15 +97,16 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-jose/go-jose/v3 v3.0.0 // indirect github.com/go-logr/logr v1.2.4 // indirect - github.com/go-openapi/analysis v0.21.2 // indirect - github.com/go-openapi/errors v0.20.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.21.4 // indirect + github.com/go-openapi/errors v0.20.4 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect - github.com/go-openapi/loads v0.21.1 // indirect - github.com/go-openapi/runtime v0.23.0 // indirect - github.com/go-openapi/spec v0.20.4 // indirect - github.com/go-openapi/swag v0.22.3 // indirect - github.com/go-openapi/validate v0.20.3 // indirect + github.com/go-openapi/loads v0.21.2 // indirect + github.com/go-openapi/runtime v0.26.0 // indirect + github.com/go-openapi/spec v0.20.8 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/validate v0.22.1 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -198,6 +199,8 @@ require ( github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.11.0 // indirect go.mongodb.org/mongo-driver v1.11.6 // indirect + go.opentelemetry.io/otel v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect diff --git a/go.sum b/go.sum index 4c0c671a2eb..b8033010c9d 100644 --- a/go.sum +++ b/go.sum @@ -105,8 +105,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231017073329-75ebe90c98ba/go.mod h1:mt+ github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9 h1:sXRzCK3Glxpyu66Tu2NjztLdT5sDwj4qly+MJKRhdWY= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230822142550-30562e113de9/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= -github.com/IBM-Cloud/power-go-client v1.2.4 h1:4y/ubiOXpMg3xyBryfgfsa8hae/9Dn5WLdvphoxvgsQ= -github.com/IBM-Cloud/power-go-client v1.2.4/go.mod h1:0YVWoIQN5I5IvyhO/m4yxgPJqCh9QjceN2FNlVpYlOQ= +github.com/IBM-Cloud/power-go-client v1.5.3 h1:qfI15aH+WMm0np5YZBId7i6yUOaPhMwcXu6xzfNAL/Y= +github.com/IBM-Cloud/power-go-client v1.5.3/go.mod h1:Vd8aSxWA30soUhE2U+tmzaYDUVNOmQE3/npny7BsN6Y= github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw= github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4= github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs= @@ -139,7 +139,6 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/go-sdk-core/v5 v5.14.1 h1:WR1r0zz+gDW++xzZjF41r9ueY4JyjS2vgZjiYs8lO3c= github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= @@ -267,7 +266,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= @@ -486,9 +484,12 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= @@ -498,27 +499,20 @@ github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70t github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= -github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgTAUNE9AEEMdlJQ= -github.com/go-openapi/analysis v0.19.16/go.mod h1:GLInF007N83Ad3m8a/CbQ5TPzdnGT7workfHwuVjNVk= -github.com/go-openapi/analysis v0.20.0/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= -github.com/go-openapi/analysis v0.20.1/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= -github.com/go-openapi/analysis v0.21.2 h1:hXFrOYFHUAMQdu6zwAiKKJHJQ8kqZs1ux/ru1P1wLJU= github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= +github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= +github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.20.1/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWLG6M= +github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= @@ -531,7 +525,6 @@ github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3Hfo github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= @@ -539,47 +532,30 @@ github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= -github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= -github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= -github.com/go-openapi/loads v0.19.6/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= -github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= -github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= -github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= -github.com/go-openapi/loads v0.21.0/go.mod h1:rHYve9nZrQ4CJhyeIIFJINGCg1tQpx2yJrrNo8sf1ws= -github.com/go-openapi/loads v0.21.1 h1:Wb3nVZpdEzDTcly8S4HMkey6fjARRzb7iEaySimlDW0= github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= +github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= +github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= -github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= -github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= -github.com/go-openapi/runtime v0.23.0 h1:HX6ET2sHCIvaKeDDQoU01CtO1ekg5EkekHSkLTtWXH0= -github.com/go-openapi/runtime v0.23.0/go.mod h1:aQg+kaIQEn+A2CRSY1TxbM8+sT9g2V3aLc1FbIAnbbs= +github.com/go-openapi/runtime v0.26.0 h1:HYOFtG00FM1UvqrcxbEJg/SwvDRvYLQKGhw2zaQjTcc= +github.com/go-openapi/runtime v0.26.0/go.mod h1:QgRGeZwrUcSHdeh4Ka9Glvo0ug1LC5WyE+EV88plZrQ= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= -github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= -github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= -github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= -github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxRU= +github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= -github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= -github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.10/go.mod h1:qBBipho+3EoIqn6YDI+4RnQEtj6jT/IdKm+PAlXxSUc= -github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= -github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= @@ -593,24 +569,15 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= -github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= -github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= -github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= -github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= -github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= -github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= -github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw= -github.com/go-openapi/validate v0.20.3/go.mod h1:goDdqVGiigM3jChcrYJxD2joalke3ZXeftD16byIjA4= +github.com/go-openapi/validate v0.22.1 h1:G+c2ub6q47kfX1sOBLwIQwzBVt8qmOAARyo/9Fqs9NU= +github.com/go-openapi/validate v0.22.1/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= @@ -1158,7 +1125,6 @@ github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= @@ -1220,9 +1186,7 @@ github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1D github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -1321,7 +1285,6 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= @@ -1349,7 +1312,6 @@ github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mo github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47/go.mod h1:u7NRAjtYVAKokiI9LouzTv4mhds8P4S1TwdVAfbjKSk= github.com/openshift/client-go v0.0.0-20230324103026-3f1513df25e0 h1:ftAVjdiw4/Bnav0Fvw9mxoa0kU1lGK8GKRn28eja8Ik= github.com/openshift/client-go v0.0.0-20230324103026-3f1513df25e0/go.mod h1:8jtoeGR9UNGacP00O4WBeSFY3WaP7t0gkm9NZOSSWmg= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b/go.mod h1:AC62GU6hc0BrNm+9RK9VSiwa/EUe1bkIeFORAMcHvJU= github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= @@ -1371,7 +1333,6 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= @@ -1619,12 +1580,7 @@ go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.2.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= -go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= go.mongodb.org/mongo-driver v1.4.2/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= @@ -1644,6 +1600,11 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= +go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= +go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1787,7 +1748,6 @@ golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= From 1553249520569ee3933527b58947d4dbaf260de7 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 25 Oct 2023 23:38:48 +0530 Subject: [PATCH 04/13] feedback resolved --- ..._volume_clone_task.go => data_source_ibm_pi_volume_clone.go} | 0 ...one_task_test.go => data_source_ibm_pi_volume_clone_test.go} | 0 ...pi_volume_clone_async.go => resource_ibm_pi_volume_clone.go} | 2 +- ...clone_async_test.go => resource_ibm_pi_volume_clone_test.go} | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename ibm/service/power/{data_source_ibm_pi_volume_clone_task.go => data_source_ibm_pi_volume_clone.go} (100%) rename ibm/service/power/{data_source_ibm_pi_volume_clone_task_test.go => data_source_ibm_pi_volume_clone_test.go} (100%) rename ibm/service/power/{resource_ibm_pi_volume_clone_async.go => resource_ibm_pi_volume_clone.go} (99%) rename ibm/service/power/{resource_ibm_pi_volume_clone_async_test.go => resource_ibm_pi_volume_clone_test.go} (100%) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_task.go b/ibm/service/power/data_source_ibm_pi_volume_clone.go similarity index 100% rename from ibm/service/power/data_source_ibm_pi_volume_clone_task.go rename to ibm/service/power/data_source_ibm_pi_volume_clone.go diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go similarity index 100% rename from ibm/service/power/data_source_ibm_pi_volume_clone_task_test.go rename to ibm/service/power/data_source_ibm_pi_volume_clone_test.go diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_async.go b/ibm/service/power/resource_ibm_pi_volume_clone.go similarity index 99% rename from ibm/service/power/resource_ibm_pi_volume_clone_async.go rename to ibm/service/power/resource_ibm_pi_volume_clone.go index 888296ced3b..a7da48262a9 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone_async.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -203,7 +203,7 @@ func isIBMPIVolumeCloneRefreshFunc(client *st.IBMPICloneVolumeClient, id string) return nil, "", err } - if *volClone.Status == "completed" { + if *volClone.Status == PIVolumeCloneDone { return volClone, PIVolumeCloneDone, nil } diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_async_test.go b/ibm/service/power/resource_ibm_pi_volume_clone_test.go similarity index 100% rename from ibm/service/power/resource_ibm_pi_volume_clone_async_test.go rename to ibm/service/power/resource_ibm_pi_volume_clone_test.go From 60b1dff2cd2677eac58a8358ec717dc0bfa795aa Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 25 Oct 2023 23:42:02 +0530 Subject: [PATCH 05/13] testcase func renamed --- ibm/service/power/data_source_ibm_pi_volume_clone_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go index 14d9a6de066..acac3ae5f59 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go @@ -12,13 +12,13 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccIBMPIVolumeCloneTask_basic(t *testing.T) { +func TestAccIBMPIVolumeClone_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckIBMPIVolumeCloneTaskConfig(), + Config: testAccCheckIBMPIVolumeCloneBasicConfig(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "id"), resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "volume_clone_status"), @@ -28,7 +28,7 @@ func TestAccIBMPIVolumeCloneTask_basic(t *testing.T) { }) } -func testAccCheckIBMPIVolumeCloneTaskConfig() string { +func testAccCheckIBMPIVolumeCloneBasicConfig() string { return fmt.Sprintf(` data "ibm_pi_volume_clone" "testacc_ds_volume_clone" { pi_volume_clone_task_id = "%s" From a6d1c349f7731d667a41ca3040c3927a9e74b23d Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Thu, 26 Oct 2023 08:50:27 +0530 Subject: [PATCH 06/13] Resolved conflicts --- go.mod | 9 --------- go.sum | 18 ------------------ ibm/service/power/ibm_pi_constants.go | 8 -------- 3 files changed, 35 deletions(-) diff --git a/go.mod b/go.mod index 53d722a91e6..7753489b0c1 100644 --- a/go.mod +++ b/go.mod @@ -70,7 +70,6 @@ require ( require ( cloud.google.com/go/kms v1.10.1 // indirect cloud.google.com/go/monitoring v1.13.0 // indirect - github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75 // indirect github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/agext/levenshtein v1.2.2 // indirect @@ -87,7 +86,6 @@ require ( github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect - github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/eapache/go-resiliency v1.4.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect @@ -119,7 +117,6 @@ require ( github.com/google/gnostic v0.6.9 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -160,7 +157,6 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kardianos/govendor v1.0.9 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect github.com/leodido/go-urn v1.2.3 // indirect @@ -172,8 +168,6 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect - github.com/mitchellh/gox v1.0.1 // indirect - github.com/mitchellh/iochan v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/spdystream v0.2.0 // indirect @@ -214,9 +208,6 @@ require ( golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.12.0 // indirect - golang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect - golang.org/x/tools/go/vcs v0.1.0-deprecated // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect diff --git a/go.sum b/go.sum index 16a8d4755da..ca344dadf77 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,6 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75 h1:xGHheKK44eC6K0u5X+DZW/fRaR1LnDdqPHMZMWx5fv8= -github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75/go.mod h1:4/6eNcqZ09BZ9wLK3tZOjBA1nDj+B0728nlX5YRlSmQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -129,8 +127,6 @@ github.com/IBM/continuous-delivery-go-sdk v1.2.0 h1:FcgB5EvVrZLUnyR4S/mBocHHo9gJ github.com/IBM/continuous-delivery-go-sdk v1.2.0/go.mod h1:oW51tS5/MDCcEM7lUvjK1H9GFC/oKsRbyYfmvGyMGmw= github.com/IBM/event-notifications-go-admin-sdk v0.2.7 h1:Y6YPiXZO3/oAhs7rY6ekowJAsf9J05g2UFq3wjFkuCs= github.com/IBM/event-notifications-go-admin-sdk v0.2.7/go.mod h1:iI6/TJt4GQBDsl8NYzoIYGnsNjMG0kOVIEl7mcM5v1E= -github.com/IBM/eventstreams-go-sdk v1.2.0 h1:eP0afHArMGjwhGqvZAhhu/3EDKRch2JehpveqF1TUjs= -github.com/IBM/eventstreams-go-sdk v1.2.0/go.mod h1:2tuAxaYLctfqfr5jvyqSrxxEQGMwYPm3yJGWSj85YVQ= github.com/IBM/eventstreams-go-sdk v1.4.0 h1:yS/Ns29sBOe8W2tynQmz9HTKqQZ0ckse4Py5Oy/F2rM= github.com/IBM/eventstreams-go-sdk v1.4.0/go.mod h1:2tuAxaYLctfqfr5jvyqSrxxEQGMwYPm3yJGWSj85YVQ= github.com/IBM/go-sdk-core/v3 v3.0.0/go.mod h1:JI5NS2+iCoY/D8Oq3JNEZNA7qO42agu6fnaUmDsRcJA= @@ -364,8 +360,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU= github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0= -github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 h1:3T8ZyTDp5QxTx3NU48JVb2u+75xc040fofcBaN+6jPA= -github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185/go.mod h1:cFRxtTwTOJkz2x3rQUNCYKWC93yP1VKjR8NUhqFxZNU= github.com/denisenkom/go-mssqldb v0.0.0-20190412130859-3b1d194e553a/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba h1:p6poVbjHDkKa+wtC8frBMwQtT3BmqGYBjzMwJ63tuR4= github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc h1:8WFBn63wegobsYAX0YjD+8suexZDga5CctH4CCTx2+8= @@ -741,8 +735,6 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 h1:2XF1Vzq06X+inNqgJ9tRnGuw+ZVCB3FazXODD6JE1R8= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -892,7 +884,6 @@ github.com/hashicorp/go-uuid v1.0.2-0.20191001231223-f32f5fe8d6a8/go.mod h1:6SBZ github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -1077,8 +1068,6 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kardianos/govendor v1.0.9 h1:WOH3FcVI9eOgnIZYg96iwUwrL4eOVx+aQ66oyX2R8Yc= -github.com/kardianos/govendor v1.0.9/go.mod h1:yvmR6q9ZZ7nSF5Wvh40v0wfP+3TwwL8zYQp+itoZSVM= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= @@ -1193,10 +1182,7 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= -github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -2074,10 +2060,6 @@ golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= -golang.org/x/tools/cmd/cover v0.1.0-deprecated h1:Rwy+mWYz6loAF+LnG1jHG/JWMHRMMC2/1XX3Ejkx9lA= -golang.org/x/tools/cmd/cover v0.1.0-deprecated/go.mod h1:hMDiIvlpN1NoVgmjLjUJE9tMHyxHjFX7RuQ+rW12mSA= -golang.org/x/tools/go/vcs v0.1.0-deprecated h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4= -golang.org/x/tools/go/vcs v0.1.0-deprecated/go.mod h1:zUrvATBAvEI9535oC0yWYsLsHIV4Z7g63sNPVMtuBy8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index af08e64938a..b12aafae4b0 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -156,14 +156,6 @@ const ( SctionStop = "stop" PIVolumeCloneDone = "completed" PIVolumeCloneRunning = "running" - StatusShutoff = "SHUTOFF" - StatusActive = "ACTIVE" - StatusResize = "RESIZE" - StatusError = "ERROR" - StatusBuild = "BUILD" - StatusPending = "PENDING" - SctionStart = "start" - SctionStop = "stop" // Workspaces Attr_WorkspaceCapabilities = "pi_workspace_capabilities" From cb2d6ba291571eca05ad246d3f603f4bfff188f1 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Thu, 26 Oct 2023 21:00:52 +0530 Subject: [PATCH 07/13] feedback resolved renamed targetReplicationEnabled to replicationEnabled --- ibm/service/power/ibm_pi_constants.go | 7 +++---- ibm/service/power/resource_ibm_pi_volume_clone.go | 4 ++-- ibm/service/power/resource_ibm_pi_volume_clone_test.go | 2 +- website/docs/r/pi_volume_clone.html.markdown | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index b12aafae4b0..5235af2be85 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -82,10 +82,9 @@ const ( PIAntiAffinityVolumes = "pi_anti_affinity_volumes" // Volume Clone - PIVolumeCloneName = "pi_volume_clone_name" - PIVolumeCloneTaskID = "pi_volume_clone_task_id" - PITargetStorageTier = "pi_target_storage_tier" - PITargetReplicationEnabled = "pi_target_replication_enabled" + PIVolumeCloneName = "pi_volume_clone_name" + PIVolumeCloneTaskID = "pi_volume_clone_task_id" + PITargetStorageTier = "pi_target_storage_tier" // IBM PI Volume Group PIVolumeGroupName = "pi_volume_group_name" diff --git a/ibm/service/power/resource_ibm_pi_volume_clone.go b/ibm/service/power/resource_ibm_pi_volume_clone.go index a7da48262a9..c0873e71f22 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -58,7 +58,7 @@ func ResourceIBMPIVolumeClone() *schema.Resource { ForceNew: true, Description: "Target storage tier for the cloned volumes.", }, - PITargetReplicationEnabled: { + helpers.PIReplicationEnabled: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -110,7 +110,7 @@ func resourceIBMPIVolumeCloneCreate(ctx context.Context, d *schema.ResourceData, body.TargetStorageTier = v.(string) } - if v, ok := d.GetOk(PITargetReplicationEnabled); ok { + if v, ok := d.GetOk(helpers.PIReplicationEnabled); ok { value := v.(bool) body.TargetReplicationEnabled = &value } diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_test.go b/ibm/service/power/resource_ibm_pi_volume_clone_test.go index e152891f608..1f9126ed005 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone_test.go @@ -76,7 +76,7 @@ func testAccCheckIBMPIVolumeCloneConfig(name string) string { pi_volume_clone_name = "%[2]s" pi_volume_ids = [ibm_pi_volume.power_volume[0].volume_id,ibm_pi_volume.power_volume[1].volume_id] pi_target_storage_tier = "%[3]s" - pi_target_replication_enabled = %[4]v + pi_replication_enabled = %[4]v } `, acc.Pi_cloud_instance_id, name, acc.Pi_target_storage_tier, false) } diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown index a73f4281356..3e201ff7379 100644 --- a/website/docs/r/pi_volume_clone.html.markdown +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -19,7 +19,7 @@ resource "ibm_pi_volume_clone" "testacc_volume_clone" { pi_volume_clone_name = "test-volume-clone" pi_volume_ids = [""] pi_target_storage_tier = "" - pi_target_replication_enabled = true + pi_replication_enabled = true } ``` @@ -49,9 +49,9 @@ ibm_pi_volume_clone provides the following [timeouts](https://www.terraform.io/d Review the argument references that you can specify for your resource. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. -- `pi_target_replication_enabled` - (Optional, Boolean) Indicates whether the cloned volume should have replication enabled. If no value is provided, it will default to the replication status of the source volume(s). -- `pi_target_storage_tier` - (Optional, String) The storage tier for the cloned volume(s). - `pi_volume_clone_name` - (Required, String) The base name of the newly cloned volume(s). +- `pi_replication_enabled` - (Optional, Boolean) Indicates whether the cloned volume should have replication enabled. If no value is provided, it will default to the replication status of the source volume(s). +- `pi_target_storage_tier` - (Optional, String) The storage tier for the cloned volume(s). - `pi_volume_ids` - (Required, Set of String) List of volumes to be cloned. ## Attribute reference From d3f23d975fbf8bb275dfe5c96b65b3237732b1c6 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Thu, 26 Oct 2023 21:08:58 +0530 Subject: [PATCH 08/13] Alphabetically sorted documentation attributes. --- website/docs/r/pi_volume_clone.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown index 3e201ff7379..d6f78997a9e 100644 --- a/website/docs/r/pi_volume_clone.html.markdown +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -49,9 +49,9 @@ ibm_pi_volume_clone provides the following [timeouts](https://www.terraform.io/d Review the argument references that you can specify for your resource. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. -- `pi_volume_clone_name` - (Required, String) The base name of the newly cloned volume(s). - `pi_replication_enabled` - (Optional, Boolean) Indicates whether the cloned volume should have replication enabled. If no value is provided, it will default to the replication status of the source volume(s). - `pi_target_storage_tier` - (Optional, String) The storage tier for the cloned volume(s). +- `pi_volume_clone_name` - (Required, String) The base name of the newly cloned volume(s). - `pi_volume_ids` - (Required, Set of String) List of volumes to be cloned. ## Attribute reference From 4b661c5bd72a760aa158044c8cf2f05bd80333ad Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 3 Jan 2024 14:39:21 +0530 Subject: [PATCH 09/13] Improved minor naming convention & docs --- ibm/acctest/acctest.go | 7 +++++-- .../power/data_source_ibm_pi_volume_clone.go | 8 +++++--- .../data_source_ibm_pi_volume_clone_test.go | 6 +++--- ibm/service/power/ibm_pi_constants.go | 20 +++++++++---------- .../power/resource_ibm_pi_volume_clone.go | 16 ++++++++------- .../resource_ibm_pi_volume_clone_test.go | 2 +- 6 files changed, 33 insertions(+), 26 deletions(-) diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index dc29c840e10..5cfa109ae86 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -1093,6 +1093,7 @@ func init() { Pi_shared_processor_pool_id = "tf-pi-shared-processor-pool" fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'") } + Pi_target_storage_tier = os.Getenv("PI_TARGET_STORAGE_TIER") if Pi_target_storage_tier == "" { Pi_target_storage_tier = "terraform-test-tier" @@ -1101,8 +1102,10 @@ func init() { Pi_volume_clone_task_id = os.Getenv("PI_VOLUME_CLONE_TASK_ID") if Pi_volume_clone_task_id == "" { - Pi_volume_clone_task_id = "terraform-test-tier" - fmt.Println("[INFO] Set the environment variable PI_VOLUME_CLONE_TASK_ID for testing Pi_volume_clone_task_id resource else it is set to default value 'terraform-test-tier'") + Pi_volume_clone_task_id = "terraform-test-volume-clone-task-id" + fmt.Println("[INFO] Set the environment variable PI_VOLUME_CLONE_TASK_ID for testing Pi_volume_clone_task_id resource else it is set to default value 'terraform-test-volume-clone-task-id'") + } + Pi_resource_group_id = os.Getenv("PI_RESOURCE_GROUP_ID") if Pi_resource_group_id == "" { Pi_resource_group_id = "" diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone.go b/ibm/service/power/data_source_ibm_pi_volume_clone.go index f76c1e3fd06..fc44cb856b8 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. +// Copyright IBM Corp. 2023, 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power @@ -64,8 +64,10 @@ func dataSourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - d.SetId(PIVolumeCloneTaskID) - d.Set("volume_clone_status", volClone.Status) + d.SetId(d.Get(PIVolumeCloneTaskID).(string)) + if volClone.Status != nil { + d.Set("volume_clone_status", *volClone.Status) + } d.Set("volume_clone_failure_reason", volClone.FailedReason) if volClone.PercentComplete != nil { d.Set("volume_clone_percent_complete", *volClone.PercentComplete) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go index acac3ae5f59..03de00a6637 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. +// Copyright IBM Corp. 2023, 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power_test @@ -31,8 +31,8 @@ func TestAccIBMPIVolumeClone_basic(t *testing.T) { func testAccCheckIBMPIVolumeCloneBasicConfig() string { return fmt.Sprintf(` data "ibm_pi_volume_clone" "testacc_ds_volume_clone" { - pi_volume_clone_task_id = "%s" - pi_cloud_instance_id = "%s" + pi_volume_clone_task_id = "%s" + pi_cloud_instance_id = "%s" }`, acc.Pi_volume_clone_task_id, acc.Pi_cloud_instance_id) } diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index ba0ccc41ab6..427273d4973 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -145,16 +145,16 @@ const ( // status // common status states - StatusShutoff = "SHUTOFF" - StatusActive = "ACTIVE" - StatusResize = "RESIZE" - StatusError = "ERROR" - StatusBuild = "BUILD" - StatusPending = "PENDING" - SctionStart = "start" - SctionStop = "stop" - PIVolumeCloneDone = "completed" - PIVolumeCloneRunning = "running" + StatusShutoff = "SHUTOFF" + StatusActive = "ACTIVE" + StatusResize = "RESIZE" + StatusError = "ERROR" + StatusBuild = "BUILD" + StatusPending = "PENDING" + SctionStart = "start" + SctionStop = "stop" + PIVolumeCloneCompleted = "completed" + PIVolumeCloneRunning = "running" // Workspaces Attr_WorkspaceCapabilities = "pi_workspace_capabilities" diff --git a/ibm/service/power/resource_ibm_pi_volume_clone.go b/ibm/service/power/resource_ibm_pi_volume_clone.go index c0873e71f22..20b6e68ed60 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. +// Copyright IBM Corp. 2023, 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power @@ -110,8 +110,8 @@ func resourceIBMPIVolumeCloneCreate(ctx context.Context, d *schema.ResourceData, body.TargetStorageTier = v.(string) } - if v, ok := d.GetOk(helpers.PIReplicationEnabled); ok { - value := v.(bool) + if !d.GetRawConfig().GetAttr(helpers.PIReplicationEnabled).IsNull() { + value := d.Get(helpers.PIReplicationEnabled).(bool) body.TargetReplicationEnabled = &value } @@ -150,7 +150,9 @@ func resourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, m } d.Set("volume_clone_task_id", vcTaskID) - d.Set("volume_clone_status", volCloneTask.Status) + if volCloneTask.Status != nil { + d.Set("volume_clone_status", *volCloneTask.Status) + } d.Set("volume_clone_failure_reason", volCloneTask.FailedReason) if volCloneTask.PercentComplete != nil { d.Set("volume_clone_percent_complete", *volCloneTask.PercentComplete) @@ -186,7 +188,7 @@ func isWaitForIBMPIVolumeCloneCompletion(ctx context.Context, client *st.IBMPICl stateConf := &resource.StateChangeConf{ Pending: []string{PIVolumeCloneRunning}, - Target: []string{PIVolumeCloneDone}, + Target: []string{PIVolumeCloneCompleted}, Refresh: isIBMPIVolumeCloneRefreshFunc(client, id), Delay: 10 * time.Second, MinTimeout: 2 * time.Minute, @@ -203,8 +205,8 @@ func isIBMPIVolumeCloneRefreshFunc(client *st.IBMPICloneVolumeClient, id string) return nil, "", err } - if *volClone.Status == PIVolumeCloneDone { - return volClone, PIVolumeCloneDone, nil + if *volClone.Status == PIVolumeCloneCompleted { + return volClone, PIVolumeCloneCompleted, nil } return volClone, PIVolumeCloneRunning, nil diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_test.go b/ibm/service/power/resource_ibm_pi_volume_clone_test.go index 1f9126ed005..f68c49d343e 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone_test.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. +// Copyright IBM Corp. 2023, 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power_test From 512b6fcaf8b63553924095a31dc8e7fcecbb71d5 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 3 Jan 2024 21:12:02 +0530 Subject: [PATCH 10/13] Added some use case scenarios --- ibm/flex/structures.go | 4 ++++ ibm/service/power/resource_ibm_pi_volume.go | 10 ++++------ ibm/service/power/resource_ibm_pi_volume_clone.go | 3 +-- ibm/service/power/resource_ibm_pi_volume_group_test.go | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ibm/flex/structures.go b/ibm/flex/structures.go index f4370020f97..aaa54458d16 100644 --- a/ibm/flex/structures.go +++ b/ibm/flex/structures.go @@ -1171,6 +1171,10 @@ func PtrToString(s string) *string { return &s } +func PtrToBool(b bool) *bool { + return &b +} + func IntValue(i64 *int64) (i int) { if i64 != nil { i = int(*i64) diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index c80b9c2790e..63f8d4e1f03 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -364,14 +364,12 @@ func resourceIBMPIVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta } if d.HasChanges(helpers.PIReplicationEnabled, helpers.PIVolumeType) { - var replicationEnabled bool volActionBody := models.VolumeAction{} - if v, ok := d.GetOk(helpers.PIReplicationEnabled); ok { - replicationEnabled = v.(bool) - volActionBody.ReplicationEnabled = &replicationEnabled + if d.HasChange(helpers.PIReplicationEnabled) { + volActionBody.ReplicationEnabled = flex.PtrToBool(d.Get(helpers.PIReplicationEnabled).(bool)) } - if v, ok := d.GetOk(helpers.PIVolumeType); ok { - volActionBody.TargetStorageTier = flex.PtrToString(v.(string)) + if d.HasChange(helpers.PIVolumeType) { + volActionBody.TargetStorageTier = flex.PtrToString(d.Get(helpers.PIVolumeType).(string)) } err = client.VolumeAction(volumeID, &volActionBody) if err != nil { diff --git a/ibm/service/power/resource_ibm_pi_volume_clone.go b/ibm/service/power/resource_ibm_pi_volume_clone.go index 20b6e68ed60..05a64f7d165 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -111,8 +111,7 @@ func resourceIBMPIVolumeCloneCreate(ctx context.Context, d *schema.ResourceData, } if !d.GetRawConfig().GetAttr(helpers.PIReplicationEnabled).IsNull() { - value := d.Get(helpers.PIReplicationEnabled).(bool) - body.TargetReplicationEnabled = &value + body.TargetReplicationEnabled = flex.PtrToBool(d.Get(helpers.PIReplicationEnabled).(bool)) } client := st.NewIBMPICloneVolumeClient(ctx, sess, cloudInstanceID) diff --git a/ibm/service/power/resource_ibm_pi_volume_group_test.go b/ibm/service/power/resource_ibm_pi_volume_group_test.go index 5b05f8a0964..5d55c1981bc 100644 --- a/ibm/service/power/resource_ibm_pi_volume_group_test.go +++ b/ibm/service/power/resource_ibm_pi_volume_group_test.go @@ -146,9 +146,9 @@ func volumeConfig(name, cloud_instance_id string) string { pi_volume_size = 2 pi_volume_name = "%[1]s-${count.index}" pi_volume_shareable = true - pi_volume_pool = "Tier1-Flash-1" + pi_volume_pool = "%[3]s" pi_cloud_instance_id = "%[2]s" pi_replication_enabled = true } - `, name, cloud_instance_id) + `, name, cloud_instance_id, acc.PiStoragePool) } From 2cda0cfdb77b1aea11e02f925e52690edcb91e37 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Tue, 9 Jan 2024 13:20:22 +0530 Subject: [PATCH 11/13] Feedback resolved --- .../power/data_source_ibm_pi_volume_clone.go | 25 ++++---- .../data_source_ibm_pi_volume_clone_test.go | 4 +- ibm/service/power/ibm_pi_constants.go | 22 +++---- .../power/resource_ibm_pi_volume_clone.go | 57 ++++++++++--------- .../resource_ibm_pi_volume_clone_test.go | 14 +++-- website/docs/d/pi_volume_clone.html.markdown | 11 ++-- website/docs/r/pi_volume_clone.html.markdown | 22 +++---- 7 files changed, 81 insertions(+), 74 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone.go b/ibm/service/power/data_source_ibm_pi_volume_clone.go index fc44cb856b8..87a9c5f12fa 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023, 2024 All Rights Reserved. +// Copyright IBM Corp. 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power @@ -22,30 +22,31 @@ func DataSourceIBMPIVolumeClone() *schema.Resource { PIVolumeCloneTaskID: { Type: schema.TypeString, Required: true, - Description: "Clone task ID", + Description: "The ID of the volume clone task.", ValidateFunc: validation.NoZeroValues, }, - helpers.PICloudInstanceId: { + Arg_CloudInstanceID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.NoZeroValues, + Description: "The GUID of the service instance associated with an account.", }, // Computed attributes "cloned_volumes": clonedVolumesSchema(), - "volume_clone_failure_reason": { + "failure_reason": { Type: schema.TypeString, Computed: true, - Description: "The reason the clone volumes task has failed", + Description: "The reason the clone volumes task has failed.", }, - "volume_clone_percent_complete": { + "percent_complete": { Type: schema.TypeInt, Computed: true, - Description: "Clone task completion percentage", + Description: "The completion percentage of the volume clone task.", }, - "volume_clone_status": { + "status": { Type: schema.TypeString, Computed: true, - Description: "Status of the clone volumes task", + Description: "The status of the volume clone task.", }, }, } @@ -66,11 +67,11 @@ func dataSourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, d.SetId(d.Get(PIVolumeCloneTaskID).(string)) if volClone.Status != nil { - d.Set("volume_clone_status", *volClone.Status) + d.Set("status", *volClone.Status) } - d.Set("volume_clone_failure_reason", volClone.FailedReason) + d.Set("failure_reason", volClone.FailedReason) if volClone.PercentComplete != nil { - d.Set("volume_clone_percent_complete", *volClone.PercentComplete) + d.Set("percent_complete", *volClone.PercentComplete) } d.Set("cloned_volumes", flattenClonedVolumes(volClone.ClonedVolumes)) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go index 03de00a6637..a8b8d805d47 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone_test.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023, 2024 All Rights Reserved. +// Copyright IBM Corp. 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power_test @@ -21,7 +21,7 @@ func TestAccIBMPIVolumeClone_basic(t *testing.T) { Config: testAccCheckIBMPIVolumeCloneBasicConfig(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "id"), - resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "volume_clone_status"), + resource.TestCheckResourceAttrSet("data.ibm_pi_volume_clone.testacc_ds_volume_clone", "status"), ), }, }, diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 427273d4973..b4f18b330cd 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -145,16 +145,18 @@ const ( // status // common status states - StatusShutoff = "SHUTOFF" - StatusActive = "ACTIVE" - StatusResize = "RESIZE" - StatusError = "ERROR" - StatusBuild = "BUILD" - StatusPending = "PENDING" - SctionStart = "start" - SctionStop = "stop" - PIVolumeCloneCompleted = "completed" - PIVolumeCloneRunning = "running" + StatusShutoff = "SHUTOFF" + StatusActive = "ACTIVE" + StatusResize = "RESIZE" + StatusError = "ERROR" + StatusBuild = "BUILD" + StatusPending = "PENDING" + SctionStart = "start" + SctionStop = "stop" + + // volume clone task status + VolumeCloneCompleted = "completed" + VolumeCloneRunning = "running" // Workspaces Attr_WorkspaceCapabilities = "pi_workspace_capabilities" diff --git a/ibm/service/power/resource_ibm_pi_volume_clone.go b/ibm/service/power/resource_ibm_pi_volume_clone.go index 05a64f7d165..c874863c95e 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023, 2024 All Rights Reserved. +// Copyright IBM Corp. 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power @@ -32,17 +32,17 @@ func ResourceIBMPIVolumeClone() *schema.Resource { }, Schema: map[string]*schema.Schema{ - helpers.PICloudInstanceId: { + Arg_CloudInstanceID: { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Cloud Instance ID - This is the service_instance_id.", + Description: "The GUID of the service instance associated with an account.", }, PIVolumeCloneName: { Type: schema.TypeString, Required: true, ForceNew: true, - Description: "Base name of the new cloned volume(s)", + Description: "The base name of the newly cloned volume(s).", }, PIVolumeIds: { Type: schema.TypeSet, @@ -50,42 +50,42 @@ func ResourceIBMPIVolumeClone() *schema.Resource { ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, - Description: "List of volumes to be cloned", + Description: "List of volumes to be cloned.", }, PITargetStorageTier: { Type: schema.TypeString, Optional: true, ForceNew: true, - Description: "Target storage tier for the cloned volumes.", + Description: "The storage tier for the cloned volume(s).", }, helpers.PIReplicationEnabled: { Type: schema.TypeBool, Optional: true, ForceNew: true, - Description: "By default, cloned volume replication is determined by the source volume unless explicitly specified", + Description: "Indicates whether the cloned volume should have replication enabled. If no value is provided, it will default to the replication status of the source volume(s).", }, // Computed attributes - "volume_clone_task_id": { + "task_id": { Type: schema.TypeString, Computed: true, - Description: "Clone task ID", + Description: "The ID of the volume clone task.", }, "cloned_volumes": clonedVolumesSchema(), - "volume_clone_failure_reason": { + "failure_reason": { Type: schema.TypeString, Computed: true, - Description: "The reason the clone volumes task has failed", + Description: "The reason for the failure of the volume clone task.", }, - "volume_clone_percent_complete": { + "percent_complete": { Type: schema.TypeInt, Computed: true, - Description: "Clone task completion percentage", + Description: "The completion percentage of the volume clone task.", }, - "volume_clone_status": { + "status": { Type: schema.TypeString, Computed: true, - Description: "Status of the clone volumes task", + Description: "The status of the volume clone task.", }, }, } @@ -148,13 +148,13 @@ func resourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, m return diag.FromErr(err) } - d.Set("volume_clone_task_id", vcTaskID) + d.Set("task_id", vcTaskID) if volCloneTask.Status != nil { - d.Set("volume_clone_status", *volCloneTask.Status) + d.Set("status", *volCloneTask.Status) } - d.Set("volume_clone_failure_reason", volCloneTask.FailedReason) + d.Set("failure_reason", volCloneTask.FailedReason) if volCloneTask.PercentComplete != nil { - d.Set("volume_clone_percent_complete", *volCloneTask.PercentComplete) + d.Set("percent_complete", *volCloneTask.PercentComplete) } d.Set("cloned_volumes", flattenClonedVolumes(volCloneTask.ClonedVolumes)) @@ -186,8 +186,8 @@ func isWaitForIBMPIVolumeCloneCompletion(ctx context.Context, client *st.IBMPICl log.Printf("Waiting for Volume clone (%s) to be completed.", id) stateConf := &resource.StateChangeConf{ - Pending: []string{PIVolumeCloneRunning}, - Target: []string{PIVolumeCloneCompleted}, + Pending: []string{VolumeCloneRunning}, + Target: []string{VolumeCloneCompleted}, Refresh: isIBMPIVolumeCloneRefreshFunc(client, id), Delay: 10 * time.Second, MinTimeout: 2 * time.Minute, @@ -204,29 +204,30 @@ func isIBMPIVolumeCloneRefreshFunc(client *st.IBMPICloneVolumeClient, id string) return nil, "", err } - if *volClone.Status == PIVolumeCloneCompleted { - return volClone, PIVolumeCloneCompleted, nil + if *volClone.Status == VolumeCloneCompleted { + return volClone, VolumeCloneCompleted, nil } - return volClone, PIVolumeCloneRunning, nil + return volClone, VolumeCloneRunning, nil } } func clonedVolumesSchema() *schema.Schema { return &schema.Schema{ - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The List of cloned volumes.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "clone_volume_id": { Type: schema.TypeString, Computed: true, - Description: "ID of the new cloned volume", + Description: "The ID of the newly cloned volume.", }, "source_volume_id": { Type: schema.TypeString, Computed: true, - Description: "ID of the source volume to be cloned", + Description: "The ID of the source volume.", }, }, }, diff --git a/ibm/service/power/resource_ibm_pi_volume_clone_test.go b/ibm/service/power/resource_ibm_pi_volume_clone_test.go index f68c49d343e..4a5da2446f8 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone_test.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone_test.go @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2023, 2024 All Rights Reserved. +// Copyright IBM Corp. 2024 All Rights Reserved. // Licensed under the Mozilla Public License v2.0 package power_test @@ -19,6 +19,7 @@ import ( ) func TestAccIBMPIVolumeClone(t *testing.T) { + resVolumeClone := "ibm_pi_volume_clone.power_volume_clone" name := fmt.Sprintf("tf-pi-volume-clone-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, @@ -27,9 +28,12 @@ func TestAccIBMPIVolumeClone(t *testing.T) { { Config: testAccCheckIBMPIVolumeCloneConfig(name), Check: resource.ComposeTestCheckFunc( - testAccCheckIBMPIVolumeCloneExists("ibm_pi_volume_clone.power_volume_clone"), - resource.TestCheckResourceAttrSet("ibm_pi_volume_clone.power_volume_clone", "id"), - resource.TestCheckResourceAttrSet("ibm_pi_volume_clone.power_volume_clone", "volume_clone_status"), + testAccCheckIBMPIVolumeCloneExists(resVolumeClone), + resource.TestCheckResourceAttrSet(resVolumeClone, "id"), + resource.TestCheckResourceAttrSet(resVolumeClone, "status"), + resource.TestCheckResourceAttr(resVolumeClone, "status", "completed"), + resource.TestCheckResourceAttrSet(resVolumeClone, "percent_complete"), + resource.TestCheckResourceAttr(resVolumeClone, "percent_complete", "100"), ), }, }, @@ -74,7 +78,7 @@ func testAccCheckIBMPIVolumeCloneConfig(name string) string { resource "ibm_pi_volume_clone" "power_volume_clone" { pi_cloud_instance_id = "%[1]s" pi_volume_clone_name = "%[2]s" - pi_volume_ids = [ibm_pi_volume.power_volume[0].volume_id,ibm_pi_volume.power_volume[1].volume_id] + pi_volume_ids = ibm_pi_volume.power_volume.*.volume_id pi_target_storage_tier = "%[3]s" pi_replication_enabled = %[4]v } diff --git a/website/docs/d/pi_volume_clone.html.markdown b/website/docs/d/pi_volume_clone.html.markdown index 02d7ecb2ceb..9c61c9b835a 100644 --- a/website/docs/d/pi_volume_clone.html.markdown +++ b/website/docs/d/pi_volume_clone.html.markdown @@ -15,8 +15,8 @@ The following example retrieves information about the volume clone task that is ```terraform data "ibm_pi_volume_clone" "ds_volume_clone" { - pi_cloud_instance_id = "" - pi_volume_clone_task_id = "" + pi_cloud_instance_id = "" + pi_volume_clone_task_id = "" } ``` @@ -48,8 +48,7 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `cloned_volumes`: - `clone_volume_id` - (String) The ID of the newly cloned volume. - `source_volume_id` - (String) The ID of the source volume. +- `failure_reason` - (String) The reason for the failure of the clone volume task. - `id` - (String) The unique identifier of the volume clone task. -- `volume_clone_failure_reason` - (String) The reason for the failure of the clone volume task. -- `volume_clone_percent_complete` - (Integer) The completion percentage of the volume clone task. -- `volume_clone_status` - (String) The status of the volume clone task. -- `volume_clone_task_id` - (String) The ID of the volume clone task. +- `percent_complete` - (Integer) The completion percentage of the volume clone task. +- `status` - (String) The status of the volume clone task. diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown index d6f78997a9e..bf25d45455a 100644 --- a/website/docs/r/pi_volume_clone.html.markdown +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -15,11 +15,11 @@ The following example creates a volume clone. ```terraform resource "ibm_pi_volume_clone" "testacc_volume_clone" { - pi_cloud_instance_id = "" - pi_volume_clone_name = "test-volume-clone" - pi_volume_ids = [""] - pi_target_storage_tier = "" - pi_replication_enabled = true + pi_cloud_instance_id = "" + pi_volume_clone_name = "test-volume-clone" + pi_volume_ids = [""] + pi_target_storage_tier = "" + pi_replication_enabled = true } ``` @@ -61,15 +61,15 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `cloned_volumes`: - `clone_volume_id` - (String) The ID of the newly cloned volume. - `source_volume_id` - (String) The ID of the source volume. -- `id` - (String) The unique identifier of the volume clone. The ID is composed of `/`. -- `volume_clone_failure_reason` - (String) The reason for the failure of the volume clone task. -- `volume_clone_percent_complete` - (Integer) The completion percentage of the volume clone task. -- `volume_clone_status` - (String) The status of the volume clone task. -- `volume_clone_task_id` - (String) The ID of the volume clone task. +- `failure_reason` - (String) The reason for the failure of the volume clone task. +- `id` - (String) The unique identifier of the volume clone. The ID is composed of `/`. +- `percent_complete` - (Integer) The completion percentage of the volume clone task. +- `status` - (String) The status of the volume clone task. +- `task_id` - (String) The ID of the volume clone task. ## Import -The `ibm_pi_volume_clone` resource can be imported by using `power_instance_id` and `volume_clone_task_id`. +The `ibm_pi_volume_clone` resource can be imported by using `pi_cloud_instance_id` and `task_id`. **Example** From cf14eda17a0e95840ea9f09597d445a34f0f4f06 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Wed, 10 Jan 2024 10:20:35 +0530 Subject: [PATCH 12/13] Fix: Document formatting --- website/docs/d/pi_volume_clone.html.markdown | 1 + website/docs/r/pi_volume_clone.html.markdown | 1 + 2 files changed, 2 insertions(+) diff --git a/website/docs/d/pi_volume_clone.html.markdown b/website/docs/d/pi_volume_clone.html.markdown index 9c61c9b835a..995cac79ac8 100644 --- a/website/docs/d/pi_volume_clone.html.markdown +++ b/website/docs/d/pi_volume_clone.html.markdown @@ -45,6 +45,7 @@ Review the argument references that you can specify for your resource. In addition to all argument reference list, you can access the following attribute reference after your resource is created. - `cloned_volumes` - (List of objects) The List of cloned volumes. + Nested scheme for `cloned_volumes`: - `clone_volume_id` - (String) The ID of the newly cloned volume. - `source_volume_id` - (String) The ID of the source volume. diff --git a/website/docs/r/pi_volume_clone.html.markdown b/website/docs/r/pi_volume_clone.html.markdown index bf25d45455a..616b6b2f39a 100644 --- a/website/docs/r/pi_volume_clone.html.markdown +++ b/website/docs/r/pi_volume_clone.html.markdown @@ -58,6 +58,7 @@ Review the argument references that you can specify for your resource. In addition to all argument reference list, you can access the following attribute reference after your resource is created. - `cloned_volumes` - (List of objects) The List of cloned volumes. + Nested scheme for `cloned_volumes`: - `clone_volume_id` - (String) The ID of the newly cloned volume. - `source_volume_id` - (String) The ID of the source volume. From 2cc2bfd577c45a4f7453caecc58dae1f4d7a2919 Mon Sep 17 00:00:00 2001 From: dhirendersingh19 Date: Thu, 11 Jan 2024 14:49:06 +0530 Subject: [PATCH 13/13] Making use of the correct cloudInstanceId constant --- ibm/service/power/data_source_ibm_pi_volume_clone.go | 3 +-- ibm/service/power/resource_ibm_pi_volume_clone.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_volume_clone.go b/ibm/service/power/data_source_ibm_pi_volume_clone.go index 87a9c5f12fa..3692be175ff 100644 --- a/ibm/service/power/data_source_ibm_pi_volume_clone.go +++ b/ibm/service/power/data_source_ibm_pi_volume_clone.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" st "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" ) @@ -58,7 +57,7 @@ func dataSourceIBMPIVolumeCloneRead(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) client := st.NewIBMPICloneVolumeClient(ctx, sess, cloudInstanceID) volClone, err := client.Get(d.Get(PIVolumeCloneTaskID).(string)) if err != nil { diff --git a/ibm/service/power/resource_ibm_pi_volume_clone.go b/ibm/service/power/resource_ibm_pi_volume_clone.go index c874863c95e..6d43f4efbaa 100644 --- a/ibm/service/power/resource_ibm_pi_volume_clone.go +++ b/ibm/service/power/resource_ibm_pi_volume_clone.go @@ -97,7 +97,7 @@ func resourceIBMPIVolumeCloneCreate(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) vcName := d.Get(PIVolumeCloneName).(string) volids := flex.ExpandStringList((d.Get(PIVolumeIds).(*schema.Set)).List())