aws_sdk_comprehend/operation/start_pii_entities_detection_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_pii_entities_detection_job::_start_pii_entities_detection_job_output::StartPiiEntitiesDetectionJobOutputBuilder;
3
4pub use crate::operation::start_pii_entities_detection_job::_start_pii_entities_detection_job_input::StartPiiEntitiesDetectionJobInputBuilder;
5
6impl crate::operation::start_pii_entities_detection_job::builders::StartPiiEntitiesDetectionJobInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_pii_entities_detection_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartPiiEntitiesDetectionJob`.
24///
25/// <p>Starts an asynchronous PII entity detection job for a collection of documents.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct StartPiiEntitiesDetectionJobFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::start_pii_entities_detection_job::builders::StartPiiEntitiesDetectionJobInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobOutput,
35        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobError,
36    > for StartPiiEntitiesDetectionJobFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobOutput,
44            crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl StartPiiEntitiesDetectionJobFluentBuilder {
51    /// Creates a new `StartPiiEntitiesDetectionJobFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the StartPiiEntitiesDetectionJob as a reference.
60    pub fn as_input(&self) -> &crate::operation::start_pii_entities_detection_job::builders::StartPiiEntitiesDetectionJobInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJob::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJob::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobOutput,
97        crate::operation::start_pii_entities_detection_job::StartPiiEntitiesDetectionJobError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The input properties for a PII entities detection job.</p>
112    pub fn input_data_config(mut self, input: crate::types::InputDataConfig) -> Self {
113        self.inner = self.inner.input_data_config(input);
114        self
115    }
116    /// <p>The input properties for a PII entities detection job.</p>
117    pub fn set_input_data_config(mut self, input: ::std::option::Option<crate::types::InputDataConfig>) -> Self {
118        self.inner = self.inner.set_input_data_config(input);
119        self
120    }
121    /// <p>The input properties for a PII entities detection job.</p>
122    pub fn get_input_data_config(&self) -> &::std::option::Option<crate::types::InputDataConfig> {
123        self.inner.get_input_data_config()
124    }
125    /// <p>Provides configuration parameters for the output of PII entity detection jobs.</p>
126    pub fn output_data_config(mut self, input: crate::types::OutputDataConfig) -> Self {
127        self.inner = self.inner.output_data_config(input);
128        self
129    }
130    /// <p>Provides configuration parameters for the output of PII entity detection jobs.</p>
131    pub fn set_output_data_config(mut self, input: ::std::option::Option<crate::types::OutputDataConfig>) -> Self {
132        self.inner = self.inner.set_output_data_config(input);
133        self
134    }
135    /// <p>Provides configuration parameters for the output of PII entity detection jobs.</p>
136    pub fn get_output_data_config(&self) -> &::std::option::Option<crate::types::OutputDataConfig> {
137        self.inner.get_output_data_config()
138    }
139    /// <p>Specifies whether the output provides the locations (offsets) of PII entities or a file in which PII entities are redacted.</p>
140    pub fn mode(mut self, input: crate::types::PiiEntitiesDetectionMode) -> Self {
141        self.inner = self.inner.mode(input);
142        self
143    }
144    /// <p>Specifies whether the output provides the locations (offsets) of PII entities or a file in which PII entities are redacted.</p>
145    pub fn set_mode(mut self, input: ::std::option::Option<crate::types::PiiEntitiesDetectionMode>) -> Self {
146        self.inner = self.inner.set_mode(input);
147        self
148    }
149    /// <p>Specifies whether the output provides the locations (offsets) of PII entities or a file in which PII entities are redacted.</p>
150    pub fn get_mode(&self) -> &::std::option::Option<crate::types::PiiEntitiesDetectionMode> {
151        self.inner.get_mode()
152    }
153    /// <p>Provides configuration parameters for PII entity redaction.</p>
154    /// <p>This parameter is required if you set the <code>Mode</code> parameter to <code>ONLY_REDACTION</code>. In that case, you must provide a <code>RedactionConfig</code> definition that includes the <code>PiiEntityTypes</code> parameter.</p>
155    pub fn redaction_config(mut self, input: crate::types::RedactionConfig) -> Self {
156        self.inner = self.inner.redaction_config(input);
157        self
158    }
159    /// <p>Provides configuration parameters for PII entity redaction.</p>
160    /// <p>This parameter is required if you set the <code>Mode</code> parameter to <code>ONLY_REDACTION</code>. In that case, you must provide a <code>RedactionConfig</code> definition that includes the <code>PiiEntityTypes</code> parameter.</p>
161    pub fn set_redaction_config(mut self, input: ::std::option::Option<crate::types::RedactionConfig>) -> Self {
162        self.inner = self.inner.set_redaction_config(input);
163        self
164    }
165    /// <p>Provides configuration parameters for PII entity redaction.</p>
166    /// <p>This parameter is required if you set the <code>Mode</code> parameter to <code>ONLY_REDACTION</code>. In that case, you must provide a <code>RedactionConfig</code> definition that includes the <code>PiiEntityTypes</code> parameter.</p>
167    pub fn get_redaction_config(&self) -> &::std::option::Option<crate::types::RedactionConfig> {
168        self.inner.get_redaction_config()
169    }
170    /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.</p>
171    pub fn data_access_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
172        self.inner = self.inner.data_access_role_arn(input.into());
173        self
174    }
175    /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.</p>
176    pub fn set_data_access_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
177        self.inner = self.inner.set_data_access_role_arn(input);
178        self
179    }
180    /// <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.</p>
181    pub fn get_data_access_role_arn(&self) -> &::std::option::Option<::std::string::String> {
182        self.inner.get_data_access_role_arn()
183    }
184    /// <p>The identifier of the job.</p>
185    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.job_name(input.into());
187        self
188    }
189    /// <p>The identifier of the job.</p>
190    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.inner = self.inner.set_job_name(input);
192        self
193    }
194    /// <p>The identifier of the job.</p>
195    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
196        self.inner.get_job_name()
197    }
198    /// <p>The language of the input documents. Enter the language code for English (en) or Spanish (es).</p>
199    pub fn language_code(mut self, input: crate::types::LanguageCode) -> Self {
200        self.inner = self.inner.language_code(input);
201        self
202    }
203    /// <p>The language of the input documents. Enter the language code for English (en) or Spanish (es).</p>
204    pub fn set_language_code(mut self, input: ::std::option::Option<crate::types::LanguageCode>) -> Self {
205        self.inner = self.inner.set_language_code(input);
206        self
207    }
208    /// <p>The language of the input documents. Enter the language code for English (en) or Spanish (es).</p>
209    pub fn get_language_code(&self) -> &::std::option::Option<crate::types::LanguageCode> {
210        self.inner.get_language_code()
211    }
212    /// <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p>
213    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214        self.inner = self.inner.client_request_token(input.into());
215        self
216    }
217    /// <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p>
218    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_client_request_token(input);
220        self
221    }
222    /// <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p>
223    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
224        self.inner.get_client_request_token()
225    }
226    ///
227    /// Appends an item to `Tags`.
228    ///
229    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
230    ///
231    /// <p>Tags to associate with the PII entities detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
232    pub fn tags(mut self, input: crate::types::Tag) -> Self {
233        self.inner = self.inner.tags(input);
234        self
235    }
236    /// <p>Tags to associate with the PII entities detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
237    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
238        self.inner = self.inner.set_tags(input);
239        self
240    }
241    /// <p>Tags to associate with the PII entities detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
242    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
243        self.inner.get_tags()
244    }
245}