go19.go 662 B

12345678910111213141516171819202122232425
  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 transport
  6. import (
  7. "context"
  8. "golang.org/x/oauth2/google"
  9. "google.golang.org/api/internal"
  10. "google.golang.org/api/option"
  11. )
  12. // Creds constructs a google.Credentials from the information in the options,
  13. // or obtains the default credentials in the same way as google.FindDefaultCredentials.
  14. func Creds(ctx context.Context, opts ...option.ClientOption) (*google.Credentials, error) {
  15. var ds internal.DialSettings
  16. for _, opt := range opts {
  17. opt.Apply(&ds)
  18. }
  19. return internal.Creds(ctx, &ds)
  20. }