command/kv: Add a "kv" subcommand for using the key-value store (#4168)

* Add more cli subcommands

* Add metadata commands

* Add more subcommands

* Update cli

* Move archive commands to delete

* Add helpers for making http calls to the kv backend

* rename cli header

* Format the various maps from kv

* Add list command

* Update help text

* Add a command to enable versioning on a backend

* Rename enable-versions command

* Some review feedback

* Fix listing of top level keys

* Fix issue when metadata is nil

* Add test for lising top level keys

* Fix some typos

* Add a note about deleting all versions
This commit is contained in:
Brian Kassouf
2018-03-21 15:02:41 -07:00
committed by GitHub
parent df723aa4b6
commit a03a722fa9
18 changed files with 1661 additions and 3 deletions

View File

@@ -675,6 +675,90 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
},
}, nil
},
"kv": func() (cli.Command, error) {
return &KVCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv put": func() (cli.Command, error) {
return &KVPutCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv get": func() (cli.Command, error) {
return &KVGetCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv delete": func() (cli.Command, error) {
return &KVDeleteCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv list": func() (cli.Command, error) {
return &KVListCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv destroy": func() (cli.Command, error) {
return &KVDestroyCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv undelete": func() (cli.Command, error) {
return &KVUndeleteCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv enable-versioning": func() (cli.Command, error) {
return &KVEnableVersioningCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv metadata": func() (cli.Command, error) {
return &KVMetadataCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv metadata put": func() (cli.Command, error) {
return &KVMetadataPutCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv metadata get": func() (cli.Command, error) {
return &KVMetadataGetCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
"kv metadata delete": func() (cli.Command, error) {
return &KVMetadataDeleteCommand{
BaseCommand: &BaseCommand{
UI: ui,
},
}, nil
},
}
// Deprecated commands