From ca8b9359cf576b89514aa5ffa6815498815a09e8 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Fri, 30 Sep 2016 00:44:38 -0400 Subject: [PATCH] API for rolling back a job update has been integrated. --- examples/client.go | 9 +++++++++ realis.go | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/examples/client.go b/examples/client.go index 0d46136..91b660d 100644 --- a/examples/client.go +++ b/examples/client.go @@ -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}) diff --git a/realis.go b/realis.go index 9e7714a..2a689f9 100644 --- a/realis.go +++ b/realis.go @@ -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 +}