| 37 | } |
| 38 | |
| 39 | func (c *KVMetadataPatchCommand) Help() string { |
| 40 | helpText := ` |
| 41 | Usage: vault kv metadata patch [options] KEY |
| 42 | |
| 43 | This command can be used to create a blank key in the key-value store or to |
| 44 | update key configuration for a specified key. |
| 45 | |
| 46 | Create a key in the key-value store with no data: |
| 47 | |
| 48 | $ vault kv metadata patch -mount=secret foo |
| 49 | |
| 50 | The deprecated path-like syntax can also be used, but this should be avoided |
| 51 | for KV v2, as the fact that it is not actually the full API path to |
| 52 | the secret (secret/metadata/foo) can cause confusion: |
| 53 | |
| 54 | $ vault kv metadata patch secret/foo |
| 55 | |
| 56 | Set a max versions setting on the key: |
| 57 | |
| 58 | $ vault kv metadata patch -mount=secret -max-versions=5 foo |
| 59 | |
| 60 | Set delete-version-after on the key: |
| 61 | |
| 62 | $ vault kv metadata patch -mount=secret -delete-version-after=3h25m19s foo |
| 63 | |
| 64 | Require Check-and-Set for this key: |
| 65 | |
| 66 | $ vault kv metadata patch -mount=secret -cas-required foo |
| 67 | |
| 68 | Set custom metadata on the key: |
| 69 | |
| 70 | $ vault kv metadata patch -mount=secret -custom-metadata=foo=abc -custom-metadata=bar=123 foo |
| 71 | |
| 72 | To remove custom meta data from the corresponding path in the key-value store, kv metadata patch can be used. |
| 73 | |
| 74 | $ vault kv metadata patch -mount=secret -remove-custom-metadata=bar foo |
| 75 | |
| 76 | Additional flags and more advanced use cases are detailed below. |
| 77 | |
| 78 | ` + c.Flags().Help() |
| 79 | return strings.TrimSpace(helpText) |
| 80 | } |
| 81 | |
| 82 | func (c *KVMetadataPatchCommand) Flags() *FlagSets { |
| 83 | set := c.flagSet(FlagSetHTTP | FlagSetOutputFormat) |