From cfe9f1674155764398f0b10f69ae328dee9358d5 Mon Sep 17 00:00:00 2001 From: srinandan <13950006+srinandan@users.noreply.github.com> Date: Sat, 25 May 2024 10:36:20 -0700 Subject: [PATCH 1/2] feat: adds support for autopush #465 --- internal/apiclient/options.go | 12 ++++++++---- internal/cmd/root.go | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/apiclient/options.go b/internal/apiclient/options.go index f65a7156b..89f32b072 100644 --- a/internal/apiclient/options.go +++ b/internal/apiclient/options.go @@ -26,6 +26,7 @@ import ( const ( baseURL = "https://apigee.googleapis.com/v1/organizations/" baseStagingURL = "https://staging-apigee.sandbox.googleapis.com/v1/organizations/" + baseAutoURL = "https://autopush-apigee.sandbox.googleapis.com/" ) // registryBaseURL is the Apigee API Hub control plane endpoint @@ -69,8 +70,9 @@ var apiRate Rate type API string const ( - PROD API = "prod" - STAGING API = "staging" + PROD API = "prod" + STAGING API = "staging" + AUTOPUSH API = "autopush" ) var cmdPrintHttpResponses = true @@ -134,10 +136,10 @@ func (a *API) String() string { func (a *API) Set(r string) error { switch r { - case "prod", "staging": + case "prod", "autopush", "staging": *a = API(r) default: - return fmt.Errorf("must be one of %s or %s", PROD, STAGING) + return fmt.Errorf("must be one of %s, %s or %s", PROD, AUTOPUSH, STAGING) } return nil } @@ -345,6 +347,8 @@ func GetApigeeBaseURL() string { return baseURL case STAGING: return baseStagingURL + case AUTOPUSH: + return baseAutoURL default: return baseURL } diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 182a31a11..bf5e2f9a4 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -158,7 +158,7 @@ func init() { RootCmd.PersistentFlags().BoolVarP(&defaultToken, "default-token", "", false, "Use Google default application credentials access token") - RootCmd.PersistentFlags().Var(&api, "api", "Sets the control plane API. Must be one of prod, "+ + RootCmd.PersistentFlags().Var(&api, "api", "Sets the control plane API. Must be one of prod, autopush "+ "or staging; default is prod") RootCmd.AddCommand(apis.Cmd) From 90ec6ce73b7db38eab40649fcc1d60b647404e92 Mon Sep 17 00:00:00 2001 From: Srinandan Sridhar <13950006+srinandan@users.noreply.github.com> Date: Wed, 29 May 2024 16:29:41 -0700 Subject: [PATCH 2/2] Update basePath for autopush --- internal/apiclient/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/apiclient/options.go b/internal/apiclient/options.go index 89f32b072..990e05ed8 100644 --- a/internal/apiclient/options.go +++ b/internal/apiclient/options.go @@ -26,7 +26,7 @@ import ( const ( baseURL = "https://apigee.googleapis.com/v1/organizations/" baseStagingURL = "https://staging-apigee.sandbox.googleapis.com/v1/organizations/" - baseAutoURL = "https://autopush-apigee.sandbox.googleapis.com/" + baseAutoURL = "https://autopush-apigee.sandbox.googleapis.com/v1/organizations/" ) // registryBaseURL is the Apigee API Hub control plane endpoint