Struct ResourceName

Source
pub struct ResourceName {
    pub partition: Option<Identifier>,
    pub service: Identifier,
    pub region: Option<Identifier>,
    pub account_id: Option<AccountIdentifier>,
    pub resource: ResourceIdentifier,
}
Expand description

Amazon Resource Names (ResourceNames) uniquely identify AWS resources. We require an ResourceName when you need to specify a resource unambiguously across all of AWS, such as in IAM policies, Amazon Relational Database Service (Amazon RDS) tags, and API calls.

The following are the general formats for ResourceNames; the specific components and values used depend on the AWS service.

arn:partition:service:region:account-id:resource-id
arn:partition:service:region:account-id:resource-type/resource-id
arn:partition:service:region:account-id:resource-type:resource-id

From ResourceName Format

Fields§

§partition: Option<Identifier>

The partition that the resource is in. For standard AWS Regions, the partition is aws. If you have resources in other partitions, the partition is aws-partitionname. For example, the partition for resources in the China partition is aws-cn. The module known::partition provides common values as constants (if the known feature is enabled).

§service: Identifier

The service namespace that identifies the AWS. The module known::service provides

§region: Option<Identifier>

The Region that the resource resides in. The ResourceNames for some resources do not require a Region, so this component might be omitted. The module known::region provides common values as constants (if the known feature is enabled).

§account_id: Option<AccountIdentifier>

The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. The ResourceNames for some resources don’t require an account number, so this component may be omitted.

§resource: ResourceIdentifier

The content of this part of the ResourceName varies by service. A resource identifier can be the name or ID of the resource (for example, user/Bob or instance/i-1234567890abcdef0) or a resource path. For example, some resource identifiers include a parent resource (sub-resource-type/parent-resource/sub-resource) or a qualifier such as a version (resource-type:resource-name:qualifier).

Implementations§

Source§

impl ResourceName

Source

pub fn new(service: Identifier, resource: ResourceIdentifier) -> Self

Construct a minimal ResourceName value with simply a service and resource.

Source

pub fn aws(service: Identifier, resource: ResourceIdentifier) -> Self

Construct a minimal ResourceName value with simply a service and resource in the aws partition.

Source

pub fn has_variables(&self) -> bool

Return true if the identifier contains variables of the form ${name}, else false.

Source

pub fn replace_variables<V>( &self, context: &HashMap<String, V>, ) -> Result<Self, Error>
where V: Clone + Into<String>,

Replace any variables in the string with values from the context, returning a new value if the replacements result in a legal identifier string. The

Trait Implementations§

Source§

impl Clone for ResourceName

Source§

fn clone(&self) -> ResourceName

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ResourceName

Source§

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

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

impl<'de> Deserialize<'de> for ResourceName

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ResourceName

Source§

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

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

impl From<&mut ArnBuilder> for ResourceName

Source§

fn from(v: &mut ArnBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<AccountIdentifier> for ResourceName

Source§

fn from(account: AccountIdentifier) -> Self

Converts to this type from the input type.
Source§

impl From<ArnBuilder> for ResourceName

Source§

fn from(v: ArnBuilder) -> Self

Converts to this type from the input type.
Source§

impl FromStr for ResourceName

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Format:

  • arn:partition:service:region:account-id: | resource part |
Source§

type Err = Error

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

impl PartialEq for ResourceName

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ResourceName

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ResourceName

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,