{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/80571302","id":80571302,"diff_hunk":"@@ -0,0 +1,249 @@\n+package command\n+\n+import (\n+\t\"bytes\"\n+\t\"flag\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"strings\"\n+\n+\t\"github.com/hashicorp/consul/api\"\n+\t\"github.com/mitchellh/cli\"\n+)\n+\n+// KVPutCommand is a Command implementation that is used to write data to the\n+// key-value store.\n+type KVPutCommand struct {\n+\tUi cli.Ui\n+\n+\t// testStdin is the input for testing.\n+\ttestStdin io.Reader\n+}\n+\n+func (c *KVPutCommand) Help() string {\n+\thelpText := `\n+Usage: consul kv put [options] KEY [DATA]\n+\n+  Writes the data to the given path in the key-value store. The data can be of\n+  any type, but it will be transported as a base64-encoded string for safe\n+  transport:\n+\n+      $ consul kv put config/redis/maxconns 5\n+\n+  The data can also be consumed from a file on disk by prefixing with the \"@\"\n+  symbol. For example:\n+\n+      $ consul kv put config/program/license @license.lic\n+\n+  The DATA argument itself is optional. If omitted, this will create an empty\n+  key-value pair at the specified path:\n+\n+      $ consul kv put webapp/beta/active\n+\n+  To perform a Check-And-Set operation, specify the -cas flag with the\n+  appropriate -modify-index flag corresponding to the key you want to perform\n+  the CAS operation on:\n+\n+      $ consul kv put -cas -modify-index=844 config/redis/maxconns 5\n+\n+  Additional flags and more advanced use cases are detailed below.\n+\n+` + apiOptsText + `\n+\n+KV Put Options:\n+\n+  -acquire                Obtain a lock on the key. If the key does not exist,\n+                          this operation will create the key and obtain the\n+                          lock. The session must already exist and be specified\n+                          via the -session flag. The default value is false.\n+\n+  -cas                    Perform a Check-And-Set operation. If this value is\n+                          specified without -modify-index, the key will first be\n+                          fetched and the resulting ModifyIndex will be used on\n+                          the next query. The default value is false.\n+\n+  -flags=<int>            Unsigned integer value to assign to this key-value\n+                          pair. This value is not read by Consul, so clients can\n+                          use this value however makes sense for their use case.\n+                          The default value is 0 (no flags).\n+\n+  -modify-index=<int>     Unsigned integer representing the ModifyIndex of the\n+                          key. This is often combined with the -cas flag, but it\n+                          can be specified for any key. The default value is 0.","path":"command/kv_put.go","position":74,"original_position":74,"commit_id":"31832f0eb811950add2abb42028835e39402154c","original_commit_id":"31832f0eb811950add2abb42028835e39402154c","user":{"login":"slackpad","id":673509,"avatar_url":"https://avatars.githubusercontent.com/u/673509?v=3","gravatar_id":"","url":"https://api.github.com/users/slackpad","html_url":"https://github.com/slackpad","followers_url":"https://api.github.com/users/slackpad/followers","following_url":"https://api.github.com/users/slackpad/following{/other_user}","gists_url":"https://api.github.com/users/slackpad/gists{/gist_id}","starred_url":"https://api.github.com/users/slackpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackpad/subscriptions","organizations_url":"https://api.github.com/users/slackpad/orgs","repos_url":"https://api.github.com/users/slackpad/repos","events_url":"https://api.github.com/users/slackpad/events{/privacy}","received_events_url":"https://api.github.com/users/slackpad/received_events","type":"User","site_admin":false},"body":"Only makes sense for a CAS, otherwise Consul will ignore it.","created_at":"2016-09-26T20:57:33Z","updated_at":"2016-09-26T20:57:33Z","html_url":"https://github.com/hashicorp/consul/pull/2360#discussion_r80571302","pull_request_url":"https://api.github.com/repos/hashicorp/consul/pulls/2360","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/80571302"},"html":{"href":"https://github.com/hashicorp/consul/pull/2360#discussion_r80571302"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/2360"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/2360","id":86762575,"html_url":"https://github.com/hashicorp/consul/pull/2360","diff_url":"https://github.com/hashicorp/consul/pull/2360.diff","patch_url":"https://github.com/hashicorp/consul/pull/2360.patch","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/2360","number":2360,"state":"open","locked":false,"title":"Add kv subcommand and CLI","user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"body":"This implements the `kv` subcommand CLI for reading, writing, and deleting keys. This pass does not support the transaction-based keys yet, but that could be implemented in a later pass. The framework is in place for adding new commands and formats pretty easily.\r\n\r\n```\r\nUsage: consul kv <subcommand> [options] [args]\r\n\r\n  This command has subcommands for interacting with Consul's key-value\r\n  store. Here are some simple examples, and more detailed examples are\r\n  available in the subcommands or the documentation.\r\n\r\n  Create or update the key named \"redis/config/connections\" with the value \"5\":\r\n\r\n      $ consul kv put redis/config/connections 5\r\n\r\n  Read this value back:\r\n\r\n      $ consul kv get redis/config/connections\r\n\r\n  Or get detailed key information:\r\n\r\n      $ consul kv get -detailed redis/config/connections\r\n\r\n  Finally, delete the key:\r\n\r\n      $ consul kv delete redis/config/connections\r\n\r\n  For more examples, ask for subcommand help or view the documentation.\r\n\r\nSubcommands:\r\n\r\n    delete    Removes data from the KV store\r\n    get       Retrieves or lists data from the KV store\r\n    put       Sets or updates data in the KV store\r\n```\r\n\r\n/cc @slackpad @ryanuber @armon ","created_at":"2016-09-26T15:17:07Z","updated_at":"2016-09-26T20:57:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34e6d04096a119637c3922998e3d8eb2ce1622a2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/consul/pulls/2360/commits","review_comments_url":"https://api.github.com/repos/hashicorp/consul/pulls/2360/comments","review_comment_url":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/2360/comments","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/31832f0eb811950add2abb42028835e39402154c","head":{"label":"hashicorp:sethvargo/kv_cli","ref":"sethvargo/kv_cli","sha":"31832f0eb811950add2abb42028835e39402154c","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/consul/deployments","created_at":"2013-11-04T22:15:27Z","updated_at":"2016-09-26T19:37:41Z","pushed_at":"2016-09-26T20:36:39Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"https://www.consul.io/","size":18706,"stargazers_count":7350,"watchers_count":7350,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1204,"mirror_url":null,"open_issues_count":507,"forks":1204,"open_issues":507,"watchers":7350,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"bdcc8c44f510c2c2407cf63a722d2f92aecba255","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/consul/deployments","created_at":"2013-11-04T22:15:27Z","updated_at":"2016-09-26T19:37:41Z","pushed_at":"2016-09-26T20:36:39Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"https://www.consul.io/","size":18706,"stargazers_count":7350,"watchers_count":7350,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1204,"mirror_url":null,"open_issues_count":507,"forks":1204,"open_issues":507,"watchers":7350,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/2360"},"html":{"href":"https://github.com/hashicorp/consul/pull/2360"},"issue":{"href":"https://api.github.com/repos/hashicorp/consul/issues/2360"},"comments":{"href":"https://api.github.com/repos/hashicorp/consul/issues/2360/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/2360/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/2360/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/consul/statuses/31832f0eb811950add2abb42028835e39402154c"}}}}
{"actor":{"display_login":"slackpad"}}