X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=cmd-sdks.go;h=853e8475ba63f76bc2fa62e7cc5c926866ad9dd4;hb=f95aa5f0e39b85198655e8399c161fc5e6cd8a59;hp=8568b3a1ac5629c0663807bfe101d15a21371796;hpb=c35d7a0fc8bbb1f9123bb41a7b66e45ea2564dd2;p=src%2Fxds%2Fxds-cli.git diff --git a/cmd-sdks.go b/cmd-sdks.go index 8568b3a..853e847 100644 --- a/cmd-sdks.go +++ b/cmd-sdks.go @@ -1,10 +1,28 @@ +/* + * Copyright (C) 2017 "IoT.bzh" + * Author Sebastien Douheret + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + package main import ( "fmt" "strconv" - "github.com/iotbzh/xds-agent/lib/apiv1" + "github.com/iotbzh/xds-agent/lib/xaapiv1" "github.com/urfave/cli" ) @@ -62,7 +80,7 @@ func initCmdSdks(cmdDef *[]cli.Command) { func sdksList(ctx *cli.Context) error { // Get SDKs list - sdks := []apiv1.SDK{} + sdks := []xaapiv1.SDK{} if err := sdksListGet(&sdks); err != nil { return cli.NewExitError(err.Error(), 1) } @@ -75,16 +93,16 @@ func sdksGet(ctx *cli.Context) error { if id == "" { return cli.NewExitError("id parameter or option must be set", 1) } - sdks := apiv1.SDK{} - url := "server/" + strconv.Itoa(XdsServerIndexGet()) + "/sdks/" + id + sdks := xaapiv1.SDK{} + url := "servers/" + strconv.Itoa(XdsServerIndexGet()) + "/sdks/" + id if err := HTTPCli.Get(url, &sdks); err != nil { return cli.NewExitError(err.Error(), 1) } - _displaySdks([]apiv1.SDK{sdks}, true) + _displaySdks([]xaapiv1.SDK{sdks}, true) return nil } -func _displaySdks(sdks []apiv1.SDK, verbose bool) { +func _displaySdks(sdks []xaapiv1.SDK, verbose bool) { // Display result first := true writer := NewTableWriter() @@ -112,8 +130,8 @@ func _displaySdks(sdks []apiv1.SDK, verbose bool) { writer.Flush() } -func sdksListGet(sdks *[]apiv1.SDK) error { - url := "server/" + strconv.Itoa(XdsServerIndexGet()) + "/sdks" +func sdksListGet(sdks *[]xaapiv1.SDK) error { + url := "servers/" + strconv.Itoa(XdsServerIndexGet()) + "/sdks" if err := HTTPCli.Get(url, &sdks); err != nil { return err }