Struct scratchstack_arn::Arn
source · [−]pub struct Arn { /* private fields */ }
Expand description
An Amazon Resource Name (ARN) representing an exact resource.
This is used to represent a known resource, such as an S3 bucket, EC2 instance, assumed role instance, etc. This is not used to represent resource statements in the IAM Aspen policy language, which may contain wildcards. For ARNs used to match resource statements, see ArnPattern.
Arn objects are immutable.
Implementations
sourceimpl Arn
impl Arn
sourcepub fn new(
partition: &str,
service: &str,
region: &str,
account_id: &str,
resource: &str
) -> Result<Self, ArnError>
pub fn new(
partition: &str,
service: &str,
region: &str,
account_id: &str,
resource: &str
) -> Result<Self, ArnError>
Create a new ARN from the specified components.
partition
- The partition the resource is in (required). This is usuallyaws
,aws-cn
, oraws-us-gov
for actual AWS resources, but may be any string meeting the rules specified in validate_partition for non-AWS resources.service
- The service the resource belongs to (required). This is a service name likeec2
ors3
. Non-AWS resources must conform to the naming rules specified in validate_service.region
- The region the resource is in (optional). If the resource is regional (and may other regions may have the resources with the same name), this is the region name. If the resource is global, this is empty.account_id
- The account ID the resource belongs to (optional). This is the 12-digit account ID or the stringaws
for certain AWS-owned resources. Some resources (such as S3 buckets and objects) do not need the account ID (the bucket name is globally unique within a partition), so this may be empty.resource
- The resource name (required). This is the name of the resource. The formatting is service-specific, but must be a valid UTF-8 string.
If any of the arguments are invalid, an ArnError is returned.
sourcepub fn account_id(&self) -> &str
pub fn account_id(&self) -> &str
Retrieve the account ID the resource belongs to.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Arn
impl<'de> Deserialize<'de> for Arn
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for Arn
impl Ord for Arn
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Arn> for Arn
impl PartialOrd<Arn> for Arn
sourcefn partial_cmp(&self, other: &Arn) -> Option<Ordering>
fn partial_cmp(&self, other: &Arn) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Arn
impl StructuralEq for Arn
impl StructuralPartialEq for Arn
Auto Trait Implementations
impl RefUnwindSafe for Arn
impl Send for Arn
impl Sync for Arn
impl Unpin for Arn
impl UnwindSafe for Arn
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more