Skip to main content

Region

Enum Region 

Source
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

👎Deprecated since 1.3.0:

use Region::US_EAST_1; Region’s variants go no earlier than 2.0.0 (#743)

§

UsEast2

👎Deprecated since 1.3.0:

use Region::US_EAST_2; Region’s variants go no earlier than 2.0.0 (#743)

§

UsWest2

👎Deprecated since 1.3.0:

use Region::US_WEST_2; Region’s variants go no earlier than 2.0.0 (#743)

§

EuWest1

👎Deprecated since 1.3.0:

use Region::EU_WEST_1; Region’s variants go no earlier than 2.0.0 (#743)

§

ApNortheast1

👎Deprecated since 1.3.0:

use Region::AP_NORTHEAST_1; Region’s variants go no earlier than 2.0.0 (#743)

§

Unlisted(String)

👎Deprecated since 1.3.0:

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

Source

pub const US_EAST_1: Region = Region::UsEast1

Source

pub const US_EAST_2: Region = Region::UsEast2

Source

pub const US_WEST_2: Region = Region::UsWest2

Source

pub const EU_WEST_1: Region = Region::EuWest1

Source

pub const AP_NORTHEAST_1: Region = Region::ApNortheast1

Source§

impl Region

Source

pub fn as_str(&self) -> &str

The wire spelling, which is also the endpoint’s middle segment.

Source

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.

Source

pub 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)

Whether this is one of the five named regions.

Source

pub fn unlisted(name: impl Into<String>) -> Region

👎Deprecated since 1.3.0:

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.

Source

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§

Source§

impl Clone for Region

Source§

fn clone(&self) -> Region

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Region

Source§

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

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

impl Display for Region

Source§

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

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

impl Eq for Region

Source§

impl FromStr for Region

Source§

fn from_str(name: &str) -> Result<Region, Error>

Parses any well-formed region name, and refuses a malformed one.

A named region’s name comes back equal to its constant.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl Hash for Region

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Region

Source§

fn eq(&self, other: &Region) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Region

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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