aws_sdk_cloudsearchdomain/operation/upload_documents/
_upload_documents_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Container for the parameters to the <code>UploadDocuments</code> request.</p>
4#[non_exhaustive]
5#[derive(::std::fmt::Debug)]
6pub struct UploadDocumentsInput {
7    /// <p>A batch of documents formatted in JSON or HTML.</p>
8    pub documents: ::aws_smithy_types::byte_stream::ByteStream,
9    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
10    /// <ul>
11    /// <li>application/json</li>
12    /// <li>application/xml</li>
13    /// </ul>
14    pub content_type: ::std::option::Option<crate::types::ContentType>,
15}
16impl UploadDocumentsInput {
17    /// <p>A batch of documents formatted in JSON or HTML.</p>
18    pub fn documents(&self) -> &::aws_smithy_types::byte_stream::ByteStream {
19        &self.documents
20    }
21    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
22    /// <ul>
23    /// <li>application/json</li>
24    /// <li>application/xml</li>
25    /// </ul>
26    pub fn content_type(&self) -> ::std::option::Option<&crate::types::ContentType> {
27        self.content_type.as_ref()
28    }
29}
30impl UploadDocumentsInput {
31    /// Creates a new builder-style object to manufacture [`UploadDocumentsInput`](crate::operation::upload_documents::UploadDocumentsInput).
32    pub fn builder() -> crate::operation::upload_documents::builders::UploadDocumentsInputBuilder {
33        crate::operation::upload_documents::builders::UploadDocumentsInputBuilder::default()
34    }
35}
36
37/// A builder for [`UploadDocumentsInput`](crate::operation::upload_documents::UploadDocumentsInput).
38#[derive(::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct UploadDocumentsInputBuilder {
41    pub(crate) documents: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>,
42    pub(crate) content_type: ::std::option::Option<crate::types::ContentType>,
43}
44impl UploadDocumentsInputBuilder {
45    /// <p>A batch of documents formatted in JSON or HTML.</p>
46    /// This field is required.
47    pub fn documents(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
48        self.documents = ::std::option::Option::Some(input);
49        self
50    }
51    /// <p>A batch of documents formatted in JSON or HTML.</p>
52    pub fn set_documents(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
53        self.documents = input;
54        self
55    }
56    /// <p>A batch of documents formatted in JSON or HTML.</p>
57    pub fn get_documents(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
58        &self.documents
59    }
60    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
61    /// <ul>
62    /// <li>application/json</li>
63    /// <li>application/xml</li>
64    /// </ul>
65    /// This field is required.
66    pub fn content_type(mut self, input: crate::types::ContentType) -> Self {
67        self.content_type = ::std::option::Option::Some(input);
68        self
69    }
70    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
71    /// <ul>
72    /// <li>application/json</li>
73    /// <li>application/xml</li>
74    /// </ul>
75    pub fn set_content_type(mut self, input: ::std::option::Option<crate::types::ContentType>) -> Self {
76        self.content_type = input;
77        self
78    }
79    /// <p>The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats:</p>
80    /// <ul>
81    /// <li>application/json</li>
82    /// <li>application/xml</li>
83    /// </ul>
84    pub fn get_content_type(&self) -> &::std::option::Option<crate::types::ContentType> {
85        &self.content_type
86    }
87    /// Consumes the builder and constructs a [`UploadDocumentsInput`](crate::operation::upload_documents::UploadDocumentsInput).
88    pub fn build(
89        self,
90    ) -> ::std::result::Result<crate::operation::upload_documents::UploadDocumentsInput, ::aws_smithy_types::error::operation::BuildError> {
91        ::std::result::Result::Ok(crate::operation::upload_documents::UploadDocumentsInput {
92            documents: self.documents.unwrap_or_default(),
93            content_type: self.content_type,
94        })
95    }
96}