Skip to content

Commit

Permalink
Add support_systems for sap profile
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkad committed Apr 24, 2024
1 parent 6c7c7d9 commit a2df21a
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 28 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b
github.com/IBM-Cloud/power-go-client v1.6.0
github.com/IBM-Cloud/power-go-client v1.6.0-beta9
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 Expand Up @@ -65,6 +65,7 @@ require (
github.com/IBM/go-sdk-core v1.1.0
github.com/IBM/mqcloud-go-sdk v0.0.4
github.com/IBM/sarama v1.41.2
github.com/IBM/vmware-go-sdk v0.1.2
github.com/stretchr/testify v1.9.0
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749
sigs.k8s.io/controller-runtime v0.14.1
Expand Down Expand Up @@ -210,7 +211,7 @@ require (
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240402122236-5c5b994a3f1a/go.mod h1:/7h
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b h1:Wnq0BuprazpP41+nQlRpxpmAs8+8jyOqU50KrvFdJQ4=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b/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.6.0 h1:X+QX+WSF66+aouyaf4r+IeBLXUurAJj9+Bd+vH7G5I0=
github.com/IBM-Cloud/power-go-client v1.6.0/go.mod h1:0ad5Lcq1utoYVJx0uqooMjCpUaYaK0ItP9QJYtY6k0Y=
github.com/IBM-Cloud/power-go-client v1.6.0-beta9 h1:yMF53vAVoxapFEqJEIFCqx8bAjC/ZA6gbPqId3Gj4NI=
github.com/IBM-Cloud/power-go-client v1.6.0-beta9/go.mod h1:ucyaXsQxyssFFIbWT01uAA5784aKcU7u+q31yu04Rs4=
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 Expand Up @@ -172,6 +172,8 @@ github.com/IBM/schematics-go-sdk v0.2.3 h1:lgTt0Sbudii3cuSk1YSQgrtiZAXDbBABAoVj3
github.com/IBM/schematics-go-sdk v0.2.3/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu86jQmo5hcpd+L4=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40=
github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w9M=
github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA=
github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc=
github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA=
github.com/IBM/vpc-go-sdk v0.50.0 h1:+vnXYK0FXFXYqaS/5/X1XEqH0bbRotkzkerRk21ZEjE=
Expand Down Expand Up @@ -1910,8 +1912,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
30 changes: 30 additions & 0 deletions ibm/service/power/data_source_ibm_pi_sap_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,42 @@ func DataSourceIBMPISAPProfile() *schema.Resource {
Description: "Amount of cores.",
Type: schema.TypeInt,
},
Attr_FullSystemProfile: {
Computed: true,
Description: "Requires full system for deployment.",
Type: schema.TypeBool,
},
Attr_Memory: {
Computed: true,
Description: "Amount of memory (in GB).",
Type: schema.TypeInt,
},
Attr_SAPS: {
Computed: true,
Description: "SAP Application Performance Standard",
Type: schema.TypeInt,
},
Attr_SupportedSystems: {
Computed: true,
Description: "List of supported systems.",
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
Attr_Type: {
Computed: true,
Description: "Type of profile.",
Type: schema.TypeString,
},
Attr_WorkloadType: {
Computed: true,
Description: "Workload Type.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Type: schema.TypeList,
},
},
}
}
Expand All @@ -76,8 +102,12 @@ func dataSourceIBMPISAPProfileRead(ctx context.Context, d *schema.ResourceData,
d.SetId(*sapProfile.ProfileID)
d.Set(Attr_Certified, *sapProfile.Certified)
d.Set(Attr_Cores, *sapProfile.Cores)
d.Set(Attr_FullSystemProfile, *sapProfile.FullSystemProfile)
d.Set(Attr_Memory, *sapProfile.Memory)
d.Set(Attr_SAPS, *sapProfile.Saps)
d.Set(Attr_SupportedSystems, sapProfile.SupportedSystems)
d.Set(Attr_Type, *sapProfile.Type)
d.Set(Attr_WorkloadType, *&sapProfile.WorkloadTypes)

return nil
}
40 changes: 35 additions & 5 deletions ibm/service/power/data_source_ibm_pi_sap_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func DataSourceIBMPISAPProfiles() *schema.Resource {
Description: "Amount of cores.",
Type: schema.TypeInt,
},
Attr_FullSystemProfile: {
Computed: true,
Description: "Requires full system for deployment.",
Type: schema.TypeBool,
},
Attr_Memory: {
Computed: true,
Description: "Amount of memory (in GB).",
Expand All @@ -53,11 +58,32 @@ func DataSourceIBMPISAPProfiles() *schema.Resource {
Description: "SAP Profile ID.",
Type: schema.TypeString,
},
Attr_SAPS: {
Computed: true,
Description: "SAP Application Performance Standard",
Type: schema.TypeInt,
},
Attr_SupportedSystems: {
Computed: true,
Description: "List of supported systems.",
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
Attr_Type: {
Computed: true,
Description: "Type of profile.",
Type: schema.TypeString,
},
Attr_WorkloadType: {
Computed: true,
Description: "Workload Type.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Type: schema.TypeList,
},
},
},
Type: schema.TypeList,
Expand All @@ -84,11 +110,15 @@ func dataSourceIBMPISAPProfilesRead(ctx context.Context, d *schema.ResourceData,
result := make([]map[string]interface{}, 0, len(sapProfiles.Profiles))
for _, sapProfile := range sapProfiles.Profiles {
profile := map[string]interface{}{
Attr_Certified: *sapProfile.Certified,
Attr_Cores: *sapProfile.Cores,
Attr_Memory: *sapProfile.Memory,
Attr_ProfileID: *sapProfile.ProfileID,
Attr_Type: *sapProfile.Type,
Attr_Certified: *sapProfile.Certified,
Attr_Cores: *sapProfile.Cores,
Attr_FullSystemProfile: *sapProfile.FullSystemProfile,
Attr_Memory: *sapProfile.Memory,
Attr_ProfileID: *sapProfile.ProfileID,
Attr_SAPS: *sapProfile.Saps,
Attr_SupportedSystems: sapProfile.SupportedSystems,
Attr_Type: *sapProfile.Type,
Attr_WorkloadType: *&sapProfile.WorkloadTypes,
}
result = append(result, profile)
}
Expand Down
11 changes: 10 additions & 1 deletion ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const (
Attr_FlashCopyMappings = "flash_copy_mappings"
Attr_FlashCopyName = "flash_copy_name"
Attr_FreezeTime = "freeze_time"
Attr_FullSystemProfile = "full_system_profile"
Attr_Gateway = "gateway"
Attr_GlobalRouting = "global_routing"
Attr_GreDestinationAddress = "gre_destination_address"
Expand Down Expand Up @@ -218,6 +219,7 @@ const (
Attr_ReservedCores = "reserved_cores"
Attr_ResultsOnboardedVolumes = "results_onboarded_volumes"
Attr_ResultsVolumeOnboardingFailures = "results_volume_onboarding_failures"
Attr_SAPS = "saps"
Attr_ServerName = "server_name"
Attr_Shareable = "shreable"
Attr_SharedCoreRatio = "shared_core_ratio"
Expand Down Expand Up @@ -260,6 +262,7 @@ const (
Attr_StoragePoolsCapacity = "storage_pools_capacity"
Attr_StorageType = "storage_type"
Attr_StorageTypesCapacity = "storage_types_capacity"
Attr_SupportedSystems = "supported_systems"
Attr_Synchronized = "synchronized"
Attr_SystemPoolName = "system_pool_name"
Attr_SystemPools = "system_pools"
Expand Down Expand Up @@ -296,11 +299,14 @@ const (
Attr_WorkspaceID = "pi_workspace_id"
Attr_WorkspaceLocation = "pi_workspace_location"
Attr_WorkspaceName = "pi_workspace_name"
Attr_WorkloadType = "workload_type"
Attr_Workspaces = "workspaces"
Attr_WorkspaceStatus = "pi_workspace_status"
Attr_WorkspaceType = "pi_workspace_type"
Attr_WWN = "wwn"
OS_IBMI = "ibmi"

// Instance
OS_IBMI = "ibmi"

// TODO: Second Half Cleanup, remove extra variables

Expand Down Expand Up @@ -344,6 +350,9 @@ const (
PIInstanceUserData = "pi_user_data"
PIInstanceVolumeIds = "pi_volume_ids"

Attr_PIInstanceSharedProcessorPool = "shared_processor_pool"

Check failure on line 353 in ibm/service/power/ibm_pi_constants.go

View workflow job for this annotation

GitHub Actions / Build

Attr_PIInstanceSharedProcessorPool redeclared in this block
Attr_PIInstanceSharedProcessorPoolID = "shared_processor_pool_id"

Check failure on line 354 in ibm/service/power/ibm_pi_constants.go

View workflow job for this annotation

GitHub Actions / Build

Attr_PIInstanceSharedProcessorPoolID redeclared in this block

// Placement Group
PIPlacementGroupID = "placement_group_id"
PIPlacementGroupMembers = "members"
Expand Down
27 changes: 19 additions & 8 deletions website/docs/d/pi_sap_profile.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,51 @@ description: |-
---

# ibm_pi_sap_profile

Retrieve information about a SAP profile. For more information, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).

## Example usage

```terraform
data "ibm_pi_sap_profile" "example" {
pi_cloud_instance_id = "<value of the cloud_instance_id>"
pi_sap_profile_id = "tinytest-1x4"
}
```

**Notes**
### Notes

- 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"
}
```
Example usage:

```terraform
provider "ibm" {
region = "lon"
zone = "lon04"
}
```
## Argument reference
Review the argument references that you can specify for your data source.
- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account.
- `pi_sap_profile_id` - (Required, String) SAP Profile ID.
## Attribute reference
In addition to all argument reference list, you can access the following attribute references after your data source is created.
- `certified` - (Boolean) Has certification been performed on profile.
- `cores` - (Integer) Amount of cores.
- `full_system_profile` - (Boolean) Requires full system for deployment.
- `memory` - (Integer) Amount of memory (in GB).
- `saps` - (Integer) SAP application performance standard.
- `supported_systems` - (List) List of supported systems.
- `type` - (String) Type of profile.
- `workload_type` - (List) List of workload types.
26 changes: 18 additions & 8 deletions website/docs/d/pi_sap_profiles.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,52 @@ description: |-
---

# ibm_pi_sap_profiles

Retrieve information about all SAP profiles. For more information, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).

## Example usage

```terraform
data "ibm_pi_sap_profiles" "example" {
pi_cloud_instance_id = "<value of the cloud_instance_id>"
}
```

**Notes**
### Notes

- 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"
}
```
Example usage:

```terraform
provider "ibm" {
region = "lon"
zone = "lon04"
}
```
## Argument reference
Review the argument references that you can specify for your data source.
- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account.
## Attribute reference
In addition to all argument reference list, you can access the following attribute references after your data source is created.
- `profiles` - (List) List of all the SAP Profiles.
Nested scheme for `profiles`:
- `certified` - (Boolean) Has certification been performed on profile.
- `cores` - (Integer) Amount of cores.
- `full_system_profile` - (Boolean) Requires full system for deployment.
- `memory` - (Integer) Amount of memory (in GB).
- `profile_id` - (String) SAP Profile ID.
- `saps` - (Integer) SAP application performance standard.
- `supported_systems` - (List) List of supported systems.
- `type` - (String) Type of profile.
- `workload_type` - (List) List of workload types.

0 comments on commit a2df21a

Please sign in to comment.