aws_sdk_kendra/operation/batch_put_document/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_put_document::_batch_put_document_output::BatchPutDocumentOutputBuilder;
3
4pub use crate::operation::batch_put_document::_batch_put_document_input::BatchPutDocumentInputBuilder;
5
6impl crate::operation::batch_put_document::builders::BatchPutDocumentInputBuilder {
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::batch_put_document::BatchPutDocumentOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::batch_put_document::BatchPutDocumentError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.batch_put_document();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `BatchPutDocument`.
24///
25/// <p>Adds one or more documents to an index.</p>
26/// <p>The <code>BatchPutDocument</code> API enables you to ingest inline documents or a set of documents stored in an Amazon S3 bucket. Use this API to ingest your text and unstructured text into an index, add custom attributes to the documents, and to attach an access control list to the documents added to the index.</p>
27/// <p>The documents are indexed asynchronously. You can see the progress of the batch using Amazon Web Services CloudWatch. Any error messages related to processing the batch are sent to your Amazon Web Services CloudWatch log. You can also use the <code>BatchGetDocumentStatus</code> API to monitor the progress of indexing your documents.</p>
28/// <p>For an example of ingesting inline documents using Python and Java SDKs, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/in-adding-binary-doc.html">Adding files directly to an index</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct BatchPutDocumentFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::batch_put_document::builders::BatchPutDocumentInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::batch_put_document::BatchPutDocumentOutput,
38        crate::operation::batch_put_document::BatchPutDocumentError,
39    > for BatchPutDocumentFluentBuilder
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::batch_put_document::BatchPutDocumentOutput,
47            crate::operation::batch_put_document::BatchPutDocumentError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl BatchPutDocumentFluentBuilder {
54    /// Creates a new `BatchPutDocumentFluentBuilder`.
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 BatchPutDocument as a reference.
63    pub fn as_input(&self) -> &crate::operation::batch_put_document::builders::BatchPutDocumentInputBuilder {
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::batch_put_document::BatchPutDocumentOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::batch_put_document::BatchPutDocumentError,
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::batch_put_document::BatchPutDocument::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::batch_put_document::BatchPutDocument::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::batch_put_document::BatchPutDocumentOutput,
100        crate::operation::batch_put_document::BatchPutDocumentError,
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 identifier of the index to add the documents to. You need to create the index first using the <code>CreateIndex</code> API.</p>
115    pub fn index_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.index_id(input.into());
117        self
118    }
119    /// <p>The identifier of the index to add the documents to. You need to create the index first using the <code>CreateIndex</code> API.</p>
120    pub fn set_index_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_index_id(input);
122        self
123    }
124    /// <p>The identifier of the index to add the documents to. You need to create the index first using the <code>CreateIndex</code> API.</p>
125    pub fn get_index_id(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_index_id()
127    }
128    /// <p>The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html">IAM access roles for Amazon Kendra</a>.</p>
129    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.role_arn(input.into());
131        self
132    }
133    /// <p>The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html">IAM access roles for Amazon Kendra</a>.</p>
134    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_role_arn(input);
136        self
137    }
138    /// <p>The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html">IAM access roles for Amazon Kendra</a>.</p>
139    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_role_arn()
141    }
142    ///
143    /// Appends an item to `Documents`.
144    ///
145    /// To override the contents of this collection use [`set_documents`](Self::set_documents).
146    ///
147    /// <p>One or more documents to add to the index.</p>
148    /// <p>Documents have the following file size limits.</p>
149    /// <ul>
150    /// <li>
151    /// <p>50 MB total size for any file</p></li>
152    /// <li>
153    /// <p>5 MB extracted text for any file</p></li>
154    /// </ul>
155    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/quotas.html">Quotas</a>.</p>
156    pub fn documents(mut self, input: crate::types::Document) -> Self {
157        self.inner = self.inner.documents(input);
158        self
159    }
160    /// <p>One or more documents to add to the index.</p>
161    /// <p>Documents have the following file size limits.</p>
162    /// <ul>
163    /// <li>
164    /// <p>50 MB total size for any file</p></li>
165    /// <li>
166    /// <p>5 MB extracted text for any file</p></li>
167    /// </ul>
168    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/quotas.html">Quotas</a>.</p>
169    pub fn set_documents(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Document>>) -> Self {
170        self.inner = self.inner.set_documents(input);
171        self
172    }
173    /// <p>One or more documents to add to the index.</p>
174    /// <p>Documents have the following file size limits.</p>
175    /// <ul>
176    /// <li>
177    /// <p>50 MB total size for any file</p></li>
178    /// <li>
179    /// <p>5 MB extracted text for any file</p></li>
180    /// </ul>
181    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/quotas.html">Quotas</a>.</p>
182    pub fn get_documents(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Document>> {
183        self.inner.get_documents()
184    }
185    /// <p>Configuration information for altering your document metadata and content during the document ingestion process when you use the <code>BatchPutDocument</code> API.</p>
186    /// <p>For more information on how to create, modify and delete document metadata, or make other content alterations when you ingest documents into Amazon Kendra, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html">Customizing document metadata during the ingestion process</a>.</p>
187    pub fn custom_document_enrichment_configuration(mut self, input: crate::types::CustomDocumentEnrichmentConfiguration) -> Self {
188        self.inner = self.inner.custom_document_enrichment_configuration(input);
189        self
190    }
191    /// <p>Configuration information for altering your document metadata and content during the document ingestion process when you use the <code>BatchPutDocument</code> API.</p>
192    /// <p>For more information on how to create, modify and delete document metadata, or make other content alterations when you ingest documents into Amazon Kendra, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html">Customizing document metadata during the ingestion process</a>.</p>
193    pub fn set_custom_document_enrichment_configuration(
194        mut self,
195        input: ::std::option::Option<crate::types::CustomDocumentEnrichmentConfiguration>,
196    ) -> Self {
197        self.inner = self.inner.set_custom_document_enrichment_configuration(input);
198        self
199    }
200    /// <p>Configuration information for altering your document metadata and content during the document ingestion process when you use the <code>BatchPutDocument</code> API.</p>
201    /// <p>For more information on how to create, modify and delete document metadata, or make other content alterations when you ingest documents into Amazon Kendra, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html">Customizing document metadata during the ingestion process</a>.</p>
202    pub fn get_custom_document_enrichment_configuration(&self) -> &::std::option::Option<crate::types::CustomDocumentEnrichmentConfiguration> {
203        self.inner.get_custom_document_enrichment_configuration()
204    }
205}