awsutil

package
v0.0.0-...-69a3ef4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package awsutil provide common helper utilities to interact with AWS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAPILogMessage

func MakeAPILogMessage(op string, in interface{}) message.Fields

MakeAPILogMessage creates a message to log information about an API call.

Types

type BaseClient

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

BaseClient provides various helpers to set up and use AWS clients for various services.

func NewBaseClient

func NewBaseClient(opts ClientOptions) BaseClient

NewBaseClient creates a new base AWS client from the client options.

func (*BaseClient) Close

func (c *BaseClient) Close(ctx context.Context) error

Close closes the client and cleans up its resources.

func (*BaseClient) GetConfig

func (c *BaseClient) GetConfig(ctx context.Context) (*aws.Config, error)

GetConfig ensures that the config is initialized and returns it.

func (*BaseClient) GetRetryOptions

func (c *BaseClient) GetRetryOptions() utility.RetryOptions

GetRetryOptions returns the retry options for the client.

type ClientOptions

type ClientOptions struct {
	// CredsProvider is a credentials provider, which may be used to either connect to
	// the AWS API directly, or authenticate to STS to retrieve temporary
	// credentials to access the API (if Role is specified).
	CredsProvider aws.CredentialsProvider
	// Role is the STS role that should be used to perform authorized actions.
	// If specified, Creds will be used to retrieve temporary credentials from
	// STS.
	Role *string
	// Region is the geographical region where API calls should be made.
	Region *string
	// RetryOpts sets the retry policy for API requests.
	RetryOpts *utility.RetryOptions
	// HTTPClient is the HTTP client to use to make requests.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

ClientOptions represent AWS client options such as authentication and making requests.

func NewClientOptions

func NewClientOptions() *ClientOptions

NewClientOptions returns new unconfigured client options.

func (*ClientOptions) Close

func (o *ClientOptions) Close()

Close cleans up the HTTP client if it is owned by this client.

func (*ClientOptions) GetConfig

func (o *ClientOptions) GetConfig(ctx context.Context) (*aws.Config, error)

GetConfig gets the authenticated config to perform authorized API actions.

func (*ClientOptions) GetCredentialsProvider

func (o *ClientOptions) GetCredentialsProvider(ctx context.Context) (aws.CredentialsProvider, error)

GetCredentialsProvider retrieves the appropriate credentials provider to use for the client.

func (*ClientOptions) SetCredentialsProvider

func (o *ClientOptions) SetCredentialsProvider(creds aws.CredentialsProvider) *ClientOptions

SetCredentialsProvider sets the client's credentials provider.

func (*ClientOptions) SetHTTPClient

func (o *ClientOptions) SetHTTPClient(hc *http.Client) *ClientOptions

SetHTTPClient sets the HTTP client to use.

func (*ClientOptions) SetRegion

func (o *ClientOptions) SetRegion(region string) *ClientOptions

SetRegion sets the client's geographical region.

func (*ClientOptions) SetRetryOptions

func (o *ClientOptions) SetRetryOptions(opts utility.RetryOptions) *ClientOptions

SetRetryOptions sets the client's retry options.

func (*ClientOptions) SetRole

func (o *ClientOptions) SetRole(role string) *ClientOptions

SetRole sets the client's role to assume.

func (*ClientOptions) Validate

func (o *ClientOptions) Validate() error

Validate sets defaults for unspecified options.

Jump to

Keyboard shortcuts

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