aws_sdk_quicksight/operation/start_dashboard_snapshot_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_dashboard_snapshot_job::_start_dashboard_snapshot_job_output::StartDashboardSnapshotJobOutputBuilder;
3
4pub use crate::operation::start_dashboard_snapshot_job::_start_dashboard_snapshot_job_input::StartDashboardSnapshotJobInputBuilder;
5
6impl crate::operation::start_dashboard_snapshot_job::builders::StartDashboardSnapshotJobInputBuilder {
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::start_dashboard_snapshot_job::StartDashboardSnapshotJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_dashboard_snapshot_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartDashboardSnapshotJob`.
24///
25/// <p>Starts an asynchronous job that generates a snapshot of a dashboard's output. You can request one or several of the following format configurations in each API call.</p>
26/// <ul>
27/// <li>
28/// <p>1 Paginated PDF</p></li>
29/// <li>
30/// <p>1 Excel workbook that includes up to 5 table or pivot table visuals</p></li>
31/// <li>
32/// <p>5 CSVs from table or pivot table visuals</p></li>
33/// </ul>
34/// <p>The status of a submitted job can be polled with the <code>DescribeDashboardSnapshotJob</code> API. When you call the <code>DescribeDashboardSnapshotJob</code> API, check the <code>JobStatus</code> field in the response. Once the job reaches a <code>COMPLETED</code> or <code>FAILED</code> status, use the <code>DescribeDashboardSnapshotJobResult</code> API to obtain the URLs for the generated files. If the job fails, the <code>DescribeDashboardSnapshotJobResult</code> API returns detailed information about the error that occurred.</p>
35/// <p><b>StartDashboardSnapshotJob API throttling</b></p>
36/// <p>Quick Sight utilizes API throttling to create a more consistent user experience within a time span for customers when they call the <code>StartDashboardSnapshotJob</code>. By default, 12 jobs can run simlutaneously in one Amazon Web Services account and users can submit up 10 API requests per second before an account is throttled. If an overwhelming number of API requests are made by the same user in a short period of time, Quick Sight throttles the API calls to maintin an optimal experience and reliability for all Quick Sight users.</p>
37/// <p><b>Common throttling scenarios</b></p>
38/// <p>The following list provides information about the most commin throttling scenarios that can occur.</p>
39/// <ul>
40/// <li>
41/// <p><b>A large number of <code>SnapshotExport</code> API jobs are running simultaneously on an Amazon Web Services account.</b> When a new <code>StartDashboardSnapshotJob</code> is created and there are already 12 jobs with the <code>RUNNING</code> status, the new job request fails and returns a <code>LimitExceededException</code> error. Wait for a current job to comlpete before you resubmit the new job.</p></li>
42/// <li>
43/// <p><b>A large number of API requests are submitted on an Amazon Web Services account.</b> When a user makes more than 10 API calls to the Quick Sight API in one second, a <code>ThrottlingException</code> is returned.</p></li>
44/// </ul>
45/// <p>If your use case requires a higher throttling limit, contact your account admin or <a href="http://aws.amazon.com/contact-us/">Amazon Web ServicesSupport</a> to explore options to tailor a more optimal expereince for your account.</p>
46/// <p><b>Best practices to handle throttling</b></p>
47/// <p>If your use case projects high levels of API traffic, try to reduce the degree of frequency and parallelism of API calls as much as you can to avoid throttling. You can also perform a timing test to calculate an estimate for the total processing time of your projected load that stays within the throttling limits of the Quick Sight APIs. For example, if your projected traffic is 100 snapshot jobs before 12:00 PM per day, start 12 jobs in parallel and measure the amount of time it takes to proccess all 12 jobs. Once you obtain the result, multiply the duration by 9, for example <code>(12 minutes * 9 = 108 minutes)</code>. Use the new result to determine the latest time at which the jobs need to be started to meet your target deadline.</p>
48/// <p>The time that it takes to process a job can be impacted by the following factors:</p>
49/// <ul>
50/// <li>
51/// <p>The dataset type (Direct Query or SPICE).</p></li>
52/// <li>
53/// <p>The size of the dataset.</p></li>
54/// <li>
55/// <p>The complexity of the calculated fields that are used in the dashboard.</p></li>
56/// <li>
57/// <p>The number of visuals that are on a sheet.</p></li>
58/// <li>
59/// <p>The types of visuals that are on the sheet.</p></li>
60/// <li>
61/// <p>The number of formats and snapshots that are requested in the job configuration.</p></li>
62/// <li>
63/// <p>The size of the generated snapshots.</p></li>
64/// </ul>
65/// <p><b>Registered user support</b></p>
66/// <p>You can generate snapshots for registered Quick Sight users by using the Snapshot Job APIs with <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-identity-enhanced-iam-role-sessions.html">identity-enhanced IAM role session credentials</a>. This approach allows you to create snapshots on behalf of specific Quick Sight users while respecting their row-level security (RLS), column-level security (CLS), dynamic default parameters and dashboard parameter/filter settings.</p>
67/// <p>To generate snapshots for registered Quick Sight users, you need to:</p>
68/// <ul>
69/// <li>
70/// <p>Obtain identity-enhanced IAM role session credentials from AWS Security Token Service (STS).</p></li>
71/// <li>
72/// <p>Use these credentials to call the Snapshot Job APIs.</p></li>
73/// </ul>
74/// <p>Identity-enhanced credentials are credentials that contain information about the end user (e.g., registered Quick Sight user).</p>
75/// <p>If your Quick Sight users are backed by <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html">AWS Identity Center</a>, then you need to set up a <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/setuptrustedtokenissuer.html">trusted token issuer</a>. Then, getting identity-enhanced IAM credentials for a Quick Sight user will look like the following:</p>
76/// <ul>
77/// <li>
78/// <p>Authenticate user with your OIDC compliant Identity Provider. You should get auth tokens back.</p></li>
79/// <li>
80/// <p>Use the OIDC API, <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateTokenWithIAM.html">CreateTokenWithIAM</a>, to exchange auth tokens to IAM tokens. One of the resulted tokens will be identity token.</p></li>
81/// <li>
82/// <p>Call STS AssumeRole API as you normally would, but provide an extra <code>ProvidedContexts</code> parameter in the API request. The list of contexts must have a single trusted context assertion. The <code>ProviderArn</code> should be <code>arn:aws:iam::aws:contextProvider/IdentityCenter</code> while <code>ContextAssertion</code> will be the identity token you received in response from CreateTokenWithIAM</p></li>
83/// </ul>
84/// <p>For more details, see <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-identity-enhanced-iam-role-sessions.html">IdC documentation on Identity-enhanced IAM role sessions</a>.</p>
85/// <p>To obtain Identity-enhanced credentials for Quick Sight native users, IAM federated users, or Active Directory users, follow the steps below:</p>
86/// <ul>
87/// <li>
88/// <p>Call Quick Sight <a href="https://docs.aws.amazon.com/quicksight/latest/APIReference/API_GetIdentityContext.html">GetIdentityContext API</a> to get identity token.</p></li>
89/// <li>
90/// <p>Call STS AssumeRole API as you normally would, but provide extra <code>ProvidedContexts</code> parameter in the API request. The list of contexts must have a single trusted context assertion. The <code>ProviderArn</code> should be <code>arn:aws:iam::aws:contextProvider/QuickSight</code> while <code>ContextAssertion</code> will be the identity token you received in response from GetIdentityContext</p></li>
91/// </ul>
92/// <p>After obtaining the identity-enhanced IAM role session credentials, you can use them to start a job, describe the job and describe job result. You can use the same credentials as long as they haven't expired. All API requests made with these credentials are considered to be made by the impersonated Quick Sight user.</p><important>
93/// <p>When using identity-enhanced session credentials, set the UserConfiguration request attribute to null. Otherwise, the request will be invalid.</p>
94/// </important>
95/// <p><b>Possible error scenarios</b></p>
96/// <p>The request fails with an Access Denied error in the following scenarios:</p>
97/// <ul>
98/// <li>
99/// <p>The credentials have expired.</p></li>
100/// <li>
101/// <p>The impersonated Quick Sight user doesn't have access to the specified dashboard.</p></li>
102/// <li>
103/// <p>The impersonated Quick Sight user is restricted from exporting data in the selected formats. For more information about export restrictions, see <a href="https://docs.aws.amazon.com/quicksuite/latest/userguide/create-custom-permisions-profile.html">Customizing access to Amazon Quick Sight capabilities</a>.</p></li>
104/// </ul>
105#[derive(::std::clone::Clone, ::std::fmt::Debug)]
106pub struct StartDashboardSnapshotJobFluentBuilder {
107    handle: ::std::sync::Arc<crate::client::Handle>,
108    inner: crate::operation::start_dashboard_snapshot_job::builders::StartDashboardSnapshotJobInputBuilder,
109    config_override: ::std::option::Option<crate::config::Builder>,
110}
111impl
112    crate::client::customize::internal::CustomizableSend<
113        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobOutput,
114        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobError,
115    > for StartDashboardSnapshotJobFluentBuilder
116{
117    fn send(
118        self,
119        config_override: crate::config::Builder,
120    ) -> crate::client::customize::internal::BoxFuture<
121        crate::client::customize::internal::SendResult<
122            crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobOutput,
123            crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobError,
124        >,
125    > {
126        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
127    }
128}
129impl StartDashboardSnapshotJobFluentBuilder {
130    /// Creates a new `StartDashboardSnapshotJobFluentBuilder`.
131    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
132        Self {
133            handle,
134            inner: ::std::default::Default::default(),
135            config_override: ::std::option::Option::None,
136        }
137    }
138    /// Access the StartDashboardSnapshotJob as a reference.
139    pub fn as_input(&self) -> &crate::operation::start_dashboard_snapshot_job::builders::StartDashboardSnapshotJobInputBuilder {
140        &self.inner
141    }
142    /// Sends the request and returns the response.
143    ///
144    /// If an error occurs, an `SdkError` will be returned with additional details that
145    /// can be matched against.
146    ///
147    /// By default, any retryable failures will be retried twice. Retry behavior
148    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
149    /// set when configuring the client.
150    pub async fn send(
151        self,
152    ) -> ::std::result::Result<
153        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobOutput,
154        ::aws_smithy_runtime_api::client::result::SdkError<
155            crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobError,
156            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
157        >,
158    > {
159        let input = self
160            .inner
161            .build()
162            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
163        let runtime_plugins = crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJob::operation_runtime_plugins(
164            self.handle.runtime_plugins.clone(),
165            &self.handle.conf,
166            self.config_override,
167        );
168        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJob::orchestrate(&runtime_plugins, input).await
169    }
170
171    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
172    pub fn customize(
173        self,
174    ) -> crate::client::customize::CustomizableOperation<
175        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobOutput,
176        crate::operation::start_dashboard_snapshot_job::StartDashboardSnapshotJobError,
177        Self,
178    > {
179        crate::client::customize::CustomizableOperation::new(self)
180    }
181    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
182        self.set_config_override(::std::option::Option::Some(config_override.into()));
183        self
184    }
185
186    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
187        self.config_override = config_override;
188        self
189    }
190    /// <p>The ID of the Amazon Web Services account that the dashboard snapshot job is executed in.</p>
191    pub fn aws_account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
192        self.inner = self.inner.aws_account_id(input.into());
193        self
194    }
195    /// <p>The ID of the Amazon Web Services account that the dashboard snapshot job is executed in.</p>
196    pub fn set_aws_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197        self.inner = self.inner.set_aws_account_id(input);
198        self
199    }
200    /// <p>The ID of the Amazon Web Services account that the dashboard snapshot job is executed in.</p>
201    pub fn get_aws_account_id(&self) -> &::std::option::Option<::std::string::String> {
202        self.inner.get_aws_account_id()
203    }
204    /// <p>The ID of the dashboard that you want to start a snapshot job for.</p>
205    pub fn dashboard_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206        self.inner = self.inner.dashboard_id(input.into());
207        self
208    }
209    /// <p>The ID of the dashboard that you want to start a snapshot job for.</p>
210    pub fn set_dashboard_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
211        self.inner = self.inner.set_dashboard_id(input);
212        self
213    }
214    /// <p>The ID of the dashboard that you want to start a snapshot job for.</p>
215    pub fn get_dashboard_id(&self) -> &::std::option::Option<::std::string::String> {
216        self.inner.get_dashboard_id()
217    }
218    /// <p>An ID for the dashboard snapshot job. This ID is unique to the dashboard while the job is running. This ID can be used to poll the status of a job with a <code>DescribeDashboardSnapshotJob</code> while the job runs. You can reuse this ID for another job 24 hours after the current job is completed.</p>
219    pub fn snapshot_job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
220        self.inner = self.inner.snapshot_job_id(input.into());
221        self
222    }
223    /// <p>An ID for the dashboard snapshot job. This ID is unique to the dashboard while the job is running. This ID can be used to poll the status of a job with a <code>DescribeDashboardSnapshotJob</code> while the job runs. You can reuse this ID for another job 24 hours after the current job is completed.</p>
224    pub fn set_snapshot_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
225        self.inner = self.inner.set_snapshot_job_id(input);
226        self
227    }
228    /// <p>An ID for the dashboard snapshot job. This ID is unique to the dashboard while the job is running. This ID can be used to poll the status of a job with a <code>DescribeDashboardSnapshotJob</code> while the job runs. You can reuse this ID for another job 24 hours after the current job is completed.</p>
229    pub fn get_snapshot_job_id(&self) -> &::std::option::Option<::std::string::String> {
230        self.inner.get_snapshot_job_id()
231    }
232    /// <p>A structure that contains information about the users that the dashboard snapshot is generated for. The users can be either anonymous users or registered users. Anonymous users cannot be used together with registered users.</p><important>
233    /// <p>When using identity-enhanced session credentials, set the UserConfiguration request attribute to null. Otherwise, the request will be invalid.</p>
234    /// </important>
235    pub fn user_configuration(mut self, input: crate::types::SnapshotUserConfiguration) -> Self {
236        self.inner = self.inner.user_configuration(input);
237        self
238    }
239    /// <p>A structure that contains information about the users that the dashboard snapshot is generated for. The users can be either anonymous users or registered users. Anonymous users cannot be used together with registered users.</p><important>
240    /// <p>When using identity-enhanced session credentials, set the UserConfiguration request attribute to null. Otherwise, the request will be invalid.</p>
241    /// </important>
242    pub fn set_user_configuration(mut self, input: ::std::option::Option<crate::types::SnapshotUserConfiguration>) -> Self {
243        self.inner = self.inner.set_user_configuration(input);
244        self
245    }
246    /// <p>A structure that contains information about the users that the dashboard snapshot is generated for. The users can be either anonymous users or registered users. Anonymous users cannot be used together with registered users.</p><important>
247    /// <p>When using identity-enhanced session credentials, set the UserConfiguration request attribute to null. Otherwise, the request will be invalid.</p>
248    /// </important>
249    pub fn get_user_configuration(&self) -> &::std::option::Option<crate::types::SnapshotUserConfiguration> {
250        self.inner.get_user_configuration()
251    }
252    /// <p>A structure that describes the configuration of the dashboard snapshot.</p>
253    pub fn snapshot_configuration(mut self, input: crate::types::SnapshotConfiguration) -> Self {
254        self.inner = self.inner.snapshot_configuration(input);
255        self
256    }
257    /// <p>A structure that describes the configuration of the dashboard snapshot.</p>
258    pub fn set_snapshot_configuration(mut self, input: ::std::option::Option<crate::types::SnapshotConfiguration>) -> Self {
259        self.inner = self.inner.set_snapshot_configuration(input);
260        self
261    }
262    /// <p>A structure that describes the configuration of the dashboard snapshot.</p>
263    pub fn get_snapshot_configuration(&self) -> &::std::option::Option<crate::types::SnapshotConfiguration> {
264        self.inner.get_snapshot_configuration()
265    }
266}