Skip to content

Commit

Permalink
Removed Volumes struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Sama committed Sep 23, 2020
1 parent ecc60da commit e576c20
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions redfish/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@ type Volume struct {
drives []string
}

// Volumes is used to represent the volumes information related to a Storage
type Volumes struct {
common.Entity
// OperationApplyTimeSupport contains, among other things, the types
// of apply times the client is allowed request when performing a Create,
// Delete, or Action operation.
OperationApplyTimeSupport common.OperationApplyTimeSupport `json:"@Redfish.OperationApplyTimeSupport"`
}

// UnmarshalJSON unmarshals a Volume object from the raw JSON.
func (volume *Volume) UnmarshalJSON(b []byte) error {
type temp Volume
Expand Down Expand Up @@ -290,15 +281,17 @@ func AllowedVolumesUpdateApplyTimes(c common.Client, link string) ([]common.Oper
return nil, err
}
defer resp.Body.Close()
var volumes Volumes
var temp struct {
OperationApplyTimeSupport common.OperationApplyTimeSupport `json:"@Redfish.OperationApplyTimeSupport"`
}

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

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

0 comments on commit e576c20

Please sign in to comment.