aws_sdk_comprehend/operation/classify_document/_classify_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)]
5pub struct ClassifyDocumentInput {
6 /// <p>The document text to be analyzed. 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 Amazon Resource Number (ARN) of the endpoint.</p>
9 /// <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p>
10 /// <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p>
11 pub endpoint_arn: ::std::option::Option<::std::string::String>,
12 /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p>
13 /// <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
14 /// <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p>
15 /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p>
16 /// <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>
17 /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
18 pub bytes: ::std::option::Option<::aws_smithy_types::Blob>,
19 /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
20 pub document_reader_config: ::std::option::Option<crate::types::DocumentReaderConfig>,
21}
22impl ClassifyDocumentInput {
23 /// <p>The document text to be analyzed. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
24 pub fn text(&self) -> ::std::option::Option<&str> {
25 self.text.as_deref()
26 }
27 /// <p>The Amazon Resource Number (ARN) of the endpoint.</p>
28 /// <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p>
29 /// <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p>
30 pub fn endpoint_arn(&self) -> ::std::option::Option<&str> {
31 self.endpoint_arn.as_deref()
32 }
33 /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p>
34 /// <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
35 /// <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p>
36 /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p>
37 /// <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>
38 /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
39 pub fn bytes(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
40 self.bytes.as_ref()
41 }
42 /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
43 pub fn document_reader_config(&self) -> ::std::option::Option<&crate::types::DocumentReaderConfig> {
44 self.document_reader_config.as_ref()
45 }
46}
47impl ::std::fmt::Debug for ClassifyDocumentInput {
48 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
49 let mut formatter = f.debug_struct("ClassifyDocumentInput");
50 formatter.field("text", &"*** Sensitive Data Redacted ***");
51 formatter.field("endpoint_arn", &self.endpoint_arn);
52 formatter.field("bytes", &self.bytes);
53 formatter.field("document_reader_config", &self.document_reader_config);
54 formatter.finish()
55 }
56}
57impl ClassifyDocumentInput {
58 /// Creates a new builder-style object to manufacture [`ClassifyDocumentInput`](crate::operation::classify_document::ClassifyDocumentInput).
59 pub fn builder() -> crate::operation::classify_document::builders::ClassifyDocumentInputBuilder {
60 crate::operation::classify_document::builders::ClassifyDocumentInputBuilder::default()
61 }
62}
63
64/// A builder for [`ClassifyDocumentInput`](crate::operation::classify_document::ClassifyDocumentInput).
65#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
66#[non_exhaustive]
67pub struct ClassifyDocumentInputBuilder {
68 pub(crate) text: ::std::option::Option<::std::string::String>,
69 pub(crate) endpoint_arn: ::std::option::Option<::std::string::String>,
70 pub(crate) bytes: ::std::option::Option<::aws_smithy_types::Blob>,
71 pub(crate) document_reader_config: ::std::option::Option<crate::types::DocumentReaderConfig>,
72}
73impl ClassifyDocumentInputBuilder {
74 /// <p>The document text to be analyzed. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
75 pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76 self.text = ::std::option::Option::Some(input.into());
77 self
78 }
79 /// <p>The document text to be analyzed. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
80 pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81 self.text = input;
82 self
83 }
84 /// <p>The document text to be analyzed. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p>
85 pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
86 &self.text
87 }
88 /// <p>The Amazon Resource Number (ARN) of the endpoint.</p>
89 /// <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p>
90 /// <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p>
91 /// This field is required.
92 pub fn endpoint_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93 self.endpoint_arn = ::std::option::Option::Some(input.into());
94 self
95 }
96 /// <p>The Amazon Resource Number (ARN) of the endpoint.</p>
97 /// <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p>
98 /// <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p>
99 pub fn set_endpoint_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100 self.endpoint_arn = input;
101 self
102 }
103 /// <p>The Amazon Resource Number (ARN) of the endpoint.</p>
104 /// <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p>
105 /// <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p>
106 pub fn get_endpoint_arn(&self) -> &::std::option::Option<::std::string::String> {
107 &self.endpoint_arn
108 }
109 /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p>
110 /// <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
111 /// <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p>
112 /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p>
113 /// <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>
114 /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
115 pub fn bytes(mut self, input: ::aws_smithy_types::Blob) -> Self {
116 self.bytes = ::std::option::Option::Some(input);
117 self
118 }
119 /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p>
120 /// <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
121 /// <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p>
122 /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p>
123 /// <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>
124 /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
125 pub fn set_bytes(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
126 self.bytes = input;
127 self
128 }
129 /// <p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p>
130 /// <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p>
131 /// <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p>
132 /// <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p>
133 /// <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>
134 /// <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p>
135 pub fn get_bytes(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
136 &self.bytes
137 }
138 /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
139 pub fn document_reader_config(mut self, input: crate::types::DocumentReaderConfig) -> Self {
140 self.document_reader_config = ::std::option::Option::Some(input);
141 self
142 }
143 /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
144 pub fn set_document_reader_config(mut self, input: ::std::option::Option<crate::types::DocumentReaderConfig>) -> Self {
145 self.document_reader_config = input;
146 self
147 }
148 /// <p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p>
149 pub fn get_document_reader_config(&self) -> &::std::option::Option<crate::types::DocumentReaderConfig> {
150 &self.document_reader_config
151 }
152 /// Consumes the builder and constructs a [`ClassifyDocumentInput`](crate::operation::classify_document::ClassifyDocumentInput).
153 pub fn build(
154 self,
155 ) -> ::std::result::Result<crate::operation::classify_document::ClassifyDocumentInput, ::aws_smithy_types::error::operation::BuildError> {
156 ::std::result::Result::Ok(crate::operation::classify_document::ClassifyDocumentInput {
157 text: self.text,
158 endpoint_arn: self.endpoint_arn,
159 bytes: self.bytes,
160 document_reader_config: self.document_reader_config,
161 })
162 }
163}
164impl ::std::fmt::Debug for ClassifyDocumentInputBuilder {
165 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
166 let mut formatter = f.debug_struct("ClassifyDocumentInputBuilder");
167 formatter.field("text", &"*** Sensitive Data Redacted ***");
168 formatter.field("endpoint_arn", &self.endpoint_arn);
169 formatter.field("bytes", &self.bytes);
170 formatter.field("document_reader_config", &self.document_reader_config);
171 formatter.finish()
172 }
173}