{"action":"created","comment":{"url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/comments/207594213","pull_request_review_id":143243156,"id":207594213,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzU5NDIxMw==","diff_hunk":"@@ -0,0 +1,53 @@\n+\n+import json\n+\n+import boto3\n+from botocore.exceptions import ClientError\n+\n+\n+SECRETS_MANAGER_URL = \"https://secretsmanager.us-west-2.amazonaws.com\"\n+SECRET_KEY = 'email'\n+\n+\n+class SecretManagerException(Exception):\n+    pass\n+\n+\n+class Bouncer(object):\n+    \"\"\"\n+    Client convenience class to perform email whitelist authorization\n+    \"\"\"\n+    session = boto3.session.Session()\n+    client = session.client(service_name='secretsmanager', endpoint_url=SECRETS_MANAGER_URL)\n+\n+    def __init__(self, secret_name: str):\n+        \"\"\"\n+        :param secret_name: The name of the secret in\n+        the AWS Secret Manager. For example: commons/dev/whitelist\n+        \"\"\"\n+        self.secret_name = secret_name\n+\n+    def is_authorized(self, email: str) -> bool:\n+        \"\"\"\n+        Identify if the given email address is included in the email whitelist.\n+\n+        :param email: Google email address for which authorization is to be determined\n+        :return: True if the email address is authorized, False if not authorized\n+        :exception: <TBD> If an error occurs.","path":"bouncer/bouncer.py","position":36,"original_position":36,"commit_id":"5dd39f1d5cf1864eab481f697cda293fb5ec93b2","original_commit_id":"5dd39f1d5cf1864eab481f697cda293fb5ec93b2","user":{"login":"mikebaumann","id":24831692,"node_id":"MDQ6VXNlcjI0ODMxNjky","avatar_url":"https://avatars0.githubusercontent.com/u/24831692?v=4","gravatar_id":"","url":"https://api.github.com/users/mikebaumann","html_url":"https://github.com/mikebaumann","followers_url":"https://api.github.com/users/mikebaumann/followers","following_url":"https://api.github.com/users/mikebaumann/following{/other_user}","gists_url":"https://api.github.com/users/mikebaumann/gists{/gist_id}","starred_url":"https://api.github.com/users/mikebaumann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikebaumann/subscriptions","organizations_url":"https://api.github.com/users/mikebaumann/orgs","repos_url":"https://api.github.com/users/mikebaumann/repos","events_url":"https://api.github.com/users/mikebaumann/events{/privacy}","received_events_url":"https://api.github.com/users/mikebaumann/received_events","type":"User","site_admin":false},"body":"Please replace `<TBD>` with `SecretManagerException`\r\n\r\nPlease also add any other specific exceptions you are aware of that may occur, such as a KeyError if the \"email\" key is not defined in the secret.","created_at":"2018-08-03T16:07:53Z","updated_at":"2018-08-03T16:32:55Z","html_url":"https://github.com/ucsc-cgp/bouncer/pull/1#discussion_r207594213","pull_request_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/comments/207594213"},"html":{"href":"https://github.com/ucsc-cgp/bouncer/pull/1#discussion_r207594213"},"pull_request":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1","id":205879896,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1ODc5ODk2","html_url":"https://github.com/ucsc-cgp/bouncer/pull/1","diff_url":"https://github.com/ucsc-cgp/bouncer/pull/1.diff","patch_url":"https://github.com/ucsc-cgp/bouncer/pull/1.patch","issue_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/1","number":1,"state":"open","locked":false,"title":"Initial version","user":{"login":"jessebrennan","id":10734740,"node_id":"MDQ6VXNlcjEwNzM0NzQw","avatar_url":"https://avatars1.githubusercontent.com/u/10734740?v=4","gravatar_id":"","url":"https://api.github.com/users/jessebrennan","html_url":"https://github.com/jessebrennan","followers_url":"https://api.github.com/users/jessebrennan/followers","following_url":"https://api.github.com/users/jessebrennan/following{/other_user}","gists_url":"https://api.github.com/users/jessebrennan/gists{/gist_id}","starred_url":"https://api.github.com/users/jessebrennan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessebrennan/subscriptions","organizations_url":"https://api.github.com/users/jessebrennan/orgs","repos_url":"https://api.github.com/users/jessebrennan/repos","events_url":"https://api.github.com/users/jessebrennan/events{/privacy}","received_events_url":"https://api.github.com/users/jessebrennan/received_events","type":"User","site_admin":false},"body":"Write make the whitelist checker!\r\n\r\nThis is released on PyPI currently and should be functional.\r\n\r\nTravis is set up with minimal tests.","created_at":"2018-08-02T22:34:12Z","updated_at":"2018-08-03T16:32:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07597e82a9cb1a64e9ba331039b9186c6fd1d6fd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/1/comments","statuses_url":"https://api.github.com/repos/ucsc-cgp/bouncer/statuses/5dd39f1d5cf1864eab481f697cda293fb5ec93b2","head":{"label":"ucsc-cgp:initial-version","ref":"initial-version","sha":"5dd39f1d5cf1864eab481f697cda293fb5ec93b2","user":{"login":"ucsc-cgp","id":28362750,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MzYyNzUw","avatar_url":"https://avatars3.githubusercontent.com/u/28362750?v=4","gravatar_id":"","url":"https://api.github.com/users/ucsc-cgp","html_url":"https://github.com/ucsc-cgp","followers_url":"https://api.github.com/users/ucsc-cgp/followers","following_url":"https://api.github.com/users/ucsc-cgp/following{/other_user}","gists_url":"https://api.github.com/users/ucsc-cgp/gists{/gist_id}","starred_url":"https://api.github.com/users/ucsc-cgp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucsc-cgp/subscriptions","organizations_url":"https://api.github.com/users/ucsc-cgp/orgs","repos_url":"https://api.github.com/users/ucsc-cgp/repos","events_url":"https://api.github.com/users/ucsc-cgp/events{/privacy}","received_events_url":"https://api.github.com/users/ucsc-cgp/received_events","type":"Organization","site_admin":false},"repo":{"id":143072052,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNzIwNTI=","name":"bouncer","full_name":"ucsc-cgp/bouncer","owner":{"login":"ucsc-cgp","id":28362750,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MzYyNzUw","avatar_url":"https://avatars3.githubusercontent.com/u/28362750?v=4","gravatar_id":"","url":"https://api.github.com/users/ucsc-cgp","html_url":"https://github.com/ucsc-cgp","followers_url":"https://api.github.com/users/ucsc-cgp/followers","following_url":"https://api.github.com/users/ucsc-cgp/following{/other_user}","gists_url":"https://api.github.com/users/ucsc-cgp/gists{/gist_id}","starred_url":"https://api.github.com/users/ucsc-cgp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucsc-cgp/subscriptions","organizations_url":"https://api.github.com/users/ucsc-cgp/orgs","repos_url":"https://api.github.com/users/ucsc-cgp/repos","events_url":"https://api.github.com/users/ucsc-cgp/events{/privacy}","received_events_url":"https://api.github.com/users/ucsc-cgp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ucsc-cgp/bouncer","description":"The whitelist checker for authentication with CGP HCA Data Store","fork":false,"url":"https://api.github.com/repos/ucsc-cgp/bouncer","forks_url":"https://api.github.com/repos/ucsc-cgp/bouncer/forks","keys_url":"https://api.github.com/repos/ucsc-cgp/bouncer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ucsc-cgp/bouncer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ucsc-cgp/bouncer/teams","hooks_url":"https://api.github.com/repos/ucsc-cgp/bouncer/hooks","issue_events_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/events{/number}","events_url":"https://api.github.com/repos/ucsc-cgp/bouncer/events","assignees_url":"https://api.github.com/repos/ucsc-cgp/bouncer/assignees{/user}","branches_url":"https://api.github.com/repos/ucsc-cgp/bouncer/branches{/branch}","tags_url":"https://api.github.com/repos/ucsc-cgp/bouncer/tags","blobs_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ucsc-cgp/bouncer/statuses/{sha}","languages_url":"https://api.github.com/repos/ucsc-cgp/bouncer/languages","stargazers_url":"https://api.github.com/repos/ucsc-cgp/bouncer/stargazers","contributors_url":"https://api.github.com/repos/ucsc-cgp/bouncer/contributors","subscribers_url":"https://api.github.com/repos/ucsc-cgp/bouncer/subscribers","subscription_url":"https://api.github.com/repos/ucsc-cgp/bouncer/subscription","commits_url":"https://api.github.com/repos/ucsc-cgp/bouncer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ucsc-cgp/bouncer/contents/{+path}","compare_url":"https://api.github.com/repos/ucsc-cgp/bouncer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ucsc-cgp/bouncer/merges","archive_url":"https://api.github.com/repos/ucsc-cgp/bouncer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ucsc-cgp/bouncer/downloads","issues_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues{/number}","pulls_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls{/number}","milestones_url":"https://api.github.com/repos/ucsc-cgp/bouncer/milestones{/number}","notifications_url":"https://api.github.com/repos/ucsc-cgp/bouncer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ucsc-cgp/bouncer/labels{/name}","releases_url":"https://api.github.com/repos/ucsc-cgp/bouncer/releases{/id}","deployments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/deployments","created_at":"2018-07-31T21:28:16Z","updated_at":"2018-07-31T21:28:18Z","pushed_at":"2018-08-02T22:34:13Z","git_url":"git://github.com/ucsc-cgp/bouncer.git","ssh_url":"git@github.com:ucsc-cgp/bouncer.git","clone_url":"https://github.com/ucsc-cgp/bouncer.git","svn_url":"https://github.com/ucsc-cgp/bouncer","homepage":null,"size":11,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ucsc-cgp:master","ref":"master","sha":"86f18e08326da6810ec36129e12eedea00d59eae","user":{"login":"ucsc-cgp","id":28362750,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MzYyNzUw","avatar_url":"https://avatars3.githubusercontent.com/u/28362750?v=4","gravatar_id":"","url":"https://api.github.com/users/ucsc-cgp","html_url":"https://github.com/ucsc-cgp","followers_url":"https://api.github.com/users/ucsc-cgp/followers","following_url":"https://api.github.com/users/ucsc-cgp/following{/other_user}","gists_url":"https://api.github.com/users/ucsc-cgp/gists{/gist_id}","starred_url":"https://api.github.com/users/ucsc-cgp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucsc-cgp/subscriptions","organizations_url":"https://api.github.com/users/ucsc-cgp/orgs","repos_url":"https://api.github.com/users/ucsc-cgp/repos","events_url":"https://api.github.com/users/ucsc-cgp/events{/privacy}","received_events_url":"https://api.github.com/users/ucsc-cgp/received_events","type":"Organization","site_admin":false},"repo":{"id":143072052,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNzIwNTI=","name":"bouncer","full_name":"ucsc-cgp/bouncer","owner":{"login":"ucsc-cgp","id":28362750,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MzYyNzUw","avatar_url":"https://avatars3.githubusercontent.com/u/28362750?v=4","gravatar_id":"","url":"https://api.github.com/users/ucsc-cgp","html_url":"https://github.com/ucsc-cgp","followers_url":"https://api.github.com/users/ucsc-cgp/followers","following_url":"https://api.github.com/users/ucsc-cgp/following{/other_user}","gists_url":"https://api.github.com/users/ucsc-cgp/gists{/gist_id}","starred_url":"https://api.github.com/users/ucsc-cgp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucsc-cgp/subscriptions","organizations_url":"https://api.github.com/users/ucsc-cgp/orgs","repos_url":"https://api.github.com/users/ucsc-cgp/repos","events_url":"https://api.github.com/users/ucsc-cgp/events{/privacy}","received_events_url":"https://api.github.com/users/ucsc-cgp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ucsc-cgp/bouncer","description":"The whitelist checker for authentication with CGP HCA Data Store","fork":false,"url":"https://api.github.com/repos/ucsc-cgp/bouncer","forks_url":"https://api.github.com/repos/ucsc-cgp/bouncer/forks","keys_url":"https://api.github.com/repos/ucsc-cgp/bouncer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ucsc-cgp/bouncer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ucsc-cgp/bouncer/teams","hooks_url":"https://api.github.com/repos/ucsc-cgp/bouncer/hooks","issue_events_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/events{/number}","events_url":"https://api.github.com/repos/ucsc-cgp/bouncer/events","assignees_url":"https://api.github.com/repos/ucsc-cgp/bouncer/assignees{/user}","branches_url":"https://api.github.com/repos/ucsc-cgp/bouncer/branches{/branch}","tags_url":"https://api.github.com/repos/ucsc-cgp/bouncer/tags","blobs_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ucsc-cgp/bouncer/statuses/{sha}","languages_url":"https://api.github.com/repos/ucsc-cgp/bouncer/languages","stargazers_url":"https://api.github.com/repos/ucsc-cgp/bouncer/stargazers","contributors_url":"https://api.github.com/repos/ucsc-cgp/bouncer/contributors","subscribers_url":"https://api.github.com/repos/ucsc-cgp/bouncer/subscribers","subscription_url":"https://api.github.com/repos/ucsc-cgp/bouncer/subscription","commits_url":"https://api.github.com/repos/ucsc-cgp/bouncer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ucsc-cgp/bouncer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ucsc-cgp/bouncer/contents/{+path}","compare_url":"https://api.github.com/repos/ucsc-cgp/bouncer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ucsc-cgp/bouncer/merges","archive_url":"https://api.github.com/repos/ucsc-cgp/bouncer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ucsc-cgp/bouncer/downloads","issues_url":"https://api.github.com/repos/ucsc-cgp/bouncer/issues{/number}","pulls_url":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls{/number}","milestones_url":"https://api.github.com/repos/ucsc-cgp/bouncer/milestones{/number}","notifications_url":"https://api.github.com/repos/ucsc-cgp/bouncer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ucsc-cgp/bouncer/labels{/name}","releases_url":"https://api.github.com/repos/ucsc-cgp/bouncer/releases{/id}","deployments_url":"https://api.github.com/repos/ucsc-cgp/bouncer/deployments","created_at":"2018-07-31T21:28:16Z","updated_at":"2018-07-31T21:28:18Z","pushed_at":"2018-08-02T22:34:13Z","git_url":"git://github.com/ucsc-cgp/bouncer.git","ssh_url":"git@github.com:ucsc-cgp/bouncer.git","clone_url":"https://github.com/ucsc-cgp/bouncer.git","svn_url":"https://github.com/ucsc-cgp/bouncer","homepage":null,"size":11,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1"},"html":{"href":"https://github.com/ucsc-cgp/bouncer/pull/1"},"issue":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/1"},"comments":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ucsc-cgp/bouncer/statuses/5dd39f1d5cf1864eab481f697cda293fb5ec93b2"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mikebaumann"}}