pub struct User { /* private fields */ }
Expand description
Details about an AWS IAM user.
User structs are immutable.
Implementations§
Source§impl User
impl User
Sourcepub fn new(
partition: &str,
account_id: &str,
path: &str,
user_name: &str,
) -> Result<Self, PrincipalError>
pub fn new( partition: &str, account_id: &str, path: &str, user_name: &str, ) -> Result<Self, PrincipalError>
Create a User object.
§Arguments
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 User object is returned. Otherwise, a PrincipalError error is returned.
Sourcepub fn account_id(&self) -> &str
pub fn account_id(&self) -> &str
The account ID of the user.
Trait Implementations§
Source§impl From<User> for PrincipalIdentity
Wrap a User in a PrincipalIdentity.
impl From<User> for PrincipalIdentity
Wrap a User in a PrincipalIdentity.
Source§impl FromStr for User
impl FromStr for User
Source§type Err = PrincipalError
type Err = PrincipalError
The associated error which can be returned from parsing.
Source§impl Ord for User
impl Ord for User
Source§impl PartialOrd for User
impl PartialOrd for User
Source§impl TryFrom<&Arn> for User
impl TryFrom<&Arn> for User
Source§fn try_from(arn: &Arn) -> Result<Self, Self::Error>
fn try_from(arn: &Arn) -> Result<Self, Self::Error>
If an Arn represents a valid IAM user, convert it to a User; otherwise, return a PrincipalError indicating what is wrong with the ARN.
§Example
let arn = Arn::from_str("arn:aws:iam::123456789012:user/path/user-name").unwrap();
let user = User::try_from(&arn).unwrap();
assert_eq!(user.path(), "/path/");
assert_eq!(user.user_name(), "user-name");
Source§type Error = PrincipalError
type Error = PrincipalError
The type returned in the event of a conversion error.
impl Eq for User
impl StructuralPartialEq for User
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more