Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GRS attributes to pi volume group data sources and related #5673

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
github.com/IBM-Cloud/power-go-client v1.7.0
github.com/IBM-Cloud/power-go-client v1.8.1
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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be/go.mod h1:/7h
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/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.7.0 h1:/GuGwPMTKoCZACfnwt7b6wKr4v32q1VO1AMFGNETRN4=
github.com/IBM-Cloud/power-go-client v1.7.0/go.mod h1:9izycYAmNQ+NAdVPXDC3fHYxqWLjlR2YiwqKYveMv5Y=
github.com/IBM-Cloud/power-go-client v1.8.1 h1:tx1aPJmIQrNru1MD1VHGNasGx3eRIs0zzPZ0KvdFQrg=
github.com/IBM-Cloud/power-go-client v1.8.1/go.mod h1:N4RxrsMUvBQjSQ/qPk0iMZ8zK+fZPRTnHi/gTaASw0g=
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=
Expand Down
21 changes: 21 additions & 0 deletions ibm/service/power/data_source_ibm_pi_volume_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,22 @@ func DataSourceIBMPIVolumeGroup() *schema.Resource {
},

// Attributes
Attr_Auxiliary: {
Computed: true,
Description: "Indicates if the volume is auxiliary or not.",
Type: schema.TypeBool,
},
Attr_ConsistencyGroupName: {
Computed: true,
Description: "The name of consistency group at storage controller level.",
Type: schema.TypeString,
},
Attr_ReplicationSites: {
Computed: true,
Description: "Indicates the replication sites of the volume group.",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
},
Attr_ReplicationStatus: {
Computed: true,
Description: "The replication status of volume group.",
Expand Down Expand Up @@ -73,6 +84,11 @@ func DataSourceIBMPIVolumeGroup() *schema.Resource {
},
Type: schema.TypeSet,
},
Attr_StoragePool: {
Computed: true,
Description: "Indicates the storage pool of the volume group",
Type: schema.TypeString,
},
Attr_VolumeGroupName: {
Computed: true,
Description: "The name of the volume group.",
Expand All @@ -96,12 +112,17 @@ func dataSourceIBMPIVolumeGroupRead(ctx context.Context, d *schema.ResourceData,
}

d.SetId(*vgData.ID)
d.Set(Attr_Auxiliary, vgData.Auxiliary)
d.Set(Attr_ConsistencyGroupName, vgData.ConsistencyGroupName)
d.Set(Attr_ReplicationStatus, vgData.ReplicationStatus)
if len(vgData.ReplicationSites) > 0 {
d.Set(Attr_ReplicationSites, vgData.ReplicationSites)
}
d.Set(Attr_Status, vgData.Status)
if vgData.StatusDescription != nil {
d.Set(Attr_StatusDescriptionErrors, flattenVolumeGroupStatusDescription(vgData.StatusDescription.Errors))
}
d.Set(Attr_StoragePool, vgData.StoragePool)
d.Set(Attr_VolumeGroupName, vgData.Name)

return nil
Expand Down
21 changes: 21 additions & 0 deletions ibm/service/power/data_source_ibm_pi_volume_group_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func DataSourceIBMPIVolumeGroupDetails() *schema.Resource {
},

// Attributes
Attr_Auxiliary: {
Computed: true,
Description: "Indicates if the volume is auxiliary or not.",
Type: schema.TypeBool,
},
Attr_ConsistencyGroupName: {
Computed: true,
Description: "The name of consistency group at storage controller level.",
Expand All @@ -42,6 +47,12 @@ func DataSourceIBMPIVolumeGroupDetails() *schema.Resource {
Description: "The replication status of volume group.",
Type: schema.TypeString,
},
Attr_ReplicationSites: {
Computed: true,
Description: "Indicates the replication sites of the volume group.",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
},
Attr_Status: {
Computed: true,
Description: "The status of the volume group.",
Expand Down Expand Up @@ -72,6 +83,11 @@ func DataSourceIBMPIVolumeGroupDetails() *schema.Resource {
},
Type: schema.TypeSet,
},
Attr_StoragePool: {
Computed: true,
Description: "Indicates the storage pool of the volume group",
Type: schema.TypeString,
},
Attr_VolumeIDs: {
Computed: true,
Description: "List of volume IDs, member of volume group.",
Expand Down Expand Up @@ -101,12 +117,17 @@ func dataSourceIBMPIVolumeGroupDetailsRead(ctx context.Context, d *schema.Resour
}

d.SetId(*vgData.ID)
d.Set(Attr_Auxiliary, vgData.Auxiliary)
d.Set(Attr_ConsistencyGroupName, vgData.ConsistencyGroupName)
d.Set(Attr_ReplicationStatus, vgData.ReplicationStatus)
if len(vgData.ReplicationSites) > 0 {
d.Set(Attr_ReplicationSites, vgData.ReplicationSites)
}
d.Set(Attr_Status, vgData.Status)
if vgData.StatusDescription != nil {
d.Set(Attr_StatusDescriptionErrors, flattenVolumeGroupStatusDescription(vgData.StatusDescription.Errors))
}
d.Set(Attr_StoragePool, vgData.StoragePool)
d.Set(Attr_VolumeIDs, vgData.VolumeIDs)
d.Set(Attr_VolumeGroupName, vgData.Name)

Expand Down
22 changes: 22 additions & 0 deletions ibm/service/power/data_source_ibm_pi_volume_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func DataSourceIBMPIVolumeGroups() *schema.Resource {
Description: "List of all volume groups.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_Auxiliary: {
Computed: true,
Description: "Indicates if the volume is auxiliary or not.",
Type: schema.TypeBool,
},
Attr_ConsistencyGroupName: {
Computed: true,
Description: "The name of consistency group at storage controller level.",
Expand All @@ -50,6 +55,12 @@ func DataSourceIBMPIVolumeGroups() *schema.Resource {
Description: "The replication status of volume group.",
Type: schema.TypeString,
},
Attr_ReplicationSites: {
Computed: true,
Description: "Indicates the replication sites of the volume group.",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
},
Attr_Status: {
Computed: true,
Description: "The status of the volume group.",
Expand Down Expand Up @@ -80,6 +91,11 @@ func DataSourceIBMPIVolumeGroups() *schema.Resource {
},
Type: schema.TypeSet,
},
Attr_StoragePool: {
Computed: true,
Description: "Indicates the storage pool of the volume group",
Type: schema.TypeString,
},
Attr_VolumeGroupName: {
Computed: true,
Description: "The name of the volume group.",
Expand Down Expand Up @@ -118,13 +134,19 @@ func flattenVolumeGroups(list []*models.VolumeGroup) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(list))
for _, i := range list {
l := map[string]interface{}{
Attr_Auxiliary: i.Auxiliary,
Attr_ConsistencyGroupName: i.ConsistencyGroupName,
Attr_ID: *i.ID,
Attr_ReplicationStatus: i.ReplicationStatus,
Attr_Status: i.Status,
Attr_StatusDescriptionErrors: flattenVolumeGroupStatusDescription(i.StatusDescription.Errors),
Attr_StoragePool: i.StoragePool,
Attr_VolumeGroupName: i.Name,
}
if len(i.ReplicationSites) > 0 {
l[Attr_ReplicationSites] = i.ReplicationSites
}

result = append(result, l)
}
return result
Expand Down
22 changes: 22 additions & 0 deletions ibm/service/power/data_source_ibm_pi_volume_groups_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func DataSourceIBMPIVolumeGroupsDetails() *schema.Resource {
Description: "List of all volume group.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_Auxiliary: {
Computed: true,
Description: "Indicates if the volume is auxiliary or not.",
Type: schema.TypeBool,
},
Attr_ConsistencyGroupName: {
Computed: true,
Description: "The name of consistency group at storage controller level.",
Expand All @@ -50,11 +55,22 @@ func DataSourceIBMPIVolumeGroupsDetails() *schema.Resource {
Description: "The replication status of volume group.",
Type: schema.TypeString,
},
Attr_ReplicationSites: {
Computed: true,
Description: "Indicates the replication sites of the volume group.",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
},
Attr_Status: {
Computed: true,
Description: "The status of the volume group.",
Type: schema.TypeString,
},
Attr_StoragePool: {
Computed: true,
Description: "Indicates the storage pool of the volume group",
Type: schema.TypeString,
},
Attr_StatusDescriptionErrors: {
Computed: true,
Description: "The status details of the volume group.",
Expand Down Expand Up @@ -124,14 +140,20 @@ func flattenVolumeGroupsDetails(list []*models.VolumeGroupDetails) []map[string]
result := make([]map[string]interface{}, 0, len(list))
for _, i := range list {
l := map[string]interface{}{
Attr_Auxiliary: i.Auxiliary,
Attr_ConsistencyGroupName: i.ConsistencyGroupName,
Attr_ID: *i.ID,
Attr_ReplicationStatus: i.ReplicationStatus,
Attr_Status: i.Status,
Attr_StoragePool: i.StoragePool,
"status_description_errors": flattenVolumeGroupStatusDescription(i.StatusDescription.Errors),
Attr_VolumeGroupName: i.Name,
Attr_VolumeIDs: i.VolumeIDs,
}
if len(i.ReplicationSites) > 0 {
l[Attr_ReplicationSites] = i.ReplicationSites
}

result = append(result, l)
}
return result
Expand Down
1 change: 1 addition & 0 deletions ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const (
Arg_ReplicationEnabled = "pi_replication_enabled"
Arg_ReplicationPolicy = "pi_replication_policy"
Arg_ReplicationScheme = "pi_replication_scheme"
Arg_ReplicationSites = "pi_replication_sites"
Arg_ResourceGroupID = "pi_resource_group_id"
Arg_SAP = "sap"
Arg_SAPDeploymentType = "pi_sap_deployment_type"
Expand Down
7 changes: 7 additions & 0 deletions ibm/service/power/resource_ibm_pi_volume_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ func ResourceIBMPIVolumeGroup() *schema.Resource {
Description: "Consistency Group Name if volume is a part of volume group",
Type: schema.TypeString,
},
Attr_ReplicationSites: {
Computed: true,
Description: "Indicates the replication sites of the volume group.",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeList,
},
Attr_ReplicationStatus: {
Computed: true,
Description: "Volume Group Replication Status",
Expand Down Expand Up @@ -168,6 +174,7 @@ func resourceIBMPIVolumeGroupRead(ctx context.Context, d *schema.ResourceData, m
d.Set(Arg_VolumeGroupName, vg.Name)
d.Set(Arg_VolumeIDs, vg.VolumeIDs)
d.Set(Attr_ConsistencyGroupName, vg.ConsistencyGroupName)
d.Set(Attr_ReplicationSites, vg.ReplicationSites)
d.Set(Attr_ReplicationStatus, vg.ReplicationStatus)
if vg.StatusDescription != nil {
d.Set(Attr_StatusDescriptionErrors, flattenVolumeGroupStatusDescription(vg.StatusDescription.Errors))
Expand Down
3 changes: 3 additions & 0 deletions website/docs/d/pi_volume_group_details.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ Review the argument references that you can specify for your data source.
## Attribute reference
In addition to all argument reference list, you can access the following attribute references after your data source is created.

- `auxiliary` - (Boolean) Indicates if the volume group is auxiliary.
- `consistency_group_name` - (String) The name of consistency group at storage controller level.
- `id` - (String) The unique identifier of the volume group.
- `replication_status` - (String) The replication status of volume group.
- `replication_sites` - (List) Indicates the replication sites of the volume group.
- `status` - (String) The status of the volume group.
- `status_description_errors` - (List) The status details of the volume group.

Nested scheme for `status_description_errors`:
- `key` - (String) The volume group error key.
- `message` - (String) The failure message providing more details about the error key.
- `volume_ids` - (List) List of volume IDs, which failed to be added/removed to/from the volume group, with the given error.
- `storage_pool` - (String) Storage pool of the volume group.
- `volume_group_name` - (String) The name of the volume group.
- `volume_ids` - (List) List of volume IDs, member of volume group.
3 changes: 3 additions & 0 deletions website/docs/d/pi_volume_groups.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ In addition to all argument reference list, you can access the following attribu
- `volume_groups`: List of all volume groups.

Nested scheme for `volume_groups`:
- `auxiliary` - (Boolean) Indicates if the volume group is auxiliary.
- `consistency_group_name` - (String) The name of consistency group at storage controller level.
- `id` - (String) The unique identifier of the volume group.
- `replication_status` - (String) The replication status of volume group.
- `replication_sites` - (List) Indicates the replication sites of the volume group.
- `status` - (String) The status of the volume group.
- `status_description_errors` - (List) The status details of the volume group.

Nested scheme for `status_description_errors`:
- `key` - (String) The volume group error key.
- `message` - (String) The failure message providing more details about the error key.
- `volume_ids` - (List) List of volume IDs, which failed to be added/removed to/from the volume group, with the given error.
- `storage_pool` - (String) Storage pool of the volume group.
- `volume_group_name` - (String) The name of the volume group.
5 changes: 4 additions & 1 deletion website/docs/d/pi_volume_groups_details.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@ In addition to all argument reference list, you can access the following attribu
- `volume_groups` - (List) List of all volume group.

Nested scheme for `volume_groups`:
- `auxiliary` - (Boolean) Indicates if the volume group is auxiliary.
- `consistency_group_name` - (String) The name of consistency group at storage controller level.
- `id` - (String) The unique identifier of the volume group.
- `replication_status` - (String) The replication status of volume group.
- `replication_sites` - (List) Indicates the replication sites of the volume group.
- `status` - (String) The status of the volume group.
- `status_description_errors` - (List) The status details of the volume group.

Nested scheme for `status_description_errors`:
- `key` - (String) The volume group error key.
- `message` - (String) The failure message providing more details about the error key.
- `volume_ids` - (List) List of volume IDs, which failed to be added/removed to/from the volume group, with the given error.
- `storage_pool` - (String) Storage pool of the volume group.
- `volume_group_name` - (String) The name of the volume group.
- `volume_ids` - (List) List of volume IDs, member of volume group.
- `volume_ids` - (List) List of volume IDs, member of volume group.
3 changes: 3 additions & 0 deletions website/docs/r/pi_volume_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ 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.

- `auxiliary` - (Boolean) Indicates if the volume group is auxiliary.
- `consistency_group_name` - (String) The consistency Group Name if volume is a part of volume group.
- `id` - (String) The unique identifier of the volume group. The ID is composed of `<pi_cloud_instance_id>/<volume_group_id>`.
- `replication_sites` - (List) Indicates the replication sites of the volume group.
- `replication_status` - (String) The replication status of volume group.
- `status_description_errors` - (Set) The status details of the volume group.

Nested scheme for `status_description_errors`:
- `key` - (String) The volume group error key.
- `message` - (String) The failure message providing more details about the error key.
- `volume_ids` - (List of String) List of volume IDs, which failed to be added to or removed from the volume group, with the given error.
- `storage_pool` - (String) Storage pool of the volume group.
- `volume_group_id` - (String) The unique identifier of the volume group.
- `volume_group_status` - (String) The status of the volume group.

Expand Down
Loading