Skip to main content

aws_sdk_sts/operation/get_scoped_credentials/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_scoped_credentials::_get_scoped_credentials_input::GetScopedCredentialsInputBuilder;
3
4pub use crate::operation::get_scoped_credentials::_get_scoped_credentials_output::GetScopedCredentialsOutputBuilder;
5
6impl crate::operation::get_scoped_credentials::builders::GetScopedCredentialsInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::get_scoped_credentials::GetScopedCredentialsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_scoped_credentials::GetScopedCredentialsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_scoped_credentials();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetScopedCredentials`.
24///
25/// <p>Returns a set of temporary security credentials that are scoped down from the caller's existing temporary security credentials. <code>GetScopedCredentials</code> preserves the caller's identity while narrowing the permissions and optionally shortening the session lifetime.</p>
26/// <p>For a comparison of <code>GetScopedCredentials</code> with the other API operations that produce temporary security 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_sts-comparison.html">Compare STS credentials</a> in the IAM User Guide.</p>
27/// <p><b>Credential requirements</b></p>
28/// <p>You can only call <code>GetScopedCredentials</code> with temporary security credentials, for example, credentials from an assumed role or a federated session. You cannot call it with IAM user credentials or root credentials. If you want to scope down IAM user credentials, first call <code>GetSessionToken</code> to get temporary security credentials, and then call <code>GetScopedCredentials</code> with those credentials.</p><note>
29/// <p>The <code>GetScopedCredentials</code> API is not available on the STS Global endpoint.</p>
30/// </note>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct GetScopedCredentialsFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::get_scoped_credentials::builders::GetScopedCredentialsInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::get_scoped_credentials::GetScopedCredentialsOutput,
40        crate::operation::get_scoped_credentials::GetScopedCredentialsError,
41    > for GetScopedCredentialsFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::get_scoped_credentials::GetScopedCredentialsOutput,
49            crate::operation::get_scoped_credentials::GetScopedCredentialsError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl GetScopedCredentialsFluentBuilder {
56    /// Creates a new `GetScopedCredentialsFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the GetScopedCredentials as a reference.
65    pub fn as_input(&self) -> &crate::operation::get_scoped_credentials::builders::GetScopedCredentialsInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::get_scoped_credentials::GetScopedCredentialsOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::get_scoped_credentials::GetScopedCredentialsError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::get_scoped_credentials::GetScopedCredentials::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::get_scoped_credentials::GetScopedCredentials::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::get_scoped_credentials::GetScopedCredentialsOutput,
102        crate::operation::get_scoped_credentials::GetScopedCredentialsError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <p>An IAM policy in JSON format that you want to use as a scope down policy.</p>
117    /// <p>A request must provide at least one of <code>Policy</code> or <code>DurationSeconds</code>. Both parameters are optional individually, but you must specify at least one of them.</p>
118    /// <p>The resulting session's permissions are the intersection of the calling session's existing permissions and this scope down policy. You cannot use this scope down policy to grant more permissions than the calling session already has.</p>
119    /// <p>The plaintext of the scope down policy cannot 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>
120    /// <p>An internal conversion compresses the inline scope down policy into a packed binary format that has a separate limit. If the packed policy exceeds this limit, the request fails with <code>PackedPolicyTooLarge</code>.</p>
121    /// <p>If the document is not valid IAM policy JSON, the request fails with <code>MalformedPolicyDocument</code>.</p>
122    /// </note>
123    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.policy(input.into());
125        self
126    }
127    /// <p>An IAM policy in JSON format that you want to use as a scope down policy.</p>
128    /// <p>A request must provide at least one of <code>Policy</code> or <code>DurationSeconds</code>. Both parameters are optional individually, but you must specify at least one of them.</p>
129    /// <p>The resulting session's permissions are the intersection of the calling session's existing permissions and this scope down policy. You cannot use this scope down policy to grant more permissions than the calling session already has.</p>
130    /// <p>The plaintext of the scope down policy cannot 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>
131    /// <p>An internal conversion compresses the inline scope down policy into a packed binary format that has a separate limit. If the packed policy exceeds this limit, the request fails with <code>PackedPolicyTooLarge</code>.</p>
132    /// <p>If the document is not valid IAM policy JSON, the request fails with <code>MalformedPolicyDocument</code>.</p>
133    /// </note>
134    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_policy(input);
136        self
137    }
138    /// <p>An IAM policy in JSON format that you want to use as a scope down policy.</p>
139    /// <p>A request must provide at least one of <code>Policy</code> or <code>DurationSeconds</code>. Both parameters are optional individually, but you must specify at least one of them.</p>
140    /// <p>The resulting session's permissions are the intersection of the calling session's existing permissions and this scope down policy. You cannot use this scope down policy to grant more permissions than the calling session already has.</p>
141    /// <p>The plaintext of the scope down policy cannot 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>
142    /// <p>An internal conversion compresses the inline scope down policy into a packed binary format that has a separate limit. If the packed policy exceeds this limit, the request fails with <code>PackedPolicyTooLarge</code>.</p>
143    /// <p>If the document is not valid IAM policy JSON, the request fails with <code>MalformedPolicyDocument</code>.</p>
144    /// </note>
145    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_policy()
147    }
148    /// <p>The duration, in seconds, of the resulting scoped down credentials. The value can range from 1 second to 129,600 seconds (36 hours).</p>
149    /// <p>If you do not specify this value, the scoped down credentials will inherit the calling session's expiration time.</p>
150    pub fn duration_seconds(mut self, input: i32) -> Self {
151        self.inner = self.inner.duration_seconds(input);
152        self
153    }
154    /// <p>The duration, in seconds, of the resulting scoped down credentials. The value can range from 1 second to 129,600 seconds (36 hours).</p>
155    /// <p>If you do not specify this value, the scoped down credentials will inherit the calling session's expiration time.</p>
156    pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
157        self.inner = self.inner.set_duration_seconds(input);
158        self
159    }
160    /// <p>The duration, in seconds, of the resulting scoped down credentials. The value can range from 1 second to 129,600 seconds (36 hours).</p>
161    /// <p>If you do not specify this value, the scoped down credentials will inherit the calling session's expiration time.</p>
162    pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
163        self.inner.get_duration_seconds()
164    }
165    /// <p>The minimum size, in bytes, of the session token that STS issues for the request. STS increases the session token to at least this size, regardless of its actual content. The value must not exceed 4,096 bytes. When set to 0 or not specified, the session token size is unchanged.</p>
166    pub fn minimum_session_token_size(mut self, input: i32) -> Self {
167        self.inner = self.inner.minimum_session_token_size(input);
168        self
169    }
170    /// <p>The minimum size, in bytes, of the session token that STS issues for the request. STS increases the session token to at least this size, regardless of its actual content. The value must not exceed 4,096 bytes. When set to 0 or not specified, the session token size is unchanged.</p>
171    pub fn set_minimum_session_token_size(mut self, input: ::std::option::Option<i32>) -> Self {
172        self.inner = self.inner.set_minimum_session_token_size(input);
173        self
174    }
175    /// <p>The minimum size, in bytes, of the session token that STS issues for the request. STS increases the session token to at least this size, regardless of its actual content. The value must not exceed 4,096 bytes. When set to 0 or not specified, the session token size is unchanged.</p>
176    pub fn get_minimum_session_token_size(&self) -> &::std::option::Option<i32> {
177        self.inner.get_minimum_session_token_size()
178    }
179    /// <p>A caller-supplied description of the scoped session. The value cannot exceed 256 characters. This description is logged to CloudTrail for the request, so you can use it to record the purpose of the scoped session.</p>
180    pub fn scoped_session_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.inner = self.inner.scoped_session_description(input.into());
182        self
183    }
184    /// <p>A caller-supplied description of the scoped session. The value cannot exceed 256 characters. This description is logged to CloudTrail for the request, so you can use it to record the purpose of the scoped session.</p>
185    pub fn set_scoped_session_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.inner = self.inner.set_scoped_session_description(input);
187        self
188    }
189    /// <p>A caller-supplied description of the scoped session. The value cannot exceed 256 characters. This description is logged to CloudTrail for the request, so you can use it to record the purpose of the scoped session.</p>
190    pub fn get_scoped_session_description(&self) -> &::std::option::Option<::std::string::String> {
191        self.inner.get_scoped_session_description()
192    }
193}