{"action":"created","comment":{"url":"https://api.github.com/repos/upfluence/dns-presence/pulls/comments/82727134","pull_request_review_id":3613610,"id":82727134,"diff_hunk":"@@ -0,0 +1,80 @@\n+package route53\n+\n+import (\n+\t\"strings\"\n+\n+\tgoamz_route53 \"github.com/upfluence/goamz/route53\"\n+\n+\t\"github.com/upfluence/dns-presence/dns\"\n+)\n+\n+type route53 struct {\n+\tclient *goamz_route53.Route53\n+}\n+\n+func NewRoute53DnsManager(client *goamz_route53.Route53) dns.Manager {\n+\treturn &route53{\n+\t\tclient: client,\n+\t}\n+}\n+\n+func (r *route53) UpdateEntries(domains []string, config *dns.Configuration) error {\n+\tchanges, err := r.evaluateChanges(domains, config)\n+\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\treturn r.applyChanges(changes)\n+}\n+\n+func (r *route53) applyChanges(changes map[string][]goamz_route53.Change) error {\n+\tfor zone, set := range changes {\n+\t\t_, err := r.client.ChangeResourceRecordSets(\n+\t\t\tzone,\n+\t\t\t&goamz_route53.ChangeResourceRecordSetsRequest{\n+\t\t\t\tComment: \"\",\n+\t\t\t\tChanges: set,\n+\t\t\t},\n+\t\t)\n+\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t}\n+\treturn nil\n+}\n+\n+func (r *route53) evaluateChanges(domains []string, config *dns.Configuration) (map[string][]goamz_route53.Change, error) {\n+\n+\tzoneList, err := r.client.ListHostedZones(\"\", 0)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tchanges := map[string][]goamz_route53.Change{}\n+\n+\tfor _, zone := range zoneList.HostedZones {\n+\t\tfor _, domain := range domains {\n+\t\t\tif strings.HasSuffix(domain, zone.Name) {\n+\t\t\t\tchanges[zone.ID] = append(\n+\t\t\t\t\tchanges[zone.ID],\n+\t\t\t\t\tgoamz_route53.Change{\n+\t\t\t\t\t\tAction: \"UPSERT\",\n+\t\t\t\t\t\tRecord: goamz_route53.ResourceRecordSet{","path":"dns/route53/manager.go","position":64,"original_position":64,"commit_id":"7183d0bf402864f5aa215903a180050a57cc37ef","original_commit_id":"7183d0bf402864f5aa215903a180050a57cc37ef","user":{"login":"AlexisMontagne","id":1418979,"avatar_url":"https://avatars.githubusercontent.com/u/1418979?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexisMontagne","html_url":"https://github.com/AlexisMontagne","followers_url":"https://api.github.com/users/AlexisMontagne/followers","following_url":"https://api.github.com/users/AlexisMontagne/following{/other_user}","gists_url":"https://api.github.com/users/AlexisMontagne/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexisMontagne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexisMontagne/subscriptions","organizations_url":"https://api.github.com/users/AlexisMontagne/orgs","repos_url":"https://api.github.com/users/AlexisMontagne/repos","events_url":"https://api.github.com/users/AlexisMontagne/events{/privacy}","received_events_url":"https://api.github.com/users/AlexisMontagne/received_events","type":"User","site_admin":false},"body":"you should extract this struct instanciation in a separate method","created_at":"2016-10-11T05:40:30Z","updated_at":"2016-10-11T05:48:23Z","html_url":"https://github.com/upfluence/dns-presence/pull/1#discussion_r82727134","pull_request_url":"https://api.github.com/repos/upfluence/dns-presence/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/comments/82727134"},"html":{"href":"https://github.com/upfluence/dns-presence/pull/1#discussion_r82727134"},"pull_request":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/upfluence/dns-presence/pulls/1","id":45243107,"html_url":"https://github.com/upfluence/dns-presence/pull/1","diff_url":"https://github.com/upfluence/dns-presence/pull/1.diff","patch_url":"https://github.com/upfluence/dns-presence/pull/1.patch","issue_url":"https://api.github.com/repos/upfluence/dns-presence/issues/1","number":1,"state":"open","locked":false,"title":"Use Route53 HealthCheck engine","user":{"login":"AlexisMontagne","id":1418979,"avatar_url":"https://avatars.githubusercontent.com/u/1418979?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexisMontagne","html_url":"https://github.com/AlexisMontagne","followers_url":"https://api.github.com/users/AlexisMontagne/followers","following_url":"https://api.github.com/users/AlexisMontagne/following{/other_user}","gists_url":"https://api.github.com/users/AlexisMontagne/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexisMontagne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexisMontagne/subscriptions","organizations_url":"https://api.github.com/users/AlexisMontagne/orgs","repos_url":"https://api.github.com/users/AlexisMontagne/repos","events_url":"https://api.github.com/users/AlexisMontagne/events{/privacy}","received_events_url":"https://api.github.com/users/AlexisMontagne/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-09-17T01:27:51Z","updated_at":"2016-10-11T05:48:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e309087c70dc741e25cc350ea203b49179b387d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/upfluence/dns-presence/pulls/1/commits","review_comments_url":"https://api.github.com/repos/upfluence/dns-presence/pulls/1/comments","review_comment_url":"https://api.github.com/repos/upfluence/dns-presence/pulls/comments{/number}","comments_url":"https://api.github.com/repos/upfluence/dns-presence/issues/1/comments","statuses_url":"https://api.github.com/repos/upfluence/dns-presence/statuses/7183d0bf402864f5aa215903a180050a57cc37ef","head":{"label":"upfluence:am-use-healthcheck","ref":"am-use-healthcheck","sha":"7183d0bf402864f5aa215903a180050a57cc37ef","user":{"login":"upfluence","id":6849455,"avatar_url":"https://avatars.githubusercontent.com/u/6849455?v=3","gravatar_id":"","url":"https://api.github.com/users/upfluence","html_url":"https://github.com/upfluence","followers_url":"https://api.github.com/users/upfluence/followers","following_url":"https://api.github.com/users/upfluence/following{/other_user}","gists_url":"https://api.github.com/users/upfluence/gists{/gist_id}","starred_url":"https://api.github.com/users/upfluence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/upfluence/subscriptions","organizations_url":"https://api.github.com/users/upfluence/orgs","repos_url":"https://api.github.com/users/upfluence/repos","events_url":"https://api.github.com/users/upfluence/events{/privacy}","received_events_url":"https://api.github.com/users/upfluence/received_events","type":"Organization","site_admin":false},"repo":{"id":30148654,"name":"dns-presence","full_name":"upfluence/dns-presence","owner":{"login":"upfluence","id":6849455,"avatar_url":"https://avatars.githubusercontent.com/u/6849455?v=3","gravatar_id":"","url":"https://api.github.com/users/upfluence","html_url":"https://github.com/upfluence","followers_url":"https://api.github.com/users/upfluence/followers","following_url":"https://api.github.com/users/upfluence/following{/other_user}","gists_url":"https://api.github.com/users/upfluence/gists{/gist_id}","starred_url":"https://api.github.com/users/upfluence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/upfluence/subscriptions","organizations_url":"https://api.github.com/users/upfluence/orgs","repos_url":"https://api.github.com/users/upfluence/repos","events_url":"https://api.github.com/users/upfluence/events{/privacy}","received_events_url":"https://api.github.com/users/upfluence/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/upfluence/dns-presence","description":"AWS Route53  CoreOS sidekick service","fork":false,"url":"https://api.github.com/repos/upfluence/dns-presence","forks_url":"https://api.github.com/repos/upfluence/dns-presence/forks","keys_url":"https://api.github.com/repos/upfluence/dns-presence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/upfluence/dns-presence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/upfluence/dns-presence/teams","hooks_url":"https://api.github.com/repos/upfluence/dns-presence/hooks","issue_events_url":"https://api.github.com/repos/upfluence/dns-presence/issues/events{/number}","events_url":"https://api.github.com/repos/upfluence/dns-presence/events","assignees_url":"https://api.github.com/repos/upfluence/dns-presence/assignees{/user}","branches_url":"https://api.github.com/repos/upfluence/dns-presence/branches{/branch}","tags_url":"https://api.github.com/repos/upfluence/dns-presence/tags","blobs_url":"https://api.github.com/repos/upfluence/dns-presence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/upfluence/dns-presence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/upfluence/dns-presence/git/refs{/sha}","trees_url":"https://api.github.com/repos/upfluence/dns-presence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/upfluence/dns-presence/statuses/{sha}","languages_url":"https://api.github.com/repos/upfluence/dns-presence/languages","stargazers_url":"https://api.github.com/repos/upfluence/dns-presence/stargazers","contributors_url":"https://api.github.com/repos/upfluence/dns-presence/contributors","subscribers_url":"https://api.github.com/repos/upfluence/dns-presence/subscribers","subscription_url":"https://api.github.com/repos/upfluence/dns-presence/subscription","commits_url":"https://api.github.com/repos/upfluence/dns-presence/commits{/sha}","git_commits_url":"https://api.github.com/repos/upfluence/dns-presence/git/commits{/sha}","comments_url":"https://api.github.com/repos/upfluence/dns-presence/comments{/number}","issue_comment_url":"https://api.github.com/repos/upfluence/dns-presence/issues/comments{/number}","contents_url":"https://api.github.com/repos/upfluence/dns-presence/contents/{+path}","compare_url":"https://api.github.com/repos/upfluence/dns-presence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/upfluence/dns-presence/merges","archive_url":"https://api.github.com/repos/upfluence/dns-presence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/upfluence/dns-presence/downloads","issues_url":"https://api.github.com/repos/upfluence/dns-presence/issues{/number}","pulls_url":"https://api.github.com/repos/upfluence/dns-presence/pulls{/number}","milestones_url":"https://api.github.com/repos/upfluence/dns-presence/milestones{/number}","notifications_url":"https://api.github.com/repos/upfluence/dns-presence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/upfluence/dns-presence/labels{/name}","releases_url":"https://api.github.com/repos/upfluence/dns-presence/releases{/id}","deployments_url":"https://api.github.com/repos/upfluence/dns-presence/deployments","created_at":"2015-02-01T14:38:23Z","updated_at":"2015-03-22T16:07:17Z","pushed_at":"2016-10-10T17:25:10Z","git_url":"git://github.com/upfluence/dns-presence.git","ssh_url":"git@github.com:upfluence/dns-presence.git","clone_url":"https://github.com/upfluence/dns-presence.git","svn_url":"https://github.com/upfluence/dns-presence","homepage":"","size":19,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"upfluence:master","ref":"master","sha":"37fc428c102132ff7b6a953c9a9639026636f315","user":{"login":"upfluence","id":6849455,"avatar_url":"https://avatars.githubusercontent.com/u/6849455?v=3","gravatar_id":"","url":"https://api.github.com/users/upfluence","html_url":"https://github.com/upfluence","followers_url":"https://api.github.com/users/upfluence/followers","following_url":"https://api.github.com/users/upfluence/following{/other_user}","gists_url":"https://api.github.com/users/upfluence/gists{/gist_id}","starred_url":"https://api.github.com/users/upfluence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/upfluence/subscriptions","organizations_url":"https://api.github.com/users/upfluence/orgs","repos_url":"https://api.github.com/users/upfluence/repos","events_url":"https://api.github.com/users/upfluence/events{/privacy}","received_events_url":"https://api.github.com/users/upfluence/received_events","type":"Organization","site_admin":false},"repo":{"id":30148654,"name":"dns-presence","full_name":"upfluence/dns-presence","owner":{"login":"upfluence","id":6849455,"avatar_url":"https://avatars.githubusercontent.com/u/6849455?v=3","gravatar_id":"","url":"https://api.github.com/users/upfluence","html_url":"https://github.com/upfluence","followers_url":"https://api.github.com/users/upfluence/followers","following_url":"https://api.github.com/users/upfluence/following{/other_user}","gists_url":"https://api.github.com/users/upfluence/gists{/gist_id}","starred_url":"https://api.github.com/users/upfluence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/upfluence/subscriptions","organizations_url":"https://api.github.com/users/upfluence/orgs","repos_url":"https://api.github.com/users/upfluence/repos","events_url":"https://api.github.com/users/upfluence/events{/privacy}","received_events_url":"https://api.github.com/users/upfluence/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/upfluence/dns-presence","description":"AWS Route53  CoreOS sidekick service","fork":false,"url":"https://api.github.com/repos/upfluence/dns-presence","forks_url":"https://api.github.com/repos/upfluence/dns-presence/forks","keys_url":"https://api.github.com/repos/upfluence/dns-presence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/upfluence/dns-presence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/upfluence/dns-presence/teams","hooks_url":"https://api.github.com/repos/upfluence/dns-presence/hooks","issue_events_url":"https://api.github.com/repos/upfluence/dns-presence/issues/events{/number}","events_url":"https://api.github.com/repos/upfluence/dns-presence/events","assignees_url":"https://api.github.com/repos/upfluence/dns-presence/assignees{/user}","branches_url":"https://api.github.com/repos/upfluence/dns-presence/branches{/branch}","tags_url":"https://api.github.com/repos/upfluence/dns-presence/tags","blobs_url":"https://api.github.com/repos/upfluence/dns-presence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/upfluence/dns-presence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/upfluence/dns-presence/git/refs{/sha}","trees_url":"https://api.github.com/repos/upfluence/dns-presence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/upfluence/dns-presence/statuses/{sha}","languages_url":"https://api.github.com/repos/upfluence/dns-presence/languages","stargazers_url":"https://api.github.com/repos/upfluence/dns-presence/stargazers","contributors_url":"https://api.github.com/repos/upfluence/dns-presence/contributors","subscribers_url":"https://api.github.com/repos/upfluence/dns-presence/subscribers","subscription_url":"https://api.github.com/repos/upfluence/dns-presence/subscription","commits_url":"https://api.github.com/repos/upfluence/dns-presence/commits{/sha}","git_commits_url":"https://api.github.com/repos/upfluence/dns-presence/git/commits{/sha}","comments_url":"https://api.github.com/repos/upfluence/dns-presence/comments{/number}","issue_comment_url":"https://api.github.com/repos/upfluence/dns-presence/issues/comments{/number}","contents_url":"https://api.github.com/repos/upfluence/dns-presence/contents/{+path}","compare_url":"https://api.github.com/repos/upfluence/dns-presence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/upfluence/dns-presence/merges","archive_url":"https://api.github.com/repos/upfluence/dns-presence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/upfluence/dns-presence/downloads","issues_url":"https://api.github.com/repos/upfluence/dns-presence/issues{/number}","pulls_url":"https://api.github.com/repos/upfluence/dns-presence/pulls{/number}","milestones_url":"https://api.github.com/repos/upfluence/dns-presence/milestones{/number}","notifications_url":"https://api.github.com/repos/upfluence/dns-presence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/upfluence/dns-presence/labels{/name}","releases_url":"https://api.github.com/repos/upfluence/dns-presence/releases{/id}","deployments_url":"https://api.github.com/repos/upfluence/dns-presence/deployments","created_at":"2015-02-01T14:38:23Z","updated_at":"2015-03-22T16:07:17Z","pushed_at":"2016-10-10T17:25:10Z","git_url":"git://github.com/upfluence/dns-presence.git","ssh_url":"git@github.com:upfluence/dns-presence.git","clone_url":"https://github.com/upfluence/dns-presence.git","svn_url":"https://github.com/upfluence/dns-presence","homepage":"","size":19,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/1"},"html":{"href":"https://github.com/upfluence/dns-presence/pull/1"},"issue":{"href":"https://api.github.com/repos/upfluence/dns-presence/issues/1"},"comments":{"href":"https://api.github.com/repos/upfluence/dns-presence/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/upfluence/dns-presence/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/upfluence/dns-presence/statuses/7183d0bf402864f5aa215903a180050a57cc37ef"}}}}
{"actor":{"display_login":"AlexisMontagne"}}