Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for API Registry and enable data residency #374

Merged
merged 17 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ on:
push:
# Publish semver tags as releases.
tags:
- v[0-1].[0-9]+.[0-9]
- v[0-1].[0-9]+.[0-9]+-beta
- v[0-9].[0-9]+.[0-9]
- v[0-9].[0-9]+.[0-9]+-beta
workflow_dispatch:

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gen-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
push:
# Publish semver tags as releases.
tags:
- v[0-1].[0-9]+.[0-9]
- v[0-9].[0-9]+.[0-9]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gorelease-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ on:
push:
# Publish semver tags as releases.
tags:
- v[0-1].[0-9]+.[0-9]
- v[0-1].[0-9]+.[0-9]+-beta
- v[0-9].[0-9]+.[0-9]
- v[0-9].[0-9]+.[0-9]+-beta
workflow_dispatch:

jobs:
Expand Down
6 changes: 5 additions & 1 deletion cmd/apicategories/apicategories.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ var Cmd = &cobra.Command{
Long: "Manage Apigee API categories that are tagged on catalog items",
}

var org, siteid, id string
var org, siteid, id, region string

func init() {
Cmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")

Cmd.PersistentFlags().StringVarP(&siteid, "siteid", "s",
"", "Name or siteid of the portal")

Cmd.PersistentFlags().StringVarP(&region, "region", "r",
"", "Apigee control plane region name; default is https://apigee.googleapis.com")

Cmd.AddCommand(ListCmd)
Cmd.AddCommand(GetCmd)
Cmd.AddCommand(DelCmd)
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var CreateCmd = &cobra.Command{
Short: "Creates a new API category",
Long: "Creates a new API category",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var DelCmd = &cobra.Command{
if name != "" && id != "" {
return fmt.Errorf("name and id cannot be set as a parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var ExpCmd = &cobra.Command{
Short: "Export API Categories across all sites",
Long: "Export API Categories across all sites",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var GetCmd = &cobra.Command{
if name != "" && id != "" {
return fmt.Errorf("name and id cannot be set as a parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var ImpCmd = &cobra.Command{
Short: "Import from a folder containing apicategories",
Long: "Import from a folder containing apicategories",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/apicategories/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var ListCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/apidocs/apidocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ var Cmd = &cobra.Command{
Long: "Manage Apigee API catalog item through ApiDoc",
}

var org, siteid, id, name string
var org, siteid, id, name, region string

func init() {
Cmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Cmd.PersistentFlags().StringVarP(&siteid, "siteid", "s",
"", "Name or siteid of the portal")
Cmd.PersistentFlags().StringVarP(&region, "region", "r",
"", "Apigee control plane region name; default is https://apigee.googleapis.com")

Cmd.AddCommand(ListCmd)
Cmd.AddCommand(GetCmd)
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var CreateCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var DelCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var ExpCmd = &cobra.Command{
Short: "Export API Docs to a file",
Long: "Export API Docs to a file",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var GetCmd = &cobra.Command{
if name != "" && id != "" {
return fmt.Errorf("title and id cannot be set as a parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/getdocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var GetDocCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var ImpCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var ListCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apidocs/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var UpdateCmd = &cobra.Command{
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/apidocs/updatedocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var UpdateDocCmd = &cobra.Command{
if graphQLPath != "" && endpointUri == "" {
return fmt.Errorf("The flags graphQLPath and endpointUri must be set together")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down Expand Up @@ -86,7 +87,7 @@ func init() {
"", "Path to a file containing OpenAPI Specification documentation")
UpdateDocCmd.Flags().StringVarP(&graphQLPath, "graphql", "q",
"", "Path to a file containing GraphQL documentation")
UpdateDocCmd.Flags().StringVarP(&endpointUri, "endpointUri", "e",
UpdateDocCmd.Flags().StringVarP(&endpointUri, "endpoint-uri", "e",
"", "URI for the GraphQL proxy")

_ = UpdateDocCmd.MarkFlagRequired("id")
Expand Down
6 changes: 4 additions & 2 deletions cmd/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ var Cmd = &cobra.Command{
}

var (
org, env, name string
conn, revision int
org, region, env, name string
conn, revision int
)

const zipExt = ".zip"

func init() {
Cmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Cmd.PersistentFlags().StringVarP(&region, "region", "r",
"", "Apigee control plane region name; default is https://apigee.googleapis.com")

Cmd.AddCommand(ListCmd)
Cmd.AddCommand(ListDepCmd)
Expand Down
3 changes: 2 additions & 1 deletion cmd/apis/bundlecrtapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var BundleCreateCmd = &cobra.Command{
if env != "" {
apiclient.SetApigeeEnv(env)
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down Expand Up @@ -110,7 +111,7 @@ func init() {

BundleCreateCmd.Flags().StringVarP(&env, "env", "e",
"", "Name of the environment to deploy the proxy")
BundleCreateCmd.Flags().BoolVarP(&overrides, "ovr", "r",
BundleCreateCmd.Flags().BoolVarP(&overrides, "ovr", "",
srinandan marked this conversation as resolved.
Show resolved Hide resolved
false, "Forces deployment of the new revision")
BundleCreateCmd.Flags().BoolVarP(&wait, "wait", "",
false, "Waits for the deployment to finish, with success or error")
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/cleanapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var CleanCmd = &cobra.Command{
Short: "Deletes undeployed/unused revisions of an API proxy",
Long: "Deletes undeployed/unused revisions of an API proxy",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
5 changes: 3 additions & 2 deletions cmd/apis/cloneapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var CloneCmd = &cobra.Command{
if !strings.HasPrefix(basePath, "/") {
return fmt.Errorf("basePath must start with /")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down Expand Up @@ -101,13 +102,13 @@ func init() {

CloneCmd.Flags().StringVarP(&proxyZip, "proxy-zip", "p",
"", "Path to the Sharedflow bundle/zip file")
CloneCmd.Flags().StringVarP(&basePath, "base-path", "b",
CloneCmd.Flags().StringVarP(&basePath, "basepath", "b",
"", "A new basePath for the cloned proxy")
CloneCmd.Flags().StringVarP(&proxyFolder, "proxy-folder", "f",
"", "Path to the Sharedflow Bundle; ex: ./test/apiproxy")

_ = CloneCmd.MarkFlagRequired("name")
_ = CloneCmd.MarkFlagRequired("base-path")
_ = CloneCmd.MarkFlagRequired("basepath")
}

func copyDirectory() (tmpDir string, err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/crtapikvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var CreateKvmCmd = &cobra.Command{
Short: "Create an API Proxy scoped KVM",
Long: "Create an API Proxy scoped KVM",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/crttrcapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var CreateTrcCmd = &cobra.Command{
Long: "Create a new debug session for Apigee API proxy revision deployed in an environment",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetApigeeEnv(env)
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/delapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var DelCmd = &cobra.Command{
Long: "Deletes an API proxy and all associated endpoints, policies, resources, and revisions." +
"The proxy must be undeployed first.",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/delapikvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var DelKvmCmd = &cobra.Command{
Short: "Deletes an API Proxy scoped KVM",
Long: "Deletes an API Proxy scoped KVM",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/apis/depapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var DepCmd = &cobra.Command{
"in an organization, optionally waits for deployment",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetApigeeEnv(env)
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down Expand Up @@ -68,7 +69,7 @@ func init() {
"", "Apigee environment name")
DepCmd.Flags().IntVarP(&revision, "rev", "v",
-1, "API Proxy revision. If not set, the highest revision is used")
DepCmd.Flags().BoolVarP(&overrides, "ovr", "r",
DepCmd.Flags().BoolVarP(&overrides, "ovr", "",
srinandan marked this conversation as resolved.
Show resolved Hide resolved
false, "Forces deployment of the new revision")
DepCmd.Flags().BoolVarP(&wait, "wait", "",
false, "Waits for the deployment to finish, with success or error")
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/expapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var ExpCmd = &cobra.Command{
Short: "export API proxy bundles from an org",
Long: "export API proxy bundles from an org",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/fetchapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var FetCmd = &cobra.Command{
Short: "Returns a zip-formatted proxy bundle ",
Long: "Returns a zip-formatted proxy bundle of code and config files",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/getapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var GetCmd = &cobra.Command{
Short: "Gets an API Proxy by name",
Long: "Gets an API Proxy by name, including a list of its revisions.",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/gettrcapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var GetTrcCmd = &cobra.Command{
Long: "Get a debug session for an API proxy revision deployed in an environment",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetApigeeEnv(env)
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/apis/ghcrtapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var GhCreateCmd = &cobra.Command{
if ok := re.Match([]byte(ghPath)); !ok {
return fmt.Errorf("github path must end with /apiproxy")
}

apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand All @@ -67,7 +67,7 @@ func init() {
"", "API Proxy name")
GhCreateCmd.Flags().StringVarP(&ghOwner, "owner", "u",
"", "The github organization or username. ex: In https://github.com/apigee, apigee is the owner name")
GhCreateCmd.Flags().StringVarP(&ghRepo, "repo", "r",
GhCreateCmd.Flags().StringVarP(&ghRepo, "repo", "",
srinandan marked this conversation as resolved.
Show resolved Hide resolved
"", "The github repo name. ex: https://github.com/apigee/api-platform-samples, api-platform-samples is the repo")
GhCreateCmd.Flags().StringVarP(&ghPath, "proxy-path", "p",
"", "The path in the repo to the apiproxy folder. ex: sample-proxies/apikey/apiproxy")
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/gqlcrtapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var GqlCreateCmd = &cobra.Command{
if targetURL != "" && targetURLRef != "" {
return fmt.Errorf("either target-url or target-url-ref must be passed, not both")
}
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/impapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var ImpCmd = &cobra.Command{
Short: "Import a folder containing API proxy bundles",
Long: "Import a folder containing API proxy bundles",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/integrationapis.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var IntegrationCmd = &cobra.Command{
Short: "Creates an API proxy template for Application Integration",
Long: "Creates an API proxy template for Application Integration with an API Trigger",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/apis/listapikvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var ListKvmCmd = &cobra.Command{
Short: "List all KVMs for an API proxy",
Long: "List all KVMs for an API proxy",
Args: func(cmd *cobra.Command, args []string) (err error) {
apiclient.SetRegion(region)
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
Loading