google: add DefaultCredentials function

This new function allows reading the project ID from a service account
JSON file without an additional disk read.

Change-Id: I1f03ca3ca39a2ae3bd6524367c17761b0f08de45
Reviewed-on: https://go-review.googlesource.com/32876
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
This commit is contained in:
Ross Light
2016-11-07 13:06:47 -08:00
parent d5040cddfc
commit f6093e37b6
5 changed files with 49 additions and 31 deletions

View File

@@ -112,6 +112,7 @@ type credentialsFile struct {
PrivateKeyID string `json:"private_key_id"`
PrivateKey string `json:"private_key"`
TokenURL string `json:"token_uri"`
ProjectID string `json:"project_id"`
// User Credential fields
// (These typically come from gcloud auth.)