pub enum PolicyPrincipal {
    AssumedRole(AssumedRoleDetails),
    FederatedUser(FederatedUserDetails),
    InstanceProfile(InstanceProfileDetails),
    Group(GroupDetails),
    Role(RoleDetails),
    RootUser(RootUserDetails),
    Service(ServiceDetails),
    User(UserDetails),
}
Expand description

An AWS principal referred to in an Aspen policy.

Variants§

§

AssumedRole(AssumedRoleDetails)

Details for an assumed role.

§

FederatedUser(FederatedUserDetails)

Details for a federated user.

§

InstanceProfile(InstanceProfileDetails)

Details for an instance profile.

§

Group(GroupDetails)

Details for an IAM group.

§

Role(RoleDetails)

Details for an IAM role.

§

RootUser(RootUserDetails)

Details for the root user of an account.

§

Service(ServiceDetails)

Details for a service. Requires the service feature.

§

User(UserDetails)

Details for an IAM user.

Implementations§

source§

impl PolicyPrincipal

source

pub fn assumed_role<S1, S2, S3, S4>( partition: S1, account_id: S2, role_name: S3, session_name: S4, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>, S4: Into<String>,

Return a principal for an assumed role.

§Arguments:
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • role_name: The name of the role being assumed. This must meet the following requirements or a PrincipalError::InvalidRoleName error will be returned:
    • The name must contain between 1 and 64 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
  • session_name: A name to assign to the session. This must meet the following requirements or a PrincipalError::InvalidSessionName error will be returned:
    • The session name must contain between 2 and 64 characters.
    • The session name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with AssumedRoleDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn federated_user<S1, S2, S3>( partition: S1, account_id: S2, user_name: S3, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>,

Return a principal for a federated user.

§Arguments:
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • user_name: The name of the federated user. This must meet the following requirements or a PrincipalError::InvalidFederatedUserName error will be returned:
    • The name must contain between 2 and 64 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with FederatedUserDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn group<S1, S2, S3, S4>( partition: S1, account_id: S2, path: S3, group_name: S4, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>, S4: Into<String>,

Return a principal for a group.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • path: The IAM path the group is under. This must meet the following requirements or a PrincipalError::InvalidPath error will be returned:
    • The path must contain between 1 and 512 characters.
    • The path must start and end with /.
    • All characters in the path must be in the ASCII range 0x21 (!) through 0x7E (~). The AWS documentation erroneously indicates that 0x7F (DEL) is acceptable; however, the IAM APIs reject this character.
  • group_name: The name of the group. This must meet the following requirements or a PrincipalError::InvalidGroupName error will be returned:
    • The name must contain between 1 and 128 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with GroupDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn instance_profile<S1, S2, S3, S4>( partition: S1, account_id: S2, path: S3, instance_profile_name: S4, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>, S4: Into<String>,

Return a principal for an instance profile.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • path: The IAM path the group is under. This must meet the following requirements or a PrincipalError::InvalidPath error will be returned:
    • The path must contain between 1 and 512 characters.
    • The path must start and end with /.
    • All characters in the path must be in the ASCII range 0x21 (!) through 0x7E (~). The AWS documentation erroneously indicates that 0x7F (DEL) is acceptable; however, the IAM APIs reject this character.
  • instance_profile_name: The name of the instance profile. This must meet the following requirements or a PrincipalError::InvalidInstanceProfileName error will be returned:
    • The name must contain between 1 and 128 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with InstanceProfileDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn role<S1, S2, S3, S4>( partition: S1, account_id: S2, path: S3, role_name: S4, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>, S4: Into<String>,

Return a principal for a role.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • path: The IAM path the group is under. This must meet the following requirements or a PrincipalError::InvalidPath error will be returned:
    • The path must contain between 1 and 512 characters.
    • The path must start and end with /.
    • All characters in the path must be in the ASCII range 0x21 (!) through 0x7E (~). The AWS documentation erroneously indicates that 0x7F (DEL) is acceptable; however, the IAM APIs reject this character.
  • role_name: The name of the role. This must meet the following requirements or a PrincipalError::InvalidRoleName error will be returned:
    • The name must contain between 1 and 64 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with RoleDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn root_user<S1>( partition: Option<String>, account_id: S1, ) -> Result<Self, PrincipalError>
where S1: Into<String>,

Return a principal for the root user of an account.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
§Return value

If all of the requirements are met, a PolicyPrincipal with RootUserDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn user<S1, S2, S3, S4>( partition: S1, account_id: S2, path: S3, user_name: S4, ) -> Result<Self, PrincipalError>
where S1: Into<String>, S2: Into<String>, S3: Into<String>, S4: Into<String>,

Return a principal for a user.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • account_id: The 12 digit account id. This must be composed of 12 ASCII digits or a PrincipalError::InvalidAccountId error will be returned.
  • path: The IAM path the group is under. This must meet the following requirements or a PrincipalError::InvalidPath error will be returned:
    • The path must contain between 1 and 512 characters.
    • The path must start and end with /.
    • All characters in the path must be in the ASCII range 0x21 (!) through 0x7E (~). The AWS documentation erroneously indicates that 0x7F (DEL) is acceptable; however, the IAM APIs reject this character.
  • user_name: The name of the user. This must meet the following requirements or a PrincipalError::InvalidUserName error will be returned:
    • The name must contain between 1 and 64 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
§Return value

If all of the requirements are met, a PolicyPrincipal with UserDetails details is returned. Otherwise, a PrincipalError error is returned.

source

pub fn service<S1>( partition: Option<String>, service_name: S1, ) -> Result<Self, PrincipalError>
where S1: Into<String>,

Return a principal for a service. Requies the service feature.

§Arguments
  • partition: The partition being addressed. This must meet the following requirements or a PrincipalError::InvalidPartition error will be returned:
    • The partition must be composed of ASCII alphanumeric characters or -.
    • The partition must have between 1 and 32 characters.
    • A - cannot appear in the first or last position, nor can it appear in two consecutive characters.
  • service_name: The name of the service. This must meet the following requirements or a PrincipalError::InvalidServiceName error will be returned:
    • The name must contain between 1 and 32 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.

If all of the requirements are met, a PolicyPrincipal with ServiceDetails details is returned. Otherwise, a PrincipalError error is returned.

Trait Implementations§

source§

impl Clone for PolicyPrincipal

source§

fn clone(&self) -> PolicyPrincipal

Returns a copy 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 PolicyPrincipal

source§

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

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

impl Display for PolicyPrincipal

source§

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

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

impl From<PrincipalActor> for PolicyPrincipal

source§

fn from(from: PrincipalActor) -> PolicyPrincipal

Convert the PrincipalActor into a PolicyPrincipal.

This is a lossy conversion, losing the identifier or token details attached to the actor.

source§

impl FromStr for PolicyPrincipal

§

type Err = PrincipalError

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

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

Parses a string s to return a value of this type. Read more
source§

impl PartialEq for PolicyPrincipal

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PolicyPrincipal

source§

impl StructuralPartialEq for PolicyPrincipal

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

§

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§

default 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>,

§

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>,

§

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> Data for T
where T: Clone + Debug + PartialEq + Eq + Send + Sync + 'static,