aws_sdk_iam/types/_policy_user.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains information about a user that a managed policy is attached to.</p>
4/// <p>This data type is used as a response element in the <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListEntitiesForPolicy.html">ListEntitiesForPolicy</a> operation.</p>
5/// <p>For more information about managed policies, refer to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html">Managed policies and inline policies</a> in the <i>IAM User Guide</i>.</p>
6#[non_exhaustive]
7#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
8pub struct PolicyUser {
9 /// <p>The name (friendly name, not ARN) identifying the user.</p>
10 pub user_name: ::std::option::Option<::std::string::String>,
11 /// <p>The stable and unique string identifying the user. For more information about IDs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
12 pub user_id: ::std::option::Option<::std::string::String>,
13}
14impl PolicyUser {
15 /// <p>The name (friendly name, not ARN) identifying the user.</p>
16 pub fn user_name(&self) -> ::std::option::Option<&str> {
17 self.user_name.as_deref()
18 }
19 /// <p>The stable and unique string identifying the user. For more information about IDs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
20 pub fn user_id(&self) -> ::std::option::Option<&str> {
21 self.user_id.as_deref()
22 }
23}
24impl PolicyUser {
25 /// Creates a new builder-style object to manufacture [`PolicyUser`](crate::types::PolicyUser).
26 pub fn builder() -> crate::types::builders::PolicyUserBuilder {
27 crate::types::builders::PolicyUserBuilder::default()
28 }
29}
30
31/// A builder for [`PolicyUser`](crate::types::PolicyUser).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct PolicyUserBuilder {
35 pub(crate) user_name: ::std::option::Option<::std::string::String>,
36 pub(crate) user_id: ::std::option::Option<::std::string::String>,
37}
38impl PolicyUserBuilder {
39 /// <p>The name (friendly name, not ARN) identifying the user.</p>
40 pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41 self.user_name = ::std::option::Option::Some(input.into());
42 self
43 }
44 /// <p>The name (friendly name, not ARN) identifying the user.</p>
45 pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46 self.user_name = input;
47 self
48 }
49 /// <p>The name (friendly name, not ARN) identifying the user.</p>
50 pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
51 &self.user_name
52 }
53 /// <p>The stable and unique string identifying the user. For more information about IDs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
54 pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55 self.user_id = ::std::option::Option::Some(input.into());
56 self
57 }
58 /// <p>The stable and unique string identifying the user. For more information about IDs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
59 pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60 self.user_id = input;
61 self
62 }
63 /// <p>The stable and unique string identifying the user. For more information about IDs, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
64 pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
65 &self.user_id
66 }
67 /// Consumes the builder and constructs a [`PolicyUser`](crate::types::PolicyUser).
68 pub fn build(self) -> crate::types::PolicyUser {
69 crate::types::PolicyUser {
70 user_name: self.user_name,
71 user_id: self.user_id,
72 }
73 }
74}