Skip to content

Commit d020472

Browse files
fix: fetch proxy deployments for an env without the env arg
1 parent 5ada061 commit d020472

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

internal/client/apis/apis.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ func ListProxyDeployments(name string) (respBody []byte, err error) {
270270
return respBody, err
271271
}
272272

273+
// ListProxyDeploymentsForEnv
274+
func ListProxyDeploymentsForEnv(name string) (respBody []byte, err error) {
275+
u, _ := url.Parse(apiclient.GetApigeeBaseURL())
276+
u.Path = path.Join(u.Path, apiclient.GetApigeeOrg(), "environments", apiclient.GetApigeeEnv(), "apis", name, "deployments")
277+
respBody, err = apiclient.HttpClient(u.String())
278+
return respBody, err
279+
}
280+
273281
// ListProxyRevisionDeployments
274282
func ListProxyRevisionDeployments(name string, revision int) (respBody []byte, err error) {
275283
u, _ := url.Parse(apiclient.GetApigeeBaseURL())

internal/cmd/apis/listdeploy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ var ListDepCmd = &cobra.Command{
3535
if revision != -1 && name == "" {
3636
return fmt.Errorf("proxy name must be supplied with revision")
3737
}
38-
if name != "" && revision == -1 && apiclient.GetApigeeEnv() != "" {
39-
return fmt.Errorf("revision must be supplied with proxy name and env")
40-
}
4138
apiclient.SetRegion(region)
4239
return apiclient.SetApigeeOrg(org)
4340
},
4441
RunE: func(cmd *cobra.Command, args []string) (err error) {
4542
cmd.SilenceUsage = true
4643

4744
if apiclient.GetApigeeEnv() != "" {
48-
if revision != -1 {
45+
// To fetch the deployment info for an api deployed to an environment Issue #695
46+
if name != "" && revision == -1 {
47+
_, err = apis.ListProxyDeploymentsForEnv(name)
48+
} else if revision != -1 {
4949
if !report {
5050
_, err = apis.ListProxyRevisionDeployments(name, revision)
5151
} else {

0 commit comments

Comments
 (0)