{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/comments/28609984","id":28609984,"diff_hunk":"@@ -173,6 +173,69 @@ class V1 < Sinatra::Base\n       JSON.pretty_generate(result)\n     end\n \n+    get \"#{api_prefix}/token/:token/?\" do\n+      content_type :json\n+\n+      result = { 'ok' => false }\n+\n+      Vmpooler::API.settings.config[:auth] ? status(401) : status(404)\n+\n+      if Vmpooler::API.settings.config[:auth] and Vmpooler::API.settings.redis.exists('vmpooler__token__' + params[:token])\n+        status(200)\n+        result['ok'] = true\n+\n+        result[params[:token]] = Vmpooler::API.settings.redis.hgetall('vmpooler__token__' + params[:token])        \n+      end\n+\n+      JSON.pretty_generate(result)\n+    end\n+\n+    delete \"#{api_prefix}/token/:token/?\" do\n+      content_type :json\n+\n+      result = { 'ok' => false }\n+\n+      Vmpooler::API.settings.config[:auth] ? status(401) : status(404)\n+\n+      if Vmpooler::API.settings.config[:auth] and Vmpooler::API.settings.redis.exists('vmpooler__token__' + params[:token])\n+        status(200)\n+        result['ok'] = true\n+\n+        Vmpooler::API.settings.redis.del('vmpooler__token__' + params[:token])","path":"lib/vmpooler/api/v1.rb","position":32,"original_position":32,"commit_id":"69ea4972e685d49931c165385841608d8aaf4e6a","original_commit_id":"69ea4972e685d49931c165385841608d8aaf4e6a","user":{"login":"colinPL","id":6528153,"avatar_url":"https://avatars.githubusercontent.com/u/6528153?v=3","gravatar_id":"","url":"https://api.github.com/users/colinPL","html_url":"https://github.com/colinPL","followers_url":"https://api.github.com/users/colinPL/followers","following_url":"https://api.github.com/users/colinPL/following{/other_user}","gists_url":"https://api.github.com/users/colinPL/gists{/gist_id}","starred_url":"https://api.github.com/users/colinPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinPL/subscriptions","organizations_url":"https://api.github.com/users/colinPL/orgs","repos_url":"https://api.github.com/users/colinPL/repos","events_url":"https://api.github.com/users/colinPL/events{/privacy}","received_events_url":"https://api.github.com/users/colinPL/received_events","type":"User","site_admin":false},"body":"`del` returns the number of keys deleted, 0 meaning the key did not exist. This can be setup similar to the `hgetall` comment above.\r\n\r\n``` ruby\r\nif config[:auth]\r\n  del_count = redis.del(....)\r\nend\r\n\r\nif del_count > 1\r\n  status(200)\r\n  ....\r\nend\r\n```","created_at":"2015-04-17T16:43:34Z","updated_at":"2015-04-17T16:43:34Z","html_url":"https://github.com/puppetlabs/vmpooler/pull/96#discussion_r28609984","pull_request_url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/comments/28609984"},"html":{"href":"https://github.com/puppetlabs/vmpooler/pull/96#discussion_r28609984"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96","id":33476456,"html_url":"https://github.com/puppetlabs/vmpooler/pull/96","diff_url":"https://github.com/puppetlabs/vmpooler/pull/96.diff","patch_url":"https://github.com/puppetlabs/vmpooler/pull/96.patch","issue_url":"https://api.github.com/repos/puppetlabs/vmpooler/issues/96","number":96,"state":"open","locked":false,"title":"Add basic [LDAP] authentication and /token routes","user":{"login":"sschneid","id":20033,"avatar_url":"https://avatars.githubusercontent.com/u/20033?v=3","gravatar_id":"","url":"https://api.github.com/users/sschneid","html_url":"https://github.com/sschneid","followers_url":"https://api.github.com/users/sschneid/followers","following_url":"https://api.github.com/users/sschneid/following{/other_user}","gists_url":"https://api.github.com/users/sschneid/gists{/gist_id}","starred_url":"https://api.github.com/users/sschneid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sschneid/subscriptions","organizations_url":"https://api.github.com/users/sschneid/orgs","repos_url":"https://api.github.com/users/sschneid/repos","events_url":"https://api.github.com/users/sschneid/events{/privacy}","received_events_url":"https://api.github.com/users/sschneid/received_events","type":"User","site_admin":false},"body":"For review while I write spec tests and update docs (both needed before this should be merged).\r\n\r\nThis is deployed to and has been tested on vmpooler-dev.","created_at":"2015-04-16T17:59:47Z","updated_at":"2015-04-17T16:43:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd02182416f7c8fdb5a05e4012bdf1c0454dfc53","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/vmpooler/issues/96/comments","statuses_url":"https://api.github.com/repos/puppetlabs/vmpooler/statuses/69ea4972e685d49931c165385841608d8aaf4e6a","head":{"label":"sschneid:auth","ref":"auth","sha":"69ea4972e685d49931c165385841608d8aaf4e6a","user":{"login":"sschneid","id":20033,"avatar_url":"https://avatars.githubusercontent.com/u/20033?v=3","gravatar_id":"","url":"https://api.github.com/users/sschneid","html_url":"https://github.com/sschneid","followers_url":"https://api.github.com/users/sschneid/followers","following_url":"https://api.github.com/users/sschneid/following{/other_user}","gists_url":"https://api.github.com/users/sschneid/gists{/gist_id}","starred_url":"https://api.github.com/users/sschneid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sschneid/subscriptions","organizations_url":"https://api.github.com/users/sschneid/orgs","repos_url":"https://api.github.com/users/sschneid/repos","events_url":"https://api.github.com/users/sschneid/events{/privacy}","received_events_url":"https://api.github.com/users/sschneid/received_events","type":"User","site_admin":false},"repo":{"id":21907793,"name":"vmpooler","full_name":"sschneid/vmpooler","owner":{"login":"sschneid","id":20033,"avatar_url":"https://avatars.githubusercontent.com/u/20033?v=3","gravatar_id":"","url":"https://api.github.com/users/sschneid","html_url":"https://github.com/sschneid","followers_url":"https://api.github.com/users/sschneid/followers","following_url":"https://api.github.com/users/sschneid/following{/other_user}","gists_url":"https://api.github.com/users/sschneid/gists{/gist_id}","starred_url":"https://api.github.com/users/sschneid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sschneid/subscriptions","organizations_url":"https://api.github.com/users/sschneid/orgs","repos_url":"https://api.github.com/users/sschneid/repos","events_url":"https://api.github.com/users/sschneid/events{/privacy}","received_events_url":"https://api.github.com/users/sschneid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sschneid/vmpooler","description":"Provide configurable 'pools' of available (running) virtual machines","fork":true,"url":"https://api.github.com/repos/sschneid/vmpooler","forks_url":"https://api.github.com/repos/sschneid/vmpooler/forks","keys_url":"https://api.github.com/repos/sschneid/vmpooler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sschneid/vmpooler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sschneid/vmpooler/teams","hooks_url":"https://api.github.com/repos/sschneid/vmpooler/hooks","issue_events_url":"https://api.github.com/repos/sschneid/vmpooler/issues/events{/number}","events_url":"https://api.github.com/repos/sschneid/vmpooler/events","assignees_url":"https://api.github.com/repos/sschneid/vmpooler/assignees{/user}","branches_url":"https://api.github.com/repos/sschneid/vmpooler/branches{/branch}","tags_url":"https://api.github.com/repos/sschneid/vmpooler/tags","blobs_url":"https://api.github.com/repos/sschneid/vmpooler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sschneid/vmpooler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sschneid/vmpooler/git/refs{/sha}","trees_url":"https://api.github.com/repos/sschneid/vmpooler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sschneid/vmpooler/statuses/{sha}","languages_url":"https://api.github.com/repos/sschneid/vmpooler/languages","stargazers_url":"https://api.github.com/repos/sschneid/vmpooler/stargazers","contributors_url":"https://api.github.com/repos/sschneid/vmpooler/contributors","subscribers_url":"https://api.github.com/repos/sschneid/vmpooler/subscribers","subscription_url":"https://api.github.com/repos/sschneid/vmpooler/subscription","commits_url":"https://api.github.com/repos/sschneid/vmpooler/commits{/sha}","git_commits_url":"https://api.github.com/repos/sschneid/vmpooler/git/commits{/sha}","comments_url":"https://api.github.com/repos/sschneid/vmpooler/comments{/number}","issue_comment_url":"https://api.github.com/repos/sschneid/vmpooler/issues/comments{/number}","contents_url":"https://api.github.com/repos/sschneid/vmpooler/contents/{+path}","compare_url":"https://api.github.com/repos/sschneid/vmpooler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sschneid/vmpooler/merges","archive_url":"https://api.github.com/repos/sschneid/vmpooler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sschneid/vmpooler/downloads","issues_url":"https://api.github.com/repos/sschneid/vmpooler/issues{/number}","pulls_url":"https://api.github.com/repos/sschneid/vmpooler/pulls{/number}","milestones_url":"https://api.github.com/repos/sschneid/vmpooler/milestones{/number}","notifications_url":"https://api.github.com/repos/sschneid/vmpooler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sschneid/vmpooler/labels{/name}","releases_url":"https://api.github.com/repos/sschneid/vmpooler/releases{/id}","created_at":"2014-07-16T16:07:36Z","updated_at":"2015-04-15T20:02:11Z","pushed_at":"2015-04-17T16:16:48Z","git_url":"git://github.com/sschneid/vmpooler.git","ssh_url":"git@github.com:sschneid/vmpooler.git","clone_url":"https://github.com/sschneid/vmpooler.git","svn_url":"https://github.com/sschneid/vmpooler","homepage":"","size":2048,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"puppetlabs:master","ref":"master","sha":"331ac33b539cec2d69e64864aa20788c30464211","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":13072980,"name":"vmpooler","full_name":"puppetlabs/vmpooler","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/vmpooler","description":"Provide configurable 'pools' of available (running) virtual machines","fork":false,"url":"https://api.github.com/repos/puppetlabs/vmpooler","forks_url":"https://api.github.com/repos/puppetlabs/vmpooler/forks","keys_url":"https://api.github.com/repos/puppetlabs/vmpooler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/vmpooler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/vmpooler/teams","hooks_url":"https://api.github.com/repos/puppetlabs/vmpooler/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/vmpooler/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/vmpooler/events","assignees_url":"https://api.github.com/repos/puppetlabs/vmpooler/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/vmpooler/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/vmpooler/tags","blobs_url":"https://api.github.com/repos/puppetlabs/vmpooler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/vmpooler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/vmpooler/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/vmpooler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/vmpooler/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/vmpooler/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/vmpooler/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/vmpooler/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/vmpooler/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/vmpooler/subscription","commits_url":"https://api.github.com/repos/puppetlabs/vmpooler/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/vmpooler/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/vmpooler/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/vmpooler/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/vmpooler/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/vmpooler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/vmpooler/merges","archive_url":"https://api.github.com/repos/puppetlabs/vmpooler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/vmpooler/downloads","issues_url":"https://api.github.com/repos/puppetlabs/vmpooler/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/vmpooler/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/vmpooler/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/vmpooler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/vmpooler/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/vmpooler/releases{/id}","created_at":"2013-09-24T18:27:35Z","updated_at":"2015-04-15T19:59:31Z","pushed_at":"2015-04-17T16:16:48Z","git_url":"git://github.com/puppetlabs/vmpooler.git","ssh_url":"git@github.com:puppetlabs/vmpooler.git","clone_url":"https://github.com/puppetlabs/vmpooler.git","svn_url":"https://github.com/puppetlabs/vmpooler","homepage":"","size":2426,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":8,"forks":10,"open_issues":8,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96"},"html":{"href":"https://github.com/puppetlabs/vmpooler/pull/96"},"issue":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/issues/96"},"comments":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/vmpooler/statuses/69ea4972e685d49931c165385841608d8aaf4e6a"}}}}