Skip to content

Commit

Permalink
Update commands/spaces.go
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Starr-Bochicchio <[email protected]>
  • Loading branch information
lee-aaron and andrewsomething committed Feb 24, 2025
1 parent 877d9f9 commit f131c55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion commands/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ func withTestClient(t *testing.T, tFn testFn) {
appDockerEngineClient: builder.NewMockDockerEngineClient(ctrl),
oauth: domocks.NewMockOAuthService(ctrl),
partnerInterconnectAttachment: domocks.NewMockPartnerInterconnectAttachmentsService(ctrl),
spacesKeys: domocks.NewMockSpacesKeysService(ctrl)}
spacesKeys: domocks.NewMockSpacesKeysService(ctrl),
}

testConfig := doctl.NewTestConfig()
testConfig.DockerEngineClient = tm.appDockerEngineClient
Expand Down
1 change: 1 addition & 0 deletions commands/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func Spaces() *Command {
Command: &cobra.Command{
Use: "spaces",
Aliases: []string{"sp"},
Hidden: true,
Short: "Display commands that manage DigitalOcean Spaces.",
Long: "The subcommands of `doctl spaces` allow you to access and manage Spaces.",
GroupID: manageResourcesGroup,
Expand Down
14 changes: 8 additions & 6 deletions commands/spaces_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ func SpacesKeys() *Command {
createSpacesKeyDesc := "Create a key for a Space with the provided name."
cmdSpacesKeysCreate := CmdBuilder(cmd, spacesKeysCreate, "create <name>", "Create a key for a Space.", createSpacesKeyDesc, Writer)
AddStringSliceFlag(cmdSpacesKeysCreate, "grants", "g", []string{},
`A list of grants to add to the key. The permission should be either 'read', 'readwrite', or 'fullaccess'.
`A comma-separated list of grants to add to the key. The permission should be either 'read', 'readwrite', or 'fullaccess'.
Format: `+"`"+`"bucket=your-bucket;permission=your-permission"`+"`", requiredOpt())
cmdSpacesKeysCreate.Example = "doctl spaces keys create my-key --grants 'bucket=my-bucket;permission=readwrite'"
cmdSpacesKeysCreate.Example =
`doctl spaces keys create my-key --grants 'bucket=my-bucket;permission=readwrite,bucket=my-other-bucket;permission=read'
doctl spaces keys create my-key --grants 'bucket=;permission=fullaccess'`

listSpacesKeysDesc := "List all keys for a Space."
cmdSpacesKeysList := CmdBuilder(
Expand All @@ -58,20 +60,20 @@ Format: `+"`"+`"bucket=your-bucket;permission=your-permission"`+"`", requiredOpt
cmdSpacesKeysDelete := CmdBuilder(
cmd,
spacesKeysDelete,
"delete <key>",
"delete <access key>",
"Delete a key for a Space.",
deleteSpacesKeyDesc,
Writer, aliasOpt("rm"),
)
cmdSpacesKeysDelete.Example = "doctl spaces keys delete DOACCESSKEY"

updateSpacesKeyDesc := "Update a key for a Space."
cmdSpacesKeysUpdate := CmdBuilder(cmd, spacesKeysUpdate, "update <key>", "Update a key for a Space.", updateSpacesKeyDesc, Writer)
cmdSpacesKeysUpdate := CmdBuilder(cmd, spacesKeysUpdate, "update <access key>", "Update a key for a Space.", updateSpacesKeyDesc, Writer)
AddStringFlag(cmdSpacesKeysUpdate, "name", "n", "", "The new name for the key.", requiredOpt())
AddStringSliceFlag(cmdSpacesKeysUpdate, "grants", "g", []string{},
`A list of grants to set to the key. The permission should be either 'read', 'readwrite', or 'fullaccess'.
`A comma-separated list of grants to set to the key. The permission should be either 'read', 'readwrite', or 'fullaccess'.
Format: `+"`"+`"bucket=your-bucket;permission=your-permission"`+"`", requiredOpt())
cmdSpacesKeysUpdate.Example = "doctl spaces keys update DOACCESSKEY --name new-key --grants 'bucket=my-bucket;permission=readwrite'"
cmdSpacesKeysUpdate.Example = "doctl spaces keys update DOACCESSKEY --name new-key --grants 'bucket=my-bucket;permission=readwrite,bucket=my-other-bucket;permission=read'"

return cmd
}
Expand Down

0 comments on commit f131c55

Please sign in to comment.