Skip to content

Commit

Permalink
Merge pull request #26 from uoryon/QCOS-3170-sdk
Browse files Browse the repository at this point in the history
QCOS-0 fix host missing
  • Loading branch information
xiaoq08 authored Nov 28, 2016
2 parents db490d2 + 4da8bae commit 0acaa61
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions kirksdk/qcos_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ type QcosClient interface {

// GET /v3/configservices/<namespace>
GetConfigServiceSpec(ctx context.Context, namespace string) (ret ConfigServiceSpecInfo, err error)

// POST /v3/configservices/<namespace>
UpdateConfigServiceSpec(ctx context.Context, namespace string, args UpdateConfigServiceSpecArgs) (err error)
}

const (
Expand Down Expand Up @@ -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"`
}
13 changes: 10 additions & 3 deletions kirksdk/qcos_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1254,25 +1254,32 @@ 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/<namespace>
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
}

// POST /v3/configservices/<namespace>
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
}

func (p *qcosClientImp) wait4StackRunning(stackName string, timeout time.Duration) (err error) {
if stackName == "" {
stackName = DefaultStack
Expand Down

0 comments on commit 0acaa61

Please sign in to comment.