Skip to main content

FakeAws

Struct FakeAws 

Source
pub struct FakeAws {
    hosted_zone_id: String,
    state: Mutex<ZoneState>,
    credentials: Mutex<Option<(Arc<InstanceCredentials>, Arc<FakeImds>)>>,
}
Expand description

A Route53 hosted zone, in process.

Holds record sets, applies change batches atomically, paginates a listing, and takes each change through PENDING before INSYNC — a record set created by a change still in flight is in the zone, and is not in a listing, which is what makes “the publish waited” an observable fact rather than an internal one.

Fields§

§hosted_zone_id: String§state: Mutex<ZoneState>§credentials: Mutex<Option<(Arc<InstanceCredentials>, Arc<FakeImds>)>>

Implementations§

Source§

impl FakeAws

Source

pub fn new(hosted_zone_id: impl Into<String>) -> Arc<Self>

An empty hosted zone with AWS’s default 10,000 record-set quota, a 100-record listing page, and changes that are INSYNC as soon as they are accepted.

Source

pub fn hosted_zone_id(&self) -> &str

The hosted zone id this zone answers for.

Source

pub fn require_credentials( &self, credentials: Arc<InstanceCredentials>, imds: Arc<FakeImds>, )

Requires every request to carry a live credential from imds, and refuses one signed with a key id that has expired — Route53’s ExpiredTokenException.

Source

pub fn expire_credential_after(&self, calls: u64)

Expires the credential in hand once this many API calls have been served, so an operation already in flight is the thing that has to refresh. Requires Self::require_credentials.

Source

pub fn expire_credential(&self)

Expires the credential in hand right now: the holder reads instance metadata again on its next signature, and any request still carrying the old access key id is refused. Requires Self::require_credentials.

Source

pub fn set_pending_polls(&self, polls: u32)

How many GetChange polls a change answers PENDING to before it is INSYNC. Zero — the default — makes every change land as it is accepted.

Source

pub fn set_max_record_sets(&self, max: u64)

The zone’s record-set quota. A batch that would take the zone past it is refused whole, with LimitsExceeded.

Source

pub fn set_page_size(&self, size: usize)

How many record sets one ListResourceRecordSets page carries.

Source

pub fn throttle_next(&self, count: u32)

Answers the next count calls with Throttling.

Source

pub fn server_error_next(&self, count: u32)

Answers the next count calls with an HTTP 500.

Source

pub fn fail_next(&self, count: u32)

Drops the connection on the next count calls, before any response.

Source

pub fn seed(&self, name: &str, rtype: &str, ttl: u32, values: &[&str])

Puts a record set into the zone directly, visible immediately and without an API call — a zone that already held records when this process started.

Source

pub fn record_sets(&self) -> Vec<(String, String, Vec<String>)>

Every record set a listing would answer with, as (name, type, values), in zone order.

Source

pub fn holds(&self, name: &str, rtype: &str) -> bool

Whether the zone answers for name at rtype right now.

Source

pub fn record_set_count(&self) -> usize

Every record set the zone holds, listed or not — including one whose creating change has not reached INSYNC.

Source

pub fn calls(&self) -> Vec<(String, String)>

Every API call served, as (method, path).

Source

pub fn change_batches(&self) -> u64

How many ChangeResourceRecordSets requests the zone has been sent, counted before anything else — retries, throttled attempts and refusals included, which is what makes a duplicated write visible.

Source

fn guard(&self) -> MutexGuard<'_, ZoneState>

Source

fn check_credentials( &self, call_count: u64, expire_after: Option<u64>, ) -> Option<Response>

The credential check, run before any request is dispatched.

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