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
impl FakeAws
Sourcepub fn new(hosted_zone_id: impl Into<String>) -> Arc<Self>
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.
Sourcepub fn hosted_zone_id(&self) -> &str
pub fn hosted_zone_id(&self) -> &str
The hosted zone id this zone answers for.
Sourcepub fn require_credentials(
&self,
credentials: Arc<InstanceCredentials>,
imds: Arc<FakeImds>,
)
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.
Sourcepub fn expire_credential_after(&self, calls: u64)
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.
Sourcepub fn expire_credential(&self)
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.
Sourcepub fn set_pending_polls(&self, polls: u32)
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.
Sourcepub fn set_max_record_sets(&self, max: u64)
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.
Sourcepub fn set_page_size(&self, size: usize)
pub fn set_page_size(&self, size: usize)
How many record sets one ListResourceRecordSets page carries.
Sourcepub fn throttle_next(&self, count: u32)
pub fn throttle_next(&self, count: u32)
Answers the next count calls with Throttling.
Sourcepub fn server_error_next(&self, count: u32)
pub fn server_error_next(&self, count: u32)
Answers the next count calls with an HTTP 500.
Sourcepub fn fail_next(&self, count: u32)
pub fn fail_next(&self, count: u32)
Drops the connection on the next count calls, before any response.
Sourcepub fn seed(&self, name: &str, rtype: &str, ttl: u32, values: &[&str])
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.
Sourcepub fn record_sets(&self) -> Vec<(String, String, Vec<String>)>
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.
Sourcepub fn holds(&self, name: &str, rtype: &str) -> bool
pub fn holds(&self, name: &str, rtype: &str) -> bool
Whether the zone answers for name at rtype right now.
Sourcepub fn record_set_count(&self) -> usize
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.
Sourcepub fn change_batches(&self) -> u64
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.