Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
get all deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Apr 13, 2022
1 parent 5b6a60f commit df14e4f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
25 changes: 25 additions & 0 deletions client/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ func GetDeployments(sharedflows bool) (respBody []byte, err error) {
return respBody, err
}

func GetAllDeployments() (respBody []byte, err error) {

apiclient.SetPrintOutput(false)
proxiesResponse, err := GetDeployments(false)
if err != nil {
return nil, err
}

sharedFlowsResponse, err := GetDeployments(true)
if err != nil {
return nil, err
}

deployments := []string{}

deployments = append(deployments, "\"proxies\":"+string(proxiesResponse))
deployments = append(deployments, "\"sharedFlows\":"+string(sharedFlowsResponse))
payload := "{" + strings.Join(deployments, ",") + "}"

err = apiclient.PrettyPrint([]byte(payload))
apiclient.SetPrintOutput(true)

return []byte(payload), err
}

//GetDeployedConfig
func GetDeployedConfig() (respBody []byte, err error) {
u, _ := url.Parse(apiclient.BaseURL)
Expand Down
10 changes: 8 additions & 2 deletions cmd/env/getdeployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ var GetDeployCmd = &cobra.Command{
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = environments.GetDeployments(sharedflows)
if all {
_, err = environments.GetAllDeployments()
} else {
_, err = environments.GetDeployments(sharedflows)
}
return
},
}

var sharedflows bool
var sharedflows, all bool

func init() {

GetDeployCmd.Flags().BoolVarP(&sharedflows, "sharedflows", "s",
false, "Return sharedflow deployments")
GetDeployCmd.Flags().BoolVarP(&all, "all", "",
false, "Return all deployments")
}

0 comments on commit df14e4f

Please sign in to comment.