clients

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientOptions

func GetClientOptions(config *WaaSClientConfig) ([]option.ClientOption, error)

GetClientOptions returns the list of ClientOptions based on the given endpoint, service name, and config.

func GetHTTPClient

func GetHTTPClient(serviceName string, config *WaaSClientConfig) (*http.Client, error)

GetHTTPClient returns the HTTPClient based on the given service name and config.

func HTTPCode

func HTTPCode(err error) int

HTTPCode attempts to return the HTTP status code for the given error. If it cannot be determined, it returns a 500 (Internal Server Error).

func LROOptions

func LROOptions(op LongRunningOperation, version string, opts []gax.CallOption) []gax.CallOption

LROOptions returns the call options for long-running operations. This overrides the gapic generated client `WithPath` call option that ignores the path prefix, with a call option that includes the path prefix.

func NewTransport

func NewTransport(
	roundTripper http.RoundTripper,
	serviceName string,
	apiKey *auth.APIKey,
) (*transport, error)

NewTransport returns a new transport based on the given inputs.

func UnwrapError

func UnwrapError(err error) error

UnwrapError attempts to unwrap the passed error and return a googleapi error. It is expected that the passed error is of type apierror.APIError. If it is not, it returns the passed error unchanged.

Types

type LongRunningOperation

type LongRunningOperation interface {
	Name() string
	PathPrefix() string
}

LongRunningOperation is the interface for long-running operations that is used to create the gax call options for interacting with LROs.

type WaaSClientConfig

type WaaSClientConfig struct {
	Endpoint      string
	ServiceName   string
	APIKey        *auth.APIKey
	HTTPClient    *http.Client
	ClientOptions []option.ClientOption
	Insecure      bool
}

WaaSClientConfig stores configuration information about a WaaS client.

func GetConfig

func GetConfig(
	serviceName string,
	defaultEndpoint string,
	waasOpts ...WaaSClientOption) (*WaaSClientConfig, error)

GetConfig returns a WaaSClientConfig with all of the WaaSClientOptions applied. It uses the given default endpoint if none of the options set it.

type WaaSClientOption

type WaaSClientOption func(c *WaaSClientConfig)

WaaSClientOption is a function that applies changes to a clientConfig.

func WithAPIKey

func WithAPIKey(apiKey *auth.APIKey) WaaSClientOption

WithAPIKey returns an option to set the Coinbase Cloud API Key.

func WithClientOptions

func WithClientOptions(clientOptions ...option.ClientOption) WaaSClientOption

WithClientOptions returns an option to set the inner set of ClientOptions.

func WithEndpoint

func WithEndpoint(endpoint string) WaaSClientOption

WithEndpoint returns an option to set the service endpoint.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) WaaSClientOption

WithHTTPClient returns an option to set the HTTP Client.

func WithInsecure added in v1.0.6

func WithInsecure(insecure bool) WaaSClientOption

WithInsecure returns an option to set the insecure flag. If insecure is set to true, the client will not use transport authentication.

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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