{"action":"created","comment":{"url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/comments/201467550","pull_request_review_id":135976438,"id":201467550,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTQ2NzU1MA==","diff_hunk":"@@ -0,0 +1,68 @@\n+const assert = require('assert');\n+const taskcluster = require('taskcluster-client');\n+\n+/**\n+ * Build Pulse ConnectionString, from options on the form:\n+ * {\n+ *   username:          // Pulse username\n+ *   password:          // Pulse password\n+ *   hostname:          // Hostname to use\n+ * }\n+ */\n+const pulseCredentials = ({username, password, hostname, vhost}) => {\n+  assert(username, 'options.username is required');\n+  assert(password, 'options.password is required');\n+  assert(hostname, 'options.hostname is required');\n+  assert(vhost, 'options.vhost is required');\n+  \n+  // Construct connection string\n+  return async () => {\n+    {\n+      connectionString: [\n+        'amqps://',         // Ensure that we're using SSL\n+        encodeURI(username),\n+        ':',\n+        encodeURI(password),\n+        '@',\n+        hostname,\n+        ':',\n+        5671,                // Port for SSL\n+        '/',\n+        encodeURIComponent(vhost),\n+      ].join('');\n+    }\n+  };\n+};\n+\n+const connectionStringCredentials = (connectionString) => {\n+  return async () => {\n+    return {connectionString};\n+  };\n+};\n+\n+/**\n+   * Get pulse credentials using taskcluster credentials and build connection string \n+   * using taskcluster pulse service\n+*/\n+const claimedCredentials = ({rootUrl, credentials, namespace, expires, contact}) => {\n+  const pulse = taskcluster.Pulse({\n+    credentials,\n+    rootUrl,\n+  });\n+\n+  return async () => {\n+    const res = await pulse.claimNamespace(namespace, {\n+      expires,\n+      contact,\n+    });\n+    const connectionString = res.connectionString;\n+    const recycleAfter = res.reclaimAt-taskcluster.fromNow('0 minutes');","path":"src/credentials.js","position":59,"original_position":59,"commit_id":"089ca5addd366450c3208f9e97148afc190aa284","original_commit_id":"089ca5addd366450c3208f9e97148afc190aa284","user":{"login":"djmitche","id":28673,"node_id":"MDQ6VXNlcjI4Njcz","avatar_url":"https://avatars3.githubusercontent.com/u/28673?v=4","gravatar_id":"","url":"https://api.github.com/users/djmitche","html_url":"https://github.com/djmitche","followers_url":"https://api.github.com/users/djmitche/followers","following_url":"https://api.github.com/users/djmitche/following{/other_user}","gists_url":"https://api.github.com/users/djmitche/gists{/gist_id}","starred_url":"https://api.github.com/users/djmitche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djmitche/subscriptions","organizations_url":"https://api.github.com/users/djmitche/orgs","repos_url":"https://api.github.com/users/djmitche/repos","events_url":"https://api.github.com/users/djmitche/events{/privacy}","received_events_url":"https://api.github.com/users/djmitche/received_events","type":"User","site_admin":false},"body":"space around `-`","created_at":"2018-07-10T19:34:26Z","updated_at":"2018-07-10T19:55:20Z","html_url":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7#discussion_r201467550","pull_request_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/comments/201467550"},"html":{"href":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7#discussion_r201467550"},"pull_request":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7","id":200175121,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwMTc1MTIx","html_url":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7","diff_url":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7.diff","patch_url":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7.patch","issue_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/7","number":7,"state":"open","locked":false,"title":"Bug 1471316-support getting credentials from tc-pulse","user":{"login":"Biboswan","id":22202556,"node_id":"MDQ6VXNlcjIyMjAyNTU2","avatar_url":"https://avatars2.githubusercontent.com/u/22202556?v=4","gravatar_id":"","url":"https://api.github.com/users/Biboswan","html_url":"https://github.com/Biboswan","followers_url":"https://api.github.com/users/Biboswan/followers","following_url":"https://api.github.com/users/Biboswan/following{/other_user}","gists_url":"https://api.github.com/users/Biboswan/gists{/gist_id}","starred_url":"https://api.github.com/users/Biboswan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Biboswan/subscriptions","organizations_url":"https://api.github.com/users/Biboswan/orgs","repos_url":"https://api.github.com/users/Biboswan/repos","events_url":"https://api.github.com/users/Biboswan/events{/privacy}","received_events_url":"https://api.github.com/users/Biboswan/received_events","type":"User","site_admin":false},"body":"Oh didn't release I was working on main repo. @djmitche have a look. There is some code repeat. Maybe you would like to refactor it.","created_at":"2018-07-09T17:56:33Z","updated_at":"2018-07-10T19:55:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24a7b60ff33deaf42872c792650f2d32098f0da6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7/commits","review_comments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7/comments","review_comment_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/7/comments","statuses_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/statuses/089ca5addd366450c3208f9e97148afc190aa284","head":{"label":"taskcluster:get-pulse-credential","ref":"get-pulse-credential","sha":"089ca5addd366450c3208f9e97148afc190aa284","user":{"login":"taskcluster","id":6257436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTc0MzY=","avatar_url":"https://avatars2.githubusercontent.com/u/6257436?v=4","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":95486819,"node_id":"MDEwOlJlcG9zaXRvcnk5NTQ4NjgxOQ==","name":"taskcluster-lib-pulse","full_name":"taskcluster/taskcluster-lib-pulse","owner":{"login":"taskcluster","id":6257436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTc0MzY=","avatar_url":"https://avatars2.githubusercontent.com/u/6257436?v=4","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/taskcluster-lib-pulse","description":"Library for interacting with Pulse and Taskcluster-Pulse","fork":false,"url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse","forks_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/forks","keys_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/teams","hooks_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/events","assignees_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/tags","blobs_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/languages","stargazers_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/subscription","commits_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/merges","archive_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/downloads","issues_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/deployments","created_at":"2017-06-26T20:30:17Z","updated_at":"2018-06-25T23:09:13Z","pushed_at":"2018-07-10T19:19:28Z","git_url":"git://github.com/taskcluster/taskcluster-lib-pulse.git","ssh_url":"git@github.com:taskcluster/taskcluster-lib-pulse.git","clone_url":"https://github.com/taskcluster/taskcluster-lib-pulse.git","svn_url":"https://github.com/taskcluster/taskcluster-lib-pulse","homepage":"","size":115,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"taskcluster:master","ref":"master","sha":"7909a290f1a99ac3015bbef0d7ea747517358805","user":{"login":"taskcluster","id":6257436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTc0MzY=","avatar_url":"https://avatars2.githubusercontent.com/u/6257436?v=4","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":95486819,"node_id":"MDEwOlJlcG9zaXRvcnk5NTQ4NjgxOQ==","name":"taskcluster-lib-pulse","full_name":"taskcluster/taskcluster-lib-pulse","owner":{"login":"taskcluster","id":6257436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTc0MzY=","avatar_url":"https://avatars2.githubusercontent.com/u/6257436?v=4","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/taskcluster-lib-pulse","description":"Library for interacting with Pulse and Taskcluster-Pulse","fork":false,"url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse","forks_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/forks","keys_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/teams","hooks_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/events","assignees_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/tags","blobs_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/languages","stargazers_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/subscription","commits_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/merges","archive_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/downloads","issues_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/deployments","created_at":"2017-06-26T20:30:17Z","updated_at":"2018-06-25T23:09:13Z","pushed_at":"2018-07-10T19:19:28Z","git_url":"git://github.com/taskcluster/taskcluster-lib-pulse.git","ssh_url":"git@github.com:taskcluster/taskcluster-lib-pulse.git","clone_url":"https://github.com/taskcluster/taskcluster-lib-pulse.git","svn_url":"https://github.com/taskcluster/taskcluster-lib-pulse","homepage":"","size":115,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7"},"html":{"href":"https://github.com/taskcluster/taskcluster-lib-pulse/pull/7"},"issue":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/7"},"comments":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/taskcluster/taskcluster-lib-pulse/statuses/089ca5addd366450c3208f9e97148afc190aa284"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"djmitche"}}