aws_sdk_textract/operation/start_document_analysis/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_document_analysis::_start_document_analysis_output::StartDocumentAnalysisOutputBuilder;
3
4pub use crate::operation::start_document_analysis::_start_document_analysis_input::StartDocumentAnalysisInputBuilder;
5
6impl crate::operation::start_document_analysis::builders::StartDocumentAnalysisInputBuilder {
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_document_analysis::StartDocumentAnalysisOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_document_analysis::StartDocumentAnalysisError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_document_analysis();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartDocumentAnalysis`.
24///
25/// <p>Starts the asynchronous analysis of an input document for relationships between detected items such as key-value pairs, tables, and selection elements.</p>
26/// <p><code>StartDocumentAnalysis</code> can analyze text in documents that are in JPEG, PNG, TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use <code>DocumentLocation</code> to specify the bucket name and file name of the document.</p>
27/// <p><code>StartDocumentAnalysis</code> returns a job identifier (<code>JobId</code>) that you use to get the results of the operation. When text analysis is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you specify in <code>NotificationChannel</code>. To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is <code>SUCCEEDED</code>. If so, call <code>GetDocumentAnalysis</code>, and pass the job identifier (<code>JobId</code>) from the initial call to <code>StartDocumentAnalysis</code>.</p>
28/// <p>For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html">Document Text Analysis</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct StartDocumentAnalysisFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::start_document_analysis::builders::StartDocumentAnalysisInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::start_document_analysis::StartDocumentAnalysisOutput,
38        crate::operation::start_document_analysis::StartDocumentAnalysisError,
39    > for StartDocumentAnalysisFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::start_document_analysis::StartDocumentAnalysisOutput,
47            crate::operation::start_document_analysis::StartDocumentAnalysisError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl StartDocumentAnalysisFluentBuilder {
54    /// Creates a new `StartDocumentAnalysisFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the StartDocumentAnalysis as a reference.
63    pub fn as_input(&self) -> &crate::operation::start_document_analysis::builders::StartDocumentAnalysisInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::start_document_analysis::StartDocumentAnalysisOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::start_document_analysis::StartDocumentAnalysisError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::start_document_analysis::StartDocumentAnalysis::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::start_document_analysis::StartDocumentAnalysis::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::start_document_analysis::StartDocumentAnalysisOutput,
100        crate::operation::start_document_analysis::StartDocumentAnalysisError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The location of the document to be processed.</p>
115    pub fn document_location(mut self, input: crate::types::DocumentLocation) -> Self {
116        self.inner = self.inner.document_location(input);
117        self
118    }
119    /// <p>The location of the document to be processed.</p>
120    pub fn set_document_location(mut self, input: ::std::option::Option<crate::types::DocumentLocation>) -> Self {
121        self.inner = self.inner.set_document_location(input);
122        self
123    }
124    /// <p>The location of the document to be processed.</p>
125    pub fn get_document_location(&self) -> &::std::option::Option<crate::types::DocumentLocation> {
126        self.inner.get_document_location()
127    }
128    ///
129    /// Appends an item to `FeatureTypes`.
130    ///
131    /// To override the contents of this collection use [`set_feature_types`](Self::set_feature_types).
132    ///
133    /// <p>A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. To perform both types of analysis, add TABLES and FORMS to <code>FeatureTypes</code>. All lines and words detected in the document are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>).</p>
134    pub fn feature_types(mut self, input: crate::types::FeatureType) -> Self {
135        self.inner = self.inner.feature_types(input);
136        self
137    }
138    /// <p>A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. To perform both types of analysis, add TABLES and FORMS to <code>FeatureTypes</code>. All lines and words detected in the document are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>).</p>
139    pub fn set_feature_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeatureType>>) -> Self {
140        self.inner = self.inner.set_feature_types(input);
141        self
142    }
143    /// <p>A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. To perform both types of analysis, add TABLES and FORMS to <code>FeatureTypes</code>. All lines and words detected in the document are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>).</p>
144    pub fn get_feature_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeatureType>> {
145        self.inner.get_feature_types()
146    }
147    /// <p>The idempotent token that you use to identify the start request. If you use the same token with multiple <code>StartDocumentAnalysis</code> requests, the same <code>JobId</code> is returned. Use <code>ClientRequestToken</code> to prevent the same job from being accidentally started more than once. For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/api-async.html">Calling Amazon Textract Asynchronous Operations</a>.</p>
148    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.client_request_token(input.into());
150        self
151    }
152    /// <p>The idempotent token that you use to identify the start request. If you use the same token with multiple <code>StartDocumentAnalysis</code> requests, the same <code>JobId</code> is returned. Use <code>ClientRequestToken</code> to prevent the same job from being accidentally started more than once. For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/api-async.html">Calling Amazon Textract Asynchronous Operations</a>.</p>
153    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_client_request_token(input);
155        self
156    }
157    /// <p>The idempotent token that you use to identify the start request. If you use the same token with multiple <code>StartDocumentAnalysis</code> requests, the same <code>JobId</code> is returned. Use <code>ClientRequestToken</code> to prevent the same job from being accidentally started more than once. For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/api-async.html">Calling Amazon Textract Asynchronous Operations</a>.</p>
158    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_client_request_token()
160    }
161    /// <p>An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use <code>JobTag</code> to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).</p>
162    pub fn job_tag(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.job_tag(input.into());
164        self
165    }
166    /// <p>An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use <code>JobTag</code> to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).</p>
167    pub fn set_job_tag(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_job_tag(input);
169        self
170    }
171    /// <p>An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use <code>JobTag</code> to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).</p>
172    pub fn get_job_tag(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_job_tag()
174    }
175    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
176    pub fn notification_channel(mut self, input: crate::types::NotificationChannel) -> Self {
177        self.inner = self.inner.notification_channel(input);
178        self
179    }
180    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
181    pub fn set_notification_channel(mut self, input: ::std::option::Option<crate::types::NotificationChannel>) -> Self {
182        self.inner = self.inner.set_notification_channel(input);
183        self
184    }
185    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
186    pub fn get_notification_channel(&self) -> &::std::option::Option<crate::types::NotificationChannel> {
187        self.inner.get_notification_channel()
188    }
189    /// <p>Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the GetDocumentAnalysis operation.</p>
190    pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
191        self.inner = self.inner.output_config(input);
192        self
193    }
194    /// <p>Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the GetDocumentAnalysis operation.</p>
195    pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
196        self.inner = self.inner.set_output_config(input);
197        self
198    }
199    /// <p>Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the GetDocumentAnalysis operation.</p>
200    pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
201        self.inner.get_output_config()
202    }
203    /// <p>The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.</p>
204    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.kms_key_id(input.into());
206        self
207    }
208    /// <p>The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.</p>
209    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210        self.inner = self.inner.set_kms_key_id(input);
211        self
212    }
213    /// <p>The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.</p>
214    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
215        self.inner.get_kms_key_id()
216    }
217    /// <p></p>
218    pub fn queries_config(mut self, input: crate::types::QueriesConfig) -> Self {
219        self.inner = self.inner.queries_config(input);
220        self
221    }
222    /// <p></p>
223    pub fn set_queries_config(mut self, input: ::std::option::Option<crate::types::QueriesConfig>) -> Self {
224        self.inner = self.inner.set_queries_config(input);
225        self
226    }
227    /// <p></p>
228    pub fn get_queries_config(&self) -> &::std::option::Option<crate::types::QueriesConfig> {
229        self.inner.get_queries_config()
230    }
231    /// <p>Specifies the adapter to be used when analyzing a document.</p>
232    pub fn adapters_config(mut self, input: crate::types::AdaptersConfig) -> Self {
233        self.inner = self.inner.adapters_config(input);
234        self
235    }
236    /// <p>Specifies the adapter to be used when analyzing a document.</p>
237    pub fn set_adapters_config(mut self, input: ::std::option::Option<crate::types::AdaptersConfig>) -> Self {
238        self.inner = self.inner.set_adapters_config(input);
239        self
240    }
241    /// <p>Specifies the adapter to be used when analyzing a document.</p>
242    pub fn get_adapters_config(&self) -> &::std::option::Option<crate::types::AdaptersConfig> {
243        self.inner.get_adapters_config()
244    }
245}