pub enum Region {
UsEast1,
UsEast2,
UsWest2,
EuWest1,
ApNortheast1,
Unlisted(String),
}Expand description
An AWS region, closed over the five that run MicroVMs plus a named escape hatch.
See the module docs for why the five are an enum. Region::Unlisted is
deliberately a variant rather than a hidden flag: a reader of a call site can
see that someone opted into the trap, and a match over regions cannot forget
the case exists.
Variants§
UsEast1
UsEast2
UsWest2
EuWest1
ApNortheast1
Unlisted(String)
A region this client has not seen carry MicroVMs.
You are opting into the null-message trap. If this region does not run
MicroVMs, the first control-plane call answers AccessDeniedException with a
null message and you will spend the next hour reading an IAM policy that is
correct. Constructible only through Region::unlisted, which says so at
the call site.
It exists because AWS adds regions faster than this list is re-read, and a client that refuses a region AWS has just launched in is its own kind of wrong. The override costs exactly the diagnostic above.
Implementations§
Source§impl Region
impl Region
Sourcepub fn unlisted(name: impl Into<String>) -> Region
pub fn unlisted(name: impl Into<String>) -> Region
Opts into a region this client has not seen carry MicroVMs.
This is the escape hatch, and it costs you the diagnostic. If the region
does not run MicroVMs, the first control-plane call answers
AccessDeniedException with a null message field, which reads as a genuine
IAM denial (docs/PLATFORM.md, “Calling an unpriced region returns
AccessDeniedException with a null message”). Use it when AWS has launched
MicroVMs somewhere new, and add the region to MICROVM_REGIONS in the same
change.
A supported name passed here comes back as its proper variant rather than as
Region::Unlisted, so unlisted("us-east-1") == Region::UsEast1 and
nothing downstream has to handle two spellings of one region.
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether this is one of the five, rather than an opted-into unlisted name.
Trait Implementations§
impl Eq for Region
Source§impl FromStr for Region
impl FromStr for Region
Source§fn from_str(name: &str) -> Result<Region, Error>
fn from_str(name: &str) -> Result<Region, Error>
Parses one of the five, and refuses everything else.
The refusal is the point: this is the boundary a region name arrives at from
a CLI flag or an environment variable, where it is still a string and the
enum cannot help. A caller who genuinely wants a sixth region reaches for
Region::unlisted and says so.
impl StructuralPartialEq for Region
Auto Trait Implementations§
impl Freeze for Region
impl RefUnwindSafe for Region
impl Send for Region
impl Sync for Region
impl Unpin for Region
impl UnsafeUnpin for Region
impl UnwindSafe for Region
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more