Skip to main content

Route53Dns

Struct Route53Dns 

Source
pub struct Route53Dns {
    zone: String,
    hosted_zone_id: String,
    transport: Box<dyn Transport>,
    retry: RetryPolicy,
    wait_for_propagation: bool,
    propagation_timeout: Duration,
    poll_interval: Duration,
    ttl: u32,
    txt_ttl: u32,
    txt: TxtRecords,
    caa: CaaRecords,
}
Expand description

The production DnsProvider: writes and removes the TXT and CAA records in one Route53 hosted zone. See the module docs for the operating rules — propagation, retries, quotas and the credential’s scope.

Fields§

§zone: String§hosted_zone_id: String§transport: Box<dyn Transport>§retry: RetryPolicy§wait_for_propagation: bool§propagation_timeout: Duration§poll_interval: Duration§ttl: u32

The TTL on the CAA record this provider writes, matching the address records beside it at the apex.

§txt_ttl: u32

The TTL on the TXT records this provider writes. Short, because an ACME DNS-01 challenge value is only needed for the length of one validation and a short TTL keeps a withdrawn or replaced value from lingering in downstream caches.

§txt: TxtRecords§caa: CaaRecords

Implementations§

Source§

impl Route53Dns

Source

pub fn new( zone: impl Into<String>, hosted_zone_id: impl Into<String>, credentials: Arc<InstanceCredentials>, ) -> Self

A provider for zone, writing to hosted zone hosted_zone_id, over the real network.

Starts with empty local bookkeeping — the same starting state every provider in this crate has. Every write this provider makes is an UPSERT of the whole set it holds for a name, so a value the zone carries from a previous process is replaced by the first publish at that name rather than added to.

Source

pub(crate) fn with_transport( zone: impl Into<String>, hosted_zone_id: impl Into<String>, transport: Box<dyn Transport>, ) -> Self

Source

pub fn with_retry_policy(self, retry: RetryPolicy) -> Self

Overrides the retry policy for throttled or transient failures.

Source

pub fn with_propagation_wait(self, wait: bool) -> Self

Whether DnsProvider::publish_txt waits for the change to reach INSYNC before returning. Default true; see the module docs for why that is the honest default. Turning it off trades that guarantee for lower publish latency.

Source

pub fn with_propagation_timeout(self, timeout: Duration) -> Self

How long DnsProvider::publish_txt will wait for INSYNC before giving up and returning DnsError::Backend. Default 30 seconds.

Source

pub fn with_poll_interval(self, interval: Duration) -> Self

How long DnsProvider::publish_txt waits between GetChange polls while a change is PENDING. Default 500 milliseconds.

A Route53 change reaches INSYNC in tens of seconds, so the default is sized for that rather than for how fast a caller can learn the answer. Lowering it costs one API call per poll.

Source

pub fn accepts(&self, host: &str) -> bool

Whether host is under this provider’s zone.

A deployment answers this zone with a single-label wildcard DNS record (*.<zone>), and RFC 1034 wildcards match exactly one label. So host must be the zone itself (the apex, for CAA) or exactly one label below it (_acme-challenge.<zone>) — never two or more.

Source

fn check(&self, host: &str) -> Result<(), DnsError>

Source

fn backend_error(&self, host: &str, message: String) -> DnsError

Source

fn call_with_retry( &self, method: &str, path: &str, query: &[(String, String)], body: String, host_for_errors: &str, ) -> Result<String, DnsError>

Issues one API call, retrying on throttling or a server error per Self::retry.

Source

fn classify(&self, host: &str, status: u16, message: &str) -> DnsError

Maps a non-retried API error to the right DnsError variant.

Source

fn await_propagation(&self, change_id: &str) -> Result<(), DnsError>

Polls GetChange until change_id reaches INSYNC, or gives up after Self::propagation_timeout.

Source

fn submit_change( &self, host: &str, action: &str, rtype: &str, ttl: u32, values: &[String], ) -> Result<String, DnsError>

Trait Implementations§

Source§

impl Debug for Route53Dns

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DnsProvider for Route53Dns

Source§

fn name(&self) -> &str

Short stable identifier for this provider, used in log fields.
Source§

fn publish_txt(&self, host: &str, value: &str) -> Result<(), DnsError>

Adds value to the set of TXT values published at host, leaving any other values at that name untouched. Read more
Source§

fn withdraw_txt(&self, host: &str, value: &str) -> Result<(), DnsError>

Removes one TXT value at host, leaving any other values at that name untouched. Read more
Source§

fn txt_values(&self, host: &str) -> Vec<String>

Every TXT value currently published at host, sorted. Read more
Source§

fn publish_caa(&self, host: &str, values: &[CaaValue]) -> Result<(), DnsError>

Replaces the CAA record set at host with exactly values, removing the record entirely when values is empty. Read more
Source§

fn caa_values(&self, host: &str) -> Vec<CaaValue>

Every CAA value currently published at host, sorted. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more