Skip to content

Commit

Permalink
Add Drive.EnvironmentMetrics() accessor (#373)
Browse files Browse the repository at this point in the history
We added EnvironmentMetrics objects, but did not provide a way to fetch
them from the links of a Drive. This adds a Drive function to retrieve
the EnvironmentMetrics when available.

Signed-off-by: Sean McGinnis <[email protected]>
  • Loading branch information
stmcginnis authored Oct 16, 2024
1 parent 13dccf5 commit 0cb0c9c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions redfish/drive.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,17 @@ func (drive *Drive) Endpoints() ([]*Endpoint, error) {
return common.GetObjects[Endpoint](drive.GetClient(), drive.endpoints)
}

// EnvironmentMetrics gets the environment metrics for this drive.
// If no metrics are available the EnvironmentMetrics reference will be nil but
// no error will be returned unless it was due to a problem fetching the data.
func (drive *Drive) EnvironmentMetrics() (*EnvironmentMetrics, error) {
if drive.environmentMetrics == "" {
return nil, nil
}

return GetEnvironmentMetrics(drive.GetClient(), drive.environmentMetrics)
}

// Volumes references the Volumes that this drive is associated with.
func (drive *Drive) Volumes() ([]*Volume, error) {
return common.GetObjects[Volume](drive.GetClient(), drive.volumes)
Expand Down

0 comments on commit 0cb0c9c

Please sign in to comment.