Skip to content

Commit

Permalink
feat: adds support for autopush #465
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed May 25, 2024
1 parent 99b4b5e commit cfe9f16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions internal/apiclient/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -345,6 +347,8 @@ func GetApigeeBaseURL() string {
return baseURL
case STAGING:
return baseStagingURL
case AUTOPUSH:
return baseAutoURL
default:
return baseURL
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cfe9f16

Please sign in to comment.