aws_sdk_translate/operation/translate_document/_translate_document_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct TranslateDocumentInput {
6 /// <p>The content and content type for the document to be translated. The document size must not exceed 100 KB.</p>
7 pub document: ::std::option::Option<crate::types::Document>,
8 /// <p>The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.</p>
9 /// <p>Use the <code>ListTerminologies</code> operation to get the available terminology lists.</p>
10 /// <p>For more information about custom terminology lists, see <a href="https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html">Custom terminology</a>.</p>
11 pub terminology_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12 /// <p>The language code for the language of the source text. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
13 /// <p>To have Amazon Translate determine the source language of your text, you can specify <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon Comprehend</a> to determine the source language.</p><note>
14 /// <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.</p>
15 /// </note>
16 pub source_language_code: ::std::option::Option<::std::string::String>,
17 /// <p>The language code requested for the translated document. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
18 pub target_language_code: ::std::option::Option<::std::string::String>,
19 /// <p>Settings to configure your translation output. You can configure the following options:</p>
20 /// <ul>
21 /// <li>
22 /// <p>Brevity: not supported.</p></li>
23 /// <li>
24 /// <p>Formality: sets the formality level of the output text.</p></li>
25 /// <li>
26 /// <p>Profanity: masks profane words and phrases in your translation output.</p></li>
27 /// </ul>
28 pub settings: ::std::option::Option<crate::types::TranslationSettings>,
29}
30impl TranslateDocumentInput {
31 /// <p>The content and content type for the document to be translated. The document size must not exceed 100 KB.</p>
32 pub fn document(&self) -> ::std::option::Option<&crate::types::Document> {
33 self.document.as_ref()
34 }
35 /// <p>The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.</p>
36 /// <p>Use the <code>ListTerminologies</code> operation to get the available terminology lists.</p>
37 /// <p>For more information about custom terminology lists, see <a href="https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html">Custom terminology</a>.</p>
38 ///
39 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.terminology_names.is_none()`.
40 pub fn terminology_names(&self) -> &[::std::string::String] {
41 self.terminology_names.as_deref().unwrap_or_default()
42 }
43 /// <p>The language code for the language of the source text. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
44 /// <p>To have Amazon Translate determine the source language of your text, you can specify <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon Comprehend</a> to determine the source language.</p><note>
45 /// <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.</p>
46 /// </note>
47 pub fn source_language_code(&self) -> ::std::option::Option<&str> {
48 self.source_language_code.as_deref()
49 }
50 /// <p>The language code requested for the translated document. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
51 pub fn target_language_code(&self) -> ::std::option::Option<&str> {
52 self.target_language_code.as_deref()
53 }
54 /// <p>Settings to configure your translation output. You can configure the following options:</p>
55 /// <ul>
56 /// <li>
57 /// <p>Brevity: not supported.</p></li>
58 /// <li>
59 /// <p>Formality: sets the formality level of the output text.</p></li>
60 /// <li>
61 /// <p>Profanity: masks profane words and phrases in your translation output.</p></li>
62 /// </ul>
63 pub fn settings(&self) -> ::std::option::Option<&crate::types::TranslationSettings> {
64 self.settings.as_ref()
65 }
66}
67impl TranslateDocumentInput {
68 /// Creates a new builder-style object to manufacture [`TranslateDocumentInput`](crate::operation::translate_document::TranslateDocumentInput).
69 pub fn builder() -> crate::operation::translate_document::builders::TranslateDocumentInputBuilder {
70 crate::operation::translate_document::builders::TranslateDocumentInputBuilder::default()
71 }
72}
73
74/// A builder for [`TranslateDocumentInput`](crate::operation::translate_document::TranslateDocumentInput).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
76#[non_exhaustive]
77pub struct TranslateDocumentInputBuilder {
78 pub(crate) document: ::std::option::Option<crate::types::Document>,
79 pub(crate) terminology_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
80 pub(crate) source_language_code: ::std::option::Option<::std::string::String>,
81 pub(crate) target_language_code: ::std::option::Option<::std::string::String>,
82 pub(crate) settings: ::std::option::Option<crate::types::TranslationSettings>,
83}
84impl TranslateDocumentInputBuilder {
85 /// <p>The content and content type for the document to be translated. The document size must not exceed 100 KB.</p>
86 /// This field is required.
87 pub fn document(mut self, input: crate::types::Document) -> Self {
88 self.document = ::std::option::Option::Some(input);
89 self
90 }
91 /// <p>The content and content type for the document to be translated. The document size must not exceed 100 KB.</p>
92 pub fn set_document(mut self, input: ::std::option::Option<crate::types::Document>) -> Self {
93 self.document = input;
94 self
95 }
96 /// <p>The content and content type for the document to be translated. The document size must not exceed 100 KB.</p>
97 pub fn get_document(&self) -> &::std::option::Option<crate::types::Document> {
98 &self.document
99 }
100 /// Appends an item to `terminology_names`.
101 ///
102 /// To override the contents of this collection use [`set_terminology_names`](Self::set_terminology_names).
103 ///
104 /// <p>The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.</p>
105 /// <p>Use the <code>ListTerminologies</code> operation to get the available terminology lists.</p>
106 /// <p>For more information about custom terminology lists, see <a href="https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html">Custom terminology</a>.</p>
107 pub fn terminology_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108 let mut v = self.terminology_names.unwrap_or_default();
109 v.push(input.into());
110 self.terminology_names = ::std::option::Option::Some(v);
111 self
112 }
113 /// <p>The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.</p>
114 /// <p>Use the <code>ListTerminologies</code> operation to get the available terminology lists.</p>
115 /// <p>For more information about custom terminology lists, see <a href="https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html">Custom terminology</a>.</p>
116 pub fn set_terminology_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
117 self.terminology_names = input;
118 self
119 }
120 /// <p>The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.</p>
121 /// <p>Use the <code>ListTerminologies</code> operation to get the available terminology lists.</p>
122 /// <p>For more information about custom terminology lists, see <a href="https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html">Custom terminology</a>.</p>
123 pub fn get_terminology_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
124 &self.terminology_names
125 }
126 /// <p>The language code for the language of the source text. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
127 /// <p>To have Amazon Translate determine the source language of your text, you can specify <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon Comprehend</a> to determine the source language.</p><note>
128 /// <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.</p>
129 /// </note>
130 /// This field is required.
131 pub fn source_language_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132 self.source_language_code = ::std::option::Option::Some(input.into());
133 self
134 }
135 /// <p>The language code for the language of the source text. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
136 /// <p>To have Amazon Translate determine the source language of your text, you can specify <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon Comprehend</a> to determine the source language.</p><note>
137 /// <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.</p>
138 /// </note>
139 pub fn set_source_language_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.source_language_code = input;
141 self
142 }
143 /// <p>The language code for the language of the source text. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
144 /// <p>To have Amazon Translate determine the source language of your text, you can specify <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon Comprehend</a> to determine the source language.</p><note>
145 /// <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.</p>
146 /// </note>
147 pub fn get_source_language_code(&self) -> &::std::option::Option<::std::string::String> {
148 &self.source_language_code
149 }
150 /// <p>The language code requested for the translated document. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
151 /// This field is required.
152 pub fn target_language_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153 self.target_language_code = ::std::option::Option::Some(input.into());
154 self
155 }
156 /// <p>The language code requested for the translated document. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
157 pub fn set_target_language_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158 self.target_language_code = input;
159 self
160 }
161 /// <p>The language code requested for the translated document. For a list of supported language codes, see <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
162 pub fn get_target_language_code(&self) -> &::std::option::Option<::std::string::String> {
163 &self.target_language_code
164 }
165 /// <p>Settings to configure your translation output. You can configure the following options:</p>
166 /// <ul>
167 /// <li>
168 /// <p>Brevity: not supported.</p></li>
169 /// <li>
170 /// <p>Formality: sets the formality level of the output text.</p></li>
171 /// <li>
172 /// <p>Profanity: masks profane words and phrases in your translation output.</p></li>
173 /// </ul>
174 pub fn settings(mut self, input: crate::types::TranslationSettings) -> Self {
175 self.settings = ::std::option::Option::Some(input);
176 self
177 }
178 /// <p>Settings to configure your translation output. You can configure the following options:</p>
179 /// <ul>
180 /// <li>
181 /// <p>Brevity: not supported.</p></li>
182 /// <li>
183 /// <p>Formality: sets the formality level of the output text.</p></li>
184 /// <li>
185 /// <p>Profanity: masks profane words and phrases in your translation output.</p></li>
186 /// </ul>
187 pub fn set_settings(mut self, input: ::std::option::Option<crate::types::TranslationSettings>) -> Self {
188 self.settings = input;
189 self
190 }
191 /// <p>Settings to configure your translation output. You can configure the following options:</p>
192 /// <ul>
193 /// <li>
194 /// <p>Brevity: not supported.</p></li>
195 /// <li>
196 /// <p>Formality: sets the formality level of the output text.</p></li>
197 /// <li>
198 /// <p>Profanity: masks profane words and phrases in your translation output.</p></li>
199 /// </ul>
200 pub fn get_settings(&self) -> &::std::option::Option<crate::types::TranslationSettings> {
201 &self.settings
202 }
203 /// Consumes the builder and constructs a [`TranslateDocumentInput`](crate::operation::translate_document::TranslateDocumentInput).
204 pub fn build(
205 self,
206 ) -> ::std::result::Result<crate::operation::translate_document::TranslateDocumentInput, ::aws_smithy_types::error::operation::BuildError> {
207 ::std::result::Result::Ok(crate::operation::translate_document::TranslateDocumentInput {
208 document: self.document,
209 terminology_names: self.terminology_names,
210 source_language_code: self.source_language_code,
211 target_language_code: self.target_language_code,
212 settings: self.settings,
213 })
214 }
215}