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

[Datasource] Add host reference to power dedicated host data sources #5834

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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-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
21 changes: 9 additions & 12 deletions website/docs/d/pi_host.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ After your data source is created, you can read values from the following attrib
- `capacity` - (List) Capacities of the host.

Nested schema for `capacity`:
- `available_core` - (Float) Number of cores currently available.
- `available_memory` - (Float) Amount of memory currently available (in GB).
- `reserved_core` - (Float) Number of cores reserved for system use.
- `reserved_memory` - (Float) Amount of memory reserved for system use (in GB).
- `total_core` - (Float) Total number of cores of the host.
- `total_memory` - (Float) Total amount of memory of the host (in GB).
- `used_core` - (Float) Number of cores in use on the host.
- `used_memory` - (Float) Amount of memory used on the host (in GB).
- `available_core` - (Float) Number of cores currently available.
- `available_memory` - (Float) Amount of memory currently available (in GB).
- `reserved_core` - (Float) Number of cores reserved for system use.
- `reserved_memory` - (Float) Amount of memory reserved for system use (in GB).
- `total_core` - (Float) Total number of cores of the host.
- `total_memory` - (Float) Total amount of memory of the host (in GB).
- `used_core` - (Float) Number of cores in use on the host.
- `used_memory` - (Float) Amount of memory used on the host (in GB).

- `display_name` - (String) Name of the host.
- `host_group` - (Map) Information about the owning host group.
Expand All @@ -66,11 +66,8 @@ After your data source is created, you can read values from the following attrib
- `access` - (String) Whether the host group is a primary or secondary host group.
- `href` - (String) Link to the host group resource.
- `name` - (String) Name of the host group.

- `host_reference` - (Integer) Current physical ID of the host.
- `state` - (String) State of the host `up` or `down`.

- `id` - (String) The unique identifier of the host.

- `status` - (String) Status of the host `enabled` or `disabled`.

- `sys_type` - (String) System type.
1 change: 1 addition & 0 deletions website/docs/d/pi_hosts.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ After your data source is created, you can read values from the following attrib
- `href` - (String) Link to the host group resource.
- `name` - (String) Name of the host group.
- `host_id` - (String) ID of the host.
- `host_reference` - (Integer) Current physical ID of the host.
- `id` - (String) The unique identifier of the pi_hosts.
- `state` - (String) State of the host `up` or `down`.
- `status` - (String) Status of the host `enabled` or `disabled`.
Expand Down
Loading