{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/262","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/262/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/262/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-golang/issues/262","id":155113843,"number":262,"title":"Add a cloud.WithServiceAccountJSON option","user":{"login":"broady","id":24982,"avatar_url":"https://avatars.githubusercontent.com/u/24982?v=3","gravatar_id":"","url":"https://api.github.com/users/broady","html_url":"https://github.com/broady","followers_url":"https://api.github.com/users/broady/followers","following_url":"https://api.github.com/users/broady/following{/other_user}","gists_url":"https://api.github.com/users/broady/gists{/gist_id}","starred_url":"https://api.github.com/users/broady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broady/subscriptions","organizations_url":"https://api.github.com/users/broady/orgs","repos_url":"https://api.github.com/users/broady/repos","events_url":"https://api.github.com/users/broady/events{/privacy}","received_events_url":"https://api.github.com/users/broady/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"rakyll","id":108380,"avatar_url":"https://avatars.githubusercontent.com/u/108380?v=3","gravatar_id":"","url":"https://api.github.com/users/rakyll","html_url":"https://github.com/rakyll","followers_url":"https://api.github.com/users/rakyll/followers","following_url":"https://api.github.com/users/rakyll/following{/other_user}","gists_url":"https://api.github.com/users/rakyll/gists{/gist_id}","starred_url":"https://api.github.com/users/rakyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakyll/subscriptions","organizations_url":"https://api.github.com/users/rakyll/orgs","repos_url":"https://api.github.com/users/rakyll/repos","events_url":"https://api.github.com/users/rakyll/events{/privacy}","received_events_url":"https://api.github.com/users/rakyll/received_events","type":"User","site_admin":false},"assignees":[{"login":"rakyll","id":108380,"avatar_url":"https://avatars.githubusercontent.com/u/108380?v=3","gravatar_id":"","url":"https://api.github.com/users/rakyll","html_url":"https://github.com/rakyll","followers_url":"https://api.github.com/users/rakyll/followers","following_url":"https://api.github.com/users/rakyll/following{/other_user}","gists_url":"https://api.github.com/users/rakyll/gists{/gist_id}","starred_url":"https://api.github.com/users/rakyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakyll/subscriptions","organizations_url":"https://api.github.com/users/rakyll/orgs","repos_url":"https://api.github.com/users/rakyll/repos","events_url":"https://api.github.com/users/rakyll/events{/privacy}","received_events_url":"https://api.github.com/users/rakyll/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2016-05-16T20:25:37Z","updated_at":"2016-09-01T23:02:28Z","closed_at":null,"body":"This would call google.JWTConfigFromJSON, apply the appropriate scopes to a TokenSource."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/comments/244238224","html_url":"https://github.com/GoogleCloudPlatform/gcloud-golang/issues/262#issuecomment-244238224","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-golang/issues/262","id":244238224,"user":{"login":"rakyll","id":108380,"avatar_url":"https://avatars.githubusercontent.com/u/108380?v=3","gravatar_id":"","url":"https://api.github.com/users/rakyll","html_url":"https://github.com/rakyll","followers_url":"https://api.github.com/users/rakyll/followers","following_url":"https://api.github.com/users/rakyll/following{/other_user}","gists_url":"https://api.github.com/users/rakyll/gists{/gist_id}","starred_url":"https://api.github.com/users/rakyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakyll/subscriptions","organizations_url":"https://api.github.com/users/rakyll/orgs","repos_url":"https://api.github.com/users/rakyll/repos","events_url":"https://api.github.com/users/rakyll/events{/privacy}","received_events_url":"https://api.github.com/users/rakyll/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T23:02:28Z","updated_at":"2016-09-01T23:02:28Z","body":"Ok, this is uglier than what I was thinking.\r\n\r\nJWTConfigFromJSON doesn't allow the setting of the scopes lazily. JWTConfigFromJSON.TokenSource requires a context.\r\n\r\nAnd we need to keep the state of the last error. Yuck.\r\n\r\n```\r\ntype withServiceAccount struct {\r\n\tctx      context.Context\r\n\tfilename string\r\n}\r\n\r\nfunc (w withServiceAccount) Apply(o *internal.DialSettings) {\r\n\tkey, err := ioutil.ReadFile(w.filename)\r\n\tif err != nil {\r\n\t\to.Err = err\r\n\t\treturn\r\n\t}\r\n\tcfg, err := google.JWTConfigFromJSON(key) // scopes?\r\n\tif err != nil {\r\n\t\to.Err = err\r\n\t\treturn\r\n\t}\r\n\to.TokenSource = cfg.TokenSource(w.ctx)\r\n}\r\n```\r\n\r\nThe option should look like `WithServiceAccount(ctx context.Context, filename string, scope ...string)`. Hence I am saying no to this feature :("}}
{"actor":{"display_login":"rakyll"}}