aws_sdk_quicksight/operation/get_identity_context/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_identity_context::_get_identity_context_output::GetIdentityContextOutputBuilder;
3
4pub use crate::operation::get_identity_context::_get_identity_context_input::GetIdentityContextInputBuilder;
5
6impl crate::operation::get_identity_context::builders::GetIdentityContextInputBuilder {
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_identity_context::GetIdentityContextOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_identity_context::GetIdentityContextError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_identity_context();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetIdentityContext`.
24///
25/// <p>Retrieves the identity context for a Quick Sight user in a specified namespace, allowing you to obtain identity tokens that can be used with identity-enhanced IAM role sessions to call identity-aware APIs.</p>
26/// <p>Currently, you can call the following APIs with identity-enhanced Credentials</p>
27/// <ul>
28/// <li>
29/// <p><a href="https://docs.aws.amazon.com/quicksight/latest/APIReference/API_StartDashboardSnapshotJob.html">StartDashboardSnapshotJob</a></p></li>
30/// <li>
31/// <p><a href="https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DescribeDashboardSnapshotJob.html">DescribeDashboardSnapshotJob</a></p></li>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DescribeDashboardSnapshotJobResult.html">DescribeDashboardSnapshotJobResult</a></p></li>
34/// </ul>
35/// <p><b>Supported Authentication Methods</b></p>
36/// <p>This API supports Quick Sight native users, IAM federated users, and Active Directory users. For Quick Sight users authenticated by Amazon Web Services Identity Center, see <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-identity-enhanced-iam-role-sessions.html">Identity Center documentation on identity-enhanced IAM role sessions</a>.</p>
37/// <p><b>Getting Identity-Enhanced Credentials</b></p>
38/// <p>To obtain identity-enhanced credentials, follow these steps:</p>
39/// <ul>
40/// <li>
41/// <p>Call the GetIdentityContext API to retrieve an identity token for the specified user.</p></li>
42/// <li>
43/// <p>Use the identity token with the <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html">STS AssumeRole API</a> to obtain identity-enhanced IAM role session credentials.</p></li>
44/// </ul>
45/// <p><b>Usage with STS AssumeRole</b></p>
46/// <p>The identity token returned by this API should be used with the STS AssumeRole API to obtain credentials for an identity-enhanced IAM role session. When calling AssumeRole, include the identity token in the <code>ProvidedContexts</code> parameter with <code>ProviderArn</code> set to <code>arn:aws:iam::aws:contextProvider/QuickSight</code> and <code>ContextAssertion</code> set to the identity token received from this API.</p>
47/// <p>The assumed role must allow the <code>sts:SetContext</code> action in addition to <code>sts:AssumeRole</code> in its trust relationship policy. The trust policy should include both actions for the principal that will be assuming the role.</p>
48#[derive(::std::clone::Clone, ::std::fmt::Debug)]
49pub struct GetIdentityContextFluentBuilder {
50    handle: ::std::sync::Arc<crate::client::Handle>,
51    inner: crate::operation::get_identity_context::builders::GetIdentityContextInputBuilder,
52    config_override: ::std::option::Option<crate::config::Builder>,
53}
54impl
55    crate::client::customize::internal::CustomizableSend<
56        crate::operation::get_identity_context::GetIdentityContextOutput,
57        crate::operation::get_identity_context::GetIdentityContextError,
58    > for GetIdentityContextFluentBuilder
59{
60    fn send(
61        self,
62        config_override: crate::config::Builder,
63    ) -> crate::client::customize::internal::BoxFuture<
64        crate::client::customize::internal::SendResult<
65            crate::operation::get_identity_context::GetIdentityContextOutput,
66            crate::operation::get_identity_context::GetIdentityContextError,
67        >,
68    > {
69        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
70    }
71}
72impl GetIdentityContextFluentBuilder {
73    /// Creates a new `GetIdentityContextFluentBuilder`.
74    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
75        Self {
76            handle,
77            inner: ::std::default::Default::default(),
78            config_override: ::std::option::Option::None,
79        }
80    }
81    /// Access the GetIdentityContext as a reference.
82    pub fn as_input(&self) -> &crate::operation::get_identity_context::builders::GetIdentityContextInputBuilder {
83        &self.inner
84    }
85    /// Sends the request and returns the response.
86    ///
87    /// If an error occurs, an `SdkError` will be returned with additional details that
88    /// can be matched against.
89    ///
90    /// By default, any retryable failures will be retried twice. Retry behavior
91    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
92    /// set when configuring the client.
93    pub async fn send(
94        self,
95    ) -> ::std::result::Result<
96        crate::operation::get_identity_context::GetIdentityContextOutput,
97        ::aws_smithy_runtime_api::client::result::SdkError<
98            crate::operation::get_identity_context::GetIdentityContextError,
99            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
100        >,
101    > {
102        let input = self
103            .inner
104            .build()
105            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
106        let runtime_plugins = crate::operation::get_identity_context::GetIdentityContext::operation_runtime_plugins(
107            self.handle.runtime_plugins.clone(),
108            &self.handle.conf,
109            self.config_override,
110        );
111        crate::operation::get_identity_context::GetIdentityContext::orchestrate(&runtime_plugins, input).await
112    }
113
114    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
115    pub fn customize(
116        self,
117    ) -> crate::client::customize::CustomizableOperation<
118        crate::operation::get_identity_context::GetIdentityContextOutput,
119        crate::operation::get_identity_context::GetIdentityContextError,
120        Self,
121    > {
122        crate::client::customize::CustomizableOperation::new(self)
123    }
124    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
125        self.set_config_override(::std::option::Option::Some(config_override.into()));
126        self
127    }
128
129    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
130        self.config_override = config_override;
131        self
132    }
133    /// <p>The ID for the Amazon Web Services account that the user whose identity context you want to retrieve is in. Currently, you use the ID for the Amazon Web Services account that contains your Quick Sight account.</p>
134    pub fn aws_account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.aws_account_id(input.into());
136        self
137    }
138    /// <p>The ID for the Amazon Web Services account that the user whose identity context you want to retrieve is in. Currently, you use the ID for the Amazon Web Services account that contains your Quick Sight account.</p>
139    pub fn set_aws_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_aws_account_id(input);
141        self
142    }
143    /// <p>The ID for the Amazon Web Services account that the user whose identity context you want to retrieve is in. Currently, you use the ID for the Amazon Web Services account that contains your Quick Sight account.</p>
144    pub fn get_aws_account_id(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_aws_account_id()
146    }
147    /// <p>The identifier for the user whose identity context you want to retrieve.</p>
148    pub fn user_identifier(mut self, input: crate::types::UserIdentifier) -> Self {
149        self.inner = self.inner.user_identifier(input);
150        self
151    }
152    /// <p>The identifier for the user whose identity context you want to retrieve.</p>
153    pub fn set_user_identifier(mut self, input: ::std::option::Option<crate::types::UserIdentifier>) -> Self {
154        self.inner = self.inner.set_user_identifier(input);
155        self
156    }
157    /// <p>The identifier for the user whose identity context you want to retrieve.</p>
158    pub fn get_user_identifier(&self) -> &::std::option::Option<crate::types::UserIdentifier> {
159        self.inner.get_user_identifier()
160    }
161    /// <p>The namespace of the user that you want to get identity context for. This parameter is required when the UserIdentifier is specified using Email or UserName.</p>
162    pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.namespace(input.into());
164        self
165    }
166    /// <p>The namespace of the user that you want to get identity context for. This parameter is required when the UserIdentifier is specified using Email or UserName.</p>
167    pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_namespace(input);
169        self
170    }
171    /// <p>The namespace of the user that you want to get identity context for. This parameter is required when the UserIdentifier is specified using Email or UserName.</p>
172    pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_namespace()
174    }
175    /// <p>The timestamp at which the session will expire.</p>
176    pub fn session_expires_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
177        self.inner = self.inner.session_expires_at(input);
178        self
179    }
180    /// <p>The timestamp at which the session will expire.</p>
181    pub fn set_session_expires_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
182        self.inner = self.inner.set_session_expires_at(input);
183        self
184    }
185    /// <p>The timestamp at which the session will expire.</p>
186    pub fn get_session_expires_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
187        self.inner.get_session_expires_at()
188    }
189}