diff options
Diffstat (limited to 'client/go/internal/admin/deploy/activate.go')
-rw-r--r-- | client/go/internal/admin/deploy/activate.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/client/go/internal/admin/deploy/activate.go b/client/go/internal/admin/deploy/activate.go new file mode 100644 index 00000000000..1f475ff0461 --- /dev/null +++ b/client/go/internal/admin/deploy/activate.go @@ -0,0 +1,44 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// vespa-deploy command +// Author: arnej + +package deploy + +import ( + "fmt" + "strconv" +) + +// main entry point for vespa-deploy activate + +func RunActivate(opts *Options, args []string) error { + var sessId string + if len(args) == 0 { + sessId = getSessionIdFromFile(opts.Tenant) + } else { + sessId = args[0] + } + src := makeConfigsourceUrl(opts) + url := src + pathPrefix(opts) + "/" + sessId + "/active" + url = addUrlPropertyFromFlag(url, opts.Verbose, "verbose") + url = addUrlPropertyFromOption(url, strconv.Itoa(opts.Timeout), "timeout") + fmt.Printf("Activating session %s using %s\n", sessId, urlWithoutQuery(url)) + output, err := curlPutNothing(url) + if err != nil { + return err + } + var result ActivateResult + code, err := decodeResponse(output, &result) + if err != nil { + return err + } + if code == 200 { + fmt.Println(result.Message) + fmt.Println("Checksum: ", result.Application.Checksum) + fmt.Println("Timestamp: ", result.Deploy.Timestamp) + fmt.Println("Generation:", result.Application.Generation) + } else { + err = fmt.Errorf("Request failed. HTTP status code: %d\n%s", code, result.Message) + } + return err +} |