diff --git a/README.md b/README.md index c45fce8..30735f8 100644 --- a/README.md +++ b/README.md @@ -331,7 +331,12 @@ $ biko gcp [product] [flag(s)] | Product | What | Command | Flags(Optional) | |:----:|:----:|:----:|:----:| -| Container Registry | Go to container registry or the container detail | `gcr` | `--name, -n` | +| Container Registry | Go to container registry or the container detail | `gcr` | `--name, -n` | + + +**Security** + +| Secret Manager | Go to secret manager's detail | `secret-manager`, `sm`, `secretmanager`, `secretManager` | `--secret, -s` | **Big Data** diff --git a/cli/gcp.go b/cli/gcp.go index 0fed348..18302d2 100644 --- a/cli/gcp.go +++ b/cli/gcp.go @@ -48,19 +48,20 @@ func newGCPCmd() cli.Command { Subcommands: []cli.Command{ newGCPGAECmd(), newGCPBQCmd(), - newGCPGKECmd(), - newGCPSpannerCmd(), - newGCPGCRCmd(), - newGCPFunctionsCmd(), newGCPCloudRunCmd(), + newGCPDataflowCmd(), + newGCPFunctionsCmd(), newGCPGCECmd(), - newGCPLogsCmd(), + newGCPGCRCmd(), + newGCPGKECmd(), newGCPIAMCmd(), - newGCPSQLCmd(), + newGCPLogsCmd(), + newGCPKMSCmd(), newGCPPubSubCmd(), + newGCPSecretManagerCmd(), + newGCPSpannerCmd(), newGCPStorageCmd(), - newGCPDataflowCmd(), - newGCPKMSCmd(), + newGCPSQLCmd(), }, } } @@ -137,7 +138,7 @@ func newGCPGKECmd() cli.Command { Usage: "Name of the cluter", }, cli.StringFlag{ - Name: "namespaces, ns", + Name: "namespaces, ns", Usage: "Namespaces of workload page to open (you can input multiple namespaces by comma-speparated string)", }, }, @@ -184,6 +185,32 @@ func newGCPSpannerCmd() cli.Command { } } +func newGCPSecretManagerCmd() cli.Command { + return cli.Command{ + Name: "secret-manager", + Aliases: []string{"sm", "secretmanager", "secretManager"}, + Usage: "Open Secret Manager page", + Category: categoryStorage, + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "project", + Usage: "Specify the project to open", + }, + cli.StringFlag{ + Name: "secret, s", + Usage: "Secret name", + }, + }, + Action: func(c *cli.Context) error { + gcp, err := gcp.GetProvider() + if err != nil { + return err + } + return browser.Open(c, gcp) + }, + } +} + func newGCPGCRCmd() cli.Command { return cli.Command{ Name: "gcr", diff --git a/providers/gcp/gcp.go b/providers/gcp/gcp.go index 754bfbd..18991f9 100644 --- a/providers/gcp/gcp.go +++ b/providers/gcp/gcp.go @@ -158,6 +158,12 @@ func (p *Provider) addProductPath(product string) { p.join("workload") p.addGKEPageStateParam(namespaces) } + case "secret-manager": + p.join(fmt.Sprintf("security/%s", product)) + var secret string + if secret = p.GetCtxString("secret"); secret != "" { + p.join(fmt.Sprintf("secret/%s", secret)) + } case "spanner": p.join(product) var instance, db, scheme string