From 383aa12385cd7353b12811f30ad4dc9175f1db4a Mon Sep 17 00:00:00 2001 From: Berk Gokden Date: Tue, 9 Apr 2019 11:20:54 +0200 Subject: [PATCH] Default Version is set when version is not provided (#12) --- client/client.go | 7 +++++++ cmd/root.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index fb1298d..71a90b8 100644 --- a/client/client.go +++ b/client/client.go @@ -26,6 +26,7 @@ import ( "time" "github.com/ghodss/yaml" + "github.com/magneticio/vampkubistcli/logging" "github.com/magneticio/vampkubistcli/models" "gopkg.in/resty.v1" ) @@ -95,8 +96,14 @@ type authSuccess struct { RefreshToken string `json:"refresh_token"` } +const defaultVersion = "v1" + func NewRestClient(url string, token string, version string, isVerbose bool, cert string) *restClient { resty.SetDebug(isVerbose) + if version == "" { + logging.Info("Using Default Version for client: %s\n", defaultVersion) + version = defaultVersion + } if cert != "" { // Create our Temp File: This will create a filename like /tmp/prefix-123456 // We can use a pattern of "pre-*.txt" to get an extension like: /tmp/pre-123456.txt diff --git a/cmd/root.go b/cmd/root.go index 4b37b2b..5f6d985 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -58,7 +58,7 @@ var OutputType string var Hosts []string // version should be in format d.d.d where d is a decimal number -const Version string = "0.0.20" +const Version string = "0.0.21" const AppName string = "vamp" // Backend version is the version this client is tested with