| 40 | } |
| 41 | |
| 42 | func (c *WriteCommand) Help() string { |
| 43 | helpText := ` |
| 44 | Usage: vault write [options] PATH [DATA K=V...] |
| 45 | |
| 46 | Writes data to Vault at the given path. The data can be credentials, secrets, |
| 47 | configuration, or arbitrary data. The specific behavior of this command is |
| 48 | determined at the thing mounted at the path. |
| 49 | |
| 50 | Data is specified as "key=value" pairs. If the value begins with an "@", then |
| 51 | it is loaded from a file. If the value is "-", Vault will read the value from |
| 52 | stdin. |
| 53 | |
| 54 | Store an arbitrary secret in the token's cubbyhole. |
| 55 | |
| 56 | $ vault write cubbyhole/git-credentials username="student01" password="p@$$w0rd" |
| 57 | |
| 58 | Create a new encryption key in the transit secrets engine: |
| 59 | |
| 60 | $ vault write -force transit/keys/my-key |
| 61 | |
| 62 | The -force / -f flag allows a write operation without any input data. |
| 63 | |
| 64 | Upload an AWS IAM policy from a file on disk: |
| 65 | |
| 66 | $ vault write aws/roles/ops policy=@policy.json |
| 67 | |
| 68 | Configure access to Consul by providing an access token: |
| 69 | |
| 70 | $ echo $MY_TOKEN | vault write consul/config/access token=- |
| 71 | |
| 72 | Create a token |
| 73 | |
| 74 | $ vault write auth/token/create policies="admin" policies="secops" ttl=8h num_uses=3 |
| 75 | |
| 76 | For a full list of examples and paths, please see the documentation that |
| 77 | corresponds to the secret engines in use. |
| 78 | |
| 79 | ` + c.Flags().Help() |
| 80 | |
| 81 | return strings.TrimSpace(helpText) |
| 82 | } |
| 83 | |
| 84 | func (c *WriteCommand) Flags() *FlagSets { |
| 85 | set := c.flagSet(FlagSetHTTP | FlagSetOutputField | FlagSetOutputFormat) |