Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cli/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,16 @@ var _clusterExportCmd = &cobra.Command{
exit.Error(err)
}

for _, apiResponse := range apisResponse {
specFilePath := filepath.Join(exportPath, apiResponse.Spec.Name+".yaml")
for _, api := range apisResponse {
apisWithSpec, err := cluster.GetAPI(operatorConfig, api.Metadata.Name)
if err != nil {
exit.Error(err)
}

fmt.Println(fmt.Sprintf("exporting %s to %s", apiResponse.Spec.Name, specFilePath))
specFilePath := filepath.Join(exportPath, api.Metadata.Name+".yaml")
fmt.Println(fmt.Sprintf("exporting %s to %s", api.Metadata.Name, specFilePath))

yamlBytes, err := yaml.Marshal(apiResponse.Spec.API.SubmittedAPISpec)
yamlBytes, err := yaml.Marshal(apisWithSpec[0].Spec.API.SubmittedAPISpec)
if err != nil {
exit.Error(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ func describeAPI(env cliconfig.Environment, apiName string) (string, error) {
case userconfig.AsyncAPIKind:
return asyncDescribeAPITable(apiRes, env)
default:
return "", errors.ErrorUnexpected(fmt.Sprintf("encountered unexpected kind %s for api %s", apiRes.Spec.Kind, apiRes.Spec.Name))
return "", errors.ErrorUnexpected(fmt.Sprintf("encountered unexpected kind %s for api %s", apiRes.Metadata.Kind, apiRes.Metadata.Name))
}
}
6 changes: 3 additions & 3 deletions cli/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _getCmd = &cobra.Command{
}

var jobTable string
if apisRes[0].Spec.Kind == userconfig.BatchAPIKind {
if apisRes[0].Metadata.Kind == userconfig.BatchAPIKind {
jobTable, err = getBatchJob(env, args[0], args[1])
} else {
jobTable, err = getTaskJob(env, args[0], args[1])
Expand Down Expand Up @@ -484,7 +484,7 @@ func getAPI(env cliconfig.Environment, apiName string) (string, error) {

apiRes := apisRes[0]

switch apiRes.Spec.Kind {
switch apiRes.Metadata.Kind {
case userconfig.RealtimeAPIKind:
return realtimeAPITable(apiRes, env)
case userconfig.AsyncAPIKind:
Expand All @@ -496,7 +496,7 @@ func getAPI(env cliconfig.Environment, apiName string) (string, error) {
case userconfig.TaskAPIKind:
return taskAPITable(apiRes), nil
default:
return "", errors.ErrorUnexpected(fmt.Sprintf("encountered unexpected kind %s for api %s", apiRes.Spec.Kind, apiRes.Spec.Name))
return "", errors.ErrorUnexpected(fmt.Sprintf("encountered unexpected kind %s for api %s", apiRes.Metadata.Kind, apiRes.Metadata.Name))
}
}

Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/lib_traffic_splitters.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func trafficSplitTable(trafficSplitter schema.APIResponse, env cliconfig.Environ
}
lastUpdated := time.Unix(apiRes.Metadata.LastUpdated, 0)

apiName := apiRes.Spec.Name
apiName := apiRes.Metadata.Name
if api.Shadow {
apiName += " (shadow)"
}
Expand Down