API for rolling back a job update has been integrated.

This commit is contained in:
Renan DelValle 2016-09-30 00:44:38 -04:00
parent 97f9c05026
commit ca8b9359cf
2 changed files with 19 additions and 0 deletions

View file

@ -238,6 +238,15 @@ func main() {
}
fmt.Println(resp.String())
break
case "rollbackUpdate":
fmt.Println("Abort update")
resp, err := r.RollbackJobUpdate(aurora.JobUpdateKey{job.JobKey(), *updateId}, "")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(resp.String())
break
case "taskConfig":
fmt.Println("Getting job info")
config, err := r.FetchTaskConfig(aurora.InstanceKey{job.JobKey(), 0})

View file

@ -38,6 +38,7 @@ type Realis interface {
KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error)
RestartInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error)
RestartJob(key *aurora.JobKey) (*aurora.Response, error)
RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error)
StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error)
Close()
}
@ -289,3 +290,12 @@ func (r realisClient) JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*auro
return resp, nil
}
func (r realisClient) RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error) {
resp, err := r.client.RollbackJobUpdate(&key, message)
if err != nil {
return nil, errors.Wrap(err, "Unable to roll back job update")
}
return resp, nil
}