options

package
v2.51.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option defines a function that modifies the configuration of an Options instance.

func WithAuthenticator

func WithAuthenticator(auth authentication.Authenticator) Option

WithAuthenticator sets the provided Authenticator for authentication in the Options configuration.

func WithCredentials

func WithCredentials(creds credentials.Credentials) Option

WithCredentials sets the provided Credentials to the Options, used for signing and authenticating API requests.

func WithCustomDialOptions

func WithCustomDialOptions(opts ...grpc.DialOption) Option

WithCustomDialOptions injects custom gRPC dial options into the SDK's configuration. It ovverides any other dial options that may have been set by other Options.

func WithDefaultRetryOptions

func WithDefaultRetryOptions() Option

WithDefaultRetryOptions enables default retry handling by setting the `DefaultRetryOptions` field to true in Options. it could be used in combination with WithRetryOptions to override default retry options.

func WithDiscoveryEndpoint

func WithDiscoveryEndpoint(endpoint string) Option

WithDiscoveryEndpoint sets a custom discovery endpoint URL for resolving service endpoints in the SDK configuration.

func WithEndpointsResolver

func WithEndpointsResolver(resolver endpoints.EndpointsResolver) Option

WithEndpointsResolver configures a custom EndpointsResolver to dynamically resolve gRPC service endpoints for the SDK.

func WithPlaintext

func WithPlaintext() Option

WithPlaintext is an Option that configures the SDK to use Plaintext communication, disabling TLS for gRPC connections.

func WithRetryOptions

func WithRetryOptions(opts ...retry.RetryOption) Option

WithRetryOptions applies retry options to the SDK's configuration.

func WithTLSConfig

func WithTLSConfig(config *tls.Config) Option

WithTLSConfig sets a custom TLS configuration for gRPC connections by assigning it to the Options struct.

type Options

type Options struct {
	// Credentials is used to sign and authenticate API requests.
	Credentials credentials.Credentials
	// EndpointsResolver provides or overrides service endpoints.
	// By default, the SDK uses built-in endpoints, but you can
	// supply a custom resolver to target pre-release or private APIs.
	EndpointsResolver endpoints.EndpointsResolver
	// DiscoveryEndpoint specifies a custom URL to retrieve default
	// service endpoints. If unset, the SDK uses its default discovery service.
	DiscoveryEndpoint string
	// Authenticator signs requests and injects auth headers.
	Authenticator authentication.Authenticator
	// TLSConfig allows customizing TLS settings for gRPC connections.
	// If nil, the SDK uses the system default configuration.
	TlsConfig *tls.Config
	// Plaintext, when true, disables TLS and connects over Plaintext.
	// This is useful for local testing or when an external proxy handles TLS.
	Plaintext bool
	// Logger provides structured logging functionality using zap Logger.
	// If not set, no logging will be performed.
	Logger *zap.Logger

	CustomDialOpts      []grpc.DialOption
	RetryOptions        []retry.RetryOption
	DefaultRetryOptions bool
}

Options defines a configuration structure for customizing SDK behavior and connections.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions initializes and returns an Options struct with default configuration for endpoint and connection timeout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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