Skip to content

Commit

Permalink
Merge pull request #110 from KeisukeYamashita/gcp/add-secret-manager
Browse files Browse the repository at this point in the history
Add GCP secret manager
  • Loading branch information
KeisukeYamashita committed Jun 28, 2021
2 parents c20cffd + 099f938 commit 51f18ad
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
45 changes: 36 additions & 9 deletions cli/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}
}
Expand Down Expand Up @@ -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)",
},
},
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions providers/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 51f18ad

Please sign in to comment.