Skip to content

Commit 1a8b054

Browse files
committed
Cleanup API, remove deprecation, stuff
1 parent 681e12e commit 1a8b054

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ aws ec2 run-instances \
102102

103103
For more information, see the [AWS EC2 Instance Metadata Options documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceMetadataOptionsRequest.html).
104104

105+
## Note on propagation-related fields
106+
107+
When you update records in AWS Route53, changes first propagate internally across AWS’s DNS servers before becoming visible to the public. This internal step usually finishes within seconds, but may take more in rare cases, and can be waited on when `WaitForPropagation` is enabled. *It is different from normal DNS propagation, which depends on TTL and external caching.*
108+
109+
See [Change Propagation to Route 53 DNS Servers](https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html#API_ChangeResourceRecordSets_RequestSyntax:~:text=Change%20Propagation%20to%20Route%2053%20DNS%20Servers).
110+
105111
## Contributing
106112

107113
Contributions are welcome! Please ensure that:

client.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ func (p *Provider) init(ctx context.Context) {
9292
p.MaxRetries = 5
9393
}
9494

95-
p.MaxWaitDur *= time.Second
96-
if p.MaxWaitDur == 0 {
97-
p.MaxWaitDur = time.Minute
95+
if p.MaxWaitDuration == 0 {
96+
p.MaxWaitDuration = time.Minute
9897
}
9998

10099
opts := make([]func(*config.LoadOptions) error, 0)
@@ -105,9 +104,6 @@ func (p *Provider) init(ctx context.Context) {
105104
)
106105

107106
profile := p.Profile
108-
if profile == "" {
109-
profile = p.AWSProfile
110-
}
111107

112108
if profile != "" {
113109
opts = append(opts, config.WithSharedConfigProfile(profile))
@@ -119,9 +115,6 @@ func (p *Provider) init(ctx context.Context) {
119115

120116
if p.AccessKeyId != "" && p.SecretAccessKey != "" {
121117
token := p.SessionToken
122-
if token == "" {
123-
token = p.Token
124-
}
125118

126119
opts = append(
127120
opts,
@@ -407,7 +400,7 @@ func (p *Provider) applyChange(ctx context.Context, input *r53.ChangeResourceRec
407400

408401
// Wait for the RecordSetChange status to be "INSYNC"
409402
waiter := r53.NewResourceRecordSetsChangedWaiter(p.client)
410-
err = waiter.Wait(ctx, changeInput, p.MaxWaitDur)
403+
err = waiter.Wait(ctx, changeInput, p.MaxWaitDuration)
411404
if err != nil {
412405
return err
413406
}

client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,15 @@ func TestMaxWaitDur(t *testing.T) {
376376
{
377377
name: "custom",
378378
input: 120,
379-
expected: 120 * time.Second,
379+
expected: 120,
380380
},
381381
}
382382

383383
for _, c := range cases {
384384
t.Run(c.name, func(t *testing.T) {
385-
provider := Provider{MaxWaitDur: c.input}
385+
provider := Provider{MaxWaitDuration: c.input}
386386
provider.init(context.TODO())
387-
actual := provider.MaxWaitDur
387+
actual := provider.MaxWaitDuration
388388
if actual != c.expected {
389389
t.Errorf("expected %d, got %d", c.expected, actual)
390390
}

provider.go

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ type Provider struct {
1919
// environment variable.
2020
Region string `json:"region,omitempty"`
2121

22-
// AWSProfile is the AWS Profile to use. If not set, it will use
23-
// AWS_PROFILE environment variable.
24-
//
25-
// Deprecated: Use Profile instead
26-
AWSProfile string `json:"aws_profile,omitempty"`
27-
2822
// AWSProfile is the AWS Profile to use. If not set, it will use
2923
// AWS_PROFILE environment variable.
3024
Profile string `json:"profile,omitempty"`
@@ -37,12 +31,6 @@ type Provider struct {
3731
// AWS_SECRET_ACCESS_KEY environment variable.
3832
SecretAccessKey string `json:"secret_access_key,omitempty"`
3933

40-
// Token is the AWS Session Token to use. If not set, it will use
41-
// AWS_SESSION_TOKEN environment variable.
42-
//
43-
// Deprecated: Use SessionToken instead.
44-
Token string `json:"token,omitempty"`
45-
4634
// SessionToken is the AWS Session Token to use. If not set, it will use
4735
// AWS_SESSION_TOKEN environment variable.
4836
SessionToken string `json:"session_token,omitempty"`
@@ -51,15 +39,16 @@ type Provider struct {
5139
// fails. If not set, it will use 5 retries.
5240
MaxRetries int `json:"max_retries,omitempty"`
5341

54-
// MaxWaitDur is the maximum amount of time in seconds to wait for a record
55-
// to be propagated. If not set, it will 1 minute.
56-
MaxWaitDur time.Duration `json:"max_wait_dur,omitempty"`
42+
// MaxWaitDuration is the maximum amount of time to wait for a record
43+
// to be propagated within AWS infrastructure. Default is 1 minute.
44+
MaxWaitDuration time.Duration `json:"max_wait_duration,omitempty"`
5745

5846
// WaitForPropagation if set to true, it will wait for the record to be
59-
// propagated before returning.
47+
// propagated within AWS infrastructure before returning. This is not related
48+
// to DNS propagation, that could take much longer.
6049
WaitForPropagation bool `json:"wait_for_propagation,omitempty"`
6150

62-
// hostedZoneID is the ID of the hosted zone to use. If not set, it will
51+
// HostedZoneID is the ID of the hosted zone to use. If not set, it will
6352
// be discovered from the zone name.
6453
//
6554
// This option should contain only the ID; the "/hostedzone/" prefix

0 commit comments

Comments
 (0)