aws

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAccessKeyID     = ""
	DefaultSecretAccessKey = ""
	DefaultToken           = ""
)

Variables

This section is empty.

Functions

func AttemptLoggerInitMiddleware

func AttemptLoggerInitMiddleware(logger log.Logger, backoff *exec.BackoffSettings) smithyMiddleware.InitializeMiddleware

func AttemptLoggerRetryMiddleware

func AttemptLoggerRetryMiddleware(logger log.Logger) smithyMiddleware.FinalizeMiddleware

func CheckConnectionError

func CheckConnectionError(_ interface{}, err error) exec.ErrorType

func CheckErrorRetryable

func CheckErrorRetryable(_ interface{}, err error) exec.ErrorType

func CheckErrorThrottle

func CheckErrorThrottle(_ interface{}, err error) exec.ErrorType

func CheckInvalidStatusError

func CheckInvalidStatusError(_ interface{}, err error) exec.ErrorType

func DefaultClientConfig

func DefaultClientConfig(ctx context.Context, config cfg.Config, logger log.Logger, clientConfig ClientConfigAware) (aws.Config, error)

func DefaultClientOptions

func DefaultClientOptions(ctx context.Context, config cfg.Config, logger log.Logger, clientConfig ClientConfigAware) ([]func(options *awsCfg.LoadOptions) error, error)

func DefaultClientRetryOptions

func DefaultClientRetryOptions(clientConfig ClientConfigAware) []func(*retry.StandardOptions)

func EndpointResolver

func EndpointResolver(url string) *endpointResolver

func GetAssumeRoleCredentialsProvider

func GetAssumeRoleCredentialsProvider(ctx context.Context, roleArn string) (aws.CredentialsProvider, error)

func GetClientConfigKey

func GetClientConfigKey(service string, name string) string

func GetCredentialsProvider

func GetCredentialsProvider(ctx context.Context, config cfg.Config, settings ClientSettings) (aws.CredentialsProvider, error)

func GetDefaultCredentials

func GetDefaultCredentials() *credentials.Credentials

GetDefaultCredentials provides you with credentials to use. In an integration test, you will get the credentials matching your environment or some static credentials if there are no credentials in your environment. Outside of tests, you get this implementation that tells the AWS SDK to use the default credentials (as if you didn't specify any credentials at all).

func IsAwsError

func IsAwsError(err error, awsCode string) bool

func IsAwsErrorCodeRequestCanceled

func IsAwsErrorCodeRequestCanceled(err error) bool

func IsConnectionError

func IsConnectionError(err error) bool

func IsInvalidStatusError

func IsInvalidStatusError(err error) bool

func LogNewClientCreated added in v0.11.2

func LogNewClientCreated(ctx context.Context, logger log.Logger, service string, clientName string, settings ClientSettings)

func RetryWithBackoff

func RetryWithBackoff(backoff retry.BackoffDelayer) func(*retry.StandardOptions)

func RetryWithMaxAttempts

func RetryWithMaxAttempts(maxAttempts int) func(*retry.StandardOptions)

func RetryWithMaxBackoff

func RetryWithMaxBackoff(maxBackoff time.Duration) func(*retry.StandardOptions)

func RetryWithRateLimiter

func RetryWithRateLimiter(rateLimiter retry.RateLimiter) func(options *retry.StandardOptions)

func RetryWithRetryables

func RetryWithRetryables(retryables []retry.IsErrorRetryable) func(options *retry.StandardOptions)

func UnmarshalClientSettings

func UnmarshalClientSettings(config cfg.Config, settings ClientSettingsAware, service string, name string)

func WithEndpoint

func WithEndpoint(url string) func(options *awsCfg.LoadOptions) error

Types

type BackoffDelayer

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

func NewBackoffDelayer

func NewBackoffDelayer(initialInterval time.Duration, maxInterval time.Duration) *BackoffDelayer

func (*BackoffDelayer) BackoffDelay

func (d *BackoffDelayer) BackoffDelay(attempt int, _ error) (time.Duration, error)

type BackoffExecutor

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

func (BackoffExecutor) Execute

func (b BackoffExecutor) Execute(ctx context.Context, f RequestFunction) (interface{}, error)

type ClientConfigAware

type ClientConfigAware interface {
	GetSettings() ClientSettings
	GetLoadOptions() []func(options *awsCfg.LoadOptions) error
	GetRetryOptions() []func(*retry.StandardOptions)
}

type ClientHttpSettings

type ClientHttpSettings struct {
	Timeout time.Duration `cfg:"timeout" default:"0"`
}

type ClientSettings

type ClientSettings struct {
	Region     string             `cfg:"region" default:"eu-central-1"`
	Endpoint   string             `cfg:"endpoint" default:"http://localhost:4566"`
	AssumeRole string             `cfg:"assume_role"`
	HttpClient ClientHttpSettings `cfg:"http_client"`
	Backoff    exec.BackoffSettings
}

func (*ClientSettings) LogFields added in v0.11.2

func (s *ClientSettings) LogFields() log.Fields

func (*ClientSettings) SetBackoff

func (s *ClientSettings) SetBackoff(backoff exec.BackoffSettings)

type ClientSettingsAware

type ClientSettingsAware interface {
	SetBackoff(backoff exec.BackoffSettings)
}

type Credentials

type Credentials struct {
	AccessKeyID     string `cfg:"access_key_id"`
	SecretAccessKey string `cfg:"secret_access_key"`
	SessionToken    string `cfg:"session_token"`
}

func UnmarshalCredentials

func UnmarshalCredentials(config cfg.Config) *Credentials

type DefaultExecutor

type DefaultExecutor struct{}

func (DefaultExecutor) Execute

func (e DefaultExecutor) Execute(ctx context.Context, f RequestFunction) (interface{}, error)

type Executor

type Executor interface {
	Execute(ctx context.Context, f RequestFunction) (interface{}, error)
}

func NewBackoffExecutor

func NewBackoffExecutor(logger log.Logger, res *exec.ExecutableResource, settings *exec.BackoffSettings, checks ...exec.ErrorChecker) Executor

func NewBackoffExecutorWithSender

func NewBackoffExecutorWithSender(logger log.Logger, res *exec.ExecutableResource, settings *exec.BackoffSettings, sender Sender, checks ...exec.ErrorChecker) Executor

func NewExecutor

func NewExecutor(logger log.Logger, res *exec.ExecutableResource, settings *exec.BackoffSettings, checks ...exec.ErrorChecker) Executor

type InvalidStatusError

type InvalidStatusError struct {
	Status int
}

func (*InvalidStatusError) As

func (e *InvalidStatusError) As(target interface{}) bool

func (*InvalidStatusError) Error

func (e *InvalidStatusError) Error() string

func (*InvalidStatusError) Is

func (e *InvalidStatusError) Is(err error) bool

type Logger

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

func NewLogger

func NewLogger(base log.Logger) *Logger

func (Logger) Logf

func (l Logger) Logf(classification logging.Classification, format string, v ...interface{})

func (Logger) WithContext

func (l Logger) WithContext(ctx context.Context) logging.Logger

type NopRateLimiter

type NopRateLimiter struct{}

func NewNopRateLimiter

func NewNopRateLimiter() NopRateLimiter

func (NopRateLimiter) AddTokens

func (n NopRateLimiter) AddTokens(_ uint) error

func (NopRateLimiter) GetToken

func (n NopRateLimiter) GetToken(_ context.Context, _ uint) (releaseToken func() error, err error)

type RequestFunction

type RequestFunction func() (*request.Request, interface{})

type Sender

type Sender func(req *request.Request) (*http.Response, error)

type TestExecution

type TestExecution struct {
	Output interface{}
	Err    error
}

type TestableExecutor

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

func NewTestableExecutor

func NewTestableExecutor(clientMock *mock.Mock, executions ...TestExecution) *TestableExecutor

func (*TestableExecutor) AssertExpectations

func (e *TestableExecutor) AssertExpectations(t *testing.T)

func (*TestableExecutor) Execute

func (e *TestableExecutor) Execute(_ context.Context, f RequestFunction) (interface{}, error)

func (*TestableExecutor) ExpectExecution

func (e *TestableExecutor) ExpectExecution(clientMethod string, input interface{}, output interface{}, err error)

Jump to

Keyboard shortcuts

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