Skip to content

Commit

Permalink
US46888:As a CMO API user, I should be able to see SummaryStatus fiel… (
Browse files Browse the repository at this point in the history
#100)

* US46888:As a CMO API user, I should be able to see SummaryStatus field in TF state.
  • Loading branch information
ron-saito authored Feb 28, 2023
1 parent 16940ee commit d377deb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions internal/resources/resource_host.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
// (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP

package resources

Expand Down Expand Up @@ -47,6 +47,7 @@ const (
hPortalCommOkay = "portal_comm_okay"
hPwrState = "power_state"
hLabels = "labels"
hSummaryStatus = "summary_status"

// allowedImageLength is number of Image related attributes that can be provided in the from of 'image@version'.
allowedImageLength = 2
Expand Down Expand Up @@ -241,6 +242,11 @@ func hostSchema() map[string]*schema.Schema {
Optional: true,
Description: "map of label name to label value for this host",
},
hSummaryStatus: {
Type: schema.TypeString,
Computed: true,
Description: "The current health status of the host",
},
}
}

Expand Down Expand Up @@ -466,6 +472,10 @@ func resourceMetalHostRead(d *schema.ResourceData, meta interface{}) (err error)
d.Set(hLocationID, host.LocationID)
d.Set(hNetworkIDs, host.NetworkIDs)

if err = d.Set(hSummaryStatus, host.SummaryStatus); err != nil {
return fmt.Errorf("set summary status: %v", err)
}

varesources, _, err := p.Client.VolumeAttachmentsApi.List(ctx)
if err != nil {
return fmt.Errorf("error reading volume attachment information %v", err)
Expand Down Expand Up @@ -670,7 +680,7 @@ func resourceMetalHostUpdate(d *schema.ResourceData, meta interface{}) (err erro

_, _, err = p.Client.HostsApi.Update(ctx, host.ID, host)
if err != nil {
// nolint:wrapcheck // defer func is wrapping the error.
//nolint:wrapcheck // defer func is wrapping the error.
return err
}

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.14
0.1.15

0 comments on commit d377deb

Please sign in to comment.