internal

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package internal supports the options and transport packages.

Index

Constants

This section is empty.

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

func QuotaProjectFromCreds(cred *google.Credentials) string

QuotaProjectFromCreds returns the quota project from the JSON blob in the provided credentials.

NOTE(cbro): consider promoting this to a field on google.Credentials.

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
	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

	// 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) Validate

func (ds *DialSettings) Validate() error

Validate reports an error if ds is invalid.

type PoolResolver

type PoolResolver struct {
	// contains filtered or unexported fields
}

PoolResolver provides a fixed list of addresses to load balance between and does not provide further updates.

func NewPoolResolver

func NewPoolResolver(size int, o *DialSettings) *PoolResolver

NewPoolResolver returns a PoolResolver This is an EXPERIMENTAL API and may be changed or removed in the future.

func (*PoolResolver) Close

func (r *PoolResolver) Close()

Close releases resources associated with the pool and causes Next to unblock.

func (*PoolResolver) Next

func (r *PoolResolver) Next() ([]*naming.Update, error)

Next returns a static list of updates on the first call, and blocks indefinitely until Close is called on subsequent calls.

func (*PoolResolver) Resolve

func (r *PoolResolver) Resolve(target string) (naming.Watcher, error)

Resolve returns a Watcher for the endpoint defined by the DialSettings provided to NewPoolResolver.

Directories

Path Synopsis
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.
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).
Package version contains version information for Google Cloud Client Libraries for Go, as reported in request headers.
Package version contains version information for Google Cloud Client Libraries for Go, as reported in request headers.

Jump to

Keyboard shortcuts

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