Source File
settings.go
Belonging Package
google.golang.org/api/internal
package internal
import (
)
type DialSettings struct {
Endpoint string
DefaultEndpoint string
DefaultMTLSEndpoint string
Scopes []string
TokenSource oauth2.TokenSource
Credentials *google.Credentials
CredentialsFile string // if set, Token Source is ignored.
CredentialsJSON []byte
UserAgent string
APIKey string
Audiences []string
HTTPClient *http.Client
GRPCDialOpts []grpc.DialOption
GRPCConn *grpc.ClientConn
GRPCConnPool ConnPool
GRPCConnPoolSize int
NoAuth bool
TelemetryDisabled bool
ClientCertSource func(*tls.CertificateRequestInfo) (*tls.Certificate, error)
CustomClaims map[string]interface{}
SkipValidation bool
ImpersonationConfig *impersonate.Config
func ( *DialSettings) () error {
if .SkipValidation {
return nil
}
:= .APIKey != "" || .TokenSource != nil || .CredentialsFile != "" || .Credentials != nil
if .NoAuth && {
return errors.New("options.WithoutAuthentication is incompatible with any option that provides credentials")
:= 0
if .Credentials != nil {
++
}
if .CredentialsJSON != nil {
++
}
if .CredentialsFile != "" {
++
}
if .APIKey != "" {
++
}
if .TokenSource != nil {
++
}
if len(.Scopes) > 0 && len(.Audiences) > 0 {
return errors.New("WithScopes is incompatible with WithAudience")
if > 1 && !( == 2 && .TokenSource != nil && .CredentialsFile != "") {
return errors.New("multiple credential options provided")
}
if .GRPCConn != nil && .GRPCConnPool != nil {
return errors.New("WithGRPCConn is incompatible with WithConnPool")
}
if .HTTPClient != nil && .GRPCConnPool != nil {
return errors.New("WithHTTPClient is incompatible with WithConnPool")
}
if .HTTPClient != nil && .GRPCConn != nil {
return errors.New("WithHTTPClient is incompatible with WithGRPCConn")
}
if .HTTPClient != nil && .GRPCDialOpts != nil {
return errors.New("WithHTTPClient is incompatible with gRPC dial options")
}
if .HTTPClient != nil && .QuotaProject != "" {
return errors.New("WithHTTPClient is incompatible with QuotaProject")
}
if .HTTPClient != nil && .RequestReason != "" {
return errors.New("WithHTTPClient is incompatible with RequestReason")
}
if .HTTPClient != nil && .ClientCertSource != nil {
return errors.New("WithHTTPClient is incompatible with WithClientCertSource")
}
if .ClientCertSource != nil && (.GRPCConn != nil || .GRPCConnPool != nil || .GRPCConnPoolSize != 0 || .GRPCDialOpts != nil) {
return errors.New("WithClientCertSource is currently only supported for HTTP. gRPC settings are incompatible")
}
if .ImpersonationConfig != nil && len(.ImpersonationConfig.Scopes) == 0 && len(.Scopes) == 0 {
return errors.New("WithImpersonatedCredentials requires scopes being provided")
}
return nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |