{"action":"created","comment":{"url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments/159104442","pull_request_review_id":86007301,"id":159104442,"diff_hunk":"@@ -0,0 +1,193 @@\n+package cloudnew\n+\n+import (\n+\t\"github.com/aws/aws-sdk-go/aws/credentials\"\n+\t\"github.com/aws/aws-sdk-go/aws/session\"\n+\t\"github.com/aws/aws-sdk-go/service/ec2\"\n+\t\"github.com/evergreen-ci/evergreen/cloud\"\n+\t\"github.com/pkg/errors\"\n+)\n+\n+// AWSClient is a wrapper for aws-sdk-go so we can use a mock in testing.\n+type AWSClient interface {\n+\t// Create a new aws-sdk-client or mock if one does not exist, otherwise no-op.\n+\tCreate(*credentials.Credentials) error\n+\n+\t// RunInstances is a wrapper for ec2.RunInstances.\n+\tRunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error)\n+\n+\t// DescribeInstances is a wrapper for ec2.DescribeInstances.\n+\tDescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)\n+\n+\t// CreateTags is a wrapper for ec2.CreateTags.\n+\tCreateTags(*ec2.CreateTagsInput) error\n+\n+\t// TerminateInstances is a wrapper for ec2.TerminateInstances.\n+\tTerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)\n+\n+\t// RequestSpotInstances is a wrapper for ec2.RequestSpotInstances.\n+\tRequestSpotInstances(*ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error)\n+\n+\t// DescribeSpotInstanceRequests is a wrapper for ec2.DescribeSpotInstanceRequests.\n+\tDescribeSpotInstanceRequests(*ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error)\n+\n+\t// CancelSpotInstanceRequests is a wrapper for ec2.CancelSpotInstanceRequests.\n+\tCancelSpotInstanceRequests(*ec2.CancelSpotInstanceRequestsInput) error\n+}\n+\n+// AWSClientImpl wraps ec2.EC2.\n+type AWSClientImpl struct {\n+\tsession *session.Session\n+\t*ec2.EC2\n+}\n+\n+// Create a new aws-sdk-client if one does not exist, otherwise no-op.\n+func (c *AWSClientImpl) Create(creds *credentials.Credentials) error {\n+\tif creds == nil {\n+\t\treturn errors.New(\"creds must not be nil\")\n+\t}\n+\tif c.session == nil {\n+\t\ts, err := session.NewSession()\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\tc.session = s\n+\t}\n+\tc.EC2 = ec2.New(c.session)\n+\treturn nil\n+}\n+\n+// RunInstances is a wrapper for ec2.RunInstances.\n+func (c *AWSClientImpl) RunInstances(input *ec2.RunInstancesInput) (*ec2.Reservation, error) {\n+\treturn c.EC2.RunInstances(input)\n+}\n+\n+// DescribeInstances is a wrapper for ec2.DescribeInstances\n+func (c *AWSClientImpl) DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) {\n+\treturn c.EC2.DescribeInstances(input)\n+}\n+\n+// CreateTags is a wrapper for ec2.CreateTags.\n+func (c *AWSClientImpl) CreateTags(input *ec2.CreateTagsInput) error {\n+\t_, err := c.EC2.CreateTags(input)\n+\treturn err\n+}\n+\n+// TerminateInstances is a wrapper for ec2.TerminateInstances.\n+func (c *AWSClientImpl) TerminateInstances(input *ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error) {\n+\treturn c.EC2.TerminateInstances(input)\n+}\n+\n+// RequestSpotInstances is a wrapper for ec2.RequestSpotInstances.\n+func (c *AWSClientImpl) RequestSpotInstances(input *ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error) {\n+\treturn c.EC2.RequestSpotInstances(input)\n+}\n+\n+// DescribeSpotInstanceRequests is a wrapper for ec2.DescribeSpotInstanceRequests.\n+func (c *AWSClientImpl) DescribeSpotInstanceRequests(input *ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error) {\n+\treturn c.EC2.DescribeSpotInstanceRequests(input)\n+}\n+\n+// CancelSpotInstanceRequests is a wrapper for ec2.CancelSpotInstanceRequests.\n+func (c *AWSClientImpl) CancelSpotInstanceRequests(input *ec2.CancelSpotInstanceRequestsInput) error {\n+\t_, err := c.EC2.CancelSpotInstanceRequests(input)\n+\treturn err\n+}\n+\n+// AWSClientMock mocks ec2.EC2.\n+type AWSClientMock struct {\n+\t*credentials.Credentials\n+\t*ec2.RunInstancesInput\n+\t*ec2.DescribeInstancesInput\n+\t*ec2.CreateTagsInput\n+\t*ec2.TerminateInstancesInput\n+\t*ec2.RequestSpotInstancesInput\n+\t*ec2.DescribeSpotInstanceRequestsInput\n+\t*ec2.CancelSpotInstanceRequestsInput","path":"cloudnew/ec2_client.go","position":null,"original_position":106,"commit_id":"813bc130a2e5eaf0bd6791c587f94370bc726ed1","original_commit_id":"7647945f7ed18cd039349fc0d6b9904bd0eef1c0","user":{"login":"bsamek","id":624531,"avatar_url":"https://avatars1.githubusercontent.com/u/624531?v=4","gravatar_id":"","url":"https://api.github.com/users/bsamek","html_url":"https://github.com/bsamek","followers_url":"https://api.github.com/users/bsamek/followers","following_url":"https://api.github.com/users/bsamek/following{/other_user}","gists_url":"https://api.github.com/users/bsamek/gists{/gist_id}","starred_url":"https://api.github.com/users/bsamek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsamek/subscriptions","organizations_url":"https://api.github.com/users/bsamek/orgs","repos_url":"https://api.github.com/users/bsamek/repos","events_url":"https://api.github.com/users/bsamek/events{/privacy}","received_events_url":"https://api.github.com/users/bsamek/received_events","type":"User","site_admin":false},"body":"I considered naming these, but leaving them like this makes it easy to find the structs you need. Pointers require that client code does the right dereferencing, or tests would fail.","created_at":"2017-12-29T21:18:47Z","updated_at":"2017-12-29T21:29:06Z","html_url":"https://github.com/evergreen-ci/evergreen/pull/512#discussion_r159104442","pull_request_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments/159104442"},"html":{"href":"https://github.com/evergreen-ci/evergreen/pull/512#discussion_r159104442"},"pull_request":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512"}},"in_reply_to_id":159079486},"pull_request":{"url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512","id":160307050,"html_url":"https://github.com/evergreen-ci/evergreen/pull/512","diff_url":"https://github.com/evergreen-ci/evergreen/pull/512.diff","patch_url":"https://github.com/evergreen-ci/evergreen/pull/512.patch","issue_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/512","number":512,"state":"open","locked":false,"title":"EVG-2412 EVG-2413 Implement ec2 host provider","user":{"login":"bsamek","id":624531,"avatar_url":"https://avatars1.githubusercontent.com/u/624531?v=4","gravatar_id":"","url":"https://api.github.com/users/bsamek","html_url":"https://github.com/bsamek","followers_url":"https://api.github.com/users/bsamek/followers","following_url":"https://api.github.com/users/bsamek/following{/other_user}","gists_url":"https://api.github.com/users/bsamek/gists{/gist_id}","starred_url":"https://api.github.com/users/bsamek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsamek/subscriptions","organizations_url":"https://api.github.com/users/bsamek/orgs","repos_url":"https://api.github.com/users/bsamek/repos","events_url":"https://api.github.com/users/bsamek/events{/privacy}","received_events_url":"https://api.github.com/users/bsamek/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-27T21:51:10Z","updated_at":"2017-12-29T21:29:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"665dad7ab12eb2571ba34b615f4693b155ea9a86","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512/commits","review_comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512/comments","review_comment_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/512/comments","statuses_url":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/813bc130a2e5eaf0bd6791c587f94370bc726ed1","head":{"label":"bsamek:EVG-2412-ec2-on-demand","ref":"EVG-2412-ec2-on-demand","sha":"813bc130a2e5eaf0bd6791c587f94370bc726ed1","user":{"login":"bsamek","id":624531,"avatar_url":"https://avatars1.githubusercontent.com/u/624531?v=4","gravatar_id":"","url":"https://api.github.com/users/bsamek","html_url":"https://github.com/bsamek","followers_url":"https://api.github.com/users/bsamek/followers","following_url":"https://api.github.com/users/bsamek/following{/other_user}","gists_url":"https://api.github.com/users/bsamek/gists{/gist_id}","starred_url":"https://api.github.com/users/bsamek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsamek/subscriptions","organizations_url":"https://api.github.com/users/bsamek/orgs","repos_url":"https://api.github.com/users/bsamek/repos","events_url":"https://api.github.com/users/bsamek/events{/privacy}","received_events_url":"https://api.github.com/users/bsamek/received_events","type":"User","site_admin":false},"repo":{"id":55173348,"name":"evergreen","full_name":"bsamek/evergreen","owner":{"login":"bsamek","id":624531,"avatar_url":"https://avatars1.githubusercontent.com/u/624531?v=4","gravatar_id":"","url":"https://api.github.com/users/bsamek","html_url":"https://github.com/bsamek","followers_url":"https://api.github.com/users/bsamek/followers","following_url":"https://api.github.com/users/bsamek/following{/other_user}","gists_url":"https://api.github.com/users/bsamek/gists{/gist_id}","starred_url":"https://api.github.com/users/bsamek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsamek/subscriptions","organizations_url":"https://api.github.com/users/bsamek/orgs","repos_url":"https://api.github.com/users/bsamek/repos","events_url":"https://api.github.com/users/bsamek/events{/privacy}","received_events_url":"https://api.github.com/users/bsamek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bsamek/evergreen","description":"A Distributed Continuous Integration System from MongoDB","fork":true,"url":"https://api.github.com/repos/bsamek/evergreen","forks_url":"https://api.github.com/repos/bsamek/evergreen/forks","keys_url":"https://api.github.com/repos/bsamek/evergreen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsamek/evergreen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsamek/evergreen/teams","hooks_url":"https://api.github.com/repos/bsamek/evergreen/hooks","issue_events_url":"https://api.github.com/repos/bsamek/evergreen/issues/events{/number}","events_url":"https://api.github.com/repos/bsamek/evergreen/events","assignees_url":"https://api.github.com/repos/bsamek/evergreen/assignees{/user}","branches_url":"https://api.github.com/repos/bsamek/evergreen/branches{/branch}","tags_url":"https://api.github.com/repos/bsamek/evergreen/tags","blobs_url":"https://api.github.com/repos/bsamek/evergreen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsamek/evergreen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsamek/evergreen/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsamek/evergreen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsamek/evergreen/statuses/{sha}","languages_url":"https://api.github.com/repos/bsamek/evergreen/languages","stargazers_url":"https://api.github.com/repos/bsamek/evergreen/stargazers","contributors_url":"https://api.github.com/repos/bsamek/evergreen/contributors","subscribers_url":"https://api.github.com/repos/bsamek/evergreen/subscribers","subscription_url":"https://api.github.com/repos/bsamek/evergreen/subscription","commits_url":"https://api.github.com/repos/bsamek/evergreen/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsamek/evergreen/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsamek/evergreen/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsamek/evergreen/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsamek/evergreen/contents/{+path}","compare_url":"https://api.github.com/repos/bsamek/evergreen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsamek/evergreen/merges","archive_url":"https://api.github.com/repos/bsamek/evergreen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsamek/evergreen/downloads","issues_url":"https://api.github.com/repos/bsamek/evergreen/issues{/number}","pulls_url":"https://api.github.com/repos/bsamek/evergreen/pulls{/number}","milestones_url":"https://api.github.com/repos/bsamek/evergreen/milestones{/number}","notifications_url":"https://api.github.com/repos/bsamek/evergreen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsamek/evergreen/labels{/name}","releases_url":"https://api.github.com/repos/bsamek/evergreen/releases{/id}","deployments_url":"https://api.github.com/repos/bsamek/evergreen/deployments","created_at":"2016-03-31T18:23:29Z","updated_at":"2016-03-31T18:23:31Z","pushed_at":"2017-12-29T21:28:43Z","git_url":"git://github.com/bsamek/evergreen.git","ssh_url":"git@github.com:bsamek/evergreen.git","clone_url":"https://github.com/bsamek/evergreen.git","svn_url":"https://github.com/bsamek/evergreen","homepage":"http://evergreen.mongodb.com","size":46202,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"evergreen-ci:master","ref":"master","sha":"28f4c441e03a0267d1ea098cde54f444b3c391de","user":{"login":"evergreen-ci","id":10089490,"avatar_url":"https://avatars3.githubusercontent.com/u/10089490?v=4","gravatar_id":"","url":"https://api.github.com/users/evergreen-ci","html_url":"https://github.com/evergreen-ci","followers_url":"https://api.github.com/users/evergreen-ci/followers","following_url":"https://api.github.com/users/evergreen-ci/following{/other_user}","gists_url":"https://api.github.com/users/evergreen-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/evergreen-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evergreen-ci/subscriptions","organizations_url":"https://api.github.com/users/evergreen-ci/orgs","repos_url":"https://api.github.com/users/evergreen-ci/repos","events_url":"https://api.github.com/users/evergreen-ci/events{/privacy}","received_events_url":"https://api.github.com/users/evergreen-ci/received_events","type":"Organization","site_admin":false},"repo":{"id":36385798,"name":"evergreen","full_name":"evergreen-ci/evergreen","owner":{"login":"evergreen-ci","id":10089490,"avatar_url":"https://avatars3.githubusercontent.com/u/10089490?v=4","gravatar_id":"","url":"https://api.github.com/users/evergreen-ci","html_url":"https://github.com/evergreen-ci","followers_url":"https://api.github.com/users/evergreen-ci/followers","following_url":"https://api.github.com/users/evergreen-ci/following{/other_user}","gists_url":"https://api.github.com/users/evergreen-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/evergreen-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evergreen-ci/subscriptions","organizations_url":"https://api.github.com/users/evergreen-ci/orgs","repos_url":"https://api.github.com/users/evergreen-ci/repos","events_url":"https://api.github.com/users/evergreen-ci/events{/privacy}","received_events_url":"https://api.github.com/users/evergreen-ci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/evergreen-ci/evergreen","description":"A Distributed Continuous Integration System from MongoDB","fork":false,"url":"https://api.github.com/repos/evergreen-ci/evergreen","forks_url":"https://api.github.com/repos/evergreen-ci/evergreen/forks","keys_url":"https://api.github.com/repos/evergreen-ci/evergreen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evergreen-ci/evergreen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evergreen-ci/evergreen/teams","hooks_url":"https://api.github.com/repos/evergreen-ci/evergreen/hooks","issue_events_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/events{/number}","events_url":"https://api.github.com/repos/evergreen-ci/evergreen/events","assignees_url":"https://api.github.com/repos/evergreen-ci/evergreen/assignees{/user}","branches_url":"https://api.github.com/repos/evergreen-ci/evergreen/branches{/branch}","tags_url":"https://api.github.com/repos/evergreen-ci/evergreen/tags","blobs_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/refs{/sha}","trees_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/{sha}","languages_url":"https://api.github.com/repos/evergreen-ci/evergreen/languages","stargazers_url":"https://api.github.com/repos/evergreen-ci/evergreen/stargazers","contributors_url":"https://api.github.com/repos/evergreen-ci/evergreen/contributors","subscribers_url":"https://api.github.com/repos/evergreen-ci/evergreen/subscribers","subscription_url":"https://api.github.com/repos/evergreen-ci/evergreen/subscription","commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/commits{/sha}","git_commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/commits{/sha}","comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/comments{/number}","issue_comment_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/comments{/number}","contents_url":"https://api.github.com/repos/evergreen-ci/evergreen/contents/{+path}","compare_url":"https://api.github.com/repos/evergreen-ci/evergreen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evergreen-ci/evergreen/merges","archive_url":"https://api.github.com/repos/evergreen-ci/evergreen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evergreen-ci/evergreen/downloads","issues_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues{/number}","pulls_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls{/number}","milestones_url":"https://api.github.com/repos/evergreen-ci/evergreen/milestones{/number}","notifications_url":"https://api.github.com/repos/evergreen-ci/evergreen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evergreen-ci/evergreen/labels{/name}","releases_url":"https://api.github.com/repos/evergreen-ci/evergreen/releases{/id}","deployments_url":"https://api.github.com/repos/evergreen-ci/evergreen/deployments","created_at":"2015-05-27T18:03:09Z","updated_at":"2017-12-21T03:01:00Z","pushed_at":"2017-12-29T21:28:50Z","git_url":"git://github.com/evergreen-ci/evergreen.git","ssh_url":"git@github.com:evergreen-ci/evergreen.git","clone_url":"https://github.com/evergreen-ci/evergreen.git","svn_url":"https://github.com/evergreen-ci/evergreen","homepage":"http://evergreen.mongodb.com","size":46187,"stargazers_count":148,"watchers_count":148,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":40,"open_issues":4,"watchers":148,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512"},"html":{"href":"https://github.com/evergreen-ci/evergreen/pull/512"},"issue":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/issues/512"},"comments":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/issues/512/comments"},"review_comments":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512/comments"},"review_comment":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/512/commits"},"statuses":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/813bc130a2e5eaf0bd6791c587f94370bc726ed1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bsamek"}}