Skip to content

Commit

Permalink
Add MaxRetries setting for aws sdk to be used by AWS AUTH credential
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen0 committed Feb 14, 2018
1 parent ebcc5a8 commit 9f52633
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/credential/aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (b *backend) getRawClientConfig(ctx context.Context, s logical.Storage, reg
}

endpoint := aws.String("")
var MaxRetries int
if config != nil {
// Override the default endpoint with the configured endpoint.
switch {
Expand All @@ -47,6 +48,7 @@ func (b *backend) getRawClientConfig(ctx context.Context, s logical.Storage, reg

credsConfig.AccessKey = config.AccessKey
credsConfig.SecretKey = config.SecretKey
MaxRetries = config.MaxRetries
}

credsConfig.HTTPClient = cleanhttp.DefaultClient()
Expand All @@ -65,6 +67,7 @@ func (b *backend) getRawClientConfig(ctx context.Context, s logical.Storage, reg
Region: aws.String(region),
HTTPClient: cleanhttp.DefaultClient(),
Endpoint: endpoint,
MaxRetries: aws.Int(MaxRetries),
}, nil
}

Expand Down
5 changes: 5 additions & 0 deletions builtin/credential/aws/path_config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func pathConfigClient(b *backend) *framework.Path {
Default: "",
Description: "Value to require in the X-Vault-AWS-IAM-Server-ID request header",
},
"max_retries": &framework.FieldSchema{
Type: framework.TypeInt,
Description: "Maximum number of retries for recoverable exceptions of AWS APIs",
},
},

ExistenceCheck: b.pathConfigClientExistenceCheck,
Expand Down Expand Up @@ -254,6 +258,7 @@ type clientConfig struct {
IAMEndpoint string `json:"iam_endpoint" structs:"iam_endpoint" mapstructure:"iam_endpoint"`
STSEndpoint string `json:"sts_endpoint" structs:"sts_endpoint" mapstructure:"sts_endpoint"`
IAMServerIdHeaderValue string `json:"iam_server_id_header_value" structs:"iam_server_id_header_value" mapstructure:"iam_server_id_header_value"`
MaxRetries int `json:"max_retries"`
}

const pathConfigClientHelpSyn = `
Expand Down

0 comments on commit 9f52633

Please sign in to comment.