{"action":"created","comment":{"url":"https://api.github.com/repos/mercari/coredns/pulls/comments/236564522","pull_request_review_id":178660293,"id":236564522,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjU2NDUyMg==","diff_hunk":"@@ -0,0 +1,275 @@\n+package clouddns\n+\n+import (\n+\t\"context\"\n+\t\"fmt\"\n+\t\"strings\"\n+\t\"sync\"\n+\t\"time\"\n+\n+\t\"github.com/coredns/coredns/plugin\"\n+\t\"github.com/coredns/coredns/plugin/file\"\n+\t\"github.com/coredns/coredns/plugin/pkg/fall\"\n+\t\"github.com/coredns/coredns/plugin/pkg/upstream\"\n+\t\"github.com/coredns/coredns/request\"\n+\t\"github.com/miekg/dns\"\n+\tgdns \"google.golang.org/api/dns/v1\"\n+)\n+\n+// CloudDNS is a plugin that returns RR from Google CloudDNS.\n+type CloudDNS struct {\n+\tNext plugin.Handler\n+\tFall fall.F\n+\n+\tzoneNames []string\n+\tclient    gdns.Service\n+\tupstream  *upstream.Upstream\n+\n+\tzMu   sync.RWMutex\n+\tzones zones\n+}\n+\n+type zone struct {\n+\tid  string\n+\tz   *file.Zone\n+\tdns string\n+}\n+\n+//Zones is ok\n+type Zones []string\n+\n+type zones map[string][]*zone\n+\n+// New reads from the keys map which uses domain names as its key and hosted\n+// zone id lists as its values, validates that each domain name/zone id pair does\n+// exist, and returns a new *Route53. In addition to this, upstream is passed\n+// for doing recursive queries against CNAMEs.\n+// Returns error if it cannot verify any given domain name/zone id pair.\n+func New(ctx context.Context, c gdns.Service, proj string, keys map[string][]string, up *upstream.Upstream) (*CloudDNS, error) {\n+\tlog.Infof(\"Entering New function with %v project value\", proj)\n+\tlog.Infof(\"Current project is %v\", proj)\n+\tzones := make(map[string][]*zone, len(keys))\n+\tzoneNames := make([]string, 0, len(keys))\n+\tfor _, managedZoneNames := range keys {\n+\t\tfor _, managedZoneName := range managedZoneNames {\n+\t\t\tlog.Infof(\"ManagedzoneName is %v\", managedZoneName)\n+\t\t\tmanagedZone, err := c.ManagedZones.Get(proj, managedZoneName).Do()\n+\t\t\tif err != nil {\n+\t\t\t\treturn nil, err\n+\t\t\t}\n+\t\t\tmanagedZoneID := managedZone.DnsName\n+\t\t\tif _, ok := zones[managedZoneID]; !ok {\n+\t\t\t\tzoneNames = append(zoneNames, managedZoneID)\n+\t\t\t}\n+\t\t\tzones[managedZoneID] = append(zones[managedZoneID], &zone{id: managedZoneName, dns: managedZoneID, z: file.NewZone(managedZoneID, \"\")})\n+\t\t}\n+\t}\n+\n+\tfor i, j := range zones {\n+\t\tlog.Infof(\"Zone index is\", i)\n+\t\tlog.Infof(\"Zone value is\", j)\n+\t\tfor k, l := range j {\n+\t\t\tlog.Infof(\"Zone subindex is\", k)\n+\t\t\tlog.Infof(\"Zone dns is\", l.dns)\n+\t\t\tlog.Infof(\"Zone id is\", l.id)\n+\t\t\tlog.Infof(\"Zone file is\", l.z.All())\n+\n+\t\t}\n+\n+\t}\n+\tlog.Infof(\"keys are %v\", keys)\n+\tlog.Infof(\"keys length is %v\", len(keys))\n+\tlog.Infof(\"Zones are %v\", zones)\n+\tlog.Infof(\"Zones length is %v\", len(zones))\n+\n+\tlog.Infof(\"Zone names are %v\", zoneNames)\n+\tlog.Infof(\"Zones name length is %v\", len(zoneNames))\n+\treturn &CloudDNS{\n+\t\tclient:    c,\n+\t\tzoneNames: zoneNames,\n+\t\tzones:     zones,\n+\t\tupstream:  up,\n+\t}, nil\n+}\n+\n+//Matches test","path":"plugin/clouddns/clouddns.go","position":95,"original_position":95,"commit_id":"8ce30cff0c7a7b26880780ebe93d4d7976832bee","original_commit_id":"8ce30cff0c7a7b26880780ebe93d4d7976832bee","user":{"login":"vbanthia","id":7875161,"node_id":"MDQ6VXNlcjc4NzUxNjE=","avatar_url":"https://avatars0.githubusercontent.com/u/7875161?v=4","gravatar_id":"","url":"https://api.github.com/users/vbanthia","html_url":"https://github.com/vbanthia","followers_url":"https://api.github.com/users/vbanthia/followers","following_url":"https://api.github.com/users/vbanthia/following{/other_user}","gists_url":"https://api.github.com/users/vbanthia/gists{/gist_id}","starred_url":"https://api.github.com/users/vbanthia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbanthia/subscriptions","organizations_url":"https://api.github.com/users/vbanthia/orgs","repos_url":"https://api.github.com/users/vbanthia/repos","events_url":"https://api.github.com/users/vbanthia/events{/privacy}","received_events_url":"https://api.github.com/users/vbanthia/received_events","type":"User","site_admin":false},"body":"better description of this function.","created_at":"2018-11-27T08:43:56Z","updated_at":"2018-11-27T08:59:41Z","html_url":"https://github.com/mercari/coredns/pull/1#discussion_r236564522","pull_request_url":"https://api.github.com/repos/mercari/coredns/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/mercari/coredns/pulls/comments/236564522"},"html":{"href":"https://github.com/mercari/coredns/pull/1#discussion_r236564522"},"pull_request":{"href":"https://api.github.com/repos/mercari/coredns/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mercari/coredns/pulls/1","id":232868888,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyODY4ODg4","html_url":"https://github.com/mercari/coredns/pull/1","diff_url":"https://github.com/mercari/coredns/pull/1.diff","patch_url":"https://github.com/mercari/coredns/pull/1.patch","issue_url":"https://api.github.com/repos/mercari/coredns/issues/1","number":1,"state":"open","locked":false,"title":"plugin/clouddns: add clouddns logic","user":{"login":"lainra","id":5978068,"node_id":"MDQ6VXNlcjU5NzgwNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5978068?v=4","gravatar_id":"","url":"https://api.github.com/users/lainra","html_url":"https://github.com/lainra","followers_url":"https://api.github.com/users/lainra/followers","following_url":"https://api.github.com/users/lainra/following{/other_user}","gists_url":"https://api.github.com/users/lainra/gists{/gist_id}","starred_url":"https://api.github.com/users/lainra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lainra/subscriptions","organizations_url":"https://api.github.com/users/lainra/orgs","repos_url":"https://api.github.com/users/lainra/repos","events_url":"https://api.github.com/users/lainra/events{/privacy}","received_events_url":"https://api.github.com/users/lainra/received_events","type":"User","site_admin":false},"body":"This PR is implementing a new plugin called CloudDNS\r\n\r\nThis plugin implements Google CloudDNS service to be used as a DNS zone file backend by CoreDNS.\r\nIt is heavily inspired by the CoreDNS `route53` plugin.\r\nIt fetches resource record sets from CloudDNS to dynamically populate the `file` plugin.\r\nBy default, RRsets are pulled every minute.\r\n\r\nGoogle authentication is done by using OAuth2 with a JSON credentials file.\r\nIt is also required to specify the project along with the DNS managed zone as the DNS API only allows to fetch a zone using a project name; whereas Route53 allow fetching using the zone ID.\r\n\r\nTests are yet to be written, however, the plugin is already working and tested.","created_at":"2018-11-22T06:08:46Z","updated_at":"2018-11-27T08:59:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89a0bf22691883df68b045a8af91c8407e8ca1f1","assignee":{"login":"lainra","id":5978068,"node_id":"MDQ6VXNlcjU5NzgwNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5978068?v=4","gravatar_id":"","url":"https://api.github.com/users/lainra","html_url":"https://github.com/lainra","followers_url":"https://api.github.com/users/lainra/followers","following_url":"https://api.github.com/users/lainra/following{/other_user}","gists_url":"https://api.github.com/users/lainra/gists{/gist_id}","starred_url":"https://api.github.com/users/lainra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lainra/subscriptions","organizations_url":"https://api.github.com/users/lainra/orgs","repos_url":"https://api.github.com/users/lainra/repos","events_url":"https://api.github.com/users/lainra/events{/privacy}","received_events_url":"https://api.github.com/users/lainra/received_events","type":"User","site_admin":false},"assignees":[{"login":"lainra","id":5978068,"node_id":"MDQ6VXNlcjU5NzgwNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5978068?v=4","gravatar_id":"","url":"https://api.github.com/users/lainra","html_url":"https://github.com/lainra","followers_url":"https://api.github.com/users/lainra/followers","following_url":"https://api.github.com/users/lainra/following{/other_user}","gists_url":"https://api.github.com/users/lainra/gists{/gist_id}","starred_url":"https://api.github.com/users/lainra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lainra/subscriptions","organizations_url":"https://api.github.com/users/lainra/orgs","repos_url":"https://api.github.com/users/lainra/repos","events_url":"https://api.github.com/users/lainra/events{/privacy}","received_events_url":"https://api.github.com/users/lainra/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mercari/coredns/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mercari/coredns/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mercari/coredns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mercari/coredns/issues/1/comments","statuses_url":"https://api.github.com/repos/mercari/coredns/statuses/8ce30cff0c7a7b26880780ebe93d4d7976832bee","head":{"label":"lainra:master","ref":"master","sha":"8ce30cff0c7a7b26880780ebe93d4d7976832bee","user":{"login":"lainra","id":5978068,"node_id":"MDQ6VXNlcjU5NzgwNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5978068?v=4","gravatar_id":"","url":"https://api.github.com/users/lainra","html_url":"https://github.com/lainra","followers_url":"https://api.github.com/users/lainra/followers","following_url":"https://api.github.com/users/lainra/following{/other_user}","gists_url":"https://api.github.com/users/lainra/gists{/gist_id}","starred_url":"https://api.github.com/users/lainra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lainra/subscriptions","organizations_url":"https://api.github.com/users/lainra/orgs","repos_url":"https://api.github.com/users/lainra/repos","events_url":"https://api.github.com/users/lainra/events{/privacy}","received_events_url":"https://api.github.com/users/lainra/received_events","type":"User","site_admin":false},"repo":{"id":158635617,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg2MzU2MTc=","name":"coredns","full_name":"lainra/coredns","private":false,"owner":{"login":"lainra","id":5978068,"node_id":"MDQ6VXNlcjU5NzgwNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5978068?v=4","gravatar_id":"","url":"https://api.github.com/users/lainra","html_url":"https://github.com/lainra","followers_url":"https://api.github.com/users/lainra/followers","following_url":"https://api.github.com/users/lainra/following{/other_user}","gists_url":"https://api.github.com/users/lainra/gists{/gist_id}","starred_url":"https://api.github.com/users/lainra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lainra/subscriptions","organizations_url":"https://api.github.com/users/lainra/orgs","repos_url":"https://api.github.com/users/lainra/repos","events_url":"https://api.github.com/users/lainra/events{/privacy}","received_events_url":"https://api.github.com/users/lainra/received_events","type":"User","site_admin":false},"html_url":"https://github.com/lainra/coredns","description":"CoreDNS is a DNS server that chains plugins","fork":true,"url":"https://api.github.com/repos/lainra/coredns","forks_url":"https://api.github.com/repos/lainra/coredns/forks","keys_url":"https://api.github.com/repos/lainra/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lainra/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lainra/coredns/teams","hooks_url":"https://api.github.com/repos/lainra/coredns/hooks","issue_events_url":"https://api.github.com/repos/lainra/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/lainra/coredns/events","assignees_url":"https://api.github.com/repos/lainra/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/lainra/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/lainra/coredns/tags","blobs_url":"https://api.github.com/repos/lainra/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lainra/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lainra/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/lainra/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lainra/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/lainra/coredns/languages","stargazers_url":"https://api.github.com/repos/lainra/coredns/stargazers","contributors_url":"https://api.github.com/repos/lainra/coredns/contributors","subscribers_url":"https://api.github.com/repos/lainra/coredns/subscribers","subscription_url":"https://api.github.com/repos/lainra/coredns/subscription","commits_url":"https://api.github.com/repos/lainra/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/lainra/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/lainra/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/lainra/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/lainra/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/lainra/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lainra/coredns/merges","archive_url":"https://api.github.com/repos/lainra/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lainra/coredns/downloads","issues_url":"https://api.github.com/repos/lainra/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/lainra/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/lainra/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/lainra/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lainra/coredns/labels{/name}","releases_url":"https://api.github.com/repos/lainra/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/lainra/coredns/deployments","created_at":"2018-11-22T03:07:52Z","updated_at":"2018-11-22T03:12:09Z","pushed_at":"2018-11-22T03:12:08Z","git_url":"git://github.com/lainra/coredns.git","ssh_url":"git@github.com:lainra/coredns.git","clone_url":"https://github.com/lainra/coredns.git","svn_url":"https://github.com/lainra/coredns","homepage":"https://coredns.io","size":87036,"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":"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":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mercari:master","ref":"master","sha":"fc96c642636ee0b57f21613aed2a52eada380be9","user":{"login":"mercari","id":8133808,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMzM4MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/8133808?v=4","gravatar_id":"","url":"https://api.github.com/users/mercari","html_url":"https://github.com/mercari","followers_url":"https://api.github.com/users/mercari/followers","following_url":"https://api.github.com/users/mercari/following{/other_user}","gists_url":"https://api.github.com/users/mercari/gists{/gist_id}","starred_url":"https://api.github.com/users/mercari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercari/subscriptions","organizations_url":"https://api.github.com/users/mercari/orgs","repos_url":"https://api.github.com/users/mercari/repos","events_url":"https://api.github.com/users/mercari/events{/privacy}","received_events_url":"https://api.github.com/users/mercari/received_events","type":"Organization","site_admin":false},"repo":{"id":158647983,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg2NDc5ODM=","name":"coredns","full_name":"mercari/coredns","private":false,"owner":{"login":"mercari","id":8133808,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMzM4MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/8133808?v=4","gravatar_id":"","url":"https://api.github.com/users/mercari","html_url":"https://github.com/mercari","followers_url":"https://api.github.com/users/mercari/followers","following_url":"https://api.github.com/users/mercari/following{/other_user}","gists_url":"https://api.github.com/users/mercari/gists{/gist_id}","starred_url":"https://api.github.com/users/mercari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercari/subscriptions","organizations_url":"https://api.github.com/users/mercari/orgs","repos_url":"https://api.github.com/users/mercari/repos","events_url":"https://api.github.com/users/mercari/events{/privacy}","received_events_url":"https://api.github.com/users/mercari/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mercari/coredns","description":"CoreDNS is a DNS server that chains plugins","fork":true,"url":"https://api.github.com/repos/mercari/coredns","forks_url":"https://api.github.com/repos/mercari/coredns/forks","keys_url":"https://api.github.com/repos/mercari/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mercari/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mercari/coredns/teams","hooks_url":"https://api.github.com/repos/mercari/coredns/hooks","issue_events_url":"https://api.github.com/repos/mercari/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/mercari/coredns/events","assignees_url":"https://api.github.com/repos/mercari/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/mercari/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/mercari/coredns/tags","blobs_url":"https://api.github.com/repos/mercari/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mercari/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mercari/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/mercari/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mercari/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/mercari/coredns/languages","stargazers_url":"https://api.github.com/repos/mercari/coredns/stargazers","contributors_url":"https://api.github.com/repos/mercari/coredns/contributors","subscribers_url":"https://api.github.com/repos/mercari/coredns/subscribers","subscription_url":"https://api.github.com/repos/mercari/coredns/subscription","commits_url":"https://api.github.com/repos/mercari/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/mercari/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/mercari/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/mercari/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/mercari/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/mercari/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mercari/coredns/merges","archive_url":"https://api.github.com/repos/mercari/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mercari/coredns/downloads","issues_url":"https://api.github.com/repos/mercari/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/mercari/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/mercari/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/mercari/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mercari/coredns/labels{/name}","releases_url":"https://api.github.com/repos/mercari/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/mercari/coredns/deployments","created_at":"2018-11-22T05:44:33Z","updated_at":"2018-11-22T05:44:36Z","pushed_at":"2018-11-22T06:08:47Z","git_url":"git://github.com/mercari/coredns.git","ssh_url":"git@github.com:mercari/coredns.git","clone_url":"https://github.com/mercari/coredns.git","svn_url":"https://github.com/mercari/coredns","homepage":"https://coredns.io","size":87036,"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":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/mercari/coredns/pulls/1"},"html":{"href":"https://github.com/mercari/coredns/pull/1"},"issue":{"href":"https://api.github.com/repos/mercari/coredns/issues/1"},"comments":{"href":"https://api.github.com/repos/mercari/coredns/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mercari/coredns/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mercari/coredns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mercari/coredns/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mercari/coredns/statuses/8ce30cff0c7a7b26880780ebe93d4d7976832bee"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"vbanthia"}}