Skip to content

Commit

Permalink
[Datasource] Add host reference to power dedicated host data sources
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Kita committed Dec 2, 2024
1 parent 7f0333b commit ae0146f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
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-20240926024252-81b3928fd062
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
github.com/IBM-Cloud/power-go-client v1.8.3
github.com/IBM-Cloud/power-go-client v1.9.0
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-20240926024252-81b3928fd062/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.8.3 h1:QsBuIS6KvKsiEpe0yiHYKhWgXlqkcJ7XqFHtATj8Yh4=
github.com/IBM-Cloud/power-go-client v1.8.3/go.mod h1:UDyXeIKEp6r7yWUXYu3r0ZnFSlNZ2YeQTHwM2Tmlgv0=
github.com/IBM-Cloud/power-go-client v1.9.0 h1:nnErpb/7TJQe8P7OfIlJPhSJVq5oyuCJlMje9Ry6XEY=
github.com/IBM-Cloud/power-go-client v1.9.0/go.mod h1:UDyXeIKEp6r7yWUXYu3r0ZnFSlNZ2YeQTHwM2Tmlgv0=
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
8 changes: 8 additions & 0 deletions ibm/service/power/data_source_ibm_pi_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func DataSourceIBMPIHost() *schema.Resource {
Description: "Link to host group resource.",
Type: schema.TypeMap,
},
Attr_HostReference: {
Computed: true,
Description: "Current physical ID of the host.",
Type: schema.TypeInt,
},
Attr_State: {
Computed: true,
Description: "State of the host (up/down).",
Expand Down Expand Up @@ -137,6 +142,9 @@ func dataSourceIBMPIHostRead(ctx context.Context, d *schema.ResourceData, meta i
if host.HostGroup != nil {
d.Set(Attr_HostGroup, hostGroupToMap(host.HostGroup))
}
if host.HostReference != 0 {
d.Set(Attr_HostReference, host.HostReference)
}
if host.State != "" {
d.Set(Attr_State, host.State)
}
Expand Down
8 changes: 8 additions & 0 deletions ibm/service/power/data_source_ibm_pi_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func DataSourceIBMPIHosts() *schema.Resource {
Description: "Link to host group resource.",
Type: schema.TypeMap,
},
Attr_HostReference: {
Computed: true,
Description: "Current physical ID of the host.",
Type: schema.TypeInt,
},
Attr_State: {
Computed: true,
Description: "State of the host (up/down).",
Expand Down Expand Up @@ -151,6 +156,9 @@ func dataSourceIBMPIHostsRead(ctx context.Context, d *schema.ResourceData, meta
if host.HostGroup != nil {
hs[Attr_HostGroup] = hostGroupToMap(host.HostGroup)
}
if host.HostReference != 0 {
hs[Attr_HostReference] = host.HostReference
}
if host.State != "" {
hs[Attr_State] = host.State
}
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 @@ -206,6 +206,7 @@ const (
Attr_HostGroupID = "host_group_id"
Attr_HostGroups = "host_groups"
Attr_HostID = "host_id"
Attr_HostReference = "host_reference"
Attr_Hosts = "hosts"
Attr_Href = "href"
Attr_Hypervisor = "hypervisor"
Expand Down

0 comments on commit ae0146f

Please sign in to comment.