pub enum Region {
UsEast1,
UsEast2,
UsWest2,
EuWest1,
ApNortheast1,
Unlisted(String),
}Expand description
An AWS region, by its name.
Built by parsing ("eu-central-1".parse::<Region>()), from the environment
(Region::from_env), or from a constant (Region::US_EAST_1). Equality is by name,
so a parsed "us-east-1" equals the constant. Read a region with Region::as_str
rather than matching on its variants, which are deprecated (see the module docs).
Variants§
UsEast1
use Region::US_EAST_1; Region’s variants go no earlier than 2.0.0 (#743)
UsEast2
use Region::US_EAST_2; Region’s variants go no earlier than 2.0.0 (#743)
UsWest2
use Region::US_WEST_2; Region’s variants go no earlier than 2.0.0 (#743)
EuWest1
use Region::EU_WEST_1; Region’s variants go no earlier than 2.0.0 (#743)
ApNortheast1
use Region::AP_NORTHEAST_1; Region’s variants go no earlier than 2.0.0 (#743)
Unlisted(String)
parse the name with name.parse::<Region>() and read it with as_str; Region’s variants go no earlier than 2.0.0 (#743)
Any region outside the five above, by name.
Since 1.3.0 every well-formed name outside the five parses to this, whether or not
AWS was measured running MicroVMs there; Region::is_measured says which.
Implementations§
Source§impl Region
impl Region
Sourcepub fn is_measured(&self) -> bool
pub fn is_measured(&self) -> bool
Whether AWS was measured running MicroVMs here: membership in MEASURED_REGIONS.
False means unmeasured, not refused. The region still works when AWS runs MicroVMs
there; what it changes is what a null-message AccessDeniedException there most
likely means.
Sourcepub fn is_supported(&self) -> bool
👎Deprecated since 1.3.0: AWS runs MicroVMs in more regions than the five named ones: use is_measured (#743)
pub fn is_supported(&self) -> bool
AWS runs MicroVMs in more regions than the five named ones: use is_measured (#743)
Whether this is one of the five named regions.
Sourcepub fn unlisted(name: impl Into<String>) -> Region
👎Deprecated since 1.3.0: every well-formed region name parses: use name.parse::<Region>()
pub fn unlisted(name: impl Into<String>) -> Region
every well-formed region name parses: use name.parse::<Region>()
A region by name, without the shape check.
Every well-formed name parses since 1.3.0, so this is str::parse without its
refusal of a malformed name. A named region’s name comes back as its constant, so
unlisted("us-east-1") == Region::US_EAST_1.
Sourcepub fn from_env(env: &dyn Fn(&str) -> Option<String>) -> Result<Region, Error>
pub fn from_env(env: &dyn Fn(&str) -> Option<String>) -> Result<Region, Error>
The region the environment names: $AWS_REGION, then $AWS_DEFAULT_REGION, then
us-east-1.
Parsed rather than accepted, because an environment variable is where a stray space
or a case change arrives. env is a lookup rather than std::env::var so a caller
(and a test) decides where the variables come from. The CLI’s region resolution and
microvms_core::preflight::preflight both read it here.
Trait Implementations§
impl Eq for Region
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