route53: allow custom client to be provided (#1050)

This commit is contained in:
Aidan Steele 2020-02-01 22:10:40 +11:00 committed by GitHub
parent ee33cff002
commit 87e770cc02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ type Config struct {
PropagationTimeout time.Duration PropagationTimeout time.Duration
PollingInterval time.Duration PollingInterval time.Duration
HostedZoneID string HostedZoneID string
Client *route53.Route53
} }
// NewDefaultConfig returns a default configuration for the DNSProvider // NewDefaultConfig returns a default configuration for the DNSProvider
@ -86,6 +87,10 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
return nil, errors.New("route53: the configuration of the Route53 DNS provider is nil") return nil, errors.New("route53: the configuration of the Route53 DNS provider is nil")
} }
if config.Client != nil {
return &DNSProvider{client: config.Client, config: config}, nil
}
retry := customRetryer{} retry := customRetryer{}
retry.NumMaxRetries = config.MaxRetries retry.NumMaxRetries = config.MaxRetries
sessionCfg := request.WithRetryer(aws.NewConfig(), retry) sessionCfg := request.WithRetryer(aws.NewConfig(), retry)