aws_sdk_sts/operation/assume_role/_assume_role_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the response to a successful <code>AssumeRole</code> request, including temporary Amazon Web Services credentials that can be used to make Amazon Web Services requests.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct AssumeRoleOutput {
7 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
8 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
9 /// </note>
10 pub credentials: ::std::option::Option<crate::types::Credentials>,
11 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
12 pub assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
13 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
14 pub packed_policy_size: ::std::option::Option<i32>,
15 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
16 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
17 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
18 pub source_identity: ::std::option::Option<::std::string::String>,
19 _request_id: Option<String>,
20}
21impl AssumeRoleOutput {
22 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
23 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
24 /// </note>
25 pub fn credentials(&self) -> ::std::option::Option<&crate::types::Credentials> {
26 self.credentials.as_ref()
27 }
28 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
29 pub fn assumed_role_user(&self) -> ::std::option::Option<&crate::types::AssumedRoleUser> {
30 self.assumed_role_user.as_ref()
31 }
32 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
33 pub fn packed_policy_size(&self) -> ::std::option::Option<i32> {
34 self.packed_policy_size
35 }
36 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
37 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
38 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
39 pub fn source_identity(&self) -> ::std::option::Option<&str> {
40 self.source_identity.as_deref()
41 }
42}
43impl ::std::fmt::Debug for AssumeRoleOutput {
44 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
45 let mut formatter = f.debug_struct("AssumeRoleOutput");
46 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
47 formatter.field("assumed_role_user", &self.assumed_role_user);
48 formatter.field("packed_policy_size", &self.packed_policy_size);
49 formatter.field("source_identity", &self.source_identity);
50 formatter.field("_request_id", &self._request_id);
51 formatter.finish()
52 }
53}
54impl ::aws_types::request_id::RequestId for AssumeRoleOutput {
55 fn request_id(&self) -> Option<&str> {
56 self._request_id.as_deref()
57 }
58}
59impl AssumeRoleOutput {
60 /// Creates a new builder-style object to manufacture [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
61 pub fn builder() -> crate::operation::assume_role::builders::AssumeRoleOutputBuilder {
62 crate::operation::assume_role::builders::AssumeRoleOutputBuilder::default()
63 }
64}
65
66/// A builder for [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
68#[non_exhaustive]
69pub struct AssumeRoleOutputBuilder {
70 pub(crate) credentials: ::std::option::Option<crate::types::Credentials>,
71 pub(crate) assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
72 pub(crate) packed_policy_size: ::std::option::Option<i32>,
73 pub(crate) source_identity: ::std::option::Option<::std::string::String>,
74 _request_id: Option<String>,
75}
76impl AssumeRoleOutputBuilder {
77 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
78 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
79 /// </note>
80 pub fn credentials(mut self, input: crate::types::Credentials) -> Self {
81 self.credentials = ::std::option::Option::Some(input);
82 self
83 }
84 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
85 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
86 /// </note>
87 pub fn set_credentials(mut self, input: ::std::option::Option<crate::types::Credentials>) -> Self {
88 self.credentials = input;
89 self
90 }
91 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
92 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
93 /// </note>
94 pub fn get_credentials(&self) -> &::std::option::Option<crate::types::Credentials> {
95 &self.credentials
96 }
97 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
98 pub fn assumed_role_user(mut self, input: crate::types::AssumedRoleUser) -> Self {
99 self.assumed_role_user = ::std::option::Option::Some(input);
100 self
101 }
102 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
103 pub fn set_assumed_role_user(mut self, input: ::std::option::Option<crate::types::AssumedRoleUser>) -> Self {
104 self.assumed_role_user = input;
105 self
106 }
107 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
108 pub fn get_assumed_role_user(&self) -> &::std::option::Option<crate::types::AssumedRoleUser> {
109 &self.assumed_role_user
110 }
111 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
112 pub fn packed_policy_size(mut self, input: i32) -> Self {
113 self.packed_policy_size = ::std::option::Option::Some(input);
114 self
115 }
116 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
117 pub fn set_packed_policy_size(mut self, input: ::std::option::Option<i32>) -> Self {
118 self.packed_policy_size = input;
119 self
120 }
121 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
122 pub fn get_packed_policy_size(&self) -> &::std::option::Option<i32> {
123 &self.packed_policy_size
124 }
125 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
126 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
127 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
128 pub fn source_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.source_identity = ::std::option::Option::Some(input.into());
130 self
131 }
132 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
133 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
134 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
135 pub fn set_source_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.source_identity = input;
137 self
138 }
139 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
140 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
141 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
142 pub fn get_source_identity(&self) -> &::std::option::Option<::std::string::String> {
143 &self.source_identity
144 }
145 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
146 self._request_id = Some(request_id.into());
147 self
148 }
149
150 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
151 self._request_id = request_id;
152 self
153 }
154 /// Consumes the builder and constructs a [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
155 pub fn build(self) -> crate::operation::assume_role::AssumeRoleOutput {
156 crate::operation::assume_role::AssumeRoleOutput {
157 credentials: self.credentials,
158 assumed_role_user: self.assumed_role_user,
159 packed_policy_size: self.packed_policy_size,
160 source_identity: self.source_identity,
161 _request_id: self._request_id,
162 }
163 }
164}
165impl ::std::fmt::Debug for AssumeRoleOutputBuilder {
166 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
167 let mut formatter = f.debug_struct("AssumeRoleOutputBuilder");
168 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
169 formatter.field("assumed_role_user", &self.assumed_role_user);
170 formatter.field("packed_policy_size", &self.packed_policy_size);
171 formatter.field("source_identity", &self.source_identity);
172 formatter.field("_request_id", &self._request_id);
173 formatter.finish()
174 }
175}