Commit Graph

48 Commits

Author SHA1 Message Date
Brian Kassouf
a03a722fa9
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
2018-03-21 15:02:41 -07:00
Lukasz Jagiello
068d8cb974 Vault status formatting (#4073)
```
:~# vault status
Key                     Value
---                     -----
Seal Type               shamir
Sealed                  false
Total Shares            8
Threshold               2
Version                 0.9.5
Cluster Name            vault-cluster-8c85f1aa
Cluster ID              aaaaaaaa-1111-2222-3333-444444444444
HA Enabled              true
HA Cluster              https://10.0.0.1:8201
HA Mode                 standby
Active Node Address:    https://10.0.0.1:8200
```

`Active Node Address:` - is the only one with a colon at the end.

This PR fix that output style issue.
2018-03-05 07:40:59 -05:00
Jeff Mitchell
9c88c9ddac
Handle missed error case in seal status output format (#4001)
Fixes #3998
2018-02-17 20:52:42 -05:00
Jeff Mitchell
b24cf9a8af
Allow formatted data when using -field and -format together. (#3987)
* Allow formatted data when using -field and -format together.

As a special case, allows "data" to be passed in to get the entire data
struct output.

* If data exists in the output map use that instead when special casing
2018-02-15 09:11:56 -05:00
Calvin Leung Huang
3189278c84
CLI Enhancements (#3897)
* Use Colored UI if stdout is a tty

* Add format options to operator unseal

* Add format test on operator unseal

* Add -no-color output flag, and use BasicUi if no-color flag is provided

* Move seal status formatting logic to OutputSealStatus

* Apply no-color to warnings from DeprecatedCommands as well

* Add OutputWithFormat to support arbitrary data, add format option to auth list

* Add ability to output arbitrary list data on TableFormatter

* Clear up switch logic on format

* Add format option for list-related commands

* Add format option to rest of commands that returns a client API response

* Remove initOutputYAML and initOutputJSON, and use OutputWithFormat instead

* Remove outputAsYAML and outputAsJSON, and use OutputWithFormat instead

* Remove -no-color flag, use env var exclusively to toggle colored output

* Fix compile

* Remove -no-color flag in main.go

* Add missing FlagSetOutputFormat

* Fix generate-root/decode test

* Migrate init functions to main.go

* Add no-color flag back as hidden

* Handle non-supported data types for TableFormatter.OutputList

* Pull formatting much further up to remove the need to use c.flagFormat (#3950)

* Pull formatting much further up to remove the need to use c.flagFormat

Also remove OutputWithFormat as the logic can cause issues.

* Use const for env var

* Minor updates

* Remove unnecessary check

* Fix SSH output and some tests

* Fix tests

* Make race detector not run on generate root since it kills Travis these days

* Update docs

* Update docs

* Address review feedback

* Handle --format as well as -format
2018-02-12 18:12:16 -05:00
Jeff Mitchell
d6552a11cc Merge branch 'master-oss' into sethvargo/cli-magic 2018-01-03 14:02:31 -05:00
Jeff Mitchell
c77196cea2
Port over bits (#3575) 2017-11-13 15:31:32 -05:00
Seth Vargo
be7c31f695
Fix bad rebase
Apparently I can't git...
2017-10-24 09:39:34 -04:00
Seth Vargo
80e757c3b2
More consistent output 2017-10-24 09:34:30 -04:00
Seth Vargo
9c76f0b2e5
Use a unified helper for seal output 2017-10-24 09:34:12 -04:00
Seth Vargo
b4d9d1517b
Move more formatting into base_helpers 2017-10-24 09:30:48 -04:00
Seth Vargo
9d4e8c3529
Update format to not use colored UI for json/yaml 2017-10-24 09:28:07 -04:00
Seth Vargo
ac63ed573b
Output JSON with spaces not tabs 2017-10-24 09:26:44 -04:00
Brian Kassouf
41db07530a Add basic autocompletion (#3223)
* Add basic autocompletion

* Add autocomplete to some common commands

* Autocomplete the generate-root flags

* Add information about autocomplete to the docs
2017-08-24 15:23:40 -07:00
Calvin Leung Huang
15634f3b6e Store original request path in WrapInfo (#3100)
* Store original request path in WrapInfo as CreationPath

* Add wrapping_token_creation_path to CLI output

* Add CreationPath to AuditResponseWrapInfo

* Fix tests

* Add and fix tests, update API docs with new sample responses
2017-08-02 18:28:58 -04:00
vishalnayak
a7408e4dd5 Add yml alias for yaml 2016-09-16 10:43:23 -04:00
Jeff Mitchell
7f0b68862e Don't output key/value header if there are no values to display. (#1838)
Fixes #1835
2016-09-01 15:58:16 -04:00
Jeff Mitchell
65ae080c82 Add a separator to list output 2016-08-30 16:48:55 -04:00
Jeff Mitchell
4f27886641 Have human-oriented token duration and secret duration output display a more human-friendly format 2016-07-19 12:15:00 -04:00
vishalnayak
e6a91d891a Concatenating the output instead of printing twice 2016-06-20 15:26:33 -04:00
vishalnayak
56ae3530fb Fix the output format when warnings are present 2016-06-15 17:13:14 -04:00
Jeff Mitchell
47dc1ccd25 Add token accessor to wrap information if one exists 2016-06-13 23:58:17 +00:00
Jeff Mitchell
8dffc64388 Use time.Time which does RFC3339 across the wire to handle time zones. Arguably we should change the API to always do this... 2016-06-07 16:01:09 -04:00
Jeff Mitchell
91053b7471 Add creation time to returned wrapped token info
This makes it easier to understand the expected lifetime without a
lookup call that uses the single use left on the token.

This also adds a couple of safety checks and for JSON uses int, rather
than int64, for the TTL for the wrapped token.
2016-06-07 15:00:35 -04:00
Jeff Mitchell
07b86fe304 Merge branch 'master-oss' into cubbyhole-the-world 2016-05-19 02:43:22 +00:00
Jeff Mitchell
8c3866ea16 Rename lease_duration to refresh_interval when there is no lease ID, and output ---- between header and values 2016-05-17 17:10:12 +00:00
Jeff Mitchell
ff4dc0b853 Add wrap support to API/CLI 2016-05-02 02:03:23 -04:00
vishalnayak
2a35de81dc AccessorID --> Accessor, accessor_id --> accessor 2016-03-09 06:23:31 -05:00
vishalnayak
38a5d75caa Introduced AccessorID in TokenEntry and returning it along with token 2016-03-08 14:06:10 -05:00
Jeff Mitchell
949e707006 Fix CLI formatter to show warnings again on CLI list output. 2016-02-24 21:45:58 -05:00
Ron Kuris
32bf42519c Refactor formatting of output
This change is almost perfectly compatible with the existing code,
except it's a little shorter because it uses a list of a available
formatters that must implement a `command.Formatter` interface.

Also added some basic formatting tests.
2016-02-16 12:27:29 -08:00
Jeff Mitchell
f1b843d773 Remove bare option, prevent writes ending in slash, and return an exact file match as "." 2016-01-22 10:07:32 -05:00
Jeff Mitchell
f8e569ae0a Address some review feedback 2016-01-22 10:07:32 -05:00
Jeff Mitchell
2613343c3d Updates and documentation 2016-01-22 10:07:32 -05:00
Mathias Lafeldt
05f0cde643 Show error if output format is invalid
Rather than silently using table as a fallback.
2015-12-14 17:14:22 +01:00
Jeff Mitchell
55e2417b11 Merge pull request #832 from mlafeldt/yaml-ouput
Allow to output secrets in YAML format
2015-12-11 12:04:41 -05:00
Mathias Lafeldt
073e4c872e Allow to output secrets in YAML format
This can be done with https://github.com/ghodss/yaml, which reuses
existing JSON struct tags for YAML.
2015-12-10 11:32:31 +01:00
Mathias Lafeldt
459be44363 Output secrets sorted by key
Instead of printing them in random order each time `vault read` is invoked.
2015-12-10 10:08:23 +01:00
Jeff Mitchell
41f7cc9406 Adjust warnings message to make it clear they are from the server 2015-10-07 16:18:39 -04:00
Jeff Mitchell
fd2c0f033e Add the ability for warnings to be added to responses. These are
marshalled into JSON or displayed from the CLI depending on the output
mode. This allows conferring information such as "no such policy exists"
when creating a token -- not an error, but something the user should be
aware of.

Fixes #676
2015-10-07 16:18:39 -04:00
Jeff Mitchell
4801922b43 Minor updates to passthrough and additional tests 2015-09-21 16:57:41 -04:00
Jeff Mitchell
7e1c2c62c4 Use 'ttl_seconds' in CLI output so as not to shadow actual 'ttl' parameter 2015-09-21 16:37:37 -04:00
Jeff Mitchell
a782efa308 If there's no lease, output ttl instead of lease_duration 2015-09-21 16:37:37 -04:00
Jeff Mitchell
b0c97f8b8d If lease_duration is not zero, output it even if there is no lease. 2015-09-21 16:37:37 -04:00
Armon Dadgar
d19b74f78f command/token-create: provide more useful output. Fixes #337 2015-06-17 16:59:50 -07:00
A.I
f42a100d03 Fix lease_renewable output 2015-05-02 19:58:48 -07:00
Mitchell Hashimoto
8b961490cd command/format: add lease_renewable to output 2015-05-02 13:11:40 -07:00
Armon Dadgar
5aee91ccb9 command: refactor to share output formating code 2015-04-27 14:55:29 -07:00