Skip to content

Commit

Permalink
add missing response section
Browse files Browse the repository at this point in the history
  • Loading branch information
樊尚享 committed Aug 1, 2017
1 parent 1e9547d commit f1702ea
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func WaitJob(jobService *service.JobService, jobID string, timeout time.Duration
}

// CheckJobStatus get job status
func CheckJobStatus(jobService *service.JobService, jobID string) (string,error) {
func CheckJobStatus(jobService *service.JobService, jobID string) (string, error) {
input := &service.DescribeJobsInput{Jobs: []*string{&jobID}}
output, err := jobService.DescribeJobs(input)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions service/nic.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@ func (s *NicService) DescribeNics(i *DescribeNicsInput) (*DescribeNicsOutput, er
}

type DescribeNicsInput struct {
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
NICName *string `json:"nic_name" name:"nic_name" location:"params"`
Nics []*string `json:"nics" name:"nics" location:"params"`
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
Instances []*string `json:"instances" name:"instances" location:"params"`
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
NICName *string `json:"nic_name" name:"nic_name" location:"params"`
Nics []*string `json:"nics" name:"nics" location:"params"`
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
// Status's available values: available, in-use
Status *string `json:"status" name:"status" location:"params"`
// VxNetType's available values: 0, 1
Expand Down
18 changes: 18 additions & 0 deletions service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,7 @@ type Router struct {
// Status's available values: pending, active, poweroffed, suspended, deleted, ceased
Status *string `json:"status" name:"status"`
StatusTime *time.Time `json:"status_time" name:"status_time" format:"ISO 8601"`
Tags []*Tag `json:"tags" name:"tags"`
// TransitionStatus's available values: creating, updating, suspending, resuming, poweroffing, poweroning, deleting
TransitionStatus *string `json:"transition_status" name:"transition_status"`
VxNets []*VxNet `json:"vxnets" name:"vxnets"`
Expand Down Expand Up @@ -1913,6 +1914,14 @@ func (v *Router) Validate() error {
}
}

if len(v.Tags) > 0 {
for _, property := range v.Tags {
if err := property.Validate(); err != nil {
return err
}
}
}

if v.TransitionStatus != nil {
transitionStatusValidValues := []string{"creating", "updating", "suspending", "resuming", "poweroffing", "poweroning", "deleting"}
transitionStatusParameterValue := fmt.Sprint(*v.TransitionStatus)
Expand Down Expand Up @@ -2200,6 +2209,7 @@ type SecurityGroup struct {
Resources []*Resource `json:"resources" name:"resources"`
SecurityGroupID *string `json:"security_group_id" name:"security_group_id"`
SecurityGroupName *string `json:"security_group_name" name:"security_group_name"`
Tags []*Tag `json:"tags" name:"tags"`
}

func (v *SecurityGroup) Validate() error {
Expand All @@ -2212,6 +2222,14 @@ func (v *SecurityGroup) Validate() error {
}
}

if len(v.Tags) > 0 {
for _, property := range v.Tags {
if err := property.Validate(); err != nil {
return err
}
}
}

return nil
}

Expand Down
4 changes: 3 additions & 1 deletion utils/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
type TimeoutError struct {
timeout time.Duration
}

// Error message
func (e *TimeoutError) Error() string { return fmt.Sprintf("Wait timeout [%s] ", e.timeout) }
func (e *TimeoutError) Error() string { return fmt.Sprintf("Wait timeout [%s] ", e.timeout) }

// Timeout duration
func (e *TimeoutError) Timeout() time.Duration { return e.timeout }

Expand Down

0 comments on commit f1702ea

Please sign in to comment.