aws_sdk_cloudsearchdomain/operation/upload_documents/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::upload_documents::_upload_documents_output::UploadDocumentsOutputBuilder;
3
4pub use crate::operation::upload_documents::_upload_documents_input::UploadDocumentsInputBuilder;
5
6impl crate::operation::upload_documents::builders::UploadDocumentsInputBuilder {
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::upload_documents::UploadDocumentsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::upload_documents::UploadDocumentsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.upload_documents();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UploadDocuments`.
24///
25/// <p>Posts a batch of documents to a search domain for indexing. A document batch is a collection of add and delete operations that represent the documents you want to add, update, or delete from your domain. Batches can be described in either JSON or XML. Each item that you want Amazon CloudSearch to return as a search result (such as a product) is represented as a document. Every document has a unique ID and one or more fields that contain the data that you want to search and return in results. Individual documents cannot contain more than 1 MB of data. The entire batch cannot exceed 5 MB. To get the best possible upload performance, group add and delete operations in batches that are close the 5 MB limit. Submitting a large volume of single-document batches can overload a domain's document service.</p>
26/// <p>The endpoint for submitting <code>UploadDocuments</code> requests is domain-specific. To get the document endpoint for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console.</p>
27/// <p>For more information about formatting your data for Amazon CloudSearch, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html">Preparing Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>. For more information about uploading data for indexing, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/uploading-data.html">Uploading Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.</p>
28#[derive(::std::fmt::Debug)]
29pub struct UploadDocumentsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::upload_documents::builders::UploadDocumentsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::upload_documents::UploadDocumentsOutput,
37        crate::operation::upload_documents::UploadDocumentsError,
38    > for UploadDocumentsFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::upload_documents::UploadDocumentsOutput,
46            crate::operation::upload_documents::UploadDocumentsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl UploadDocumentsFluentBuilder {
53    /// Creates a new `UploadDocumentsFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the UploadDocuments as a reference.
62    pub fn as_input(&self) -> &crate::operation::upload_documents::builders::UploadDocumentsInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::upload_documents::UploadDocumentsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::upload_documents::UploadDocumentsError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::upload_documents::UploadDocuments::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::upload_documents::UploadDocuments::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::upload_documents::UploadDocumentsOutput,
99        crate::operation::upload_documents::UploadDocumentsError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>A batch of documents formatted in JSON or HTML.</p>
114    pub fn documents(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
115        self.inner = self.inner.documents(input);
116        self
117    }
118    /// <p>A batch of documents formatted in JSON or HTML.</p>
119    pub fn set_documents(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
120        self.inner = self.inner.set_documents(input);
121        self
122    }
123    /// <p>A batch of documents formatted in JSON or HTML.</p>
124    pub fn get_documents(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
125        self.inner.get_documents()
126    }
127    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
128    /// <ul>
129    /// <li>application/json</li>
130    /// <li>application/xml</li>
131    /// </ul>
132    pub fn content_type(mut self, input: crate::types::ContentType) -> Self {
133        self.inner = self.inner.content_type(input);
134        self
135    }
136    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
137    /// <ul>
138    /// <li>application/json</li>
139    /// <li>application/xml</li>
140    /// </ul>
141    pub fn set_content_type(mut self, input: ::std::option::Option<crate::types::ContentType>) -> Self {
142        self.inner = self.inner.set_content_type(input);
143        self
144    }
145    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
146    /// <ul>
147    /// <li>application/json</li>
148    /// <li>application/xml</li>
149    /// </ul>
150    pub fn get_content_type(&self) -> &::std::option::Option<crate::types::ContentType> {
151        self.inner.get_content_type()
152    }
153}