// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::upload_documents::_upload_documents_output::UploadDocumentsOutputBuilder;
pub use crate::operation::upload_documents::_upload_documents_input::UploadDocumentsInputBuilder;
impl crate::operation::upload_documents::builders::UploadDocumentsInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::upload_documents::UploadDocumentsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::upload_documents::UploadDocumentsError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.upload_documents();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `UploadDocuments`.
///
/// <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>
/// <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>
/// <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>
#[derive(::std::fmt::Debug)]
pub struct UploadDocumentsFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::upload_documents::builders::UploadDocumentsInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::upload_documents::UploadDocumentsOutput,
crate::operation::upload_documents::UploadDocumentsError,
> for UploadDocumentsFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::upload_documents::UploadDocumentsOutput,
crate::operation::upload_documents::UploadDocumentsError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl UploadDocumentsFluentBuilder {
/// Creates a new `UploadDocumentsFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the UploadDocuments as a reference.
pub fn as_input(&self) -> &crate::operation::upload_documents::builders::UploadDocumentsInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::upload_documents::UploadDocumentsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::upload_documents::UploadDocumentsError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::upload_documents::UploadDocuments::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::upload_documents::UploadDocuments::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::upload_documents::UploadDocumentsOutput,
crate::operation::upload_documents::UploadDocumentsError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>A batch of documents formatted in JSON or HTML.</p>
pub fn documents(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
self.inner = self.inner.documents(input);
self
}
/// <p>A batch of documents formatted in JSON or HTML.</p>
pub fn set_documents(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
self.inner = self.inner.set_documents(input);
self
}
/// <p>A batch of documents formatted in JSON or HTML.</p>
pub fn get_documents(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
self.inner.get_documents()
}
/// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
/// <ul>
/// <li>application/json</li>
/// <li>application/xml</li>
/// </ul>
pub fn content_type(mut self, input: crate::types::ContentType) -> Self {
self.inner = self.inner.content_type(input);
self
}
/// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
/// <ul>
/// <li>application/json</li>
/// <li>application/xml</li>
/// </ul>
pub fn set_content_type(mut self, input: ::std::option::Option<crate::types::ContentType>) -> Self {
self.inner = self.inner.set_content_type(input);
self
}
/// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
/// <ul>
/// <li>application/json</li>
/// <li>application/xml</li>
/// </ul>
pub fn get_content_type(&self) -> &::std::option::Option<crate::types::ContentType> {
self.inner.get_content_type()
}
}