From ffec6848070243ec8df1b9ce523bf856afcb378e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=AB=20H=C7=8Ei?= Date: Mon, 28 Nov 2016 10:11:39 +0800 Subject: [PATCH 1/3] QCOS-3170 sdk fix host missing --- kirksdk/qcos_client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kirksdk/qcos_client.go b/kirksdk/qcos_client.go index 541ec96..947eda0 100644 --- a/kirksdk/qcos_client.go +++ b/kirksdk/qcos_client.go @@ -1254,21 +1254,21 @@ func (p *qcosClientImp) GetContainerAlert(ctx context.Context, ip string, level // GET /v3/configservices func (p *qcosClientImp) ListConfigServiceSpecs(ctx context.Context) (ret []ConfigServiceSpecInfo, err error) { - url := fmt.Sprintf("%s/v3/configservices") + url := fmt.Sprintf("%s/v3/configservices", p.host) err = p.client.Call(ctx, &ret, "GET", url) return } // POST /v3/configservices func (p *qcosClientImp) CreateConfigServiceSpec(ctx context.Context, args CreateConfigServiceSpecArgs) (err error) { - url := fmt.Sprintf("%s/v3/configservices") + url := fmt.Sprintf("%s/v3/configservices", p.host) err = p.client.CallWithJson(ctx, nil, "POST", url, args) return } // GET /v3/configservices/ func (p *qcosClientImp) GetConfigServiceSpec(ctx context.Context, namespace string) (ret ConfigServiceSpecInfo, err error) { - url := fmt.Sprintf("%s/v3/configservices/%s", namespace) + url := fmt.Sprintf("%s/v3/configservices/%s", p.host, namespace) err = p.client.Call(ctx, &ret, "GET", url) return } From d5494674c4b88217aaa0b5b6c559dbff1b0caf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=AB=20H=C7=8Ei?= Date: Mon, 28 Nov 2016 10:18:10 +0800 Subject: [PATCH 2/3] QCOS-3170 sdk add update api --- kirksdk/qcos_api.go | 8 ++++++++ kirksdk/qcos_client.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/kirksdk/qcos_api.go b/kirksdk/qcos_api.go index 11ea6fd..255c5ba 100644 --- a/kirksdk/qcos_api.go +++ b/kirksdk/qcos_api.go @@ -311,6 +311,9 @@ type QcosClient interface { // GET /v3/configservices/ GetConfigServiceSpec(ctx context.Context, namespace string) (ret ConfigServiceSpecInfo, err error) + + // POST /v3/configservices/ + UpdateConfigServiceSpec(ctx context.Context, namespace string, args UpdateConfigServiceSpecArgs) (err error) } const ( @@ -886,3 +889,8 @@ type CreateConfigServiceSpecArgs struct { } type ConfigServiceSpecInfo CreateConfigServiceSpecArgs + +type UpdateConfigServiceSpecArgs struct { + Vars map[string]interface{} `json:"vars"` + Listvars []map[string]interface{} `json:"listvars"` +} diff --git a/kirksdk/qcos_client.go b/kirksdk/qcos_client.go index 947eda0..525f960 100644 --- a/kirksdk/qcos_client.go +++ b/kirksdk/qcos_client.go @@ -1273,6 +1273,13 @@ func (p *qcosClientImp) GetConfigServiceSpec(ctx context.Context, namespace stri return } +// POST /v3/configservices/ +func (p *qcosClientImp) UpdateConfigServiceSpec(ctx context.Context, args UpdateConfigServiceSpecArgs) (err error) { + url := fmt.Sprintf("%s/v3/configservices/%s", p.host, namespace) + err = p.client.CallWithJson(ctx, nil, "POST", url, args) + return +} + func (p *qcosClientImp) wait4StackRunning(stackName string, timeout time.Duration) (err error) { if stackName == "" { stackName = DefaultStack From 4da8baece662ae0f438d4ae52e9be001124ef1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=AB=20H=C7=8Ei?= Date: Mon, 28 Nov 2016 13:30:08 +0800 Subject: [PATCH 3/3] QCOS-3170 sdk add update api --- kirksdk/qcos_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kirksdk/qcos_client.go b/kirksdk/qcos_client.go index 525f960..52fc7b2 100644 --- a/kirksdk/qcos_client.go +++ b/kirksdk/qcos_client.go @@ -1274,7 +1274,7 @@ func (p *qcosClientImp) GetConfigServiceSpec(ctx context.Context, namespace stri } // POST /v3/configservices/ -func (p *qcosClientImp) UpdateConfigServiceSpec(ctx context.Context, args UpdateConfigServiceSpecArgs) (err error) { +func (p *qcosClientImp) UpdateConfigServiceSpec(ctx context.Context, namespace string, args UpdateConfigServiceSpecArgs) (err error) { url := fmt.Sprintf("%s/v3/configservices/%s", p.host, namespace) err = p.client.CallWithJson(ctx, nil, "POST", url, args) return