Documentation
¶
Index ¶
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// Region is the AWS Region to use. If not set, it will use AWS_REGION
// environment variable.
Region string `json:"region,omitempty"`
// AWSProfile is the AWS Profile to use. If not set, it will use
// AWS_PROFILE environment variable.
Profile string `json:"profile,omitempty"`
// AccessKeyId is the AWS Access Key ID to use. If not set, it will use
// AWS_ACCESS_KEY_ID
AccessKeyId string `json:"access_key_id,omitempty"` //nolint:revive,staticcheck // established public API, cannot change
// SecretAccessKey is the AWS Secret Access Key to use. If not set, it will use
// AWS_SECRET_ACCESS_KEY environment variable.
SecretAccessKey string `json:"secret_access_key,omitempty"`
// SessionToken is the AWS Session Token to use. If not set, it will use
// AWS_SESSION_TOKEN environment variable.
SessionToken string `json:"session_token,omitempty"`
// MaxRetries is the maximum number of retries to make when a request
// fails. If not set, it will use 5 retries.
MaxRetries int `json:"max_retries,omitempty"`
// Route53MaxWait is the maximum amount of time to wait for a record
// to be propagated within AWS infrastructure. Default is 1 minute.
Route53MaxWait time.Duration `json:"route53_max_wait,omitempty"`
// WaitForRoute53Sync if set to true, it will wait for the record to be
// propagated within AWS infrastructure before returning. This is not related
// to DNS propagation, that could take much longer.
WaitForRoute53Sync bool `json:"wait_for_route53_sync,omitempty"`
// SkipRoute53SyncOnDelete if set to true, it will skip waiting for Route53
// synchronization when deleting records, even if WaitForRoute53Sync is true.
// This can speed up bulk delete operations where waiting is not necessary.
SkipRoute53SyncOnDelete bool `json:"skip_route53_sync_on_delete,omitempty"`
// HostedZoneID is the ID of the hosted zone to use. If not set, it will
// be discovered from the zone name.
//
// This option should contain only the ID; the "/hostedzone/" prefix
// will be added automatically.
HostedZoneID string `json:"hosted_zone_id,omitempty"`
// Logger receives structured log events emitted by the provider. If nil,
// a discard handler is used. Wrappers (for example, the Caddy DNS module)
// can adapt their own logger via slog.Handler — for zap, see
// go.uber.org/zap/exp/zapslog.
//
// All events are emitted at Debug level except for ambiguous zone
// resolution, which is Warn.
Logger *slog.Logger `json:"-"`
// contains filtered or unexported fields
}
Provider implements the libdns interfaces for Route53.
By default, the provider loads the AWS configuration from the environment. To override these values, set the fields in the Provider struct.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the given records from the zone and returns the records that were actually deleted. Input records that do not exist in the zone are silently ignored.
As the libdns contract requires, an empty value or an empty type acts as a wildcard: an empty value matches every value in the targeted record set, and an empty type applies the deletion to every record type at that name. The zone's own SOA and NS record sets are never matched by an empty type, because Route53 does not allow deleting them.
TTL is not compared. Route53 keeps one TTL per record set rather than per value, so the TTL a caller holds for a record can legitimately differ from the stored one.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords sets the records in the zone. For each (name, type) tuple represented in the input, the corresponding ResourceRecordSet is replaced with exactly the values provided — other tuples in the zone are not touched. It returns the records that were set.
Multiple input records sharing the same (name, type) are combined into a single UPSERT carrying all their values, matching libdns semantics.