aws_sdk_textract/operation/start_document_text_detection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_document_text_detection::_start_document_text_detection_output::StartDocumentTextDetectionOutputBuilder;
3
4pub use crate::operation::start_document_text_detection::_start_document_text_detection_input::StartDocumentTextDetectionInputBuilder;
5
6impl crate::operation::start_document_text_detection::builders::StartDocumentTextDetectionInputBuilder {
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_text_detection::StartDocumentTextDetectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_document_text_detection::StartDocumentTextDetectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_document_text_detection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartDocumentTextDetection`.
24///
25/// <p>Starts the asynchronous detection of text in a document. Amazon Textract can detect lines of text and the words that make up a line of text.</p>
26/// <p><code>StartDocumentTextDetection</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>StartDocumentTextDetection</code> returns a job identifier (<code>JobId</code>) that you use to get the results of the operation. When text detection 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 detection operation, first check that the status value published to the Amazon SNS topic is <code>SUCCEEDED</code>. If so, call <code>GetDocumentTextDetection</code>, and pass the job identifier (<code>JobId</code>) from the initial call to <code>StartDocumentTextDetection</code>.</p>
28/// <p>For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html">Document Text Detection</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct StartDocumentTextDetectionFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::start_document_text_detection::builders::StartDocumentTextDetectionInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::start_document_text_detection::StartDocumentTextDetectionOutput,
38        crate::operation::start_document_text_detection::StartDocumentTextDetectionError,
39    > for StartDocumentTextDetectionFluentBuilder
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_text_detection::StartDocumentTextDetectionOutput,
47            crate::operation::start_document_text_detection::StartDocumentTextDetectionError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl StartDocumentTextDetectionFluentBuilder {
54    /// Creates a new `StartDocumentTextDetectionFluentBuilder`.
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 StartDocumentTextDetection as a reference.
63    pub fn as_input(&self) -> &crate::operation::start_document_text_detection::builders::StartDocumentTextDetectionInputBuilder {
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_text_detection::StartDocumentTextDetectionOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::start_document_text_detection::StartDocumentTextDetectionError,
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_text_detection::StartDocumentTextDetection::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::start_document_text_detection::StartDocumentTextDetection::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_text_detection::StartDocumentTextDetectionOutput,
100        crate::operation::start_document_text_detection::StartDocumentTextDetectionError,
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    /// <p>The idempotent token that's used to identify the start request. If you use the same token with multiple <code>StartDocumentTextDetection</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>
129    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.client_request_token(input.into());
131        self
132    }
133    /// <p>The idempotent token that's used to identify the start request. If you use the same token with multiple <code>StartDocumentTextDetection</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>
134    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_client_request_token(input);
136        self
137    }
138    /// <p>The idempotent token that's used to identify the start request. If you use the same token with multiple <code>StartDocumentTextDetection</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>
139    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_client_request_token()
141    }
142    /// <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>
143    pub fn job_tag(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.job_tag(input.into());
145        self
146    }
147    /// <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>
148    pub fn set_job_tag(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149        self.inner = self.inner.set_job_tag(input);
150        self
151    }
152    /// <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>
153    pub fn get_job_tag(&self) -> &::std::option::Option<::std::string::String> {
154        self.inner.get_job_tag()
155    }
156    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
157    pub fn notification_channel(mut self, input: crate::types::NotificationChannel) -> Self {
158        self.inner = self.inner.notification_channel(input);
159        self
160    }
161    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
162    pub fn set_notification_channel(mut self, input: ::std::option::Option<crate::types::NotificationChannel>) -> Self {
163        self.inner = self.inner.set_notification_channel(input);
164        self
165    }
166    /// <p>The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.</p>
167    pub fn get_notification_channel(&self) -> &::std::option::Option<crate::types::NotificationChannel> {
168        self.inner.get_notification_channel()
169    }
170    /// <p>Sets if the output will go to a customer defined bucket. By default Amazon Textract will save the results internally to be accessed with the GetDocumentTextDetection operation.</p>
171    pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
172        self.inner = self.inner.output_config(input);
173        self
174    }
175    /// <p>Sets if the output will go to a customer defined bucket. By default Amazon Textract will save the results internally to be accessed with the GetDocumentTextDetection operation.</p>
176    pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
177        self.inner = self.inner.set_output_config(input);
178        self
179    }
180    /// <p>Sets if the output will go to a customer defined bucket. By default Amazon Textract will save the results internally to be accessed with the GetDocumentTextDetection operation.</p>
181    pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
182        self.inner.get_output_config()
183    }
184    /// <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>
185    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.kms_key_id(input.into());
187        self
188    }
189    /// <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>
190    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.inner = self.inner.set_kms_key_id(input);
192        self
193    }
194    /// <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>
195    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
196        self.inner.get_kms_key_id()
197    }
198}