aws_sdk_comprehend/operation/detect_entities/
_detect_entities_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)]
5pub struct DetectEntitiesInput {
6    /// <p>A UTF-8 text string. The maximum string size is 100 KB. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
7    pub text: ::std::option::Option<::std::string::String>,
8    /// <p>The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. If your request includes the endpoint for a custom entity recognition model, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you specify here.</p>
9    /// <p>All input documents must be in the same language.</p>
10    pub language_code: ::std::option::Option<crate::types::LanguageCode>,
11    /// <p>The Amazon Resource Name of an endpoint that is associated with a custom entity recognition model. Provide an endpoint if you want to detect entities by using your own custom model instead of the default model that is used by Amazon Comprehend.</p>
12    /// <p>If you specify an endpoint, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you provide in your request.</p>
13    /// <p>For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>
14    pub endpoint_arn: ::std::option::Option<::std::string::String>,
15    /// <p>This field applies only when you use a custom entity recognition model that was trained with PDF annotations. For other cases, enter your text input in the <code>Text</code> field.</p>
16    /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file. Using a plain-text file in the <code>Bytes</code> parameter is equivelent to using the <code>Text</code> parameter (the <code>Entities</code> field in the response is identical).</p>
17    /// <p>You can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
18    /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to detect entities, the SDK may encode the document file bytes for you.</p>
19    /// <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p>
20    /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
21    pub bytes: ::std::option::Option<::aws_smithy_types::Blob>,
22    /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
23    pub document_reader_config: ::std::option::Option<crate::types::DocumentReaderConfig>,
24}
25impl DetectEntitiesInput {
26    /// <p>A UTF-8 text string. The maximum string size is 100 KB. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
27    pub fn text(&self) -> ::std::option::Option<&str> {
28        self.text.as_deref()
29    }
30    /// <p>The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. If your request includes the endpoint for a custom entity recognition model, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you specify here.</p>
31    /// <p>All input documents must be in the same language.</p>
32    pub fn language_code(&self) -> ::std::option::Option<&crate::types::LanguageCode> {
33        self.language_code.as_ref()
34    }
35    /// <p>The Amazon Resource Name of an endpoint that is associated with a custom entity recognition model. Provide an endpoint if you want to detect entities by using your own custom model instead of the default model that is used by Amazon Comprehend.</p>
36    /// <p>If you specify an endpoint, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you provide in your request.</p>
37    /// <p>For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>
38    pub fn endpoint_arn(&self) -> ::std::option::Option<&str> {
39        self.endpoint_arn.as_deref()
40    }
41    /// <p>This field applies only when you use a custom entity recognition model that was trained with PDF annotations. For other cases, enter your text input in the <code>Text</code> field.</p>
42    /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file. Using a plain-text file in the <code>Bytes</code> parameter is equivelent to using the <code>Text</code> parameter (the <code>Entities</code> field in the response is identical).</p>
43    /// <p>You can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
44    /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to detect entities, the SDK may encode the document file bytes for you.</p>
45    /// <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p>
46    /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
47    pub fn bytes(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
48        self.bytes.as_ref()
49    }
50    /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
51    pub fn document_reader_config(&self) -> ::std::option::Option<&crate::types::DocumentReaderConfig> {
52        self.document_reader_config.as_ref()
53    }
54}
55impl ::std::fmt::Debug for DetectEntitiesInput {
56    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
57        let mut formatter = f.debug_struct("DetectEntitiesInput");
58        formatter.field("text", &"*** Sensitive Data Redacted ***");
59        formatter.field("language_code", &self.language_code);
60        formatter.field("endpoint_arn", &self.endpoint_arn);
61        formatter.field("bytes", &self.bytes);
62        formatter.field("document_reader_config", &self.document_reader_config);
63        formatter.finish()
64    }
65}
66impl DetectEntitiesInput {
67    /// Creates a new builder-style object to manufacture [`DetectEntitiesInput`](crate::operation::detect_entities::DetectEntitiesInput).
68    pub fn builder() -> crate::operation::detect_entities::builders::DetectEntitiesInputBuilder {
69        crate::operation::detect_entities::builders::DetectEntitiesInputBuilder::default()
70    }
71}
72
73/// A builder for [`DetectEntitiesInput`](crate::operation::detect_entities::DetectEntitiesInput).
74#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
75#[non_exhaustive]
76pub struct DetectEntitiesInputBuilder {
77    pub(crate) text: ::std::option::Option<::std::string::String>,
78    pub(crate) language_code: ::std::option::Option<crate::types::LanguageCode>,
79    pub(crate) endpoint_arn: ::std::option::Option<::std::string::String>,
80    pub(crate) bytes: ::std::option::Option<::aws_smithy_types::Blob>,
81    pub(crate) document_reader_config: ::std::option::Option<crate::types::DocumentReaderConfig>,
82}
83impl DetectEntitiesInputBuilder {
84    /// <p>A UTF-8 text string. The maximum string size is 100 KB. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
85    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.text = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>A UTF-8 text string. The maximum string size is 100 KB. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
90    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.text = input;
92        self
93    }
94    /// <p>A UTF-8 text string. The maximum string size is 100 KB. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
95    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
96        &self.text
97    }
98    /// <p>The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. If your request includes the endpoint for a custom entity recognition model, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you specify here.</p>
99    /// <p>All input documents must be in the same language.</p>
100    pub fn language_code(mut self, input: crate::types::LanguageCode) -> Self {
101        self.language_code = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. If your request includes the endpoint for a custom entity recognition model, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you specify here.</p>
105    /// <p>All input documents must be in the same language.</p>
106    pub fn set_language_code(mut self, input: ::std::option::Option<crate::types::LanguageCode>) -> Self {
107        self.language_code = input;
108        self
109    }
110    /// <p>The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. If your request includes the endpoint for a custom entity recognition model, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you specify here.</p>
111    /// <p>All input documents must be in the same language.</p>
112    pub fn get_language_code(&self) -> &::std::option::Option<crate::types::LanguageCode> {
113        &self.language_code
114    }
115    /// <p>The Amazon Resource Name of an endpoint that is associated with a custom entity recognition model. Provide an endpoint if you want to detect entities by using your own custom model instead of the default model that is used by Amazon Comprehend.</p>
116    /// <p>If you specify an endpoint, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you provide in your request.</p>
117    /// <p>For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>
118    pub fn endpoint_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.endpoint_arn = ::std::option::Option::Some(input.into());
120        self
121    }
122    /// <p>The Amazon Resource Name of an endpoint that is associated with a custom entity recognition model. Provide an endpoint if you want to detect entities by using your own custom model instead of the default model that is used by Amazon Comprehend.</p>
123    /// <p>If you specify an endpoint, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you provide in your request.</p>
124    /// <p>For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>
125    pub fn set_endpoint_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.endpoint_arn = input;
127        self
128    }
129    /// <p>The Amazon Resource Name of an endpoint that is associated with a custom entity recognition model. Provide an endpoint if you want to detect entities by using your own custom model instead of the default model that is used by Amazon Comprehend.</p>
130    /// <p>If you specify an endpoint, Amazon Comprehend uses the language of your custom model, and it ignores any language code that you provide in your request.</p>
131    /// <p>For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>
132    pub fn get_endpoint_arn(&self) -> &::std::option::Option<::std::string::String> {
133        &self.endpoint_arn
134    }
135    /// <p>This field applies only when you use a custom entity recognition model that was trained with PDF annotations. For other cases, enter your text input in the <code>Text</code> field.</p>
136    /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file. Using a plain-text file in the <code>Bytes</code> parameter is equivelent to using the <code>Text</code> parameter (the <code>Entities</code> field in the response is identical).</p>
137    /// <p>You can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
138    /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to detect entities, the SDK may encode the document file bytes for you.</p>
139    /// <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p>
140    /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
141    pub fn bytes(mut self, input: ::aws_smithy_types::Blob) -> Self {
142        self.bytes = ::std::option::Option::Some(input);
143        self
144    }
145    /// <p>This field applies only when you use a custom entity recognition model that was trained with PDF annotations. For other cases, enter your text input in the <code>Text</code> field.</p>
146    /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file. Using a plain-text file in the <code>Bytes</code> parameter is equivelent to using the <code>Text</code> parameter (the <code>Entities</code> field in the response is identical).</p>
147    /// <p>You can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
148    /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to detect entities, the SDK may encode the document file bytes for you.</p>
149    /// <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p>
150    /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
151    pub fn set_bytes(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
152        self.bytes = input;
153        self
154    }
155    /// <p>This field applies only when you use a custom entity recognition model that was trained with PDF annotations. For other cases, enter your text input in the <code>Text</code> field.</p>
156    /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file. Using a plain-text file in the <code>Bytes</code> parameter is equivelent to using the <code>Text</code> parameter (the <code>Entities</code> field in the response is identical).</p>
157    /// <p>You can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
158    /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to detect entities, the SDK may encode the document file bytes for you.</p>
159    /// <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p>
160    /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
161    pub fn get_bytes(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
162        &self.bytes
163    }
164    /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
165    pub fn document_reader_config(mut self, input: crate::types::DocumentReaderConfig) -> Self {
166        self.document_reader_config = ::std::option::Option::Some(input);
167        self
168    }
169    /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
170    pub fn set_document_reader_config(mut self, input: ::std::option::Option<crate::types::DocumentReaderConfig>) -> Self {
171        self.document_reader_config = input;
172        self
173    }
174    /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
175    pub fn get_document_reader_config(&self) -> &::std::option::Option<crate::types::DocumentReaderConfig> {
176        &self.document_reader_config
177    }
178    /// Consumes the builder and constructs a [`DetectEntitiesInput`](crate::operation::detect_entities::DetectEntitiesInput).
179    pub fn build(
180        self,
181    ) -> ::std::result::Result<crate::operation::detect_entities::DetectEntitiesInput, ::aws_smithy_types::error::operation::BuildError> {
182        ::std::result::Result::Ok(crate::operation::detect_entities::DetectEntitiesInput {
183            text: self.text,
184            language_code: self.language_code,
185            endpoint_arn: self.endpoint_arn,
186            bytes: self.bytes,
187            document_reader_config: self.document_reader_config,
188        })
189    }
190}
191impl ::std::fmt::Debug for DetectEntitiesInputBuilder {
192    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
193        let mut formatter = f.debug_struct("DetectEntitiesInputBuilder");
194        formatter.field("text", &"*** Sensitive Data Redacted ***");
195        formatter.field("language_code", &self.language_code);
196        formatter.field("endpoint_arn", &self.endpoint_arn);
197        formatter.field("bytes", &self.bytes);
198        formatter.field("document_reader_config", &self.document_reader_config);
199        formatter.finish()
200    }
201}