Update vendored library google.golang.org/api

This commit is contained in:
Alexander Neumann 2018-03-30 12:51:18 +02:00
parent 5b6568875c
commit c0960f538f
363 changed files with 581827 additions and 452273 deletions

View file

@ -20,6 +20,7 @@ import (
"net/http"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/grpc"
)
@ -29,6 +30,7 @@ type DialSettings struct {
Endpoint string
Scopes []string
TokenSource oauth2.TokenSource
Credentials *google.DefaultCredentials
CredentialsFile string // if set, Token Source is ignored.
UserAgent string
APIKey string
@ -40,10 +42,16 @@ type DialSettings struct {
// Validate reports an error if ds is invalid.
func (ds *DialSettings) Validate() error {
hasCreds := ds.APIKey != "" || ds.TokenSource != nil || ds.CredentialsFile != ""
hasCreds := ds.APIKey != "" || ds.TokenSource != nil || ds.CredentialsFile != "" || ds.Credentials != nil
if ds.NoAuth && hasCreds {
return errors.New("options.WithoutAuthentication is incompatible with any option that provides credentials")
}
// Credentials should not appear with other options.
// We currently allow TokenSource and CredentialsFile to coexist.
// TODO(jba): make TokenSource & CredentialsFile an error (breaking change).
if ds.Credentials != nil && (ds.APIKey != "" || ds.TokenSource != nil || ds.CredentialsFile != "") {
return errors.New("multiple credential options provided")
}
if ds.HTTPClient != nil && ds.GRPCConn != nil {
return errors.New("WithHTTPClient is incompatible with WithGRPCConn")
}