...

Package internal

import "google.golang.org/api/internal"
Overview
Index
Subdirectories

Overview ▾

Package internal supports the options and transport packages.

Package internal supports the options and transport packages.

Constants

Version is the current tagged release of the library.

const Version = "0.181.0"

func Creds

func Creds(ctx context.Context, ds *DialSettings) (*google.Credentials, error)

Creds returns credential information obtained from DialSettings, or if none, then it returns default credential information.

func ErrUniverseNotMatch

func ErrUniverseNotMatch(settingsUD, credsUD string) error

ErrUniverseNotMatch composes an error string from the provided universe domain sources (DialSettings and Credentials, respectively).

func GetGRPCTransportConfigAndEndpoint

func GetGRPCTransportConfigAndEndpoint(settings *DialSettings) (credentials.TransportCredentials, string, error)

GetGRPCTransportConfigAndEndpoint returns an instance of credentials.TransportCredentials, and the corresponding endpoint to use for GRPC client.

func GetHTTPTransportConfigAndEndpoint

func GetHTTPTransportConfigAndEndpoint(settings *DialSettings) (cert.Source, func(context.Context, string, string) (net.Conn, error), string, error)

GetHTTPTransportConfigAndEndpoint returns a client certificate source, a function for dialing MTLS with S2A, and the endpoint to use for HTTP client.

func GetQuotaProject

func GetQuotaProject(creds *google.Credentials, clientOpt string) string

GetQuotaProject retrieves quota project with precedence being: client option, environment variable, creds file.

func GetS2AAddress

func GetS2AAddress() string

GetS2AAddress returns the S2A address to be reached via plaintext connection.

func GetUniverseDomain

func GetUniverseDomain(creds *google.Credentials) (string, error)

GetUniverseDomain returns the default service domain for a given Cloud universe, from google.Credentials, for comparison with the value returned by (*DialSettings).GetUniverseDomain. This wrapper function should be removed to close https://github.com/googleapis/google-api-go-client/issues/2399.

type ConnPool

ConnPool is a pool of grpc.ClientConns.

type ConnPool interface {
    // Conn returns a ClientConn from the pool.
    //
    // Conns aren't returned to the pool.
    Conn() *grpc.ClientConn

    // Num returns the number of connections in the pool.
    //
    // It will always return the same value.
    Num() int

    // Close closes every ClientConn in the pool.
    //
    // The error returned by Close may be a single error or multiple errors.
    Close() error

    // ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
    grpc.ClientConnInterface
}

type DialSettings

DialSettings holds information needed to establish a connection with a Google API service.

type DialSettings struct {
    Endpoint                      string
    DefaultEndpoint               string
    DefaultEndpointTemplate       string
    DefaultMTLSEndpoint           string
    Scopes                        []string
    DefaultScopes                 []string
    EnableJwtWithScope            bool
    TokenSource                   oauth2.TokenSource
    Credentials                   *google.Credentials
    CredentialsFile               string // if set, Token Source is ignored.
    CredentialsJSON               []byte
    InternalCredentials           *google.Credentials
    UserAgent                     string
    APIKey                        string
    Audiences                     []string
    DefaultAudience               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
    EnableDirectPath              bool
    EnableDirectPathXds           bool
    AllowNonDefaultServiceAccount bool
    DefaultUniverseDomain         string
    UniverseDomain                string
    // Google API system parameters. For more information please read:
    // https://cloud.google.com/apis/docs/system-parameters
    QuotaProject  string
    RequestReason string

    // New Auth library Options
    AuthCredentials      *auth.Credentials
    EnableNewAuthLibrary bool
}

func (*DialSettings) GetAudience

func (ds *DialSettings) GetAudience() string

GetAudience returns the user-provided audience, if set, or else falls back to the default audience.

func (*DialSettings) GetDefaultUniverseDomain

func (ds *DialSettings) GetDefaultUniverseDomain() string

GetDefaultUniverseDomain returns the Google default universe domain ("googleapis.com").

func (*DialSettings) GetScopes

func (ds *DialSettings) GetScopes() []string

GetScopes returns the user-provided scopes, if set, or else falls back to the default scopes.

func (*DialSettings) GetUniverseDomain

func (ds *DialSettings) GetUniverseDomain() string

GetUniverseDomain returns the default service domain for a given Cloud universe, with the following precedence:

1. A non-empty option.WithUniverseDomain. 2. A non-empty environment variable GOOGLE_CLOUD_UNIVERSE_DOMAIN. 3. The default value "googleapis.com".

func (*DialSettings) HasCustomAudience

func (ds *DialSettings) HasCustomAudience() bool

HasCustomAudience returns true if a custom audience is provided by users.

func (*DialSettings) IsNewAuthLibraryEnabled

func (ds *DialSettings) IsNewAuthLibraryEnabled() bool

IsNewAuthLibraryEnabled returns true if the new auth library should be used.

func (*DialSettings) IsUniverseDomainGDU

func (ds *DialSettings) IsUniverseDomainGDU() bool

IsUniverseDomainGDU returns true if the universe domain is the default Google universe ("googleapis.com").

func (*DialSettings) Validate

func (ds *DialSettings) Validate() error

Validate reports an error if ds is invalid.

Subdirectories

Name Synopsis
..