Skip to content

Commit

Permalink
Merge pull request #87 from mikeletux/master
Browse files Browse the repository at this point in the history
Volume OperationApplyTimeSupport added
  • Loading branch information
stmcginnis authored Sep 23, 2020
2 parents da73ff6 + e576c20 commit cb247f3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions redfish/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ func (storage *Storage) SetEncryptionKey(key string) error {
return err
}

// GetOperationApplyTimeValues returns the OperationApplyTime values applicable for this storage
func (storage *Storage) GetOperationApplyTimeValues() ([]common.OperationApplyTime, error) {
return AllowedVolumesUpdateApplyTimes(storage.Client, storage.volumes)

}

// StorageController is used to represent a resource that represents a
// storage controller in the Redfish specification.
type StorageController struct {
Expand Down
23 changes: 23 additions & 0 deletions redfish/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,26 @@ func (volume *Volume) Drives() ([]*Drive, error) {

return result, nil
}

// AllowedVolumesUpdateApplyTimes returns the set of allowed apply times to request when setting the volumes values
func AllowedVolumesUpdateApplyTimes(c common.Client, link string) ([]common.OperationApplyTime, error) {
resp, err := c.Get(link)
if err != nil {
return nil, err
}
defer resp.Body.Close()
var temp struct {
OperationApplyTimeSupport common.OperationApplyTimeSupport `json:"@Redfish.OperationApplyTimeSupport"`
}

err = json.NewDecoder(resp.Body).Decode(&temp)
if err != nil {
return nil, err
}

var applyTimes []common.OperationApplyTime
for _, v := range temp.OperationApplyTimeSupport.SupportedValues {
applyTimes = append(applyTimes, v)
}
return applyTimes, nil
}

0 comments on commit cb247f3

Please sign in to comment.