aboutsummaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/api/option/option.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/api/option/option.go')
-rw-r--r--vendor/google.golang.org/api/option/option.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/google.golang.org/api/option/option.go b/vendor/google.golang.org/api/option/option.go
index 556a6df..b935e6d 100644
--- a/vendor/google.golang.org/api/option/option.go
+++ b/vendor/google.golang.org/api/option/option.go
@@ -26,6 +26,21 @@ func (w withTokenSource) Apply(o *internal.DialSettings) {
o.TokenSource = w.ts
}
+// WithServiceAccountFile returns a ClientOption that uses a Google service
+// account credentials file to authenticate.
+// Use WithTokenSource with a token source created from
+// golang.org/x/oauth2/google.JWTConfigFromJSON
+// if reading the file from disk is not an option.
+func WithServiceAccountFile(filename string) ClientOption {
+ return withServiceAccountFile(filename)
+}
+
+type withServiceAccountFile string
+
+func (w withServiceAccountFile) Apply(o *internal.DialSettings) {
+ o.ServiceAccountJSONFilename = string(w)
+}
+
// WithEndpoint returns a ClientOption that overrides the default endpoint
// to be used for a service.
func WithEndpoint(url string) ClientOption {