internal

package
v0.118.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package internal supports the options and transport packages.

Package internal supports the options and transport packages.

Index

Constants

View Source
const Version = "0.118.0"

Version is the current tagged release of the library.

Variables

This section is empty.

Functions

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 GetGRPCTransportConfigAndEndpoint added in v0.117.0

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 added in v0.117.0

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 added in v0.113.0

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

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

func GetS2AAddress added in v0.117.0

func GetS2AAddress() string

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

Types

type ConnPool added in v0.17.0

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
}

ConnPool is a pool of grpc.ClientConns.

type DialSettings

type DialSettings struct {
	Endpoint                      string
	DefaultEndpoint               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
	AllowNonDefaultServiceAccount bool

	// Google API system parameters. For more information please read:
	// https://cloud.google.com/apis/docs/system-parameters
	QuotaProject  string
	RequestReason string
}

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

func (*DialSettings) GetAudience added in v0.49.0

func (ds *DialSettings) GetAudience() string

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

func (*DialSettings) GetScopes added in v0.36.0

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

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

func (*DialSettings) HasCustomAudience added in v0.49.0

func (ds *DialSettings) HasCustomAudience() bool

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

func (*DialSettings) Validate

func (ds *DialSettings) Validate() error

Validate reports an error if ds is invalid.

Directories

Path Synopsis
Package cert contains certificate tools for Google API clients.
Package cert contains certificate tools for Google API clients.
examples
fake
Package fake demonstrates how to use concrete services and fake the interactions with them in tests.
Package fake demonstrates how to use concrete services and fake the interactions with them in tests.
mock
Package mock demonstrates how to use interfaces to mock interactions with service in tests.
Package mock demonstrates how to use interfaces to mock interactions with service in tests.
Package gensupport is an internal implementation detail used by code generated by the google-api-go-generator tool.
Package gensupport is an internal implementation detail used by code generated by the google-api-go-generator tool.
Package impersonate is used to impersonate Google Credentials.
Package impersonate is used to impersonate Google Credentials.
kokoro
discogen Module
third_party
uritemplates
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL