credentials_go19.go 543 B

1234567891011121314151617181920212223
  1. // Copyright 2018 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build go1.9
  5. package option
  6. import (
  7. "golang.org/x/oauth2/google"
  8. "google.golang.org/api/internal"
  9. )
  10. type withCreds google.Credentials
  11. func (w *withCreds) Apply(o *internal.DialSettings) {
  12. o.Credentials = (*google.Credentials)(w)
  13. }
  14. // WithCredentials returns a ClientOption that authenticates API calls.
  15. func WithCredentials(creds *google.Credentials) ClientOption {
  16. return (*withCreds)(creds)
  17. }