Struct scratchstack_aspen::ResourceArn
source · [−]pub struct ResourceArn { /* private fields */ }
Expand description
An Amazon Resource Name (ARN) statement in an IAM Aspen policy.
This is used to match scratchstack_arn::Arn objects from a resource statement in the IAM Aspen policy language. For example,
an ResourceArn created from arn:aws*:ec2:us-*-?:123456789012:instance/i-*
would match the following Arn
objects:
arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0
arn:aws-us-gov:ec2:us-west-2:123456789012:instance/i-1234567890abcdef0
Patterns are similar to glob statements with a few differences:
- The
*
character matches any number of characters, including none, within a single segment of the ARN. - The
?
character matches any single character within a single segment of the ARN.
ResourceArn objects are immutable.
Implementations
sourceimpl ResourceArn
impl ResourceArn
sourcepub fn new(
partition: &str,
service: &str,
region: &str,
account_id: &str,
resource: &str
) -> Self
pub fn new(
partition: &str,
service: &str,
region: &str,
account_id: &str,
resource: &str
) -> Self
Create a new ARN pattern from the specified components.
partition
- The partition the resource is in.service
- The service the resource belongs to.region
- The region the resource is in.account_id
- The account ID the resource belongs to.resource
- The resource name.
sourcepub fn partition_pattern(&self) -> &str
pub fn partition_pattern(&self) -> &str
Retrieve the partition string pattern.
sourcepub fn service_pattern(&self) -> &str
pub fn service_pattern(&self) -> &str
Retrieve the service string pattern.
sourcepub fn region_pattern(&self) -> &str
pub fn region_pattern(&self) -> &str
Retrieve the region string pattern.
sourcepub fn account_id_pattern(&self) -> &str
pub fn account_id_pattern(&self) -> &str
Retrieve the account ID string pattern.
sourcepub fn resource_pattern(&self) -> &str
pub fn resource_pattern(&self) -> &str
Retrieve the resource name string pattern.
pub fn matches(
&self,
context: &Context,
pv: PolicyVersion,
candidate: &Arn
) -> Result<bool, AspenError>
Trait Implementations
sourceimpl Clone for ResourceArn
impl Clone for ResourceArn
sourcefn clone(&self) -> ResourceArn
fn clone(&self) -> ResourceArn
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ResourceArn
impl Debug for ResourceArn
sourceimpl Display for ResourceArn
impl Display for ResourceArn
sourceimpl FromStr for ResourceArn
impl FromStr for ResourceArn
type Err = AspenError
type Err = AspenError
The associated error which can be returned from parsing.
sourceimpl Hash for ResourceArn
impl Hash for ResourceArn
sourceimpl PartialEq<ResourceArn> for ResourceArn
impl PartialEq<ResourceArn> for ResourceArn
sourcefn eq(&self, other: &ResourceArn) -> bool
fn eq(&self, other: &ResourceArn) -> bool
impl Eq for ResourceArn
impl StructuralEq for ResourceArn
impl StructuralPartialEq for ResourceArn
Auto Trait Implementations
impl RefUnwindSafe for ResourceArn
impl Send for ResourceArn
impl Sync for ResourceArn
impl Unpin for ResourceArn
impl UnwindSafe for ResourceArn
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