aws_sdk_personalize/operation/create_data_deletion_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_data_deletion_job::_create_data_deletion_job_output::CreateDataDeletionJobOutputBuilder;
3
4pub use crate::operation::create_data_deletion_job::_create_data_deletion_job_input::CreateDataDeletionJobInputBuilder;
5
6impl crate::operation::create_data_deletion_job::builders::CreateDataDeletionJobInputBuilder {
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::create_data_deletion_job::CreateDataDeletionJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_data_deletion_job::CreateDataDeletionJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_data_deletion_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDataDeletionJob`.
24///
25/// <p>Creates a batch job that deletes all references to specific users from an Amazon Personalize dataset group in batches. You specify the users to delete in a CSV file of userIds in an Amazon S3 bucket. After a job completes, Amazon Personalize no longer trains on the users’ data and no longer considers the users when generating user segments. For more information about creating a data deletion job, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/delete-records.html">Deleting users</a>.</p>
26/// <ul>
27/// <li>
28/// <p>Your input file must be a CSV file with a single USER_ID column that lists the users IDs. For more information about preparing the CSV file, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/prepare-deletion-input-file.html">Preparing your data deletion file and uploading it to Amazon S3</a>.</p></li>
29/// <li>
30/// <p>To give Amazon Personalize permission to access your input CSV file of userIds, you must specify an IAM service role that has permission to read from the data source. This role needs <code>GetObject</code> and <code>ListBucket</code> permissions for the bucket and its content. These permissions are the same as importing data. For information on granting access to your Amazon S3 bucket, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/granting-personalize-s3-access.html">Giving Amazon Personalize Access to Amazon S3 Resources</a>.</p></li>
31/// </ul>
32/// <p>After you create a job, it can take up to a day to delete all references to the users from datasets and models. Until the job completes, Amazon Personalize continues to use the data when training. And if you use a User Segmentation recipe, the users might appear in user segments.</p>
33/// <p><b>Status</b></p>
34/// <p>A data deletion job can have one of the following statuses:</p>
35/// <ul>
36/// <li>
37/// <p>PENDING &gt; IN_PROGRESS &gt; COMPLETED -or- FAILED</p></li>
38/// </ul>
39/// <p>To get the status of the data deletion job, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataDeletionJob.html">DescribeDataDeletionJob</a> API operation and specify the Amazon Resource Name (ARN) of the job. If the status is FAILED, the response includes a <code>failureReason</code> key, which describes why the job failed.</p>
40/// <p class="title"><b>Related APIs</b></p>
41/// <ul>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListDataDeletionJobs.html">ListDataDeletionJobs</a></p></li>
44/// <li>
45/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataDeletionJob.html">DescribeDataDeletionJob</a></p></li>
46/// </ul>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct CreateDataDeletionJobFluentBuilder {
49    handle: ::std::sync::Arc<crate::client::Handle>,
50    inner: crate::operation::create_data_deletion_job::builders::CreateDataDeletionJobInputBuilder,
51    config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54    crate::client::customize::internal::CustomizableSend<
55        crate::operation::create_data_deletion_job::CreateDataDeletionJobOutput,
56        crate::operation::create_data_deletion_job::CreateDataDeletionJobError,
57    > for CreateDataDeletionJobFluentBuilder
58{
59    fn send(
60        self,
61        config_override: crate::config::Builder,
62    ) -> crate::client::customize::internal::BoxFuture<
63        crate::client::customize::internal::SendResult<
64            crate::operation::create_data_deletion_job::CreateDataDeletionJobOutput,
65            crate::operation::create_data_deletion_job::CreateDataDeletionJobError,
66        >,
67    > {
68        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69    }
70}
71impl CreateDataDeletionJobFluentBuilder {
72    /// Creates a new `CreateDataDeletionJobFluentBuilder`.
73    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74        Self {
75            handle,
76            inner: ::std::default::Default::default(),
77            config_override: ::std::option::Option::None,
78        }
79    }
80    /// Access the CreateDataDeletionJob as a reference.
81    pub fn as_input(&self) -> &crate::operation::create_data_deletion_job::builders::CreateDataDeletionJobInputBuilder {
82        &self.inner
83    }
84    /// Sends the request and returns the response.
85    ///
86    /// If an error occurs, an `SdkError` will be returned with additional details that
87    /// can be matched against.
88    ///
89    /// By default, any retryable failures will be retried twice. Retry behavior
90    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91    /// set when configuring the client.
92    pub async fn send(
93        self,
94    ) -> ::std::result::Result<
95        crate::operation::create_data_deletion_job::CreateDataDeletionJobOutput,
96        ::aws_smithy_runtime_api::client::result::SdkError<
97            crate::operation::create_data_deletion_job::CreateDataDeletionJobError,
98            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99        >,
100    > {
101        let input = self
102            .inner
103            .build()
104            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105        let runtime_plugins = crate::operation::create_data_deletion_job::CreateDataDeletionJob::operation_runtime_plugins(
106            self.handle.runtime_plugins.clone(),
107            &self.handle.conf,
108            self.config_override,
109        );
110        crate::operation::create_data_deletion_job::CreateDataDeletionJob::orchestrate(&runtime_plugins, input).await
111    }
112
113    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114    pub fn customize(
115        self,
116    ) -> crate::client::customize::CustomizableOperation<
117        crate::operation::create_data_deletion_job::CreateDataDeletionJobOutput,
118        crate::operation::create_data_deletion_job::CreateDataDeletionJobError,
119        Self,
120    > {
121        crate::client::customize::CustomizableOperation::new(self)
122    }
123    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124        self.set_config_override(::std::option::Option::Some(config_override.into()));
125        self
126    }
127
128    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129        self.config_override = config_override;
130        self
131    }
132    /// <p>The name for the data deletion job.</p>
133    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134        self.inner = self.inner.job_name(input.into());
135        self
136    }
137    /// <p>The name for the data deletion job.</p>
138    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.inner = self.inner.set_job_name(input);
140        self
141    }
142    /// <p>The name for the data deletion job.</p>
143    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_job_name()
145    }
146    /// <p>The Amazon Resource Name (ARN) of the dataset group that has the datasets you want to delete records from.</p>
147    pub fn dataset_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.dataset_group_arn(input.into());
149        self
150    }
151    /// <p>The Amazon Resource Name (ARN) of the dataset group that has the datasets you want to delete records from.</p>
152    pub fn set_dataset_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_dataset_group_arn(input);
154        self
155    }
156    /// <p>The Amazon Resource Name (ARN) of the dataset group that has the datasets you want to delete records from.</p>
157    pub fn get_dataset_group_arn(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_dataset_group_arn()
159    }
160    /// <p>The Amazon S3 bucket that contains the list of userIds of the users to delete.</p>
161    pub fn data_source(mut self, input: crate::types::DataSource) -> Self {
162        self.inner = self.inner.data_source(input);
163        self
164    }
165    /// <p>The Amazon S3 bucket that contains the list of userIds of the users to delete.</p>
166    pub fn set_data_source(mut self, input: ::std::option::Option<crate::types::DataSource>) -> Self {
167        self.inner = self.inner.set_data_source(input);
168        self
169    }
170    /// <p>The Amazon S3 bucket that contains the list of userIds of the users to delete.</p>
171    pub fn get_data_source(&self) -> &::std::option::Option<crate::types::DataSource> {
172        self.inner.get_data_source()
173    }
174    /// <p>The Amazon Resource Name (ARN) of the IAM role that has permissions to read from the Amazon S3 data source.</p>
175    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.inner = self.inner.role_arn(input.into());
177        self
178    }
179    /// <p>The Amazon Resource Name (ARN) of the IAM role that has permissions to read from the Amazon S3 data source.</p>
180    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.inner = self.inner.set_role_arn(input);
182        self
183    }
184    /// <p>The Amazon Resource Name (ARN) of the IAM role that has permissions to read from the Amazon S3 data source.</p>
185    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
186        self.inner.get_role_arn()
187    }
188    ///
189    /// Appends an item to `tags`.
190    ///
191    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
192    ///
193    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the data deletion job.</p>
194    pub fn tags(mut self, input: crate::types::Tag) -> Self {
195        self.inner = self.inner.tags(input);
196        self
197    }
198    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the data deletion job.</p>
199    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
200        self.inner = self.inner.set_tags(input);
201        self
202    }
203    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the data deletion job.</p>
204    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
205        self.inner.get_tags()
206    }
207}