Skip to content

Commit 741d5cf

Browse files
[POA-748] expose legacy command (#255)
* These changes are to make integration tests working * Exposed `specs get` command * Switched `get-spec-version` and `get-specs` to `v2/agent` since they are needed in `specs get` command
1 parent e3de342 commit 741d5cf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cmd/root.go

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/akitasoftware/akita-cli/cmd/internal/ec2"
2020
"github.com/akitasoftware/akita-cli/cmd/internal/ecs"
2121
"github.com/akitasoftware/akita-cli/cmd/internal/kube"
22+
"github.com/akitasoftware/akita-cli/cmd/internal/legacy"
2223
"github.com/akitasoftware/akita-cli/pcap"
2324
"github.com/akitasoftware/akita-cli/printer"
2425
"github.com/akitasoftware/akita-cli/rest"
@@ -265,4 +266,8 @@ func init() {
265266
rootCmd.AddCommand(ecs.Cmd)
266267
rootCmd.AddCommand(kube.Cmd)
267268
rootCmd.AddCommand(ec2.Cmd)
269+
270+
// Legacy command, included for integration tests but is hidden.
271+
legacy.SpecsCmd.Hidden = true
272+
rootCmd.AddCommand(legacy.SpecsCmd)
268273
}

rest/learn_client.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ func (c *learnClientImpl) CreateSpec(ctx context.Context, name string, lrns []ak
127127
return resp.ID, err
128128
}
129129

130-
// Deprecated: Used in legacy and get command which is deprecated.
130+
// Used only for integration tests
131131
func (c *learnClientImpl) GetSpec(ctx context.Context, api akid.APISpecID, opts GetSpecOptions) (kgxapi.GetSpecResponse, error) {
132132
qs := make(url.Values)
133133
if !opts.EnableRelatedTypes {
134134
qs.Add("strip_related_annotations", "true")
135135
}
136-
p := path.Join("/v1/services", akid.String(c.serviceID), "specs", akid.String(api))
136+
p := path.Join("/v2/agent/services", akid.String(c.serviceID), "specs", akid.String(api))
137137

138138
var resp kgxapi.GetSpecResponse
139139
err := c.GetWithQuery(ctx, p, qs, &resp)
@@ -155,10 +155,10 @@ func (c *learnClientImpl) ListSpecs(ctx context.Context) ([]kgxapi.SpecInfo, err
155155
return resp.Specs, err
156156
}
157157

158-
// Deprecated: Used in legacy commands which are deprecated.
158+
// Used only for integration tests
159159
func (c *learnClientImpl) GetSpecVersion(ctx context.Context, version string) (kgxapi.APISpecVersion, error) {
160160
var resp kgxapi.APISpecVersion
161-
p := path.Join("/v1/services", akid.String(c.serviceID), "spec-versions", version)
161+
p := path.Join("/v2/agent/services", akid.String(c.serviceID), "spec-versions", version)
162162
err := c.Get(ctx, p, &resp)
163163
if err != nil {
164164
return kgxapi.APISpecVersion{}, err

0 commit comments

Comments
 (0)