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; self
89 }
90 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
91 /// <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>
92 /// </note>
93 pub fn get_credentials(&self) -> &::std::option::Option<crate::types::Credentials> {
94 &self.credentials
95 }
96 /// <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>
97 pub fn assumed_role_user(mut self, input: crate::types::AssumedRoleUser) -> Self {
98 self.assumed_role_user = ::std::option::Option::Some(input);
99 self
100 }
101 /// <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>
102 pub fn set_assumed_role_user(mut self, input: ::std::option::Option<crate::types::AssumedRoleUser>) -> Self {
103 self.assumed_role_user = input; self
104 }
105 /// <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>
106 pub fn get_assumed_role_user(&self) -> &::std::option::Option<crate::types::AssumedRoleUser> {
107 &self.assumed_role_user
108 }
109 /// <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>
110 pub fn packed_policy_size(mut self, input: i32) -> Self {
111 self.packed_policy_size = ::std::option::Option::Some(input);
112 self
113 }
114 /// <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>
115 pub fn set_packed_policy_size(mut self, input: ::std::option::Option<i32>) -> Self {
116 self.packed_policy_size = input; self
117 }
118 /// <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>
119 pub fn get_packed_policy_size(&self) -> &::std::option::Option<i32> {
120 &self.packed_policy_size
121 }
122 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
123 /// <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>
124 /// <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>
125 pub fn source_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.source_identity = ::std::option::Option::Some(input.into());
127 self
128 }
129 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
130 /// <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>
131 /// <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>
132 pub fn set_source_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133 self.source_identity = input; self
134 }
135 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
136 /// <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>
137 /// <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>
138 pub fn get_source_identity(&self) -> &::std::option::Option<::std::string::String> {
139 &self.source_identity
140 }
141 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
142 self._request_id = Some(request_id.into());
143 self
144 }
145
146 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
147 self._request_id = request_id;
148 self
149 }
150 /// Consumes the builder and constructs a [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
151 pub fn build(self) -> crate::operation::assume_role::AssumeRoleOutput {
152 crate::operation::assume_role::AssumeRoleOutput {
153 credentials: self.credentials
154 ,
155 assumed_role_user: self.assumed_role_user
156 ,
157 packed_policy_size: self.packed_policy_size
158 ,
159 source_identity: self.source_identity
160 ,
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}
176