{"action":"opened","number":45,"pull_request":{"url":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45","id":155264102,"html_url":"https://github.com/taskcluster/ec2-manager/pull/45","diff_url":"https://github.com/taskcluster/ec2-manager/pull/45.diff","patch_url":"https://github.com/taskcluster/ec2-manager/pull/45.patch","issue_url":"https://api.github.com/repos/taskcluster/ec2-manager/issues/45","number":45,"state":"open","locked":false,"title":"Store the EBS totals in Postgres and fetch these totals in an API call","user":{"login":"SamanthaYu","id":10355013,"avatar_url":"https://avatars2.githubusercontent.com/u/10355013?v=4","gravatar_id":"","url":"https://api.github.com/users/SamanthaYu","html_url":"https://github.com/SamanthaYu","followers_url":"https://api.github.com/users/SamanthaYu/followers","following_url":"https://api.github.com/users/SamanthaYu/following{/other_user}","gists_url":"https://api.github.com/users/SamanthaYu/gists{/gist_id}","starred_url":"https://api.github.com/users/SamanthaYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamanthaYu/subscriptions","organizations_url":"https://api.github.com/users/SamanthaYu/orgs","repos_url":"https://api.github.com/users/SamanthaYu/repos","events_url":"https://api.github.com/users/SamanthaYu/events{/privacy}","received_events_url":"https://api.github.com/users/SamanthaYu/received_events","type":"User","site_admin":false},"body":"## Store the EBS totals in Postgres\r\nWe decided to store the EBS totals in Postgres. In the table `ebsusage`, the columns are `region`, `volumetype`, `state`, `totalcount`, `totalgb`, and `touched` with the primary key a combination of `region`, `volumetype`, and `state`. When `reportEbsUsage()` gets called, it inserts the totals into their respective columns. If there's already an existing record with that primary key, then that record's `totalcount` and `totalgb` gets replaced with the reported `totalcount` and `totalgb` respectively, and `touched` is set to the current timestamp.\r\n\r\n## Fetch these totals in an API call\r\nThe internal API call, `ebsUsage()`, returns the entire `ebsusage` table. In other words, it returns a list of objects in the form:\r\n```\r\n{\r\n   region: string,\r\n   volumetype: string,\r\n   state: string,\r\n   totalcount: string,\r\n   totalgb: string,\r\n   touched: timestamp,\r\n}\r\n```\r\n\r\n## Updated documentation for AMI API call\r\nBecause the API calls for EBS usage and AMI usage are similar, I updated the AMI API call's for consistency with the EBS API call and for clarity of what values get returned:\r\n```\r\n/**\r\n * List AMIs and their usage by returning a list of objects in the form:\r\n * {\r\n *   region: string,\r\n *   volumetype: string,\r\n *   lastused: timestamp,\r\n * }\r\n */\r\n```\r\n@rafvasq and @auni53 What do you think? Is this comment accurate?\r\n\r\n## Other comments\r\n@rstiyer and I decided to combine our two parts into this PR. Since @rstiyer worked on the database side and I worked on the EBS API call, the tests for each of our parts would rely on each other so it would be hard to separate them completely.\r\n\r\n@djmitche and @imbstack Can you review this PR when you get the chance? Note that @rstiyer will still be adding tests for the database.","created_at":"2017-11-29T07:06:09Z","updated_at":"2017-11-29T07:06:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45/commits","review_comments_url":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45/comments","review_comment_url":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskcluster/ec2-manager/issues/45/comments","statuses_url":"https://api.github.com/repos/taskcluster/ec2-manager/statuses/da3997fce92b2fb528dff92c23a83135c88e7e1b","head":{"label":"rstiyer:volumes-db-api","ref":"volumes-db-api","sha":"da3997fce92b2fb528dff92c23a83135c88e7e1b","user":{"login":"rstiyer","id":9583081,"avatar_url":"https://avatars0.githubusercontent.com/u/9583081?v=4","gravatar_id":"","url":"https://api.github.com/users/rstiyer","html_url":"https://github.com/rstiyer","followers_url":"https://api.github.com/users/rstiyer/followers","following_url":"https://api.github.com/users/rstiyer/following{/other_user}","gists_url":"https://api.github.com/users/rstiyer/gists{/gist_id}","starred_url":"https://api.github.com/users/rstiyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstiyer/subscriptions","organizations_url":"https://api.github.com/users/rstiyer/orgs","repos_url":"https://api.github.com/users/rstiyer/repos","events_url":"https://api.github.com/users/rstiyer/events{/privacy}","received_events_url":"https://api.github.com/users/rstiyer/received_events","type":"User","site_admin":false},"repo":{"id":104153469,"name":"ec2-manager","full_name":"rstiyer/ec2-manager","owner":{"login":"rstiyer","id":9583081,"avatar_url":"https://avatars0.githubusercontent.com/u/9583081?v=4","gravatar_id":"","url":"https://api.github.com/users/rstiyer","html_url":"https://github.com/rstiyer","followers_url":"https://api.github.com/users/rstiyer/followers","following_url":"https://api.github.com/users/rstiyer/following{/other_user}","gists_url":"https://api.github.com/users/rstiyer/gists{/gist_id}","starred_url":"https://api.github.com/users/rstiyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstiyer/subscriptions","organizations_url":"https://api.github.com/users/rstiyer/orgs","repos_url":"https://api.github.com/users/rstiyer/repos","events_url":"https://api.github.com/users/rstiyer/events{/privacy}","received_events_url":"https://api.github.com/users/rstiyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rstiyer/ec2-manager","description":null,"fork":true,"url":"https://api.github.com/repos/rstiyer/ec2-manager","forks_url":"https://api.github.com/repos/rstiyer/ec2-manager/forks","keys_url":"https://api.github.com/repos/rstiyer/ec2-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstiyer/ec2-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstiyer/ec2-manager/teams","hooks_url":"https://api.github.com/repos/rstiyer/ec2-manager/hooks","issue_events_url":"https://api.github.com/repos/rstiyer/ec2-manager/issues/events{/number}","events_url":"https://api.github.com/repos/rstiyer/ec2-manager/events","assignees_url":"https://api.github.com/repos/rstiyer/ec2-manager/assignees{/user}","branches_url":"https://api.github.com/repos/rstiyer/ec2-manager/branches{/branch}","tags_url":"https://api.github.com/repos/rstiyer/ec2-manager/tags","blobs_url":"https://api.github.com/repos/rstiyer/ec2-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstiyer/ec2-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstiyer/ec2-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstiyer/ec2-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstiyer/ec2-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/rstiyer/ec2-manager/languages","stargazers_url":"https://api.github.com/repos/rstiyer/ec2-manager/stargazers","contributors_url":"https://api.github.com/repos/rstiyer/ec2-manager/contributors","subscribers_url":"https://api.github.com/repos/rstiyer/ec2-manager/subscribers","subscription_url":"https://api.github.com/repos/rstiyer/ec2-manager/subscription","commits_url":"https://api.github.com/repos/rstiyer/ec2-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstiyer/ec2-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstiyer/ec2-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstiyer/ec2-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstiyer/ec2-manager/contents/{+path}","compare_url":"https://api.github.com/repos/rstiyer/ec2-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstiyer/ec2-manager/merges","archive_url":"https://api.github.com/repos/rstiyer/ec2-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstiyer/ec2-manager/downloads","issues_url":"https://api.github.com/repos/rstiyer/ec2-manager/issues{/number}","pulls_url":"https://api.github.com/repos/rstiyer/ec2-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/rstiyer/ec2-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/rstiyer/ec2-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstiyer/ec2-manager/labels{/name}","releases_url":"https://api.github.com/repos/rstiyer/ec2-manager/releases{/id}","deployments_url":"https://api.github.com/repos/rstiyer/ec2-manager/deployments","created_at":"2017-09-20T02:11:10Z","updated_at":"2017-09-22T21:04:46Z","pushed_at":"2017-11-29T06:40:28Z","git_url":"git://github.com/rstiyer/ec2-manager.git","ssh_url":"git@github.com:rstiyer/ec2-manager.git","clone_url":"https://github.com/rstiyer/ec2-manager.git","svn_url":"https://github.com/rstiyer/ec2-manager","homepage":null,"size":300,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"taskcluster:master","ref":"master","sha":"e2f57448cb6dea1da4074b802e110b153f42c970","user":{"login":"taskcluster","id":6257436,"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":89593937,"name":"ec2-manager","full_name":"taskcluster/ec2-manager","owner":{"login":"taskcluster","id":6257436,"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/ec2-manager","description":null,"fork":false,"url":"https://api.github.com/repos/taskcluster/ec2-manager","forks_url":"https://api.github.com/repos/taskcluster/ec2-manager/forks","keys_url":"https://api.github.com/repos/taskcluster/ec2-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/ec2-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/ec2-manager/teams","hooks_url":"https://api.github.com/repos/taskcluster/ec2-manager/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/ec2-manager/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/ec2-manager/events","assignees_url":"https://api.github.com/repos/taskcluster/ec2-manager/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/ec2-manager/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/ec2-manager/tags","blobs_url":"https://api.github.com/repos/taskcluster/ec2-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/ec2-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/ec2-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/ec2-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/ec2-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/ec2-manager/languages","stargazers_url":"https://api.github.com/repos/taskcluster/ec2-manager/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/ec2-manager/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/ec2-manager/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/ec2-manager/subscription","commits_url":"https://api.github.com/repos/taskcluster/ec2-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/ec2-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/ec2-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/ec2-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/ec2-manager/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/ec2-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/ec2-manager/merges","archive_url":"https://api.github.com/repos/taskcluster/ec2-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/ec2-manager/downloads","issues_url":"https://api.github.com/repos/taskcluster/ec2-manager/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/ec2-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/ec2-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/ec2-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/ec2-manager/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/ec2-manager/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/ec2-manager/deployments","created_at":"2017-04-27T12:16:36Z","updated_at":"2017-10-04T19:05:53Z","pushed_at":"2017-11-28T18:06:23Z","git_url":"git://github.com/taskcluster/ec2-manager.git","ssh_url":"git@github.com:taskcluster/ec2-manager.git","clone_url":"https://github.com/taskcluster/ec2-manager.git","svn_url":"https://github.com/taskcluster/ec2-manager","homepage":null,"size":261,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":17,"license":null,"forks":6,"open_issues":17,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45"},"html":{"href":"https://github.com/taskcluster/ec2-manager/pull/45"},"issue":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/issues/45"},"comments":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/taskcluster/ec2-manager/statuses/da3997fce92b2fb528dff92c23a83135c88e7e1b"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":20,"additions":143,"deletions":17,"changed_files":8}}
{"actor":{"display_login":"SamanthaYu"}}