cloudclient

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyReader

type APIKeyReader interface {
	// Get the API key to use when making requests to the cloud operations API.
	// If an error is returned, the request will fail.
	// The GetAPIKey function will be called every time a request is made to the cloud operations API.
	GetAPIKey(ctx context.Context) (string, error)
}

APIKeyReader is an interface to dynamically retrieve the API key to use when making requests to the cloud operations API.

type Client

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

Client to perform cloud-management operations.

WARNING: The client is currently experimental.

The client will not establish a connection to the server until the first call is made. The client is safe for concurrent use by multiple goroutines. The client must be closed when it is no longer needed to clean up resources.

func New

func New(options Options) (*Client, error)

New creates a client to perform cloud-management operations.

func (*Client) Close

func (c *Client) Close() error

Close closes the client connection to the server. The client must be closed when it is no longer needed to clean up resources.

func (*Client) CloudService

func (c *Client) CloudService() cloudservice.CloudServiceClient

CloudService returns the raw grpc client to perform cloud-service operations.

type Options

type Options struct {
	// The API key to use when making requests to the cloud operations API.
	// At least one of APIKey and APIKeyReader must be provided, but not both.
	APIKey string

	// The API key reader to dynamically retrieve apikey to use when making requests to the cloud operations API.
	// At least one of APIKey and APIKeyReader must be provided, but not both.
	APIKeyReader APIKeyReader

	// The hostport to use when connecting to the cloud operations API.
	// If not provided, the default hostport of `saas-api.tmprl.cloud:443` will be used.
	HostPort string

	// Allow the client to connect to the cloud operations API using an insecure connection.
	// This should only be used for testing purposes.
	AllowInsecure bool

	// The TLS configuration to use when connecting to the cloud operations API.
	// If not provided, a default TLS configuration will be used.
	// Will be ignored if AllowInsecure is set to true.
	TLSConfig *tls.Config

	// The API version to use when making requests to the cloud operations API.
	// If not provided, the latest API version  will be used.
	APIVersion string

	// Disable the default retry policy.
	// If not provided, the default retry policy will be used.
	// The default retry policy is an exponential backoff with jitter with a maximum of 7 retries for retriable errors.
	// The default retry policy will also set the operations id on the write requests, if not already set.
	// This is to ensure the write requests are idempotent in the case of a retry.
	DisableRetry bool

	// UserAgent product information to prepend to the user-agent header. Must follow RFC 9110.
	// If not provided, the user-agent header will contain product and version information for this SDK and grpc.
	UserAgent string

	// Add additional gRPC dial options.
	// This can be used to set custom timeouts, interceptors, etc.
	GRPCDialOptions []grpc.DialOption
}

Options to configure the cloud operations client. The minimum requirement is one of APIKey or APIKeyReader to be set. All other options are optional.

Jump to

Keyboard shortcuts

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