chore: upgrade dependencies

This commit is contained in:
2022-06-09 12:30:53 +02:00
parent 7203f3d6a1
commit dcb93ec8f7
518 changed files with 27809 additions and 3222 deletions

View File

@@ -18,7 +18,8 @@ import (
// LoadOptionsFunc is a type alias for LoadOptions functional option
type LoadOptionsFunc func(*LoadOptions) error
// LoadOptions are discrete set of options that are valid for loading the configuration
// LoadOptions are discrete set of options that are valid for loading the
// configuration
type LoadOptions struct {
// Region is the region to send requests to.
@@ -30,12 +31,36 @@ type LoadOptions struct {
// HTTPClient the SDK's API clients will use to invoke HTTP requests.
HTTPClient HTTPClient
// EndpointResolver that can be used to provide or override an endpoint for the given
// service and region Please see the `aws.EndpointResolver` documentation on usage.
// EndpointResolver that can be used to provide or override an endpoint for
// the given service and region.
//
// See the `aws.EndpointResolver` documentation on usage.
//
// Deprecated: See EndpointResolverWithOptions
EndpointResolver aws.EndpointResolver
// Retryer is a function that provides a Retryer implementation. A Retryer guides how HTTP requests should be
// retried in case of recoverable failures.
// EndpointResolverWithOptions that can be used to provide or override an
// endpoint for the given service and region.
//
// See the `aws.EndpointResolverWithOptions` documentation on usage.
EndpointResolverWithOptions aws.EndpointResolverWithOptions
// RetryMaxAttempts specifies the maximum number attempts an API client
// will call an operation that fails with a retryable error.
//
// This value will only be used if Retryer option is nil.
RetryMaxAttempts int
// RetryMode specifies the retry model the API client will be created with.
//
// This value will only be used if Retryer option is nil.
RetryMode aws.RetryMode
// Retryer is a function that provides a Retryer implementation. A Retryer
// guides how HTTP requests should be retried in case of recoverable
// failures.
//
// If not nil, RetryMaxAttempts, and RetryMode will be ignored.
Retryer func() aws.Retryer
// APIOptions provides the set of middleware mutations modify how the API
@@ -46,51 +71,63 @@ type LoadOptions struct {
// Logger writer interface to write logging messages to.
Logger logging.Logger
// ClientLogMode is used to configure the events that will be sent to the configured logger.
// This can be used to configure the logging of signing, retries, request, and responses
// of the SDK clients.
// ClientLogMode is used to configure the events that will be sent to the
// configured logger. This can be used to configure the logging of signing,
// retries, request, and responses of the SDK clients.
//
// See the ClientLogMode type documentation for the complete set of logging modes and available
// configuration.
// See the ClientLogMode type documentation for the complete set of logging
// modes and available configuration.
ClientLogMode *aws.ClientLogMode
// SharedConfigProfile is the profile to be used when loading the SharedConfig
SharedConfigProfile string
// SharedConfigFiles is the slice of custom shared config files to use when loading the SharedConfig.
// A non-default profile used within config file must have name defined with prefix 'profile '.
// eg [profile xyz] indicates a profile with name 'xyz'.
// To read more on the format of the config file, please refer the documentation at
// SharedConfigFiles is the slice of custom shared config files to use when
// loading the SharedConfig. A non-default profile used within config file
// must have name defined with prefix 'profile '. eg [profile xyz]
// indicates a profile with name 'xyz'. To read more on the format of the
// config file, please refer the documentation at
// https://docs.aws.amazon.com/credref/latest/refdocs/file-format.html#file-format-config
//
// If duplicate profiles are provided within the same, or across multiple shared config files, the next parsed
// profile will override only the properties that conflict with the previously defined profile.
// Note that if duplicate profiles are provided within the SharedCredentialsFiles and SharedConfigFiles,
// the properties defined in shared credentials file take precedence.
// If duplicate profiles are provided within the same, or across multiple
// shared config files, the next parsed profile will override only the
// properties that conflict with the previously defined profile. Note that
// if duplicate profiles are provided within the SharedCredentialsFiles and
// SharedConfigFiles, the properties defined in shared credentials file
// take precedence.
SharedConfigFiles []string
// SharedCredentialsFile is the slice of custom shared credentials files to use when loading the SharedConfig.
// The profile name used within credentials file must not prefix 'profile '.
// eg [xyz] indicates a profile with name 'xyz'. Profile declared as [profile xyz] will be ignored.
// To read more on the format of the credentials file, please refer the documentation at
// SharedCredentialsFile is the slice of custom shared credentials files to
// use when loading the SharedConfig. The profile name used within
// credentials file must not prefix 'profile '. eg [xyz] indicates a
// profile with name 'xyz'. Profile declared as [profile xyz] will be
// ignored. To read more on the format of the credentials file, please
// refer the documentation at
// https://docs.aws.amazon.com/credref/latest/refdocs/file-format.html#file-format-creds
//
// If duplicate profiles are provided with a same, or across multiple shared credentials files, the next parsed
// profile will override only properties that conflict with the previously defined profile.
// Note that if duplicate profiles are provided within the SharedCredentialsFiles and SharedConfigFiles,
// the properties defined in shared credentials file take precedence.
// If duplicate profiles are provided with a same, or across multiple
// shared credentials files, the next parsed profile will override only
// properties that conflict with the previously defined profile. Note that
// if duplicate profiles are provided within the SharedCredentialsFiles and
// SharedConfigFiles, the properties defined in shared credentials file
// take precedence.
SharedCredentialsFiles []string
// CustomCABundle is CA bundle PEM bytes reader
CustomCABundle io.Reader
// DefaultRegion is the fall back region, used if a region was not resolved from other sources
// DefaultRegion is the fall back region, used if a region was not resolved
// from other sources
DefaultRegion string
// UseEC2IMDSRegion indicates if SDK should retrieve the region
// from the EC2 Metadata service
UseEC2IMDSRegion *UseEC2IMDSRegion
// CredentialsCacheOptions is a function for setting the
// aws.CredentialsCacheOptions
CredentialsCacheOptions func(*aws.CredentialsCacheOptions)
// ProcessCredentialOptions is a function for setting
// the processcreds.Options
ProcessCredentialOptions func(*processcreds.Options)
@@ -132,10 +169,12 @@ type LoadOptions struct {
// AWS_EC2_METADATA_DISABLED=true
EC2IMDSClientEnableState imds.ClientEnableState
// Specifies the EC2 Instance Metadata Service default endpoint selection mode (IPv4 or IPv6)
// Specifies the EC2 Instance Metadata Service default endpoint selection
// mode (IPv4 or IPv6)
EC2IMDSEndpointMode imds.EndpointModeState
// Specifies the EC2 Instance Metadata Service endpoint to use. If specified it overrides EC2IMDSEndpointMode.
// Specifies the EC2 Instance Metadata Service endpoint to use. If
// specified it overrides EC2IMDSEndpointMode.
EC2IMDSEndpoint string
// Specifies that SDK clients must resolve a dual-stack endpoint for
@@ -145,6 +184,40 @@ type LoadOptions struct {
// Specifies that SDK clients must resolve a FIPS endpoint for
// services.
UseFIPSEndpoint aws.FIPSEndpointState
// Specifies the SDK configuration mode for defaults.
DefaultsModeOptions DefaultsModeOptions
}
func (o LoadOptions) getDefaultsMode(ctx context.Context) (aws.DefaultsMode, bool, error) {
if len(o.DefaultsModeOptions.Mode) == 0 {
return "", false, nil
}
return o.DefaultsModeOptions.Mode, true, nil
}
// GetRetryMaxAttempts returns the RetryMaxAttempts if specified in the
// LoadOptions and not 0.
func (o LoadOptions) GetRetryMaxAttempts(ctx context.Context) (int, bool, error) {
if o.RetryMaxAttempts == 0 {
return 0, false, nil
}
return o.RetryMaxAttempts, true, nil
}
// GetRetryMode returns the RetryMode specified in the LoadOptions.
func (o LoadOptions) GetRetryMode(ctx context.Context) (aws.RetryMode, bool, error) {
if len(o.RetryMode) == 0 {
return "", false, nil
}
return o.RetryMode, true, nil
}
func (o LoadOptions) getDefaultsModeIMDSClient(ctx context.Context) (*imds.Client, bool, error) {
if o.DefaultsModeOptions.IMDSClient == nil {
return nil, false, nil
}
return o.DefaultsModeOptions.IMDSClient, true, nil
}
// getRegion returns Region from config's LoadOptions
@@ -355,6 +428,29 @@ func WithCredentialsProvider(v aws.CredentialsProvider) LoadOptionsFunc {
}
}
// getCredentialsCacheOptionsProvider returns the wrapped function to set aws.CredentialsCacheOptions
func (o LoadOptions) getCredentialsCacheOptions(ctx context.Context) (func(*aws.CredentialsCacheOptions), bool, error) {
if o.CredentialsCacheOptions == nil {
return nil, false, nil
}
return o.CredentialsCacheOptions, true, nil
}
// WithCredentialsCacheOptions is a helper function to construct functional
// options that sets a function to modify the aws.CredentialsCacheOptions the
// aws.CredentialsCache will be configured with, if the CredentialsCache is used
// by the configuration loader.
//
// If multiple WithCredentialsCacheOptions calls are made, the last call
// overrides the previous call values.
func WithCredentialsCacheOptions(v func(*aws.CredentialsCacheOptions)) LoadOptionsFunc {
return func(o *LoadOptions) error {
o.CredentialsCacheOptions = v
return nil
}
}
// getProcessCredentialOptions returns the wrapped function to set processcreds.Options
func (o LoadOptions) getProcessCredentialOptions(ctx context.Context) (func(*processcreds.Options), bool, error) {
if o.ProcessCredentialOptions == nil {
@@ -505,6 +601,48 @@ func WithAPIOptions(v []func(*middleware.Stack) error) LoadOptionsFunc {
}
}
func (o LoadOptions) getRetryMaxAttempts(ctx context.Context) (int, bool, error) {
if o.RetryMaxAttempts == 0 {
return 0, false, nil
}
return o.RetryMaxAttempts, true, nil
}
// WithRetryMaxAttempts is a helper function to construct functional options that sets
// RetryMaxAttempts on LoadOptions. If RetryMaxAttempts is unset, the RetryMaxAttempts value is
// ignored. If multiple WithRetryMaxAttempts calls are made, the last call overrides
// the previous call values.
//
// Will be ignored of LoadOptions.Retryer or WithRetryer are used.
func WithRetryMaxAttempts(v int) LoadOptionsFunc {
return func(o *LoadOptions) error {
o.RetryMaxAttempts = v
return nil
}
}
func (o LoadOptions) getRetryMode(ctx context.Context) (aws.RetryMode, bool, error) {
if o.RetryMode == "" {
return "", false, nil
}
return o.RetryMode, true, nil
}
// WithRetryMode is a helper function to construct functional options that sets
// RetryMode on LoadOptions. If RetryMode is unset, the RetryMode value is
// ignored. If multiple WithRetryMode calls are made, the last call overrides
// the previous call values.
//
// Will be ignored of LoadOptions.Retryer or WithRetryer are used.
func WithRetryMode(v aws.RetryMode) LoadOptionsFunc {
return func(o *LoadOptions) error {
o.RetryMode = v
return nil
}
}
func (o LoadOptions) getRetryer(ctx context.Context) (func() aws.Retryer, bool, error) {
if o.Retryer == nil {
return nil, false, nil
@@ -533,9 +671,11 @@ func (o LoadOptions) getEndpointResolver(ctx context.Context) (aws.EndpointResol
}
// WithEndpointResolver is a helper function to construct functional options
// that sets endpoint resolver on LoadOptions. The EndpointResolver is set to nil,
// that sets the EndpointResolver on LoadOptions. If the EndpointResolver is set to nil,
// the EndpointResolver value is ignored. If multiple WithEndpointResolver calls
// are made, the last call overrides the previous call values.
//
// Deprecated: See WithEndpointResolverWithOptions
func WithEndpointResolver(v aws.EndpointResolver) LoadOptionsFunc {
return func(o *LoadOptions) error {
o.EndpointResolver = v
@@ -543,6 +683,25 @@ func WithEndpointResolver(v aws.EndpointResolver) LoadOptionsFunc {
}
}
func (o LoadOptions) getEndpointResolverWithOptions(ctx context.Context) (aws.EndpointResolverWithOptions, bool, error) {
if o.EndpointResolverWithOptions == nil {
return nil, false, nil
}
return o.EndpointResolverWithOptions, true, nil
}
// WithEndpointResolverWithOptions is a helper function to construct functional options
// that sets the EndpointResolverWithOptions on LoadOptions. If the EndpointResolverWithOptions is set to nil,
// the EndpointResolver value is ignored. If multiple WithEndpointResolver calls
// are made, the last call overrides the previous call values.
func WithEndpointResolverWithOptions(v aws.EndpointResolverWithOptions) LoadOptionsFunc {
return func(o *LoadOptions) error {
o.EndpointResolverWithOptions = v
return nil
}
}
func (o LoadOptions) getLogger(ctx context.Context) (logging.Logger, bool, error) {
if o.Logger == nil {
return nil, false, nil
@@ -748,3 +907,20 @@ func (o LoadOptions) GetUseFIPSEndpoint(ctx context.Context) (value aws.FIPSEndp
}
return o.UseFIPSEndpoint, true, nil
}
// WithDefaultsMode sets the SDK defaults configuration mode to the value provided.
//
// Zero or more functional options can be provided to provide configuration options for performing
// environment discovery when using aws.DefaultsModeAuto.
func WithDefaultsMode(mode aws.DefaultsMode, optFns ...func(options *DefaultsModeOptions)) LoadOptionsFunc {
do := DefaultsModeOptions{
Mode: mode,
}
for _, fn := range optFns {
fn(&do)
}
return func(options *LoadOptions) error {
options.DefaultsModeOptions = do
return nil
}
}