diff --git a/internal/client/products/rateplans.go b/internal/client/products/rateplans.go index 010154d8a..37ac3aa4c 100644 --- a/internal/client/products/rateplans.go +++ b/internal/client/products/rateplans.go @@ -45,11 +45,15 @@ func GetRatePlan(productName string, rateplan string) (respBody []byte, err erro } // ListRatePlan -func ListRatePlan(productName string) (respBody []byte, err error) { +func ListRatePlan(productName string, expand bool) (respBody []byte, err error) { u, _ := url.Parse(apiclient.GetApigeeBaseURL()) u.Path = path.Join(u.Path, apiclient.GetApigeeOrg(), "apiproducts", productName, "rateplans") q := u.Query() - q.Set("expand", "true") + if expand { + q.Set("expand", "true") + } else { + q.Set("expand", "false") + } u.RawQuery = q.Encode() respBody, err = apiclient.HttpClient(u.String()) return respBody, err diff --git a/internal/cmd/products/listrateplan.go b/internal/cmd/products/listrateplan.go index cb465a240..5bf8e2ce0 100644 --- a/internal/cmd/products/listrateplan.go +++ b/internal/cmd/products/listrateplan.go @@ -33,7 +33,7 @@ var ListRatePlanCmd = &cobra.Command{ RunE: func(cmd *cobra.Command, args []string) (err error) { cmd.SilenceUsage = true - _, err = products.ListRatePlan(apiproduct) + _, err = products.ListRatePlan(apiproduct, expand) return }, } @@ -41,6 +41,8 @@ var ListRatePlanCmd = &cobra.Command{ func init() { ListRatePlanCmd.Flags().StringVarP(&apiproduct, "product", "p", "", "name of the API Product") + ListRatePlanCmd.Flags().BoolVarP(&expand, "expand", "x", + false, "Expand Details") _ = ListRatePlanCmd.MarkFlagRequired("product") }