Skip to content

Commit

Permalink
review micro version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludovic Lamarche committed Feb 17, 2020
1 parent 3b4dab9 commit b540030
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions openstack/compute/v2/extensions/instanceactions/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ func ExtractInstanceActions(r pagination.Page) ([]InstanceAction, error) {

// Event represents an event of instance action.
type Event struct {
Event string `json:"event"`
Host string `json:"host"`
HostID string `json:"hostId"`
Event string `json:"event"`
// Host is the host of the event.
// This requires microversion 2.62 or later.
Host *string `json:"host"`
// HostID is the host id of the event.
// This requires microversion 2.62 or later.
HostID *string `json:"hostId"`
Result string `json:"result"`
Traceback string `json:"traceback"`
StartTime time.Time `json:"-"`
Expand Down Expand Up @@ -91,15 +95,19 @@ func (e *Event) UnmarshalJSON(b []byte) error {

// InstanceActionDetail gives more details on instance action.
type InstanceActionDetail struct {
Action string `json:"action"`
InstanceUUID string `json:"instance_uuid"`
Message string `json:"message"`
ProjectID string `json:"project_id"`
RequestID string `json:"request_id"`
UserID string `json:"user_id"`
Events []Event `json:"events"`
UpdatedAt time.Time `json:"-"`
StartTime time.Time `json:"-"`
Action string `json:"action"`
InstanceUUID string `json:"instance_uuid"`
Message string `json:"message"`
ProjectID string `json:"project_id"`
RequestID string `json:"request_id"`
UserID string `json:"user_id"`
// Events is the list of events of the action.
// This requires microversion 2.50 or later.
Events *[]Event `json:"events"`
// UpdatedAt last update date of the action.
// This requires microversion 2.58 or later.
UpdatedAt *time.Time `json:"-"`
StartTime time.Time `json:"-"`
}

// UnmarshalJSON converts our JSON API response into our instance action struct
Expand All @@ -116,7 +124,8 @@ func (i *InstanceActionDetail) UnmarshalJSON(b []byte) error {
}
*i = InstanceActionDetail(s.tmp)

i.UpdatedAt = time.Time(s.UpdatedAt)
tmpTime := time.Time(s.UpdatedAt)
i.UpdatedAt = &tmpTime
i.StartTime = time.Time(s.StartTime)
return err
}
Expand Down

0 comments on commit b540030

Please sign in to comment.