这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ec632a3
feat: manage app groups #210
srinandan Jul 21, 2023
ca9a99d
feat: manage app keys #210
srinandan Jul 21, 2023
acca77a
feat: manage apps in appgroups #210
srinandan Jul 21, 2023
3ed288b
fix typo #210
srinandan Jul 21, 2023
da85f08
feat: delete key in app #210
srinandan Jul 21, 2023
92a3626
feat: export appgroups #210
srinandan Jul 21, 2023
59b4f61
feat: export appgroups #210
srinandan Jul 21, 2023
877327d
feat: manage prods in cred #210
srinandan Jul 21, 2023
00f9c14
feat: export apps #210
srinandan Jul 21, 2023
455cc09
feat: manage apps and appgroups #210
srinandan Jul 21, 2023
c46111f
chore: fix linting issues #210
srinandan Jul 21, 2023
228e30b
feat: export all apps #210
srinandan Jul 22, 2023
d4ba83e
feat: import appgroups #210
srinandan Jul 22, 2023
c021276
feat: import apps in appgroup #210
srinandan Jul 24, 2023
9caf224
bug: fix method to create keys #210
srinandan Jul 24, 2023
a09781a
bug: add expiry #210
srinandan Jul 24, 2023
4ebecb8
bug: collects errors from import #210
srinandan Jul 24, 2023
a98639d
bug: accept appname #210
srinandan Jul 24, 2023
46fd23c
chore: fix linting issues #210
srinandan Jul 24, 2023
ef0fd2e
chore: fix typo in params #210
srinandan Jul 24, 2023
4acd0a4
chore: fix linting errors #210
srinandan Jul 24, 2023
49c1652
feat: import all app #210
srinandan Jul 24, 2023
c710db4
bug: address comments in PR 234 #210
srinandan Jul 26, 2023
d2c43a5
bug: address comments in PR 234 #210
srinandan Jul 27, 2023
b76e311
chore: linting issues #210
srinandan Jul 27, 2023
9f8e5ea
chore: linting issues #210
srinandan Jul 27, 2023
8be1a79
feat: update appgroup apps #210
srinandan Jul 27, 2023
d6ceb3c
bug: incorrect method for delete app #210
srinandan Jul 27, 2023
950908c
bug: appname missing from update #210
srinandan Jul 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions cmd/appgroups/appgroups.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"github.com/spf13/cobra"
)

// Cmd to manage appgroups
var Cmd = &cobra.Command{
Use: "appgroups",
Short: "Manage Apigee Application Groups",
Long: "Manage Apigee Application Groups",
}

var org string

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

Cmd.AddCommand(ListCmd)
Cmd.AddCommand(GetCmd)
Cmd.AddCommand(DelCmd)
Cmd.AddCommand(CreateCmd)
Cmd.AddCommand(UpdateCmd)
Cmd.AddCommand(ManageCmd)
Cmd.AddCommand(AppCmd)
Cmd.AddCommand(ExpCmd)
Cmd.AddCommand(ImpCmd)
}
38 changes: 38 additions & 0 deletions cmd/appgroups/apps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"github.com/spf13/cobra"
)

// AppCmd to manage apps
var AppCmd = &cobra.Command{
Use: "apps",
Short: "Manage apps in an Apigee Application Group",
Long: "Manage apps in an Apigee Application Group",
}

func init() {
AppCmd.AddCommand(CreateAppCmd)
AppCmd.AddCommand(ListAppCmd)
AppCmd.AddCommand(GetAppCmd)
AppCmd.AddCommand(DelAppCmd)
AppCmd.AddCommand(ManageAppCmd)
AppCmd.AddCommand(UpdateAppCmd)
AppCmd.AddCommand(KeyCmd)
AppCmd.AddCommand(ExpAppCmd)
AppCmd.AddCommand(ImpAppCmd)
}
69 changes: 69 additions & 0 deletions cmd/appgroups/createkey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"fmt"
"strconv"

"internal/apiclient"
"internal/client/appgroups"

"github.com/spf13/cobra"
)

// CreateKeyCmd to create developer keys
var CreateKeyCmd = &cobra.Command{
Use: "create",
Short: "Create an app key",
Long: "Create an app key",
Args: func(cmd *cobra.Command, args []string) (err error) {
if (key != "" && secret == "") || (secret != "" && key == "") {
return fmt.Errorf("key and secret must both be passed or neither must be sent")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = appgroups.CreateKey(name, appName, key, secret, strconv.Itoa(expiry), apiProducts, scopes, attrs)
return
},
}

var (
secret string
expiry int
)

func init() {
CreateKeyCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the AppGroup")
CreateKeyCmd.Flags().StringVarP(&appName, "app-name", "",
"", "Name of the app")
CreateKeyCmd.Flags().StringVarP(&key, "key", "k",
"", "Import an existing AppGroup app consumer key")
CreateKeyCmd.Flags().StringVarP(&secret, "secret", "r",
"", "Import an existing AppGroup app consumer secret")
CreateKeyCmd.Flags().IntVarP(&expiry, "expiry", "x",
-1, "Expiration time, in seconds, for the consumer key")
CreateKeyCmd.Flags().StringArrayVarP(&apiProducts, "prods", "p",
[]string{}, "A list of api products")
CreateKeyCmd.Flags().StringArrayVarP(&scopes, "scopes", "s",
[]string{}, "OAuth scopes")
CreateKeyCmd.Flags().StringToStringVar(&attrs, "attrs",
nil, "Custom attributes")

_ = CreateKeyCmd.MarkFlagRequired("name")
_ = CreateKeyCmd.MarkFlagRequired("app-name")
}
62 changes: 62 additions & 0 deletions cmd/appgroups/crtapp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"internal/apiclient"

"internal/client/appgroups"

"github.com/spf13/cobra"
)

// CreateAppCmd to create app
var CreateAppCmd = &cobra.Command{
Use: "create",
Short: "Create an App",
Long: "Create an App in an AppGroup",
Args: func(cmd *cobra.Command, args []string) (err error) {
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = appgroups.CreateApp(name, appName, expires, callback, apiProducts, scopes, attrs)
return
},
}

var (
expires, callback string
apiProducts, scopes []string
)

func init() {
CreateAppCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the AppGroup")
CreateAppCmd.Flags().StringVarP(&appName, "app-name", "",
"", "Name of the app")
CreateAppCmd.Flags().StringVarP(&expires, "expires", "x",
"", "A setting, in milliseconds, for the lifetime of the consumer key")
CreateAppCmd.Flags().StringVarP(&callback, "callback", "c",
"", "The callbackUrl is used by OAuth")
CreateAppCmd.Flags().StringArrayVarP(&apiProducts, "prods", "p",
[]string{}, "A list of api products")
CreateAppCmd.Flags().StringArrayVarP(&scopes, "scopes", "s",
[]string{}, "OAuth scopes")
CreateAppCmd.Flags().StringToStringVar(&attrs, "attrs",
nil, "Custom attributes")

_ = CreateAppCmd.MarkFlagRequired("name")
_ = CreateAppCmd.MarkFlagRequired("app-name")
}
56 changes: 56 additions & 0 deletions cmd/appgroups/crtappgroup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"internal/apiclient"
"internal/client/appgroups"

"github.com/spf13/cobra"
)

// CreateCmd to create appgroup
var CreateCmd = &cobra.Command{
Use: "create",
Short: "Create an AppGroup",
Long: "Create an AppGroup",
Args: func(cmd *cobra.Command, args []string) (err error) {
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = appgroups.Create(name, channelURI, channelID, displayName, attrs)
return
},
}

var (
channelID, channelURI, displayName string
attrs map[string]string
)

func init() {
CreateCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the AppGroup")
CreateCmd.Flags().StringVarP(&channelID, "channelid", "i",
"", "channel identifier identifies the owner maintaining this grouping")
CreateCmd.Flags().StringVarP(&channelURI, "channelurl", "u",
"", "A reference to the associated storefront/marketplace")
CreateCmd.Flags().StringVarP(&displayName, "display-name", "d",
"", "app group name displayed in the UI")
CreateCmd.Flags().StringToStringVar(&attrs, "attrs",
nil, "Custom attributes")

_ = CreateCmd.MarkFlagRequired("name")
}
46 changes: 46 additions & 0 deletions cmd/appgroups/delapp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"internal/apiclient"
"internal/client/appgroups"

"github.com/spf13/cobra"
)

// DelAppCmd to get app
var DelAppCmd = &cobra.Command{
Use: "delete",
Short: "Delete an App in an AppGroup",
Long: "Delete an in an AppGroup",
Args: func(cmd *cobra.Command, args []string) error {
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = appgroups.DeleteApp(name, appName)
return err
},
}

func init() {
DelAppCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the AppGroup")
DelAppCmd.Flags().StringVarP(&appName, "app-name", "",
"", "Name of the app")

_ = DelAppCmd.MarkFlagRequired("name")
_ = DelAppCmd.MarkFlagRequired("app-name")
}
41 changes: 41 additions & 0 deletions cmd/appgroups/delappgroup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package appgroups

import (
"internal/apiclient"
"internal/client/appgroups"

"github.com/spf13/cobra"
)

// DelCmd to get appgroup
var DelCmd = &cobra.Command{
Use: "delete",
Short: "Delete AppGroup in an Organization by AppGroup Name",
Long: "Delete AppGroup in an Organization by AppGroup Name",
Args: func(cmd *cobra.Command, args []string) error {
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
_, err = appgroups.Delete(name)
return err
},
}

func init() {
DelCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the AppGroup")
}
Loading