rusoto_sts/
generated.rs

1// =================================================================
2//
3//                           * WARNING *
4//
5//                    This file is generated!
6//
7//  Changes made to this file will be overwritten. If changes are
8//  required to the generated code, the service_crategen project
9//  must be updated to generate the changes.
10//
11// =================================================================
12
13use std::error::Error;
14use std::fmt;
15
16use async_trait::async_trait;
17use rusoto_core::credential::ProvideAwsCredentials;
18use rusoto_core::region;
19use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
20use rusoto_core::{Client, RusotoError};
21
22use rusoto_core::param::{Params, ServiceParams};
23use rusoto_core::proto::xml::error::*;
24use rusoto_core::proto::xml::util::{
25    self as xml_util, deserialize_elements, find_start_element, skip_tree,
26};
27use rusoto_core::proto::xml::util::{Next, Peek, XmlParseError, XmlResponse};
28use rusoto_core::request::HttpResponse;
29use rusoto_core::signature::SignedRequest;
30#[cfg(feature = "deserialize_structs")]
31use serde::Deserialize;
32#[cfg(feature = "serialize_structs")]
33use serde::Serialize;
34use serde_urlencoded;
35use std::str::FromStr;
36use xml::EventReader;
37
38impl StsClient {
39    fn new_params(&self, operation_name: &str) -> Params {
40        let mut params = Params::new();
41
42        params.put("Action", operation_name);
43        params.put("Version", "2011-06-15");
44
45        params
46    }
47
48    async fn sign_and_dispatch<E>(
49        &self,
50        request: SignedRequest,
51        from_response: fn(BufferedHttpResponse) -> RusotoError<E>,
52    ) -> Result<HttpResponse, RusotoError<E>> {
53        let mut response = self.client.sign_and_dispatch(request).await?;
54        if !response.status.is_success() {
55            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
56            return Err(from_response(response));
57        }
58
59        Ok(response)
60    }
61}
62
63#[allow(dead_code)]
64struct AccessKeyIdTypeDeserializer;
65impl AccessKeyIdTypeDeserializer {
66    #[allow(dead_code, unused_variables)]
67    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
68        xml_util::deserialize_primitive(tag_name, stack, Ok)
69    }
70}
71#[allow(dead_code)]
72struct AccessKeySecretTypeDeserializer;
73impl AccessKeySecretTypeDeserializer {
74    #[allow(dead_code, unused_variables)]
75    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
76        xml_util::deserialize_primitive(tag_name, stack, Ok)
77    }
78}
79#[allow(dead_code)]
80struct AccountTypeDeserializer;
81impl AccountTypeDeserializer {
82    #[allow(dead_code, unused_variables)]
83    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
84        xml_util::deserialize_primitive(tag_name, stack, Ok)
85    }
86}
87#[allow(dead_code)]
88struct ArnTypeDeserializer;
89impl ArnTypeDeserializer {
90    #[allow(dead_code, unused_variables)]
91    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
92        xml_util::deserialize_primitive(tag_name, stack, Ok)
93    }
94}
95#[derive(Clone, Debug, Default, PartialEq)]
96#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
97pub struct AssumeRoleRequest {
98    /// <p><p>The duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting, the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>.</p> <p>By default, the value is set to <code>3600</code> seconds. </p> <note> <p>The <code>DurationSeconds</code> parameter is separate from the duration of a console session that you might request using the returned credentials. The request to the federation endpoint for a console sign-in token takes a <code>SessionDuration</code> parameter that specifies the maximum length of the console session. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html">Creating a URL that Enables Federated Users to Access the AWS Management Console</a> in the <i>IAM User Guide</i>.</p> </note></p>
99    pub duration_seconds: Option<i64>,
100    /// <p>A unique identifier that might be required when you assume a role in another account. If the administrator of the account to which the role belongs provided you with an external ID, then provide that value in the <code>ExternalId</code> parameter. This value can be any string, such as a passphrase or account number. A cross-account role is usually set up to trust everyone in an account. Therefore, the administrator of the trusting account might send an external ID to the administrator of the trusted account. That way, only someone with the ID can assume the role, rather than everyone in the account. For more information about the external ID, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html">How to Use an External ID When Granting Access to Your AWS Resources to a Third Party</a> in the <i>IAM User Guide</i>.</p> <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>
101    pub external_id: Option<String>,
102    /// <p><p>An IAM policy in JSON format that you want to use as an inline session policy.</p> <p>This parameter is optional. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. The JSON policy characters can be any ASCII character from the space character to the end of the valid character list (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage return (\u000D) characters.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note></p>
103    pub policy: Option<String>,
104    /// <p>The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.</p> <p>This parameter is optional. You can provide up to 10 managed policy ARNs. However, the plain text that you use for both inline and managed session policies can't exceed 2,048 characters. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a> in the AWS General Reference.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>Passing policies to this operation returns new temporary credentials. The resulting session's permissions are the intersection of the role's identity-based policy and the session policies. You can use the role's temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p>
105    pub policy_arns: Option<Vec<PolicyDescriptorType>>,
106    /// <p>The Amazon Resource Name (ARN) of the role to assume.</p>
107    pub role_arn: String,
108    /// <p>An identifier for the assumed role session.</p> <p>Use the role session name to uniquely identify a session when the same role is assumed by different principals or for different reasons. In cross-account scenarios, the role session name is visible to, and can be logged by the account that owns the role. The role session name is also used in the ARN of the assumed role principal. This means that subsequent cross-account API requests that use the temporary security credentials will expose the role session name to the external account in their AWS CloudTrail logs.</p> <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>
109    pub role_session_name: String,
110    /// <p>The identification number of the MFA device that is associated with the user who is making the <code>AssumeRole</code> call. Specify this value if the trust policy of the role being assumed includes a condition that requires MFA authentication. The value is either the serial number for a hardware device (such as <code>GAHT12345678</code>) or an Amazon Resource Name (ARN) for a virtual device (such as <code>arn:aws:iam::123456789012:mfa/user</code>).</p> <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>
111    pub serial_number: Option<String>,
112    /// <p>A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Tagging AWS STS Sessions</a> in the <i>IAM User Guide</i>.</p> <p>This parameter is optional. You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters, and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is already attached to the role. When you do, session tags override a role tag with the same key. </p> <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you cannot have separate <code>Department</code> and <code>department</code> tag keys. Assume that the role has the <code>Department</code>=<code>Marketing</code> tag and you pass the <code>department</code>=<code>engineering</code> session tag. <code>Department</code> and <code>department</code> are not saved as separate tags, and the session tag passed in the request takes precedence over the role tag.</p> <p>Additionally, if you used temporary credentials to perform this operation, the new session inherits any transitive session tags from the calling session. If you pass a session tag with the same key as an inherited tag, the operation fails. To view the inherited tags for a session, see the AWS CloudTrail logs. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/session-tags.html#id_session-tags_ctlogs">Viewing Session Tags in CloudTrail</a> in the <i>IAM User Guide</i>.</p>
113    pub tags: Option<Vec<Tag>>,
114    /// <p>The value provided by the MFA device, if the trust policy of the role being assumed requires MFA (that is, if the policy includes a condition that tests for MFA). If the role being assumed requires MFA and if the <code>TokenCode</code> value is missing or expired, the <code>AssumeRole</code> call returns an "access denied" error.</p> <p>The format for this parameter, as described by its regex pattern, is a sequence of six numeric digits.</p>
115    pub token_code: Option<String>,
116    /// <p>A list of keys for session tags that you want to set as transitive. If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p>This parameter is optional. When you set session tags as transitive, the session policy and session tags packed binary limit is not affected.</p> <p>If you choose not to specify a transitive tag key, then no tags are passed from this session to any subsequent sessions.</p>
117    pub transitive_tag_keys: Option<Vec<String>>,
118}
119
120/// Serialize `AssumeRoleRequest` contents to a `SignedRequest`.
121struct AssumeRoleRequestSerializer;
122impl AssumeRoleRequestSerializer {
123    fn serialize(params: &mut Params, name: &str, obj: &AssumeRoleRequest) {
124        let mut prefix = name.to_string();
125        if prefix != "" {
126            prefix.push_str(".");
127        }
128
129        if let Some(ref field_value) = obj.duration_seconds {
130            params.put(&format!("{}{}", prefix, "DurationSeconds"), &field_value);
131        }
132        if let Some(ref field_value) = obj.external_id {
133            params.put(&format!("{}{}", prefix, "ExternalId"), &field_value);
134        }
135        if let Some(ref field_value) = obj.policy {
136            params.put(&format!("{}{}", prefix, "Policy"), &field_value);
137        }
138        if let Some(ref field_value) = obj.policy_arns {
139            PolicyDescriptorListTypeSerializer::serialize(
140                params,
141                &format!("{}{}", prefix, "PolicyArns"),
142                field_value,
143            );
144        }
145        params.put(&format!("{}{}", prefix, "RoleArn"), &obj.role_arn);
146        params.put(
147            &format!("{}{}", prefix, "RoleSessionName"),
148            &obj.role_session_name,
149        );
150        if let Some(ref field_value) = obj.serial_number {
151            params.put(&format!("{}{}", prefix, "SerialNumber"), &field_value);
152        }
153        if let Some(ref field_value) = obj.tags {
154            TagListTypeSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), field_value);
155        }
156        if let Some(ref field_value) = obj.token_code {
157            params.put(&format!("{}{}", prefix, "TokenCode"), &field_value);
158        }
159        if let Some(ref field_value) = obj.transitive_tag_keys {
160            TagKeyListTypeSerializer::serialize(
161                params,
162                &format!("{}{}", prefix, "TransitiveTagKeys"),
163                field_value,
164            );
165        }
166    }
167}
168
169/// <p>Contains the response to a successful <a>AssumeRole</a> request, including temporary AWS credentials that can be used to make AWS requests. </p>
170#[derive(Clone, Debug, Default, PartialEq)]
171#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
172pub struct AssumeRoleResponse {
173    /// <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>
174    pub assumed_role_user: Option<AssumedRoleUser>,
175    /// <p><p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p> <note> <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> </note></p>
176    pub credentials: Option<Credentials>,
177    /// <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>
178    pub packed_policy_size: Option<i64>,
179}
180
181#[allow(dead_code)]
182struct AssumeRoleResponseDeserializer;
183impl AssumeRoleResponseDeserializer {
184    #[allow(dead_code, unused_variables)]
185    fn deserialize<T: Peek + Next>(
186        tag_name: &str,
187        stack: &mut T,
188    ) -> Result<AssumeRoleResponse, XmlParseError> {
189        deserialize_elements::<_, AssumeRoleResponse, _>(tag_name, stack, |name, stack, obj| {
190            match name {
191                "AssumedRoleUser" => {
192                    obj.assumed_role_user = Some(AssumedRoleUserDeserializer::deserialize(
193                        "AssumedRoleUser",
194                        stack,
195                    )?);
196                }
197                "Credentials" => {
198                    obj.credentials =
199                        Some(CredentialsDeserializer::deserialize("Credentials", stack)?);
200                }
201                "PackedPolicySize" => {
202                    obj.packed_policy_size = Some(NonNegativeIntegerTypeDeserializer::deserialize(
203                        "PackedPolicySize",
204                        stack,
205                    )?);
206                }
207                _ => skip_tree(stack),
208            }
209            Ok(())
210        })
211    }
212}
213#[derive(Clone, Debug, Default, PartialEq)]
214#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
215pub struct AssumeRoleWithSAMLRequest {
216    /// <p><p>The duration, in seconds, of the role session. Your role session lasts for the duration that you specify for the <code>DurationSeconds</code> parameter, or until the time specified in the SAML authentication response&#39;s <code>SessionNotOnOrAfter</code> value, whichever is shorter. You can provide a <code>DurationSeconds</code> value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting, the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>.</p> <p>By default, the value is set to <code>3600</code> seconds. </p> <note> <p>The <code>DurationSeconds</code> parameter is separate from the duration of a console session that you might request using the returned credentials. The request to the federation endpoint for a console sign-in token takes a <code>SessionDuration</code> parameter that specifies the maximum length of the console session. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html">Creating a URL that Enables Federated Users to Access the AWS Management Console</a> in the <i>IAM User Guide</i>.</p> </note></p>
217    pub duration_seconds: Option<i64>,
218    /// <p><p>An IAM policy in JSON format that you want to use as an inline session policy.</p> <p>This parameter is optional. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>. </p> <p>The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. The JSON policy characters can be any ASCII character from the space character to the end of the valid character list (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage return (\u000D) characters.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note></p>
219    pub policy: Option<String>,
220    /// <p>The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.</p> <p>This parameter is optional. You can provide up to 10 managed policy ARNs. However, the plain text that you use for both inline and managed session policies can't exceed 2,048 characters. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a> in the AWS General Reference.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>Passing policies to this operation returns new temporary credentials. The resulting session's permissions are the intersection of the role's identity-based policy and the session policies. You can use the role's temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p>
221    pub policy_arns: Option<Vec<PolicyDescriptorType>>,
222    /// <p>The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.</p>
223    pub principal_arn: String,
224    /// <p>The Amazon Resource Name (ARN) of the role that the caller is assuming.</p>
225    pub role_arn: String,
226    /// <p>The base-64 encoded SAML authentication response provided by the IdP.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html">Configuring a Relying Party and Adding Claims</a> in the <i>IAM User Guide</i>. </p>
227    pub saml_assertion: String,
228}
229
230/// Serialize `AssumeRoleWithSAMLRequest` contents to a `SignedRequest`.
231struct AssumeRoleWithSAMLRequestSerializer;
232impl AssumeRoleWithSAMLRequestSerializer {
233    fn serialize(params: &mut Params, name: &str, obj: &AssumeRoleWithSAMLRequest) {
234        let mut prefix = name.to_string();
235        if prefix != "" {
236            prefix.push_str(".");
237        }
238
239        if let Some(ref field_value) = obj.duration_seconds {
240            params.put(&format!("{}{}", prefix, "DurationSeconds"), &field_value);
241        }
242        if let Some(ref field_value) = obj.policy {
243            params.put(&format!("{}{}", prefix, "Policy"), &field_value);
244        }
245        if let Some(ref field_value) = obj.policy_arns {
246            PolicyDescriptorListTypeSerializer::serialize(
247                params,
248                &format!("{}{}", prefix, "PolicyArns"),
249                field_value,
250            );
251        }
252        params.put(&format!("{}{}", prefix, "PrincipalArn"), &obj.principal_arn);
253        params.put(&format!("{}{}", prefix, "RoleArn"), &obj.role_arn);
254        params.put(
255            &format!("{}{}", prefix, "SAMLAssertion"),
256            &obj.saml_assertion,
257        );
258    }
259}
260
261/// <p>Contains the response to a successful <a>AssumeRoleWithSAML</a> request, including temporary AWS credentials that can be used to make AWS requests. </p>
262#[derive(Clone, Debug, Default, PartialEq)]
263#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
264pub struct AssumeRoleWithSAMLResponse {
265    /// <p>The identifiers for the temporary security credentials that the operation returns.</p>
266    pub assumed_role_user: Option<AssumedRoleUser>,
267    /// <p> The value of the <code>Recipient</code> attribute of the <code>SubjectConfirmationData</code> element of the SAML assertion. </p>
268    pub audience: Option<String>,
269    /// <p><p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p> <note> <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> </note></p>
270    pub credentials: Option<Credentials>,
271    /// <p>The value of the <code>Issuer</code> element of the SAML assertion.</p>
272    pub issuer: Option<String>,
273    /// <p>A hash value based on the concatenation of the <code>Issuer</code> response value, the AWS account ID, and the friendly name (the last part of the ARN) of the SAML provider in IAM. The combination of <code>NameQualifier</code> and <code>Subject</code> can be used to uniquely identify a federated user. </p> <p>The following pseudocode shows how the hash value is calculated:</p> <p> <code>BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" ) )</code> </p>
274    pub name_qualifier: Option<String>,
275    /// <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>
276    pub packed_policy_size: Option<i64>,
277    /// <p>The value of the <code>NameID</code> element in the <code>Subject</code> element of the SAML assertion.</p>
278    pub subject: Option<String>,
279    /// <p> The format of the name ID, as defined by the <code>Format</code> attribute in the <code>NameID</code> element of the SAML assertion. Typical examples of the format are <code>transient</code> or <code>persistent</code>. </p> <p> If the format includes the prefix <code>urn:oasis:names:tc:SAML:2.0:nameid-format</code>, that prefix is removed. For example, <code>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</code> is returned as <code>transient</code>. If the format includes any other prefix, the format is returned with no modifications.</p>
280    pub subject_type: Option<String>,
281}
282
283#[allow(dead_code)]
284struct AssumeRoleWithSAMLResponseDeserializer;
285impl AssumeRoleWithSAMLResponseDeserializer {
286    #[allow(dead_code, unused_variables)]
287    fn deserialize<T: Peek + Next>(
288        tag_name: &str,
289        stack: &mut T,
290    ) -> Result<AssumeRoleWithSAMLResponse, XmlParseError> {
291        deserialize_elements::<_, AssumeRoleWithSAMLResponse, _>(
292            tag_name,
293            stack,
294            |name, stack, obj| {
295                match name {
296                    "AssumedRoleUser" => {
297                        obj.assumed_role_user = Some(AssumedRoleUserDeserializer::deserialize(
298                            "AssumedRoleUser",
299                            stack,
300                        )?);
301                    }
302                    "Audience" => {
303                        obj.audience = Some(AudienceDeserializer::deserialize("Audience", stack)?);
304                    }
305                    "Credentials" => {
306                        obj.credentials =
307                            Some(CredentialsDeserializer::deserialize("Credentials", stack)?);
308                    }
309                    "Issuer" => {
310                        obj.issuer = Some(IssuerDeserializer::deserialize("Issuer", stack)?);
311                    }
312                    "NameQualifier" => {
313                        obj.name_qualifier = Some(NameQualifierDeserializer::deserialize(
314                            "NameQualifier",
315                            stack,
316                        )?);
317                    }
318                    "PackedPolicySize" => {
319                        obj.packed_policy_size =
320                            Some(NonNegativeIntegerTypeDeserializer::deserialize(
321                                "PackedPolicySize",
322                                stack,
323                            )?);
324                    }
325                    "Subject" => {
326                        obj.subject = Some(SubjectDeserializer::deserialize("Subject", stack)?);
327                    }
328                    "SubjectType" => {
329                        obj.subject_type =
330                            Some(SubjectTypeDeserializer::deserialize("SubjectType", stack)?);
331                    }
332                    _ => skip_tree(stack),
333                }
334                Ok(())
335            },
336        )
337    }
338}
339#[derive(Clone, Debug, Default, PartialEq)]
340#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
341pub struct AssumeRoleWithWebIdentityRequest {
342    /// <p><p>The duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting, the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>.</p> <p>By default, the value is set to <code>3600</code> seconds. </p> <note> <p>The <code>DurationSeconds</code> parameter is separate from the duration of a console session that you might request using the returned credentials. The request to the federation endpoint for a console sign-in token takes a <code>SessionDuration</code> parameter that specifies the maximum length of the console session. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html">Creating a URL that Enables Federated Users to Access the AWS Management Console</a> in the <i>IAM User Guide</i>.</p> </note></p>
343    pub duration_seconds: Option<i64>,
344    /// <p><p>An IAM policy in JSON format that you want to use as an inline session policy.</p> <p>This parameter is optional. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. The JSON policy characters can be any ASCII character from the space character to the end of the valid character list (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage return (\u000D) characters.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note></p>
345    pub policy: Option<String>,
346    /// <p>The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.</p> <p>This parameter is optional. You can provide up to 10 managed policy ARNs. However, the plain text that you use for both inline and managed session policies can't exceed 2,048 characters. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a> in the AWS General Reference.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>Passing policies to this operation returns new temporary credentials. The resulting session's permissions are the intersection of the role's identity-based policy and the session policies. You can use the role's temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p>
347    pub policy_arns: Option<Vec<PolicyDescriptorType>>,
348    /// <p>The fully qualified host component of the domain name of the identity provider.</p> <p>Specify this value only for OAuth 2.0 access tokens. Currently <code>www.amazon.com</code> and <code>graph.facebook.com</code> are the only supported identity providers for OAuth 2.0 access tokens. Do not include URL schemes and port numbers.</p> <p>Do not specify this value for OpenID Connect ID tokens.</p>
349    pub provider_id: Option<String>,
350    /// <p>The Amazon Resource Name (ARN) of the role that the caller is assuming.</p>
351    pub role_arn: String,
352    /// <p>An identifier for the assumed role session. Typically, you pass the name or identifier that is associated with the user who is using your application. That way, the temporary security credentials that your application will use are associated with that user. This session name is included as part of the ARN and assumed role ID in the <code>AssumedRoleUser</code> response element.</p> <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>
353    pub role_session_name: String,
354    /// <p>The OAuth 2.0 access token or OpenID Connect ID token that is provided by the identity provider. Your application must get this token by authenticating the user who is using your application with a web identity provider before the application makes an <code>AssumeRoleWithWebIdentity</code> call. </p>
355    pub web_identity_token: String,
356}
357
358/// Serialize `AssumeRoleWithWebIdentityRequest` contents to a `SignedRequest`.
359struct AssumeRoleWithWebIdentityRequestSerializer;
360impl AssumeRoleWithWebIdentityRequestSerializer {
361    fn serialize(params: &mut Params, name: &str, obj: &AssumeRoleWithWebIdentityRequest) {
362        let mut prefix = name.to_string();
363        if prefix != "" {
364            prefix.push_str(".");
365        }
366
367        if let Some(ref field_value) = obj.duration_seconds {
368            params.put(&format!("{}{}", prefix, "DurationSeconds"), &field_value);
369        }
370        if let Some(ref field_value) = obj.policy {
371            params.put(&format!("{}{}", prefix, "Policy"), &field_value);
372        }
373        if let Some(ref field_value) = obj.policy_arns {
374            PolicyDescriptorListTypeSerializer::serialize(
375                params,
376                &format!("{}{}", prefix, "PolicyArns"),
377                field_value,
378            );
379        }
380        if let Some(ref field_value) = obj.provider_id {
381            params.put(&format!("{}{}", prefix, "ProviderId"), &field_value);
382        }
383        params.put(&format!("{}{}", prefix, "RoleArn"), &obj.role_arn);
384        params.put(
385            &format!("{}{}", prefix, "RoleSessionName"),
386            &obj.role_session_name,
387        );
388        params.put(
389            &format!("{}{}", prefix, "WebIdentityToken"),
390            &obj.web_identity_token,
391        );
392    }
393}
394
395/// <p>Contains the response to a successful <a>AssumeRoleWithWebIdentity</a> request, including temporary AWS credentials that can be used to make AWS requests. </p>
396#[derive(Clone, Debug, Default, PartialEq)]
397#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
398pub struct AssumeRoleWithWebIdentityResponse {
399    /// <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>
400    pub assumed_role_user: Option<AssumedRoleUser>,
401    /// <p>The intended audience (also known as client ID) of the web identity token. This is traditionally the client identifier issued to the application that requested the web identity token.</p>
402    pub audience: Option<String>,
403    /// <p><p>The temporary security credentials, which include an access key ID, a secret access key, and a security token.</p> <note> <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> </note></p>
404    pub credentials: Option<Credentials>,
405    /// <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>
406    pub packed_policy_size: Option<i64>,
407    /// <p> The issuing authority of the web identity token presented. For OpenID Connect ID tokens, this contains the value of the <code>iss</code> field. For OAuth 2.0 access tokens, this contains the value of the <code>ProviderId</code> parameter that was passed in the <code>AssumeRoleWithWebIdentity</code> request.</p>
408    pub provider: Option<String>,
409    /// <p>The unique user identifier that is returned by the identity provider. This identifier is associated with the <code>WebIdentityToken</code> that was submitted with the <code>AssumeRoleWithWebIdentity</code> call. The identifier is typically unique to the user and the application that acquired the <code>WebIdentityToken</code> (pairwise identifier). For OpenID Connect ID tokens, this field contains the value returned by the identity provider as the token's <code>sub</code> (Subject) claim. </p>
410    pub subject_from_web_identity_token: Option<String>,
411}
412
413#[allow(dead_code)]
414struct AssumeRoleWithWebIdentityResponseDeserializer;
415impl AssumeRoleWithWebIdentityResponseDeserializer {
416    #[allow(dead_code, unused_variables)]
417    fn deserialize<T: Peek + Next>(
418        tag_name: &str,
419        stack: &mut T,
420    ) -> Result<AssumeRoleWithWebIdentityResponse, XmlParseError> {
421        deserialize_elements::<_, AssumeRoleWithWebIdentityResponse, _>(
422            tag_name,
423            stack,
424            |name, stack, obj| {
425                match name {
426                    "AssumedRoleUser" => {
427                        obj.assumed_role_user = Some(AssumedRoleUserDeserializer::deserialize(
428                            "AssumedRoleUser",
429                            stack,
430                        )?);
431                    }
432                    "Audience" => {
433                        obj.audience = Some(AudienceDeserializer::deserialize("Audience", stack)?);
434                    }
435                    "Credentials" => {
436                        obj.credentials =
437                            Some(CredentialsDeserializer::deserialize("Credentials", stack)?);
438                    }
439                    "PackedPolicySize" => {
440                        obj.packed_policy_size =
441                            Some(NonNegativeIntegerTypeDeserializer::deserialize(
442                                "PackedPolicySize",
443                                stack,
444                            )?);
445                    }
446                    "Provider" => {
447                        obj.provider = Some(IssuerDeserializer::deserialize("Provider", stack)?);
448                    }
449                    "SubjectFromWebIdentityToken" => {
450                        obj.subject_from_web_identity_token =
451                            Some(WebIdentitySubjectTypeDeserializer::deserialize(
452                                "SubjectFromWebIdentityToken",
453                                stack,
454                            )?);
455                    }
456                    _ => skip_tree(stack),
457                }
458                Ok(())
459            },
460        )
461    }
462}
463#[allow(dead_code)]
464struct AssumedRoleIdTypeDeserializer;
465impl AssumedRoleIdTypeDeserializer {
466    #[allow(dead_code, unused_variables)]
467    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
468        xml_util::deserialize_primitive(tag_name, stack, Ok)
469    }
470}
471/// <p>The identifiers for the temporary security credentials that the operation returns.</p>
472#[derive(Clone, Debug, Default, PartialEq)]
473#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
474pub struct AssumedRoleUser {
475    /// <p>The ARN of the temporary security credentials that are returned from the <a>AssumeRole</a> action. For more information about ARNs and how to use them in policies, 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>
476    pub arn: String,
477    /// <p>A unique identifier that contains the role ID and the role session name of the role that is being assumed. The role ID is generated by AWS when the role is created.</p>
478    pub assumed_role_id: String,
479}
480
481#[allow(dead_code)]
482struct AssumedRoleUserDeserializer;
483impl AssumedRoleUserDeserializer {
484    #[allow(dead_code, unused_variables)]
485    fn deserialize<T: Peek + Next>(
486        tag_name: &str,
487        stack: &mut T,
488    ) -> Result<AssumedRoleUser, XmlParseError> {
489        deserialize_elements::<_, AssumedRoleUser, _>(tag_name, stack, |name, stack, obj| {
490            match name {
491                "Arn" => {
492                    obj.arn = ArnTypeDeserializer::deserialize("Arn", stack)?;
493                }
494                "AssumedRoleId" => {
495                    obj.assumed_role_id =
496                        AssumedRoleIdTypeDeserializer::deserialize("AssumedRoleId", stack)?;
497                }
498                _ => skip_tree(stack),
499            }
500            Ok(())
501        })
502    }
503}
504#[allow(dead_code)]
505struct AudienceDeserializer;
506impl AudienceDeserializer {
507    #[allow(dead_code, unused_variables)]
508    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
509        xml_util::deserialize_primitive(tag_name, stack, Ok)
510    }
511}
512/// <p>AWS credentials for API authentication.</p>
513#[derive(Clone, Debug, Default, PartialEq)]
514#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
515pub struct Credentials {
516    /// <p>The access key ID that identifies the temporary security credentials.</p>
517    pub access_key_id: String,
518    /// <p>The date on which the current credentials expire.</p>
519    pub expiration: String,
520    /// <p>The secret access key that can be used to sign requests.</p>
521    pub secret_access_key: String,
522    /// <p>The token that users must pass to the service API to use the temporary credentials.</p>
523    pub session_token: String,
524}
525
526#[allow(dead_code)]
527struct CredentialsDeserializer;
528impl CredentialsDeserializer {
529    #[allow(dead_code, unused_variables)]
530    fn deserialize<T: Peek + Next>(
531        tag_name: &str,
532        stack: &mut T,
533    ) -> Result<Credentials, XmlParseError> {
534        deserialize_elements::<_, Credentials, _>(tag_name, stack, |name, stack, obj| {
535            match name {
536                "AccessKeyId" => {
537                    obj.access_key_id =
538                        AccessKeyIdTypeDeserializer::deserialize("AccessKeyId", stack)?;
539                }
540                "Expiration" => {
541                    obj.expiration = DateTypeDeserializer::deserialize("Expiration", stack)?;
542                }
543                "SecretAccessKey" => {
544                    obj.secret_access_key =
545                        AccessKeySecretTypeDeserializer::deserialize("SecretAccessKey", stack)?;
546                }
547                "SessionToken" => {
548                    obj.session_token = TokenTypeDeserializer::deserialize("SessionToken", stack)?;
549                }
550                _ => skip_tree(stack),
551            }
552            Ok(())
553        })
554    }
555}
556#[allow(dead_code)]
557struct DateTypeDeserializer;
558impl DateTypeDeserializer {
559    #[allow(dead_code, unused_variables)]
560    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
561        xml_util::deserialize_primitive(tag_name, stack, Ok)
562    }
563}
564#[derive(Clone, Debug, Default, PartialEq)]
565#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
566pub struct DecodeAuthorizationMessageRequest {
567    /// <p>The encoded message that was returned with the response.</p>
568    pub encoded_message: String,
569}
570
571/// Serialize `DecodeAuthorizationMessageRequest` contents to a `SignedRequest`.
572struct DecodeAuthorizationMessageRequestSerializer;
573impl DecodeAuthorizationMessageRequestSerializer {
574    fn serialize(params: &mut Params, name: &str, obj: &DecodeAuthorizationMessageRequest) {
575        let mut prefix = name.to_string();
576        if prefix != "" {
577            prefix.push_str(".");
578        }
579
580        params.put(
581            &format!("{}{}", prefix, "EncodedMessage"),
582            &obj.encoded_message,
583        );
584    }
585}
586
587/// <p>A document that contains additional information about the authorization status of a request from an encoded message that is returned in response to an AWS request.</p>
588#[derive(Clone, Debug, Default, PartialEq)]
589#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
590pub struct DecodeAuthorizationMessageResponse {
591    /// <p>An XML document that contains the decoded message.</p>
592    pub decoded_message: Option<String>,
593}
594
595#[allow(dead_code)]
596struct DecodeAuthorizationMessageResponseDeserializer;
597impl DecodeAuthorizationMessageResponseDeserializer {
598    #[allow(dead_code, unused_variables)]
599    fn deserialize<T: Peek + Next>(
600        tag_name: &str,
601        stack: &mut T,
602    ) -> Result<DecodeAuthorizationMessageResponse, XmlParseError> {
603        deserialize_elements::<_, DecodeAuthorizationMessageResponse, _>(
604            tag_name,
605            stack,
606            |name, stack, obj| {
607                match name {
608                    "DecodedMessage" => {
609                        obj.decoded_message = Some(DecodedMessageTypeDeserializer::deserialize(
610                            "DecodedMessage",
611                            stack,
612                        )?);
613                    }
614                    _ => skip_tree(stack),
615                }
616                Ok(())
617            },
618        )
619    }
620}
621#[allow(dead_code)]
622struct DecodedMessageTypeDeserializer;
623impl DecodedMessageTypeDeserializer {
624    #[allow(dead_code, unused_variables)]
625    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
626        xml_util::deserialize_primitive(tag_name, stack, Ok)
627    }
628}
629#[allow(dead_code)]
630struct FederatedIdTypeDeserializer;
631impl FederatedIdTypeDeserializer {
632    #[allow(dead_code, unused_variables)]
633    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
634        xml_util::deserialize_primitive(tag_name, stack, Ok)
635    }
636}
637/// <p>Identifiers for the federated user that is associated with the credentials.</p>
638#[derive(Clone, Debug, Default, PartialEq)]
639#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
640pub struct FederatedUser {
641    /// <p>The ARN that specifies the federated user that is associated with the credentials. For more information about ARNs and how to use them in policies, 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>
642    pub arn: String,
643    /// <p>The string that identifies the federated user associated with the credentials, similar to the unique ID of an IAM user.</p>
644    pub federated_user_id: String,
645}
646
647#[allow(dead_code)]
648struct FederatedUserDeserializer;
649impl FederatedUserDeserializer {
650    #[allow(dead_code, unused_variables)]
651    fn deserialize<T: Peek + Next>(
652        tag_name: &str,
653        stack: &mut T,
654    ) -> Result<FederatedUser, XmlParseError> {
655        deserialize_elements::<_, FederatedUser, _>(tag_name, stack, |name, stack, obj| {
656            match name {
657                "Arn" => {
658                    obj.arn = ArnTypeDeserializer::deserialize("Arn", stack)?;
659                }
660                "FederatedUserId" => {
661                    obj.federated_user_id =
662                        FederatedIdTypeDeserializer::deserialize("FederatedUserId", stack)?;
663                }
664                _ => skip_tree(stack),
665            }
666            Ok(())
667        })
668    }
669}
670#[derive(Clone, Debug, Default, PartialEq)]
671#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
672pub struct GetAccessKeyInfoRequest {
673    /// <p>The identifier of an access key.</p> <p>This parameter allows (through its regex pattern) a string of characters that can consist of any upper- or lowercase letter or digit.</p>
674    pub access_key_id: String,
675}
676
677/// Serialize `GetAccessKeyInfoRequest` contents to a `SignedRequest`.
678struct GetAccessKeyInfoRequestSerializer;
679impl GetAccessKeyInfoRequestSerializer {
680    fn serialize(params: &mut Params, name: &str, obj: &GetAccessKeyInfoRequest) {
681        let mut prefix = name.to_string();
682        if prefix != "" {
683            prefix.push_str(".");
684        }
685
686        params.put(&format!("{}{}", prefix, "AccessKeyId"), &obj.access_key_id);
687    }
688}
689
690#[derive(Clone, Debug, Default, PartialEq)]
691#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
692pub struct GetAccessKeyInfoResponse {
693    /// <p>The number used to identify the AWS account.</p>
694    pub account: Option<String>,
695}
696
697#[allow(dead_code)]
698struct GetAccessKeyInfoResponseDeserializer;
699impl GetAccessKeyInfoResponseDeserializer {
700    #[allow(dead_code, unused_variables)]
701    fn deserialize<T: Peek + Next>(
702        tag_name: &str,
703        stack: &mut T,
704    ) -> Result<GetAccessKeyInfoResponse, XmlParseError> {
705        deserialize_elements::<_, GetAccessKeyInfoResponse, _>(
706            tag_name,
707            stack,
708            |name, stack, obj| {
709                match name {
710                    "Account" => {
711                        obj.account = Some(AccountTypeDeserializer::deserialize("Account", stack)?);
712                    }
713                    _ => skip_tree(stack),
714                }
715                Ok(())
716            },
717        )
718    }
719}
720#[derive(Clone, Debug, Default, PartialEq)]
721#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
722pub struct GetCallerIdentityRequest {}
723
724/// Serialize `GetCallerIdentityRequest` contents to a `SignedRequest`.
725struct GetCallerIdentityRequestSerializer;
726impl GetCallerIdentityRequestSerializer {
727    fn serialize(_params: &mut Params, name: &str, _obj: &GetCallerIdentityRequest) {
728        let mut prefix = name.to_string();
729        if prefix != "" {
730            prefix.push_str(".");
731        }
732    }
733}
734
735/// <p>Contains the response to a successful <a>GetCallerIdentity</a> request, including information about the entity making the request.</p>
736#[derive(Clone, Debug, Default, PartialEq)]
737#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
738pub struct GetCallerIdentityResponse {
739    /// <p>The AWS account ID number of the account that owns or contains the calling entity.</p>
740    pub account: Option<String>,
741    /// <p>The AWS ARN associated with the calling entity.</p>
742    pub arn: Option<String>,
743    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
744    pub user_id: Option<String>,
745}
746
747#[allow(dead_code)]
748struct GetCallerIdentityResponseDeserializer;
749impl GetCallerIdentityResponseDeserializer {
750    #[allow(dead_code, unused_variables)]
751    fn deserialize<T: Peek + Next>(
752        tag_name: &str,
753        stack: &mut T,
754    ) -> Result<GetCallerIdentityResponse, XmlParseError> {
755        deserialize_elements::<_, GetCallerIdentityResponse, _>(
756            tag_name,
757            stack,
758            |name, stack, obj| {
759                match name {
760                    "Account" => {
761                        obj.account = Some(AccountTypeDeserializer::deserialize("Account", stack)?);
762                    }
763                    "Arn" => {
764                        obj.arn = Some(ArnTypeDeserializer::deserialize("Arn", stack)?);
765                    }
766                    "UserId" => {
767                        obj.user_id = Some(UserIdTypeDeserializer::deserialize("UserId", stack)?);
768                    }
769                    _ => skip_tree(stack),
770                }
771                Ok(())
772            },
773        )
774    }
775}
776#[derive(Clone, Debug, Default, PartialEq)]
777#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
778pub struct GetFederationTokenRequest {
779    /// <p>The duration, in seconds, that the session should last. Acceptable durations for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained using AWS account root user credentials are restricted to a maximum of 3,600 seconds (one hour). If the specified duration is longer than one hour, the session obtained by using root user credentials defaults to one hour.</p>
780    pub duration_seconds: Option<i64>,
781    /// <p>The name of the federated user. The name is used as an identifier for the temporary security credentials (such as <code>Bob</code>). For example, you can reference the federated user name in a resource-based policy, such as in an Amazon S3 bucket policy.</p> <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>
782    pub name: String,
783    /// <p><p>An IAM policy in JSON format that you want to use as an inline session policy.</p> <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies.</p> <p>This parameter is optional. However, if you do not pass any session policies, then the resulting federated user session has no permissions.</p> <p>When you pass session policies, the session permissions are the intersection of the IAM user policies and the session policies that you pass. This gives you a way to further restrict the permissions for a federated user. You cannot use session policies to grant more permissions than those that are defined in the permissions policy of the IAM user. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>The resulting credentials can be used to access a resource that has a resource-based policy. If that policy specifically references the federated user session in the <code>Principal</code> element of the policy, the session has the permissions allowed by the policy. These permissions are granted in addition to the permissions that are granted by the session policies.</p> <p>The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. The JSON policy characters can be any ASCII character from the space character to the end of the valid character list (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage return (\u000D) characters.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note></p>
784    pub policy: Option<String>,
785    /// <p><p>The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as a managed session policy. The policies must exist in the same account as the IAM user that is requesting federated access.</p> <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. You can provide up to 10 managed policy ARNs. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a> in the AWS General Reference.</p> <p>This parameter is optional. However, if you do not pass any session policies, then the resulting federated user session has no permissions.</p> <p>When you pass session policies, the session permissions are the intersection of the IAM user policies and the session policies that you pass. This gives you a way to further restrict the permissions for a federated user. You cannot use session policies to grant more permissions than those that are defined in the permissions policy of the IAM user. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>The resulting credentials can be used to access a resource that has a resource-based policy. If that policy specifically references the federated user session in the <code>Principal</code> element of the policy, the session has the permissions allowed by the policy. These permissions are granted in addition to the permissions that are granted by the session policies.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note></p>
786    pub policy_arns: Option<Vec<PolicyDescriptorType>>,
787    /// <p>A list of session tags. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>This parameter is optional. You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is already attached to the user you are federating. When you do, session tags override a user tag with the same key. </p> <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you cannot have separate <code>Department</code> and <code>department</code> tag keys. Assume that the role has the <code>Department</code>=<code>Marketing</code> tag and you pass the <code>department</code>=<code>engineering</code> session tag. <code>Department</code> and <code>department</code> are not saved as separate tags, and the session tag passed in the request takes precedence over the role tag.</p>
788    pub tags: Option<Vec<Tag>>,
789}
790
791/// Serialize `GetFederationTokenRequest` contents to a `SignedRequest`.
792struct GetFederationTokenRequestSerializer;
793impl GetFederationTokenRequestSerializer {
794    fn serialize(params: &mut Params, name: &str, obj: &GetFederationTokenRequest) {
795        let mut prefix = name.to_string();
796        if prefix != "" {
797            prefix.push_str(".");
798        }
799
800        if let Some(ref field_value) = obj.duration_seconds {
801            params.put(&format!("{}{}", prefix, "DurationSeconds"), &field_value);
802        }
803        params.put(&format!("{}{}", prefix, "Name"), &obj.name);
804        if let Some(ref field_value) = obj.policy {
805            params.put(&format!("{}{}", prefix, "Policy"), &field_value);
806        }
807        if let Some(ref field_value) = obj.policy_arns {
808            PolicyDescriptorListTypeSerializer::serialize(
809                params,
810                &format!("{}{}", prefix, "PolicyArns"),
811                field_value,
812            );
813        }
814        if let Some(ref field_value) = obj.tags {
815            TagListTypeSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), field_value);
816        }
817    }
818}
819
820/// <p>Contains the response to a successful <a>GetFederationToken</a> request, including temporary AWS credentials that can be used to make AWS requests. </p>
821#[derive(Clone, Debug, Default, PartialEq)]
822#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
823pub struct GetFederationTokenResponse {
824    /// <p><p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p> <note> <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> </note></p>
825    pub credentials: Option<Credentials>,
826    /// <p>Identifiers for the federated user associated with the credentials (such as <code>arn:aws:sts::123456789012:federated-user/Bob</code> or <code>123456789012:Bob</code>). You can use the federated user's ARN in your resource-based policies, such as an Amazon S3 bucket policy. </p>
827    pub federated_user: Option<FederatedUser>,
828    /// <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>
829    pub packed_policy_size: Option<i64>,
830}
831
832#[allow(dead_code)]
833struct GetFederationTokenResponseDeserializer;
834impl GetFederationTokenResponseDeserializer {
835    #[allow(dead_code, unused_variables)]
836    fn deserialize<T: Peek + Next>(
837        tag_name: &str,
838        stack: &mut T,
839    ) -> Result<GetFederationTokenResponse, XmlParseError> {
840        deserialize_elements::<_, GetFederationTokenResponse, _>(
841            tag_name,
842            stack,
843            |name, stack, obj| {
844                match name {
845                    "Credentials" => {
846                        obj.credentials =
847                            Some(CredentialsDeserializer::deserialize("Credentials", stack)?);
848                    }
849                    "FederatedUser" => {
850                        obj.federated_user = Some(FederatedUserDeserializer::deserialize(
851                            "FederatedUser",
852                            stack,
853                        )?);
854                    }
855                    "PackedPolicySize" => {
856                        obj.packed_policy_size =
857                            Some(NonNegativeIntegerTypeDeserializer::deserialize(
858                                "PackedPolicySize",
859                                stack,
860                            )?);
861                    }
862                    _ => skip_tree(stack),
863                }
864                Ok(())
865            },
866        )
867    }
868}
869#[derive(Clone, Debug, Default, PartialEq)]
870#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
871pub struct GetSessionTokenRequest {
872    /// <p>The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600 seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3,600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.</p>
873    pub duration_seconds: Option<i64>,
874    /// <p>The identification number of the MFA device that is associated with the IAM user who is making the <code>GetSessionToken</code> call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as <code>GAHT12345678</code>) or an Amazon Resource Name (ARN) for a virtual device (such as <code>arn:aws:iam::123456789012:mfa/user</code>). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials. </p> <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>
875    pub serial_number: Option<String>,
876    /// <p>The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, the user must provide a code when requesting a set of temporary security credentials. A user who fails to provide the code receives an "access denied" response when requesting resources that require MFA authentication.</p> <p>The format for this parameter, as described by its regex pattern, is a sequence of six numeric digits.</p>
877    pub token_code: Option<String>,
878}
879
880/// Serialize `GetSessionTokenRequest` contents to a `SignedRequest`.
881struct GetSessionTokenRequestSerializer;
882impl GetSessionTokenRequestSerializer {
883    fn serialize(params: &mut Params, name: &str, obj: &GetSessionTokenRequest) {
884        let mut prefix = name.to_string();
885        if prefix != "" {
886            prefix.push_str(".");
887        }
888
889        if let Some(ref field_value) = obj.duration_seconds {
890            params.put(&format!("{}{}", prefix, "DurationSeconds"), &field_value);
891        }
892        if let Some(ref field_value) = obj.serial_number {
893            params.put(&format!("{}{}", prefix, "SerialNumber"), &field_value);
894        }
895        if let Some(ref field_value) = obj.token_code {
896            params.put(&format!("{}{}", prefix, "TokenCode"), &field_value);
897        }
898    }
899}
900
901/// <p>Contains the response to a successful <a>GetSessionToken</a> request, including temporary AWS credentials that can be used to make AWS requests. </p>
902#[derive(Clone, Debug, Default, PartialEq)]
903#[cfg_attr(feature = "serialize_structs", derive(Serialize))]
904pub struct GetSessionTokenResponse {
905    /// <p><p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p> <note> <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> </note></p>
906    pub credentials: Option<Credentials>,
907}
908
909#[allow(dead_code)]
910struct GetSessionTokenResponseDeserializer;
911impl GetSessionTokenResponseDeserializer {
912    #[allow(dead_code, unused_variables)]
913    fn deserialize<T: Peek + Next>(
914        tag_name: &str,
915        stack: &mut T,
916    ) -> Result<GetSessionTokenResponse, XmlParseError> {
917        deserialize_elements::<_, GetSessionTokenResponse, _>(
918            tag_name,
919            stack,
920            |name, stack, obj| {
921                match name {
922                    "Credentials" => {
923                        obj.credentials =
924                            Some(CredentialsDeserializer::deserialize("Credentials", stack)?);
925                    }
926                    _ => skip_tree(stack),
927                }
928                Ok(())
929            },
930        )
931    }
932}
933#[allow(dead_code)]
934struct IssuerDeserializer;
935impl IssuerDeserializer {
936    #[allow(dead_code, unused_variables)]
937    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
938        xml_util::deserialize_primitive(tag_name, stack, Ok)
939    }
940}
941#[allow(dead_code)]
942struct NameQualifierDeserializer;
943impl NameQualifierDeserializer {
944    #[allow(dead_code, unused_variables)]
945    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
946        xml_util::deserialize_primitive(tag_name, stack, Ok)
947    }
948}
949#[allow(dead_code)]
950struct NonNegativeIntegerTypeDeserializer;
951impl NonNegativeIntegerTypeDeserializer {
952    #[allow(dead_code, unused_variables)]
953    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<i64, XmlParseError> {
954        xml_util::deserialize_primitive(tag_name, stack, |s| Ok(i64::from_str(&s).unwrap()))
955    }
956}
957
958/// Serialize `PolicyDescriptorListType` contents to a `SignedRequest`.
959struct PolicyDescriptorListTypeSerializer;
960impl PolicyDescriptorListTypeSerializer {
961    fn serialize(params: &mut Params, name: &str, obj: &Vec<PolicyDescriptorType>) {
962        for (index, obj) in obj.iter().enumerate() {
963            let key = format!("{}.member.{}", name, index + 1);
964            PolicyDescriptorTypeSerializer::serialize(params, &key, obj);
965        }
966    }
967}
968
969/// <p>A reference to the IAM managed policy that is passed as a session policy for a role session or a federated user session.</p>
970#[derive(Clone, Debug, Default, PartialEq)]
971#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
972pub struct PolicyDescriptorType {
973    /// <p>The Amazon Resource Name (ARN) of the IAM managed policy to use as a session policy for the role. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a> in the <i>AWS General Reference</i>.</p>
974    pub arn: Option<String>,
975}
976
977/// Serialize `PolicyDescriptorType` contents to a `SignedRequest`.
978struct PolicyDescriptorTypeSerializer;
979impl PolicyDescriptorTypeSerializer {
980    fn serialize(params: &mut Params, name: &str, obj: &PolicyDescriptorType) {
981        let mut prefix = name.to_string();
982        if prefix != "" {
983            prefix.push_str(".");
984        }
985
986        if let Some(ref field_value) = obj.arn {
987            params.put(&format!("{}{}", prefix, "arn"), &field_value);
988        }
989    }
990}
991
992#[allow(dead_code)]
993struct SubjectDeserializer;
994impl SubjectDeserializer {
995    #[allow(dead_code, unused_variables)]
996    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
997        xml_util::deserialize_primitive(tag_name, stack, Ok)
998    }
999}
1000#[allow(dead_code)]
1001struct SubjectTypeDeserializer;
1002impl SubjectTypeDeserializer {
1003    #[allow(dead_code, unused_variables)]
1004    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
1005        xml_util::deserialize_primitive(tag_name, stack, Ok)
1006    }
1007}
1008/// <p>You can pass custom key-value pair attributes when you assume a role or federate a user. These are called session tags. You can then use the session tags to control access to resources. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Tagging AWS STS Sessions</a> in the <i>IAM User Guide</i>.</p>
1009#[derive(Clone, Debug, Default, PartialEq)]
1010#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
1011pub struct Tag {
1012    /// <p>The key for a session tag.</p> <p>You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p>
1013    pub key: String,
1014    /// <p>The value for a session tag.</p> <p>You can pass up to 50 session tags. The plain text session tag values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p>
1015    pub value: String,
1016}
1017
1018/// Serialize `Tag` contents to a `SignedRequest`.
1019struct TagSerializer;
1020impl TagSerializer {
1021    fn serialize(params: &mut Params, name: &str, obj: &Tag) {
1022        let mut prefix = name.to_string();
1023        if prefix != "" {
1024            prefix.push_str(".");
1025        }
1026
1027        params.put(&format!("{}{}", prefix, "Key"), &obj.key);
1028        params.put(&format!("{}{}", prefix, "Value"), &obj.value);
1029    }
1030}
1031
1032/// Serialize `TagKeyListType` contents to a `SignedRequest`.
1033struct TagKeyListTypeSerializer;
1034impl TagKeyListTypeSerializer {
1035    fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
1036        for (index, obj) in obj.iter().enumerate() {
1037            let key = format!("{}.member.{}", name, index + 1);
1038            params.put(&key, &obj);
1039        }
1040    }
1041}
1042
1043/// Serialize `TagListType` contents to a `SignedRequest`.
1044struct TagListTypeSerializer;
1045impl TagListTypeSerializer {
1046    fn serialize(params: &mut Params, name: &str, obj: &Vec<Tag>) {
1047        for (index, obj) in obj.iter().enumerate() {
1048            let key = format!("{}.member.{}", name, index + 1);
1049            TagSerializer::serialize(params, &key, obj);
1050        }
1051    }
1052}
1053
1054#[allow(dead_code)]
1055struct TokenTypeDeserializer;
1056impl TokenTypeDeserializer {
1057    #[allow(dead_code, unused_variables)]
1058    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
1059        xml_util::deserialize_primitive(tag_name, stack, Ok)
1060    }
1061}
1062#[allow(dead_code)]
1063struct UserIdTypeDeserializer;
1064impl UserIdTypeDeserializer {
1065    #[allow(dead_code, unused_variables)]
1066    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
1067        xml_util::deserialize_primitive(tag_name, stack, Ok)
1068    }
1069}
1070#[allow(dead_code)]
1071struct WebIdentitySubjectTypeDeserializer;
1072impl WebIdentitySubjectTypeDeserializer {
1073    #[allow(dead_code, unused_variables)]
1074    fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
1075        xml_util::deserialize_primitive(tag_name, stack, Ok)
1076    }
1077}
1078/// Errors returned by AssumeRole
1079#[derive(Debug, PartialEq)]
1080pub enum AssumeRoleError {
1081    /// <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
1082    MalformedPolicyDocument(String),
1083    /// <p>The request was rejected because the total packed size of the session policies and session tags combined was too large. An AWS conversion compresses the session policy document, session policy ARNs, and session tags into a packed binary format that has a separate limit. The error message indicates by percentage how close the policies and tags are to the upper size limit. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You could receive this error even though you meet other defined session policy and session tag limits. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">IAM and STS Entity Character Limits</a> in the <i>IAM User Guide</i>.</p>
1084    PackedPolicyTooLarge(String),
1085    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating AWS STS in an AWS Region</a> in the <i>IAM User Guide</i>.</p>
1086    RegionDisabled(String),
1087}
1088
1089impl AssumeRoleError {
1090    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssumeRoleError> {
1091        {
1092            let reader = EventReader::new(res.body.as_ref());
1093            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1094            find_start_element(&mut stack);
1095            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1096                match &parsed_error.code[..] {
1097                    "MalformedPolicyDocument" => {
1098                        return RusotoError::Service(AssumeRoleError::MalformedPolicyDocument(
1099                            parsed_error.message,
1100                        ))
1101                    }
1102                    "PackedPolicyTooLarge" => {
1103                        return RusotoError::Service(AssumeRoleError::PackedPolicyTooLarge(
1104                            parsed_error.message,
1105                        ))
1106                    }
1107                    "RegionDisabledException" => {
1108                        return RusotoError::Service(AssumeRoleError::RegionDisabled(
1109                            parsed_error.message,
1110                        ))
1111                    }
1112                    _ => {}
1113                }
1114            }
1115        }
1116        RusotoError::Unknown(res)
1117    }
1118
1119    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1120    where
1121        T: Peek + Next,
1122    {
1123        xml_util::start_element("ErrorResponse", stack)?;
1124        XmlErrorDeserializer::deserialize("Error", stack)
1125    }
1126}
1127impl fmt::Display for AssumeRoleError {
1128    #[allow(unused_variables)]
1129    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1130        match *self {
1131            AssumeRoleError::MalformedPolicyDocument(ref cause) => write!(f, "{}", cause),
1132            AssumeRoleError::PackedPolicyTooLarge(ref cause) => write!(f, "{}", cause),
1133            AssumeRoleError::RegionDisabled(ref cause) => write!(f, "{}", cause),
1134        }
1135    }
1136}
1137impl Error for AssumeRoleError {}
1138/// Errors returned by AssumeRoleWithSAML
1139#[derive(Debug, PartialEq)]
1140pub enum AssumeRoleWithSAMLError {
1141    /// <p>The web identity token that was passed is expired or is not valid. Get a new identity token from the identity provider and then retry the request.</p>
1142    ExpiredToken(String),
1143    /// <p>The identity provider (IdP) reported that authentication failed. This might be because the claim is invalid.</p> <p>If this error is returned for the <code>AssumeRoleWithWebIdentity</code> operation, it can also mean that the claim has expired or has been explicitly revoked. </p>
1144    IDPRejectedClaim(String),
1145    /// <p>The web identity token that was passed could not be validated by AWS. Get a new identity token from the identity provider and then retry the request.</p>
1146    InvalidIdentityToken(String),
1147    /// <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
1148    MalformedPolicyDocument(String),
1149    /// <p>The request was rejected because the total packed size of the session policies and session tags combined was too large. An AWS conversion compresses the session policy document, session policy ARNs, and session tags into a packed binary format that has a separate limit. The error message indicates by percentage how close the policies and tags are to the upper size limit. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You could receive this error even though you meet other defined session policy and session tag limits. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">IAM and STS Entity Character Limits</a> in the <i>IAM User Guide</i>.</p>
1150    PackedPolicyTooLarge(String),
1151    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating AWS STS in an AWS Region</a> in the <i>IAM User Guide</i>.</p>
1152    RegionDisabled(String),
1153}
1154
1155impl AssumeRoleWithSAMLError {
1156    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssumeRoleWithSAMLError> {
1157        {
1158            let reader = EventReader::new(res.body.as_ref());
1159            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1160            find_start_element(&mut stack);
1161            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1162                match &parsed_error.code[..] {
1163                    "ExpiredTokenException" => {
1164                        return RusotoError::Service(AssumeRoleWithSAMLError::ExpiredToken(
1165                            parsed_error.message,
1166                        ))
1167                    }
1168                    "IDPRejectedClaim" => {
1169                        return RusotoError::Service(AssumeRoleWithSAMLError::IDPRejectedClaim(
1170                            parsed_error.message,
1171                        ))
1172                    }
1173                    "InvalidIdentityToken" => {
1174                        return RusotoError::Service(AssumeRoleWithSAMLError::InvalidIdentityToken(
1175                            parsed_error.message,
1176                        ))
1177                    }
1178                    "MalformedPolicyDocument" => {
1179                        return RusotoError::Service(
1180                            AssumeRoleWithSAMLError::MalformedPolicyDocument(parsed_error.message),
1181                        )
1182                    }
1183                    "PackedPolicyTooLarge" => {
1184                        return RusotoError::Service(AssumeRoleWithSAMLError::PackedPolicyTooLarge(
1185                            parsed_error.message,
1186                        ))
1187                    }
1188                    "RegionDisabledException" => {
1189                        return RusotoError::Service(AssumeRoleWithSAMLError::RegionDisabled(
1190                            parsed_error.message,
1191                        ))
1192                    }
1193                    _ => {}
1194                }
1195            }
1196        }
1197        RusotoError::Unknown(res)
1198    }
1199
1200    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1201    where
1202        T: Peek + Next,
1203    {
1204        xml_util::start_element("ErrorResponse", stack)?;
1205        XmlErrorDeserializer::deserialize("Error", stack)
1206    }
1207}
1208impl fmt::Display for AssumeRoleWithSAMLError {
1209    #[allow(unused_variables)]
1210    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1211        match *self {
1212            AssumeRoleWithSAMLError::ExpiredToken(ref cause) => write!(f, "{}", cause),
1213            AssumeRoleWithSAMLError::IDPRejectedClaim(ref cause) => write!(f, "{}", cause),
1214            AssumeRoleWithSAMLError::InvalidIdentityToken(ref cause) => write!(f, "{}", cause),
1215            AssumeRoleWithSAMLError::MalformedPolicyDocument(ref cause) => write!(f, "{}", cause),
1216            AssumeRoleWithSAMLError::PackedPolicyTooLarge(ref cause) => write!(f, "{}", cause),
1217            AssumeRoleWithSAMLError::RegionDisabled(ref cause) => write!(f, "{}", cause),
1218        }
1219    }
1220}
1221impl Error for AssumeRoleWithSAMLError {}
1222/// Errors returned by AssumeRoleWithWebIdentity
1223#[derive(Debug, PartialEq)]
1224pub enum AssumeRoleWithWebIdentityError {
1225    /// <p>The web identity token that was passed is expired or is not valid. Get a new identity token from the identity provider and then retry the request.</p>
1226    ExpiredToken(String),
1227    /// <p>The request could not be fulfilled because the identity provider (IDP) that was asked to verify the incoming identity token could not be reached. This is often a transient error caused by network conditions. Retry the request a limited number of times so that you don't exceed the request rate. If the error persists, the identity provider might be down or not responding.</p>
1228    IDPCommunicationError(String),
1229    /// <p>The identity provider (IdP) reported that authentication failed. This might be because the claim is invalid.</p> <p>If this error is returned for the <code>AssumeRoleWithWebIdentity</code> operation, it can also mean that the claim has expired or has been explicitly revoked. </p>
1230    IDPRejectedClaim(String),
1231    /// <p>The web identity token that was passed could not be validated by AWS. Get a new identity token from the identity provider and then retry the request.</p>
1232    InvalidIdentityToken(String),
1233    /// <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
1234    MalformedPolicyDocument(String),
1235    /// <p>The request was rejected because the total packed size of the session policies and session tags combined was too large. An AWS conversion compresses the session policy document, session policy ARNs, and session tags into a packed binary format that has a separate limit. The error message indicates by percentage how close the policies and tags are to the upper size limit. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You could receive this error even though you meet other defined session policy and session tag limits. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">IAM and STS Entity Character Limits</a> in the <i>IAM User Guide</i>.</p>
1236    PackedPolicyTooLarge(String),
1237    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating AWS STS in an AWS Region</a> in the <i>IAM User Guide</i>.</p>
1238    RegionDisabled(String),
1239}
1240
1241impl AssumeRoleWithWebIdentityError {
1242    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AssumeRoleWithWebIdentityError> {
1243        {
1244            let reader = EventReader::new(res.body.as_ref());
1245            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1246            find_start_element(&mut stack);
1247            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1248                match &parsed_error.code[..] {
1249                    "ExpiredTokenException" => {
1250                        return RusotoError::Service(AssumeRoleWithWebIdentityError::ExpiredToken(
1251                            parsed_error.message,
1252                        ))
1253                    }
1254                    "IDPCommunicationError" => {
1255                        return RusotoError::Service(
1256                            AssumeRoleWithWebIdentityError::IDPCommunicationError(
1257                                parsed_error.message,
1258                            ),
1259                        )
1260                    }
1261                    "IDPRejectedClaim" => {
1262                        return RusotoError::Service(
1263                            AssumeRoleWithWebIdentityError::IDPRejectedClaim(parsed_error.message),
1264                        )
1265                    }
1266                    "InvalidIdentityToken" => {
1267                        return RusotoError::Service(
1268                            AssumeRoleWithWebIdentityError::InvalidIdentityToken(
1269                                parsed_error.message,
1270                            ),
1271                        )
1272                    }
1273                    "MalformedPolicyDocument" => {
1274                        return RusotoError::Service(
1275                            AssumeRoleWithWebIdentityError::MalformedPolicyDocument(
1276                                parsed_error.message,
1277                            ),
1278                        )
1279                    }
1280                    "PackedPolicyTooLarge" => {
1281                        return RusotoError::Service(
1282                            AssumeRoleWithWebIdentityError::PackedPolicyTooLarge(
1283                                parsed_error.message,
1284                            ),
1285                        )
1286                    }
1287                    "RegionDisabledException" => {
1288                        return RusotoError::Service(
1289                            AssumeRoleWithWebIdentityError::RegionDisabled(parsed_error.message),
1290                        )
1291                    }
1292                    _ => {}
1293                }
1294            }
1295        }
1296        RusotoError::Unknown(res)
1297    }
1298
1299    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1300    where
1301        T: Peek + Next,
1302    {
1303        xml_util::start_element("ErrorResponse", stack)?;
1304        XmlErrorDeserializer::deserialize("Error", stack)
1305    }
1306}
1307impl fmt::Display for AssumeRoleWithWebIdentityError {
1308    #[allow(unused_variables)]
1309    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1310        match *self {
1311            AssumeRoleWithWebIdentityError::ExpiredToken(ref cause) => write!(f, "{}", cause),
1312            AssumeRoleWithWebIdentityError::IDPCommunicationError(ref cause) => {
1313                write!(f, "{}", cause)
1314            }
1315            AssumeRoleWithWebIdentityError::IDPRejectedClaim(ref cause) => write!(f, "{}", cause),
1316            AssumeRoleWithWebIdentityError::InvalidIdentityToken(ref cause) => {
1317                write!(f, "{}", cause)
1318            }
1319            AssumeRoleWithWebIdentityError::MalformedPolicyDocument(ref cause) => {
1320                write!(f, "{}", cause)
1321            }
1322            AssumeRoleWithWebIdentityError::PackedPolicyTooLarge(ref cause) => {
1323                write!(f, "{}", cause)
1324            }
1325            AssumeRoleWithWebIdentityError::RegionDisabled(ref cause) => write!(f, "{}", cause),
1326        }
1327    }
1328}
1329impl Error for AssumeRoleWithWebIdentityError {}
1330/// Errors returned by DecodeAuthorizationMessage
1331#[derive(Debug, PartialEq)]
1332pub enum DecodeAuthorizationMessageError {
1333    /// <p>The error returned if the message passed to <code>DecodeAuthorizationMessage</code> was invalid. This can happen if the token contains invalid characters, such as linebreaks. </p>
1334    InvalidAuthorizationMessage(String),
1335}
1336
1337impl DecodeAuthorizationMessageError {
1338    pub fn from_response(
1339        res: BufferedHttpResponse,
1340    ) -> RusotoError<DecodeAuthorizationMessageError> {
1341        {
1342            let reader = EventReader::new(res.body.as_ref());
1343            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1344            find_start_element(&mut stack);
1345            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1346                match &parsed_error.code[..] {
1347                    "InvalidAuthorizationMessageException" => {
1348                        return RusotoError::Service(
1349                            DecodeAuthorizationMessageError::InvalidAuthorizationMessage(
1350                                parsed_error.message,
1351                            ),
1352                        )
1353                    }
1354                    _ => {}
1355                }
1356            }
1357        }
1358        RusotoError::Unknown(res)
1359    }
1360
1361    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1362    where
1363        T: Peek + Next,
1364    {
1365        xml_util::start_element("ErrorResponse", stack)?;
1366        XmlErrorDeserializer::deserialize("Error", stack)
1367    }
1368}
1369impl fmt::Display for DecodeAuthorizationMessageError {
1370    #[allow(unused_variables)]
1371    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1372        match *self {
1373            DecodeAuthorizationMessageError::InvalidAuthorizationMessage(ref cause) => {
1374                write!(f, "{}", cause)
1375            }
1376        }
1377    }
1378}
1379impl Error for DecodeAuthorizationMessageError {}
1380/// Errors returned by GetAccessKeyInfo
1381#[derive(Debug, PartialEq)]
1382pub enum GetAccessKeyInfoError {}
1383
1384impl GetAccessKeyInfoError {
1385    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetAccessKeyInfoError> {
1386        {
1387            let reader = EventReader::new(res.body.as_ref());
1388            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1389            find_start_element(&mut stack);
1390            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1391                match &parsed_error.code[..] {
1392                    _ => {}
1393                }
1394            }
1395        }
1396        RusotoError::Unknown(res)
1397    }
1398
1399    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1400    where
1401        T: Peek + Next,
1402    {
1403        xml_util::start_element("ErrorResponse", stack)?;
1404        XmlErrorDeserializer::deserialize("Error", stack)
1405    }
1406}
1407impl fmt::Display for GetAccessKeyInfoError {
1408    #[allow(unused_variables)]
1409    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1410        match *self {}
1411    }
1412}
1413impl Error for GetAccessKeyInfoError {}
1414/// Errors returned by GetCallerIdentity
1415#[derive(Debug, PartialEq)]
1416pub enum GetCallerIdentityError {}
1417
1418impl GetCallerIdentityError {
1419    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetCallerIdentityError> {
1420        {
1421            let reader = EventReader::new(res.body.as_ref());
1422            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1423            find_start_element(&mut stack);
1424            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1425                match &parsed_error.code[..] {
1426                    _ => {}
1427                }
1428            }
1429        }
1430        RusotoError::Unknown(res)
1431    }
1432
1433    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1434    where
1435        T: Peek + Next,
1436    {
1437        xml_util::start_element("ErrorResponse", stack)?;
1438        XmlErrorDeserializer::deserialize("Error", stack)
1439    }
1440}
1441impl fmt::Display for GetCallerIdentityError {
1442    #[allow(unused_variables)]
1443    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1444        match *self {}
1445    }
1446}
1447impl Error for GetCallerIdentityError {}
1448/// Errors returned by GetFederationToken
1449#[derive(Debug, PartialEq)]
1450pub enum GetFederationTokenError {
1451    /// <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
1452    MalformedPolicyDocument(String),
1453    /// <p>The request was rejected because the total packed size of the session policies and session tags combined was too large. An AWS conversion compresses the session policy document, session policy ARNs, and session tags into a packed binary format that has a separate limit. The error message indicates by percentage how close the policies and tags are to the upper size limit. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You could receive this error even though you meet other defined session policy and session tag limits. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">IAM and STS Entity Character Limits</a> in the <i>IAM User Guide</i>.</p>
1454    PackedPolicyTooLarge(String),
1455    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating AWS STS in an AWS Region</a> in the <i>IAM User Guide</i>.</p>
1456    RegionDisabled(String),
1457}
1458
1459impl GetFederationTokenError {
1460    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetFederationTokenError> {
1461        {
1462            let reader = EventReader::new(res.body.as_ref());
1463            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1464            find_start_element(&mut stack);
1465            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1466                match &parsed_error.code[..] {
1467                    "MalformedPolicyDocument" => {
1468                        return RusotoError::Service(
1469                            GetFederationTokenError::MalformedPolicyDocument(parsed_error.message),
1470                        )
1471                    }
1472                    "PackedPolicyTooLarge" => {
1473                        return RusotoError::Service(GetFederationTokenError::PackedPolicyTooLarge(
1474                            parsed_error.message,
1475                        ))
1476                    }
1477                    "RegionDisabledException" => {
1478                        return RusotoError::Service(GetFederationTokenError::RegionDisabled(
1479                            parsed_error.message,
1480                        ))
1481                    }
1482                    _ => {}
1483                }
1484            }
1485        }
1486        RusotoError::Unknown(res)
1487    }
1488
1489    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1490    where
1491        T: Peek + Next,
1492    {
1493        xml_util::start_element("ErrorResponse", stack)?;
1494        XmlErrorDeserializer::deserialize("Error", stack)
1495    }
1496}
1497impl fmt::Display for GetFederationTokenError {
1498    #[allow(unused_variables)]
1499    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1500        match *self {
1501            GetFederationTokenError::MalformedPolicyDocument(ref cause) => write!(f, "{}", cause),
1502            GetFederationTokenError::PackedPolicyTooLarge(ref cause) => write!(f, "{}", cause),
1503            GetFederationTokenError::RegionDisabled(ref cause) => write!(f, "{}", cause),
1504        }
1505    }
1506}
1507impl Error for GetFederationTokenError {}
1508/// Errors returned by GetSessionToken
1509#[derive(Debug, PartialEq)]
1510pub enum GetSessionTokenError {
1511    /// <p>STS is not activated in the requested region for the account that is being asked to generate credentials. The account administrator must use the IAM console to activate STS in that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating AWS STS in an AWS Region</a> in the <i>IAM User Guide</i>.</p>
1512    RegionDisabled(String),
1513}
1514
1515impl GetSessionTokenError {
1516    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetSessionTokenError> {
1517        {
1518            let reader = EventReader::new(res.body.as_ref());
1519            let mut stack = XmlResponse::new(reader.into_iter().peekable());
1520            find_start_element(&mut stack);
1521            if let Ok(parsed_error) = Self::deserialize(&mut stack) {
1522                match &parsed_error.code[..] {
1523                    "RegionDisabledException" => {
1524                        return RusotoError::Service(GetSessionTokenError::RegionDisabled(
1525                            parsed_error.message,
1526                        ))
1527                    }
1528                    _ => {}
1529                }
1530            }
1531        }
1532        RusotoError::Unknown(res)
1533    }
1534
1535    fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
1536    where
1537        T: Peek + Next,
1538    {
1539        xml_util::start_element("ErrorResponse", stack)?;
1540        XmlErrorDeserializer::deserialize("Error", stack)
1541    }
1542}
1543impl fmt::Display for GetSessionTokenError {
1544    #[allow(unused_variables)]
1545    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1546        match *self {
1547            GetSessionTokenError::RegionDisabled(ref cause) => write!(f, "{}", cause),
1548        }
1549    }
1550}
1551impl Error for GetSessionTokenError {}
1552/// Trait representing the capabilities of the AWS STS API. AWS STS clients implement this trait.
1553#[async_trait]
1554pub trait Sts {
1555    /// <p>Returns a set of temporary security credentials that you can use to access AWS resources that you might not normally have access to. These temporary credentials consist of an access key ID, a secret access key, and a security token. Typically, you use <code>AssumeRole</code> within your account or for cross-account access. For a comparison of <code>AssumeRole</code> with other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <important> <p>You cannot use AWS account root user credentials to call <code>AssumeRole</code>. You must use credentials for an IAM user or an IAM role to call <code>AssumeRole</code>.</p> </important> <p>For cross-account access, imagine that you own multiple accounts and need to access resources in each account. You could create long-term credentials in each account to access those resources. However, managing all those credentials and remembering which one can access which account can be time consuming. Instead, you can create one set of long-term credentials in one account. Then use temporary security credentials to access all the other accounts by assuming roles in those accounts. For more information about roles, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">IAM Roles</a> in the <i>IAM User Guide</i>. </p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRole</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. You can provide a value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole*</code> API operations or the <code>assume-role*</code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>.</p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRole</code> can be used to make API calls to any AWS service with the following exception: You cannot call the AWS STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can't exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session's permissions are the intersection of the role's identity-based policy and the session policies. You can use the role's temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>To assume a role from a different account, your AWS account must be trusted by the role. The trust relationship is defined in the role's trust policy when the role is created. That trust policy states which accounts are allowed to delegate that access to users in the account. </p> <p>A user who wants to access a role in a different account must also have permissions that are delegated from the user account administrator. The administrator must attach a policy that allows the user to call <code>AssumeRole</code> for the ARN of the role in the other account. If the user is in the same account as the role, then you can do either of the following:</p> <ul> <li> <p>Attach a policy to the user (identical to the previous user in a different account).</p> </li> <li> <p>Add the user as a principal directly in the role's trust policy.</p> </li> </ul> <p>In this case, the trust policy acts as an IAM resource-based policy. Users in the same account as the role do not need explicit permission to assume the role. For more information about trust policies and resource-based policies, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html">IAM Policies</a> in the <i>IAM User Guide</i>.</p> <p> <b>Tags</b> </p> <p>(Optional) You can pass tag key-value pairs to your session. These tags are called session tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>Using MFA with AssumeRole</b> </p> <p>(Optional) You can include multi-factor authentication (MFA) information when you call <code>AssumeRole</code>. This is useful for cross-account scenarios to ensure that the user that assumes the role has been authenticated with an AWS MFA device. In that scenario, the trust policy of the role being assumed includes a condition that tests for MFA authentication. If the caller does not include valid MFA information, the request to assume the role is denied. The condition in a trust policy that tests for MFA authentication might look like the following example.</p> <p> <code>"Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}</code> </p> <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html">Configuring MFA-Protected API Access</a> in the <i>IAM User Guide</i> guide.</p> <p>To use MFA with <code>AssumeRole</code>, you pass values for the <code>SerialNumber</code> and <code>TokenCode</code> parameters. The <code>SerialNumber</code> value identifies the user's hardware or virtual MFA device. The <code>TokenCode</code> is the time-based one-time password (TOTP) that the MFA device produces. </p>
1556    async fn assume_role(
1557        &self,
1558        input: AssumeRoleRequest,
1559    ) -> Result<AssumeRoleResponse, RusotoError<AssumeRoleError>>;
1560
1561    /// <p><p>Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. This operation provides a mechanism for tying an enterprise identity store or directory to role-based AWS access without user-specific credentials or configuration. For a comparison of <code>AssumeRoleWithSAML</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p>The temporary security credentials returned by this operation consist of an access key ID, a secret access key, and a security token. Applications can use these temporary security credentials to sign calls to AWS services.</p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRoleWithSAML</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. Your role session lasts for the duration that you specify, or until the time specified in the SAML authentication response&#39;s <code>SessionNotOnOrAfter</code> value, whichever is shorter. You can provide a <code>DurationSeconds</code> value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole<em></code> API operations or the <code>assume-role</em></code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>.</p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRoleWithSAML</code> can be used to make API calls to any AWS service with the following exception: you cannot call the STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>Calling <code>AssumeRoleWithSAML</code> does not require the use of AWS security credentials. The identity of the caller is validated by using keys in the metadata document that is uploaded for the SAML provider entity for your identity provider. </p> <important> <p>Calling <code>AssumeRoleWithSAML</code> can result in an entry in your AWS CloudTrail logs. The entry includes the value in the <code>NameID</code> element of the SAML assertion. We recommend that you use a <code>NameIDType</code> that is not associated with any personally identifiable information (PII). For example, you could instead use the persistent identifier (<code>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</code>).</p> </important> <p> <b>Tags</b> </p> <p>(Optional) You can configure your IdP to pass attributes into your SAML assertion as session tags. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is attached to the role. When you do, session tags override the role&#39;s tags with the same key.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>SAML Configuration</b> </p> <p>Before your application can call <code>AssumeRoleWithSAML</code>, you must configure your SAML identity provider (IdP) to issue the claims required by AWS. Additionally, you must use AWS Identity and Access Management (IAM) to create a SAML provider entity in your AWS account that represents your identity provider. You must also create an IAM role that specifies this SAML provider in its trust policy. </p> <p>For more information, see the following resources:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html">About SAML 2.0-based Federation</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html">Creating SAML Identity Providers</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html">Configuring a Relying Party and Claims</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html">Creating a Role for SAML 2.0 Federation</a> in the <i>IAM User Guide</i>. </p> </li> </ul></p>
1562    async fn assume_role_with_saml(
1563        &self,
1564        input: AssumeRoleWithSAMLRequest,
1565    ) -> Result<AssumeRoleWithSAMLResponse, RusotoError<AssumeRoleWithSAMLError>>;
1566
1567    /// <p><p>Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider. Example providers include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider.</p> <note> <p>For mobile applications, we recommend that you use Amazon Cognito. You can use Amazon Cognito with the <a href="http://aws.amazon.com/sdkforios/">AWS SDK for iOS Developer Guide</a> and the <a href="http://aws.amazon.com/sdkforandroid/">AWS SDK for Android Developer Guide</a> to uniquely identify a user. You can also supply the user with a consistent identity throughout the lifetime of an application.</p> <p>To learn more about Amazon Cognito, see <a href="https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840">Amazon Cognito Overview</a> in <i>AWS SDK for Android Developer Guide</i> and <a href="https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664">Amazon Cognito Overview</a> in the <i>AWS SDK for iOS Developer Guide</i>.</p> </note> <p>Calling <code>AssumeRoleWithWebIdentity</code> does not require the use of AWS security credentials. Therefore, you can distribute an application (for example, on mobile devices) that requests temporary security credentials without including long-term AWS credentials in the application. You also don&#39;t need to deploy server-based proxy services that use long-term AWS credentials. Instead, the identity of the caller is validated by using a token from the web identity provider. For a comparison of <code>AssumeRoleWithWebIdentity</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p>The temporary security credentials returned by this API consist of an access key ID, a secret access key, and a security token. Applications can use these temporary security credentials to sign calls to AWS service API operations.</p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRoleWithWebIdentity</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. You can provide a value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole<em></code> API operations or the <code>assume-role</em></code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>. </p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRoleWithWebIdentity</code> can be used to make API calls to any AWS service with the following exception: you cannot call the STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p> <b>Tags</b> </p> <p>(Optional) You can configure your IdP to pass attributes into your web identity token as session tags. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is attached to the role. When you do, the session tag overrides the role tag with the same key.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>Identities</b> </p> <p>Before your application can call <code>AssumeRoleWithWebIdentity</code>, you must have an identity token from a supported identity provider and create a role that the application can assume. The role that your application assumes must trust the identity provider that is associated with the identity token. In other words, the identity provider must be specified in the role&#39;s trust policy. </p> <important> <p>Calling <code>AssumeRoleWithWebIdentity</code> can result in an entry in your AWS CloudTrail logs. The entry includes the <a href="http://openid.net/specs/openid-connect-core-1_0.html#Claims">Subject</a> of the provided Web Identity Token. We recommend that you avoid using any personally identifiable information (PII) in this field. For example, you could instead use a GUID or a pairwise identifier, as <a href="http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes">suggested in the OIDC specification</a>.</p> </important> <p>For more information about how to use web identity federation and the <code>AssumeRoleWithWebIdentity</code> API, see the following resources: </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html">Using Web Identity Federation API Operations for Mobile Apps</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a>. </p> </li> <li> <p> <a href="https://web-identity-federation-playground.s3.amazonaws.com/index.html"> Web Identity Federation Playground</a>. Walk through the process of authenticating through Login with Amazon, Facebook, or Google, getting temporary security credentials, and then using those credentials to make a request to AWS. </p> </li> <li> <p> <a href="http://aws.amazon.com/sdkforios/">AWS SDK for iOS Developer Guide</a> and <a href="http://aws.amazon.com/sdkforandroid/">AWS SDK for Android Developer Guide</a>. These toolkits contain sample apps that show how to invoke the identity providers. The toolkits then show how to use the information from these providers to get and use temporary security credentials. </p> </li> <li> <p> <a href="http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications">Web Identity Federation with Mobile Applications</a>. This article discusses web identity federation and shows an example of how to use web identity federation to get access to content in Amazon S3. </p> </li> </ul></p>
1568    async fn assume_role_with_web_identity(
1569        &self,
1570        input: AssumeRoleWithWebIdentityRequest,
1571    ) -> Result<AssumeRoleWithWebIdentityResponse, RusotoError<AssumeRoleWithWebIdentityError>>;
1572
1573    /// <p><p>Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request.</p> <p>For example, if a user is not authorized to perform an operation that he or she has requested, the request returns a <code>Client.UnauthorizedOperation</code> response (an HTTP 403 response). Some AWS operations additionally return an encoded message that can provide details about this authorization failure. </p> <note> <p>Only certain AWS operations return an encoded authorization message. The documentation for an individual operation indicates whether that operation returns an encoded message in addition to returning an HTTP code.</p> </note> <p>The message is encoded because the details of the authorization status can constitute privileged information that the user who requested the operation should not see. To decode an authorization status message, a user must be granted permissions via an IAM policy to request the <code>DecodeAuthorizationMessage</code> (<code>sts:DecodeAuthorizationMessage</code>) action. </p> <p>The decoded message includes the following type of information:</p> <ul> <li> <p>Whether the request was denied due to an explicit deny or due to the absence of an explicit allow. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow">Determining Whether a Request is Allowed or Denied</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p>The principal who made the request.</p> </li> <li> <p>The requested action.</p> </li> <li> <p>The requested resource.</p> </li> <li> <p>The values of condition keys in the context of the user&#39;s request.</p> </li> </ul></p>
1574    async fn decode_authorization_message(
1575        &self,
1576        input: DecodeAuthorizationMessageRequest,
1577    ) -> Result<DecodeAuthorizationMessageResponse, RusotoError<DecodeAuthorizationMessageError>>;
1578
1579    /// <p>Returns the account identifier for the specified access key ID.</p> <p>Access keys consist of two parts: an access key ID (for example, <code>AKIAIOSFODNN7EXAMPLE</code>) and a secret access key (for example, <code>wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY</code>). For more information about access keys, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">Managing Access Keys for IAM Users</a> in the <i>IAM User Guide</i>.</p> <p>When you pass an access key ID to this operation, it returns the ID of the AWS account to which the keys belong. Access key IDs beginning with <code>AKIA</code> are long-term credentials for an IAM user or the AWS account root user. Access key IDs beginning with <code>ASIA</code> are temporary credentials that are created using STS operations. If the account in the response belongs to you, you can sign in as the root user and review your root user access keys. Then, you can pull a <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html">credentials report</a> to learn which IAM user owns the keys. To learn who requested the temporary credentials for an <code>ASIA</code> access key, view the STS events in your <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">CloudTrail logs</a> in the <i>IAM User Guide</i>.</p> <p>This operation does not indicate the state of the access key. The key might be active, inactive, or deleted. Active keys might not have permissions to perform an operation. Providing a deleted access key might return an error that the key doesn't exist.</p>
1580    async fn get_access_key_info(
1581        &self,
1582        input: GetAccessKeyInfoRequest,
1583    ) -> Result<GetAccessKeyInfoResponse, RusotoError<GetAccessKeyInfoError>>;
1584
1585    /// <p><p>Returns details about the IAM user or role whose credentials are used to call the operation.</p> <note> <p>No permissions are required to perform this operation. If an administrator adds a policy to your IAM user or role that explicitly denies access to the <code>sts:GetCallerIdentity</code> action, you can still perform this operation. Permissions are not required because the same information is returned when an IAM user or role is denied access. To view an example response, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa">I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice</a> in the <i>IAM User Guide</i>.</p> </note></p>
1586    async fn get_caller_identity(
1587        &self,
1588        input: GetCallerIdentityRequest,
1589    ) -> Result<GetCallerIdentityResponse, RusotoError<GetCallerIdentityError>>;
1590
1591    /// <p>Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user. A typical use is in a proxy application that gets temporary security credentials on behalf of distributed applications inside a corporate network. You must call the <code>GetFederationToken</code> operation using the long-term security credentials of an IAM user. As a result, this call is appropriate in contexts where those credentials can be safely stored, usually in a server-based application. For a comparison of <code>GetFederationToken</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <note> <p>You can create a mobile-based or browser-based app that can authenticate users using a web identity provider like Login with Amazon, Facebook, Google, or an OpenID Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or <code>AssumeRoleWithWebIdentity</code>. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a> in the <i>IAM User Guide</i>.</p> </note> <p>You can also call <code>GetFederationToken</code> using the security credentials of an AWS account root user, but we do not recommend it. Instead, we recommend that you create an IAM user for the purpose of the proxy application. Then attach a policy to the IAM user that limits federated users to only the actions and resources that they need to access. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html">IAM Best Practices</a> in the <i>IAM User Guide</i>. </p> <p> <b>Session duration</b> </p> <p>The temporary credentials are valid for the specified duration, from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is 43,200 seconds (12 hours). Temporary credentials that are obtained by using AWS account root user credentials have a maximum duration of 3,600 seconds (1 hour).</p> <p> <b>Permissions</b> </p> <p>You can use the temporary credentials created by <code>GetFederationToken</code> in any AWS service except the following:</p> <ul> <li> <p>You cannot call any IAM operations using the AWS CLI or the AWS API. </p> </li> <li> <p>You cannot call any STS operations except <code>GetCallerIdentity</code>.</p> </li> </ul> <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can't exceed 2,048 characters.</p> <p>Though the session policy parameters are optional, if you do not pass a policy, then the resulting federated user session has no permissions. When you pass session policies, the session permissions are the intersection of the IAM user policies and the session policies that you pass. This gives you a way to further restrict the permissions for a federated user. You cannot use session policies to grant more permissions than those that are defined in the permissions policy of the IAM user. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>. For information about using <code>GetFederationToken</code> to create temporary security credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken">GetFederationToken—Federation Through a Custom Identity Broker</a>. </p> <p>You can use the credentials to access a resource that has a resource-based policy. If that policy specifically references the federated user session in the <code>Principal</code> element of the policy, the session has the permissions allowed by the policy. These permissions are granted in addition to the permissions granted by the session policies.</p> <p> <b>Tags</b> </p> <p>(Optional) You can pass tag key-value pairs to your session. These are called session tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you cannot have separate <code>Department</code> and <code>department</code> tag keys. Assume that the user that you are federating has the <code>Department</code>=<code>Marketing</code> tag and you pass the <code>department</code>=<code>engineering</code> session tag. <code>Department</code> and <code>department</code> are not saved as separate tags, and the session tag passed in the request takes precedence over the user tag.</p>
1592    async fn get_federation_token(
1593        &self,
1594        input: GetFederationTokenRequest,
1595    ) -> Result<GetFederationTokenResponse, RusotoError<GetFederationTokenError>>;
1596
1597    /// <p>Returns a set of temporary credentials for an AWS account or IAM user. The credentials consist of an access key ID, a secret access key, and a security token. Typically, you use <code>GetSessionToken</code> if you want to use MFA to protect programmatic calls to specific AWS API operations like Amazon EC2 <code>StopInstances</code>. MFA-enabled IAM users would need to call <code>GetSessionToken</code> and submit an MFA code that is associated with their MFA device. Using the temporary security credentials that are returned from the call, IAM users can then make programmatic calls to API operations that require MFA authentication. If you do not supply a correct MFA code, then the API returns an access denied error. For a comparison of <code>GetSessionToken</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p> <b>Session Duration</b> </p> <p>The <code>GetSessionToken</code> operation must be called by using the long-term AWS security credentials of the AWS account root user or an IAM user. Credentials that are created by IAM users are valid for the duration that you specify. This duration can range from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials based on account credentials can range from 900 seconds (15 minutes) up to 3,600 seconds (1 hour), with a default of 1 hour. </p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>GetSessionToken</code> can be used to make API calls to any AWS service with the following exceptions:</p> <ul> <li> <p>You cannot call any IAM API operations unless MFA authentication information is included in the request.</p> </li> <li> <p>You cannot call any STS API <i>except</i> <code>AssumeRole</code> or <code>GetCallerIdentity</code>.</p> </li> </ul> <note> <p>We recommend that you do not call <code>GetSessionToken</code> with AWS account root user credentials. Instead, follow our <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users">best practices</a> by creating one or more IAM users, giving them the necessary permissions, and using IAM users for everyday interaction with AWS. </p> </note> <p>The credentials that are returned by <code>GetSessionToken</code> are based on permissions associated with the user whose credentials were used to call the operation. If <code>GetSessionToken</code> is called using AWS account root user credentials, the temporary credentials have root user permissions. Similarly, if <code>GetSessionToken</code> is called using the credentials of an IAM user, the temporary credentials have the same permissions as the IAM user. </p> <p>For more information about using <code>GetSessionToken</code> to create temporary credentials, go to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken">Temporary Credentials for Users in Untrusted Environments</a> in the <i>IAM User Guide</i>. </p>
1598    async fn get_session_token(
1599        &self,
1600        input: GetSessionTokenRequest,
1601    ) -> Result<GetSessionTokenResponse, RusotoError<GetSessionTokenError>>;
1602}
1603/// A client for the AWS STS API.
1604#[derive(Clone)]
1605pub struct StsClient {
1606    client: Client,
1607    region: region::Region,
1608}
1609
1610impl StsClient {
1611    /// Creates a client backed by the default tokio event loop.
1612    ///
1613    /// The client will use the default credentials provider and tls client.
1614    pub fn new(region: region::Region) -> StsClient {
1615        StsClient {
1616            client: Client::shared(),
1617            region,
1618        }
1619    }
1620
1621    pub fn new_with<P, D>(
1622        request_dispatcher: D,
1623        credentials_provider: P,
1624        region: region::Region,
1625    ) -> StsClient
1626    where
1627        P: ProvideAwsCredentials + Send + Sync + 'static,
1628        D: DispatchSignedRequest + Send + Sync + 'static,
1629    {
1630        StsClient {
1631            client: Client::new_with(credentials_provider, request_dispatcher),
1632            region,
1633        }
1634    }
1635
1636    pub fn new_with_client(client: Client, region: region::Region) -> StsClient {
1637        StsClient { client, region }
1638    }
1639}
1640
1641#[async_trait]
1642impl Sts for StsClient {
1643    /// <p>Returns a set of temporary security credentials that you can use to access AWS resources that you might not normally have access to. These temporary credentials consist of an access key ID, a secret access key, and a security token. Typically, you use <code>AssumeRole</code> within your account or for cross-account access. For a comparison of <code>AssumeRole</code> with other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <important> <p>You cannot use AWS account root user credentials to call <code>AssumeRole</code>. You must use credentials for an IAM user or an IAM role to call <code>AssumeRole</code>.</p> </important> <p>For cross-account access, imagine that you own multiple accounts and need to access resources in each account. You could create long-term credentials in each account to access those resources. However, managing all those credentials and remembering which one can access which account can be time consuming. Instead, you can create one set of long-term credentials in one account. Then use temporary security credentials to access all the other accounts by assuming roles in those accounts. For more information about roles, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">IAM Roles</a> in the <i>IAM User Guide</i>. </p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRole</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. You can provide a value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole*</code> API operations or the <code>assume-role*</code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>.</p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRole</code> can be used to make API calls to any AWS service with the following exception: You cannot call the AWS STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can't exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session's permissions are the intersection of the role's identity-based policy and the session policies. You can use the role's temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>To assume a role from a different account, your AWS account must be trusted by the role. The trust relationship is defined in the role's trust policy when the role is created. That trust policy states which accounts are allowed to delegate that access to users in the account. </p> <p>A user who wants to access a role in a different account must also have permissions that are delegated from the user account administrator. The administrator must attach a policy that allows the user to call <code>AssumeRole</code> for the ARN of the role in the other account. If the user is in the same account as the role, then you can do either of the following:</p> <ul> <li> <p>Attach a policy to the user (identical to the previous user in a different account).</p> </li> <li> <p>Add the user as a principal directly in the role's trust policy.</p> </li> </ul> <p>In this case, the trust policy acts as an IAM resource-based policy. Users in the same account as the role do not need explicit permission to assume the role. For more information about trust policies and resource-based policies, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html">IAM Policies</a> in the <i>IAM User Guide</i>.</p> <p> <b>Tags</b> </p> <p>(Optional) You can pass tag key-value pairs to your session. These tags are called session tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>Using MFA with AssumeRole</b> </p> <p>(Optional) You can include multi-factor authentication (MFA) information when you call <code>AssumeRole</code>. This is useful for cross-account scenarios to ensure that the user that assumes the role has been authenticated with an AWS MFA device. In that scenario, the trust policy of the role being assumed includes a condition that tests for MFA authentication. If the caller does not include valid MFA information, the request to assume the role is denied. The condition in a trust policy that tests for MFA authentication might look like the following example.</p> <p> <code>"Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}</code> </p> <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html">Configuring MFA-Protected API Access</a> in the <i>IAM User Guide</i> guide.</p> <p>To use MFA with <code>AssumeRole</code>, you pass values for the <code>SerialNumber</code> and <code>TokenCode</code> parameters. The <code>SerialNumber</code> value identifies the user's hardware or virtual MFA device. The <code>TokenCode</code> is the time-based one-time password (TOTP) that the MFA device produces. </p>
1644    async fn assume_role(
1645        &self,
1646        input: AssumeRoleRequest,
1647    ) -> Result<AssumeRoleResponse, RusotoError<AssumeRoleError>> {
1648        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1649        let params = self.new_params("AssumeRole");
1650        let mut params = params;
1651        AssumeRoleRequestSerializer::serialize(&mut params, "", &input);
1652        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1653        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1654
1655        let response = self
1656            .sign_and_dispatch(request, AssumeRoleError::from_response)
1657            .await?;
1658
1659        let mut response = response;
1660        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1661            xml_util::start_element(actual_tag_name, stack)?;
1662            let result = AssumeRoleResponseDeserializer::deserialize("AssumeRoleResult", stack)?;
1663            skip_tree(stack);
1664            xml_util::end_element(actual_tag_name, stack)?;
1665            Ok(result)
1666        })
1667        .await?;
1668
1669        drop(response); // parse non-payload
1670        Ok(result)
1671    }
1672
1673    /// <p><p>Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. This operation provides a mechanism for tying an enterprise identity store or directory to role-based AWS access without user-specific credentials or configuration. For a comparison of <code>AssumeRoleWithSAML</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p>The temporary security credentials returned by this operation consist of an access key ID, a secret access key, and a security token. Applications can use these temporary security credentials to sign calls to AWS services.</p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRoleWithSAML</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. Your role session lasts for the duration that you specify, or until the time specified in the SAML authentication response&#39;s <code>SessionNotOnOrAfter</code> value, whichever is shorter. You can provide a <code>DurationSeconds</code> value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole<em></code> API operations or the <code>assume-role</em></code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>.</p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRoleWithSAML</code> can be used to make API calls to any AWS service with the following exception: you cannot call the STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p>Calling <code>AssumeRoleWithSAML</code> does not require the use of AWS security credentials. The identity of the caller is validated by using keys in the metadata document that is uploaded for the SAML provider entity for your identity provider. </p> <important> <p>Calling <code>AssumeRoleWithSAML</code> can result in an entry in your AWS CloudTrail logs. The entry includes the value in the <code>NameID</code> element of the SAML assertion. We recommend that you use a <code>NameIDType</code> that is not associated with any personally identifiable information (PII). For example, you could instead use the persistent identifier (<code>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</code>).</p> </important> <p> <b>Tags</b> </p> <p>(Optional) You can configure your IdP to pass attributes into your SAML assertion as session tags. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is attached to the role. When you do, session tags override the role&#39;s tags with the same key.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>SAML Configuration</b> </p> <p>Before your application can call <code>AssumeRoleWithSAML</code>, you must configure your SAML identity provider (IdP) to issue the claims required by AWS. Additionally, you must use AWS Identity and Access Management (IAM) to create a SAML provider entity in your AWS account that represents your identity provider. You must also create an IAM role that specifies this SAML provider in its trust policy. </p> <p>For more information, see the following resources:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html">About SAML 2.0-based Federation</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html">Creating SAML Identity Providers</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html">Configuring a Relying Party and Claims</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html">Creating a Role for SAML 2.0 Federation</a> in the <i>IAM User Guide</i>. </p> </li> </ul></p>
1674    async fn assume_role_with_saml(
1675        &self,
1676        input: AssumeRoleWithSAMLRequest,
1677    ) -> Result<AssumeRoleWithSAMLResponse, RusotoError<AssumeRoleWithSAMLError>> {
1678        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1679        let params = self.new_params("AssumeRoleWithSAML");
1680        let mut params = params;
1681        AssumeRoleWithSAMLRequestSerializer::serialize(&mut params, "", &input);
1682        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1683        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1684
1685        let response = self
1686            .sign_and_dispatch(request, AssumeRoleWithSAMLError::from_response)
1687            .await?;
1688
1689        let mut response = response;
1690        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1691            xml_util::start_element(actual_tag_name, stack)?;
1692            let result = AssumeRoleWithSAMLResponseDeserializer::deserialize(
1693                "AssumeRoleWithSAMLResult",
1694                stack,
1695            )?;
1696            skip_tree(stack);
1697            xml_util::end_element(actual_tag_name, stack)?;
1698            Ok(result)
1699        })
1700        .await?;
1701
1702        drop(response); // parse non-payload
1703        Ok(result)
1704    }
1705
1706    /// <p><p>Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider. Example providers include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider.</p> <note> <p>For mobile applications, we recommend that you use Amazon Cognito. You can use Amazon Cognito with the <a href="http://aws.amazon.com/sdkforios/">AWS SDK for iOS Developer Guide</a> and the <a href="http://aws.amazon.com/sdkforandroid/">AWS SDK for Android Developer Guide</a> to uniquely identify a user. You can also supply the user with a consistent identity throughout the lifetime of an application.</p> <p>To learn more about Amazon Cognito, see <a href="https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840">Amazon Cognito Overview</a> in <i>AWS SDK for Android Developer Guide</i> and <a href="https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664">Amazon Cognito Overview</a> in the <i>AWS SDK for iOS Developer Guide</i>.</p> </note> <p>Calling <code>AssumeRoleWithWebIdentity</code> does not require the use of AWS security credentials. Therefore, you can distribute an application (for example, on mobile devices) that requests temporary security credentials without including long-term AWS credentials in the application. You also don&#39;t need to deploy server-based proxy services that use long-term AWS credentials. Instead, the identity of the caller is validated by using a token from the web identity provider. For a comparison of <code>AssumeRoleWithWebIdentity</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p>The temporary security credentials returned by this API consist of an access key ID, a secret access key, and a security token. Applications can use these temporary security credentials to sign calls to AWS service API operations.</p> <p> <b>Session Duration</b> </p> <p>By default, the temporary security credentials created by <code>AssumeRoleWithWebIdentity</code> last for one hour. However, you can use the optional <code>DurationSeconds</code> parameter to specify the duration of your session. You can provide a value from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how to view the maximum value for your role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session">View the Maximum Session Duration Setting for a Role</a> in the <i>IAM User Guide</i>. The maximum session duration limit applies when you use the <code>AssumeRole<em></code> API operations or the <code>assume-role</em></code> CLI commands. However the limit does not apply when you use those operations to create a console URL. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html">Using IAM Roles</a> in the <i>IAM User Guide</i>. </p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>AssumeRoleWithWebIdentity</code> can be used to make API calls to any AWS service with the following exception: you cannot call the STS <code>GetFederationToken</code> or <code>GetSessionToken</code> API operations.</p> <p>(Optional) You can pass inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policies</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can&#39;t exceed 2,048 characters. Passing policies to this operation returns new temporary credentials. The resulting session&#39;s permissions are the intersection of the role&#39;s identity-based policy and the session policies. You can use the role&#39;s temporary credentials in subsequent AWS API calls to access resources in the account that owns the role. You cannot use session policies to grant more permissions than those allowed by the identity-based policy of the role that is being assumed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>.</p> <p> <b>Tags</b> </p> <p>(Optional) You can configure your IdP to pass attributes into your web identity token as session tags. Each session tag consists of a key name and an associated value. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these and additional limits, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length">IAM and STS Character Limits</a> in the <i>IAM User Guide</i>.</p> <note> <p>An AWS conversion compresses the passed session policies and session tags into a packed binary format that has a separate limit. Your request can fail for this limit even if your plain text meets the other requirements. The <code>PackedPolicySize</code> response element indicates by percentage how close the policies and tags for your request are to the upper size limit. </p> </note> <p>You can pass a session tag with the same key as a tag that is attached to the role. When you do, the session tag overrides the role tag with the same key.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>You can set the session tags as transitive. Transitive tags persist during role chaining. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining">Chaining Roles with Session Tags</a> in the <i>IAM User Guide</i>.</p> <p> <b>Identities</b> </p> <p>Before your application can call <code>AssumeRoleWithWebIdentity</code>, you must have an identity token from a supported identity provider and create a role that the application can assume. The role that your application assumes must trust the identity provider that is associated with the identity token. In other words, the identity provider must be specified in the role&#39;s trust policy. </p> <important> <p>Calling <code>AssumeRoleWithWebIdentity</code> can result in an entry in your AWS CloudTrail logs. The entry includes the <a href="http://openid.net/specs/openid-connect-core-1_0.html#Claims">Subject</a> of the provided Web Identity Token. We recommend that you avoid using any personally identifiable information (PII) in this field. For example, you could instead use a GUID or a pairwise identifier, as <a href="http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes">suggested in the OIDC specification</a>.</p> </important> <p>For more information about how to use web identity federation and the <code>AssumeRoleWithWebIdentity</code> API, see the following resources: </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html">Using Web Identity Federation API Operations for Mobile Apps</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a>. </p> </li> <li> <p> <a href="https://web-identity-federation-playground.s3.amazonaws.com/index.html"> Web Identity Federation Playground</a>. Walk through the process of authenticating through Login with Amazon, Facebook, or Google, getting temporary security credentials, and then using those credentials to make a request to AWS. </p> </li> <li> <p> <a href="http://aws.amazon.com/sdkforios/">AWS SDK for iOS Developer Guide</a> and <a href="http://aws.amazon.com/sdkforandroid/">AWS SDK for Android Developer Guide</a>. These toolkits contain sample apps that show how to invoke the identity providers. The toolkits then show how to use the information from these providers to get and use temporary security credentials. </p> </li> <li> <p> <a href="http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications">Web Identity Federation with Mobile Applications</a>. This article discusses web identity federation and shows an example of how to use web identity federation to get access to content in Amazon S3. </p> </li> </ul></p>
1707    async fn assume_role_with_web_identity(
1708        &self,
1709        input: AssumeRoleWithWebIdentityRequest,
1710    ) -> Result<AssumeRoleWithWebIdentityResponse, RusotoError<AssumeRoleWithWebIdentityError>>
1711    {
1712        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1713        let params = self.new_params("AssumeRoleWithWebIdentity");
1714        let mut params = params;
1715        AssumeRoleWithWebIdentityRequestSerializer::serialize(&mut params, "", &input);
1716        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1717        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1718
1719        let response = self
1720            .sign_and_dispatch(request, AssumeRoleWithWebIdentityError::from_response)
1721            .await?;
1722
1723        let mut response = response;
1724        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1725            xml_util::start_element(actual_tag_name, stack)?;
1726            let result = AssumeRoleWithWebIdentityResponseDeserializer::deserialize(
1727                "AssumeRoleWithWebIdentityResult",
1728                stack,
1729            )?;
1730            skip_tree(stack);
1731            xml_util::end_element(actual_tag_name, stack)?;
1732            Ok(result)
1733        })
1734        .await?;
1735
1736        drop(response); // parse non-payload
1737        Ok(result)
1738    }
1739
1740    /// <p><p>Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request.</p> <p>For example, if a user is not authorized to perform an operation that he or she has requested, the request returns a <code>Client.UnauthorizedOperation</code> response (an HTTP 403 response). Some AWS operations additionally return an encoded message that can provide details about this authorization failure. </p> <note> <p>Only certain AWS operations return an encoded authorization message. The documentation for an individual operation indicates whether that operation returns an encoded message in addition to returning an HTTP code.</p> </note> <p>The message is encoded because the details of the authorization status can constitute privileged information that the user who requested the operation should not see. To decode an authorization status message, a user must be granted permissions via an IAM policy to request the <code>DecodeAuthorizationMessage</code> (<code>sts:DecodeAuthorizationMessage</code>) action. </p> <p>The decoded message includes the following type of information:</p> <ul> <li> <p>Whether the request was denied due to an explicit deny or due to the absence of an explicit allow. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow">Determining Whether a Request is Allowed or Denied</a> in the <i>IAM User Guide</i>. </p> </li> <li> <p>The principal who made the request.</p> </li> <li> <p>The requested action.</p> </li> <li> <p>The requested resource.</p> </li> <li> <p>The values of condition keys in the context of the user&#39;s request.</p> </li> </ul></p>
1741    async fn decode_authorization_message(
1742        &self,
1743        input: DecodeAuthorizationMessageRequest,
1744    ) -> Result<DecodeAuthorizationMessageResponse, RusotoError<DecodeAuthorizationMessageError>>
1745    {
1746        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1747        let params = self.new_params("DecodeAuthorizationMessage");
1748        let mut params = params;
1749        DecodeAuthorizationMessageRequestSerializer::serialize(&mut params, "", &input);
1750        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1751        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1752
1753        let response = self
1754            .sign_and_dispatch(request, DecodeAuthorizationMessageError::from_response)
1755            .await?;
1756
1757        let mut response = response;
1758        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1759            xml_util::start_element(actual_tag_name, stack)?;
1760            let result = DecodeAuthorizationMessageResponseDeserializer::deserialize(
1761                "DecodeAuthorizationMessageResult",
1762                stack,
1763            )?;
1764            skip_tree(stack);
1765            xml_util::end_element(actual_tag_name, stack)?;
1766            Ok(result)
1767        })
1768        .await?;
1769
1770        drop(response); // parse non-payload
1771        Ok(result)
1772    }
1773
1774    /// <p>Returns the account identifier for the specified access key ID.</p> <p>Access keys consist of two parts: an access key ID (for example, <code>AKIAIOSFODNN7EXAMPLE</code>) and a secret access key (for example, <code>wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY</code>). For more information about access keys, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">Managing Access Keys for IAM Users</a> in the <i>IAM User Guide</i>.</p> <p>When you pass an access key ID to this operation, it returns the ID of the AWS account to which the keys belong. Access key IDs beginning with <code>AKIA</code> are long-term credentials for an IAM user or the AWS account root user. Access key IDs beginning with <code>ASIA</code> are temporary credentials that are created using STS operations. If the account in the response belongs to you, you can sign in as the root user and review your root user access keys. Then, you can pull a <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html">credentials report</a> to learn which IAM user owns the keys. To learn who requested the temporary credentials for an <code>ASIA</code> access key, view the STS events in your <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html">CloudTrail logs</a> in the <i>IAM User Guide</i>.</p> <p>This operation does not indicate the state of the access key. The key might be active, inactive, or deleted. Active keys might not have permissions to perform an operation. Providing a deleted access key might return an error that the key doesn't exist.</p>
1775    async fn get_access_key_info(
1776        &self,
1777        input: GetAccessKeyInfoRequest,
1778    ) -> Result<GetAccessKeyInfoResponse, RusotoError<GetAccessKeyInfoError>> {
1779        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1780        let params = self.new_params("GetAccessKeyInfo");
1781        let mut params = params;
1782        GetAccessKeyInfoRequestSerializer::serialize(&mut params, "", &input);
1783        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1784        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1785
1786        let response = self
1787            .sign_and_dispatch(request, GetAccessKeyInfoError::from_response)
1788            .await?;
1789
1790        let mut response = response;
1791        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1792            xml_util::start_element(actual_tag_name, stack)?;
1793            let result =
1794                GetAccessKeyInfoResponseDeserializer::deserialize("GetAccessKeyInfoResult", stack)?;
1795            skip_tree(stack);
1796            xml_util::end_element(actual_tag_name, stack)?;
1797            Ok(result)
1798        })
1799        .await?;
1800
1801        drop(response); // parse non-payload
1802        Ok(result)
1803    }
1804
1805    /// <p><p>Returns details about the IAM user or role whose credentials are used to call the operation.</p> <note> <p>No permissions are required to perform this operation. If an administrator adds a policy to your IAM user or role that explicitly denies access to the <code>sts:GetCallerIdentity</code> action, you can still perform this operation. Permissions are not required because the same information is returned when an IAM user or role is denied access. To view an example response, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa">I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice</a> in the <i>IAM User Guide</i>.</p> </note></p>
1806    async fn get_caller_identity(
1807        &self,
1808        input: GetCallerIdentityRequest,
1809    ) -> Result<GetCallerIdentityResponse, RusotoError<GetCallerIdentityError>> {
1810        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1811        let params = self.new_params("GetCallerIdentity");
1812        let mut params = params;
1813        GetCallerIdentityRequestSerializer::serialize(&mut params, "", &input);
1814        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1815        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1816
1817        let response = self
1818            .sign_and_dispatch(request, GetCallerIdentityError::from_response)
1819            .await?;
1820
1821        let mut response = response;
1822        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1823            xml_util::start_element(actual_tag_name, stack)?;
1824            let result = GetCallerIdentityResponseDeserializer::deserialize(
1825                "GetCallerIdentityResult",
1826                stack,
1827            )?;
1828            skip_tree(stack);
1829            xml_util::end_element(actual_tag_name, stack)?;
1830            Ok(result)
1831        })
1832        .await?;
1833
1834        drop(response); // parse non-payload
1835        Ok(result)
1836    }
1837
1838    /// <p>Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user. A typical use is in a proxy application that gets temporary security credentials on behalf of distributed applications inside a corporate network. You must call the <code>GetFederationToken</code> operation using the long-term security credentials of an IAM user. As a result, this call is appropriate in contexts where those credentials can be safely stored, usually in a server-based application. For a comparison of <code>GetFederationToken</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <note> <p>You can create a mobile-based or browser-based app that can authenticate users using a web identity provider like Login with Amazon, Facebook, Google, or an OpenID Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or <code>AssumeRoleWithWebIdentity</code>. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a> in the <i>IAM User Guide</i>.</p> </note> <p>You can also call <code>GetFederationToken</code> using the security credentials of an AWS account root user, but we do not recommend it. Instead, we recommend that you create an IAM user for the purpose of the proxy application. Then attach a policy to the IAM user that limits federated users to only the actions and resources that they need to access. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html">IAM Best Practices</a> in the <i>IAM User Guide</i>. </p> <p> <b>Session duration</b> </p> <p>The temporary credentials are valid for the specified duration, from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is 43,200 seconds (12 hours). Temporary credentials that are obtained by using AWS account root user credentials have a maximum duration of 3,600 seconds (1 hour).</p> <p> <b>Permissions</b> </p> <p>You can use the temporary credentials created by <code>GetFederationToken</code> in any AWS service except the following:</p> <ul> <li> <p>You cannot call any IAM operations using the AWS CLI or the AWS API. </p> </li> <li> <p>You cannot call any STS operations except <code>GetCallerIdentity</code>.</p> </li> </ul> <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to this operation. You can pass a single JSON policy document to use as an inline session policy. You can also specify up to 10 managed policies to use as managed session policies. The plain text that you use for both inline and managed session policies can't exceed 2,048 characters.</p> <p>Though the session policy parameters are optional, if you do not pass a policy, then the resulting federated user session has no permissions. When you pass session policies, the session permissions are the intersection of the IAM user policies and the session policies that you pass. This gives you a way to further restrict the permissions for a federated user. You cannot use session policies to grant more permissions than those that are defined in the permissions policy of the IAM user. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a> in the <i>IAM User Guide</i>. For information about using <code>GetFederationToken</code> to create temporary security credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken">GetFederationToken—Federation Through a Custom Identity Broker</a>. </p> <p>You can use the credentials to access a resource that has a resource-based policy. If that policy specifically references the federated user session in the <code>Principal</code> element of the policy, the session has the permissions allowed by the policy. These permissions are granted in addition to the permissions granted by the session policies.</p> <p> <b>Tags</b> </p> <p>(Optional) You can pass tag key-value pairs to your session. These are called session tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the <i>IAM User Guide</i>.</p> <p>An administrator must grant you the permissions necessary to pass session tags. The administrator can also create granular permissions to allow you to pass only specific session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using Tags for Attribute-Based Access Control</a> in the <i>IAM User Guide</i>.</p> <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you cannot have separate <code>Department</code> and <code>department</code> tag keys. Assume that the user that you are federating has the <code>Department</code>=<code>Marketing</code> tag and you pass the <code>department</code>=<code>engineering</code> session tag. <code>Department</code> and <code>department</code> are not saved as separate tags, and the session tag passed in the request takes precedence over the user tag.</p>
1839    async fn get_federation_token(
1840        &self,
1841        input: GetFederationTokenRequest,
1842    ) -> Result<GetFederationTokenResponse, RusotoError<GetFederationTokenError>> {
1843        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1844        let params = self.new_params("GetFederationToken");
1845        let mut params = params;
1846        GetFederationTokenRequestSerializer::serialize(&mut params, "", &input);
1847        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1848        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1849
1850        let response = self
1851            .sign_and_dispatch(request, GetFederationTokenError::from_response)
1852            .await?;
1853
1854        let mut response = response;
1855        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1856            xml_util::start_element(actual_tag_name, stack)?;
1857            let result = GetFederationTokenResponseDeserializer::deserialize(
1858                "GetFederationTokenResult",
1859                stack,
1860            )?;
1861            skip_tree(stack);
1862            xml_util::end_element(actual_tag_name, stack)?;
1863            Ok(result)
1864        })
1865        .await?;
1866
1867        drop(response); // parse non-payload
1868        Ok(result)
1869    }
1870
1871    /// <p>Returns a set of temporary credentials for an AWS account or IAM user. The credentials consist of an access key ID, a secret access key, and a security token. Typically, you use <code>GetSessionToken</code> if you want to use MFA to protect programmatic calls to specific AWS API operations like Amazon EC2 <code>StopInstances</code>. MFA-enabled IAM users would need to call <code>GetSessionToken</code> and submit an MFA code that is associated with their MFA device. Using the temporary security credentials that are returned from the call, IAM users can then make programmatic calls to API operations that require MFA authentication. If you do not supply a correct MFA code, then the API returns an access denied error. For a comparison of <code>GetSessionToken</code> with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the AWS STS API operations</a> in the <i>IAM User Guide</i>.</p> <p> <b>Session Duration</b> </p> <p>The <code>GetSessionToken</code> operation must be called by using the long-term AWS security credentials of the AWS account root user or an IAM user. Credentials that are created by IAM users are valid for the duration that you specify. This duration can range from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials based on account credentials can range from 900 seconds (15 minutes) up to 3,600 seconds (1 hour), with a default of 1 hour. </p> <p> <b>Permissions</b> </p> <p>The temporary security credentials created by <code>GetSessionToken</code> can be used to make API calls to any AWS service with the following exceptions:</p> <ul> <li> <p>You cannot call any IAM API operations unless MFA authentication information is included in the request.</p> </li> <li> <p>You cannot call any STS API <i>except</i> <code>AssumeRole</code> or <code>GetCallerIdentity</code>.</p> </li> </ul> <note> <p>We recommend that you do not call <code>GetSessionToken</code> with AWS account root user credentials. Instead, follow our <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users">best practices</a> by creating one or more IAM users, giving them the necessary permissions, and using IAM users for everyday interaction with AWS. </p> </note> <p>The credentials that are returned by <code>GetSessionToken</code> are based on permissions associated with the user whose credentials were used to call the operation. If <code>GetSessionToken</code> is called using AWS account root user credentials, the temporary credentials have root user permissions. Similarly, if <code>GetSessionToken</code> is called using the credentials of an IAM user, the temporary credentials have the same permissions as the IAM user. </p> <p>For more information about using <code>GetSessionToken</code> to create temporary credentials, go to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken">Temporary Credentials for Users in Untrusted Environments</a> in the <i>IAM User Guide</i>. </p>
1872    async fn get_session_token(
1873        &self,
1874        input: GetSessionTokenRequest,
1875    ) -> Result<GetSessionTokenResponse, RusotoError<GetSessionTokenError>> {
1876        let mut request = SignedRequest::new("POST", "sts", &self.region, "/");
1877        let params = self.new_params("GetSessionToken");
1878        let mut params = params;
1879        GetSessionTokenRequestSerializer::serialize(&mut params, "", &input);
1880        request.set_payload(Some(serde_urlencoded::to_string(&params).unwrap()));
1881        request.set_content_type("application/x-www-form-urlencoded".to_owned());
1882
1883        let response = self
1884            .sign_and_dispatch(request, GetSessionTokenError::from_response)
1885            .await?;
1886
1887        let mut response = response;
1888        let result = xml_util::parse_response(&mut response, |actual_tag_name, stack| {
1889            xml_util::start_element(actual_tag_name, stack)?;
1890            let result =
1891                GetSessionTokenResponseDeserializer::deserialize("GetSessionTokenResult", stack)?;
1892            skip_tree(stack);
1893            xml_util::end_element(actual_tag_name, stack)?;
1894            Ok(result)
1895        })
1896        .await?;
1897
1898        drop(response); // parse non-payload
1899        Ok(result)
1900    }
1901}
1902
1903#[cfg(test)]
1904mod protocol_tests {
1905
1906    extern crate rusoto_mock;
1907
1908    use self::rusoto_mock::*;
1909    use super::*;
1910    use rusoto_core::Region as rusoto_region;
1911
1912    #[tokio::test]
1913    async fn test_parse_error_sts_get_session_token() {
1914        let mock_response = MockResponseReader::read_response(
1915            "test_resources/generated/error",
1916            "sts-get-session-token.xml",
1917        );
1918        let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response);
1919        let client = StsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
1920        let request = GetSessionTokenRequest::default();
1921        let result = client.get_session_token(request).await;
1922        assert!(!result.is_ok(), "parse error: {:?}", result);
1923    }
1924
1925    #[tokio::test]
1926    async fn test_parse_valid_sts_get_session_token() {
1927        let mock_response = MockResponseReader::read_response(
1928            "test_resources/generated/valid",
1929            "sts-get-session-token.xml",
1930        );
1931        let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
1932        let client = StsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
1933        let request = GetSessionTokenRequest::default();
1934        let result = client.get_session_token(request).await;
1935        assert!(result.is_ok(), "parse error: {:?}", result);
1936    }
1937}