aws_sdk_personalize/operation/create_dataset_import_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_dataset_import_job::_create_dataset_import_job_output::CreateDatasetImportJobOutputBuilder;
3
4pub use crate::operation::create_dataset_import_job::_create_dataset_import_job_input::CreateDatasetImportJobInputBuilder;
5
6impl crate::operation::create_dataset_import_job::builders::CreateDatasetImportJobInputBuilder {
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_dataset_import_job::CreateDatasetImportJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_dataset_import_job::CreateDatasetImportJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_dataset_import_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDatasetImportJob`.
24///
25/// <p>Creates a job that imports training data from your data source (an Amazon S3 bucket) to an Amazon Personalize dataset. To allow Amazon Personalize to import the training data, you must specify an IAM service role that has permission to read from the data source, as Amazon Personalize makes a copy of your data and processes it internally. 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>
26/// <p>If you already created a recommender or deployed a custom solution version with a campaign, how new bulk records influence recommendations depends on the domain use case or recipe that you use. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/how-new-data-influences-recommendations.html">How new data influences real-time recommendations</a>.</p><important>
27/// <p>By default, a dataset import job replaces any existing data in the dataset that you imported in bulk. To add new records without replacing existing data, specify INCREMENTAL for the import mode in the CreateDatasetImportJob operation.</p>
28/// </important>
29/// <p><b>Status</b></p>
30/// <p>A dataset import job can be in one of the following states:</p>
31/// <ul>
32/// <li>
33/// <p>CREATE PENDING &gt; CREATE IN_PROGRESS &gt; ACTIVE -or- CREATE FAILED</p></li>
34/// </ul>
35/// <p>To get the status of the import job, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDatasetImportJob.html">DescribeDatasetImportJob</a>, providing the Amazon Resource Name (ARN) of the dataset import job. The dataset import is complete when the status shows as ACTIVE. If the status shows as CREATE FAILED, the response includes a <code>failureReason</code> key, which describes why the job failed.</p><note>
36/// <p>Importing takes time. You must wait until the status shows as ACTIVE before training a model using the dataset.</p>
37/// </note>
38/// <p class="title"><b>Related APIs</b></p>
39/// <ul>
40/// <li>
41/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListDatasetImportJobs.html">ListDatasetImportJobs</a></p></li>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDatasetImportJob.html">DescribeDatasetImportJob</a></p></li>
44/// </ul>
45#[derive(::std::clone::Clone, ::std::fmt::Debug)]
46pub struct CreateDatasetImportJobFluentBuilder {
47    handle: ::std::sync::Arc<crate::client::Handle>,
48    inner: crate::operation::create_dataset_import_job::builders::CreateDatasetImportJobInputBuilder,
49    config_override: ::std::option::Option<crate::config::Builder>,
50}
51impl
52    crate::client::customize::internal::CustomizableSend<
53        crate::operation::create_dataset_import_job::CreateDatasetImportJobOutput,
54        crate::operation::create_dataset_import_job::CreateDatasetImportJobError,
55    > for CreateDatasetImportJobFluentBuilder
56{
57    fn send(
58        self,
59        config_override: crate::config::Builder,
60    ) -> crate::client::customize::internal::BoxFuture<
61        crate::client::customize::internal::SendResult<
62            crate::operation::create_dataset_import_job::CreateDatasetImportJobOutput,
63            crate::operation::create_dataset_import_job::CreateDatasetImportJobError,
64        >,
65    > {
66        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
67    }
68}
69impl CreateDatasetImportJobFluentBuilder {
70    /// Creates a new `CreateDatasetImportJobFluentBuilder`.
71    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
72        Self {
73            handle,
74            inner: ::std::default::Default::default(),
75            config_override: ::std::option::Option::None,
76        }
77    }
78    /// Access the CreateDatasetImportJob as a reference.
79    pub fn as_input(&self) -> &crate::operation::create_dataset_import_job::builders::CreateDatasetImportJobInputBuilder {
80        &self.inner
81    }
82    /// Sends the request and returns the response.
83    ///
84    /// If an error occurs, an `SdkError` will be returned with additional details that
85    /// can be matched against.
86    ///
87    /// By default, any retryable failures will be retried twice. Retry behavior
88    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
89    /// set when configuring the client.
90    pub async fn send(
91        self,
92    ) -> ::std::result::Result<
93        crate::operation::create_dataset_import_job::CreateDatasetImportJobOutput,
94        ::aws_smithy_runtime_api::client::result::SdkError<
95            crate::operation::create_dataset_import_job::CreateDatasetImportJobError,
96            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
97        >,
98    > {
99        let input = self
100            .inner
101            .build()
102            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
103        let runtime_plugins = crate::operation::create_dataset_import_job::CreateDatasetImportJob::operation_runtime_plugins(
104            self.handle.runtime_plugins.clone(),
105            &self.handle.conf,
106            self.config_override,
107        );
108        crate::operation::create_dataset_import_job::CreateDatasetImportJob::orchestrate(&runtime_plugins, input).await
109    }
110
111    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
112    pub fn customize(
113        self,
114    ) -> crate::client::customize::CustomizableOperation<
115        crate::operation::create_dataset_import_job::CreateDatasetImportJobOutput,
116        crate::operation::create_dataset_import_job::CreateDatasetImportJobError,
117        Self,
118    > {
119        crate::client::customize::CustomizableOperation::new(self)
120    }
121    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
122        self.set_config_override(::std::option::Option::Some(config_override.into()));
123        self
124    }
125
126    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
127        self.config_override = config_override;
128        self
129    }
130    /// <p>The name for the dataset import job.</p>
131    pub fn job_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.job_name(input.into());
133        self
134    }
135    /// <p>The name for the dataset import job.</p>
136    pub fn set_job_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_job_name(input);
138        self
139    }
140    /// <p>The name for the dataset import job.</p>
141    pub fn get_job_name(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_job_name()
143    }
144    /// <p>The ARN of the dataset that receives the imported data.</p>
145    pub fn dataset_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.dataset_arn(input.into());
147        self
148    }
149    /// <p>The ARN of the dataset that receives the imported data.</p>
150    pub fn set_dataset_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_dataset_arn(input);
152        self
153    }
154    /// <p>The ARN of the dataset that receives the imported data.</p>
155    pub fn get_dataset_arn(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_dataset_arn()
157    }
158    /// <p>The Amazon S3 bucket that contains the training data to import.</p>
159    pub fn data_source(mut self, input: crate::types::DataSource) -> Self {
160        self.inner = self.inner.data_source(input);
161        self
162    }
163    /// <p>The Amazon S3 bucket that contains the training data to import.</p>
164    pub fn set_data_source(mut self, input: ::std::option::Option<crate::types::DataSource>) -> Self {
165        self.inner = self.inner.set_data_source(input);
166        self
167    }
168    /// <p>The Amazon S3 bucket that contains the training data to import.</p>
169    pub fn get_data_source(&self) -> &::std::option::Option<crate::types::DataSource> {
170        self.inner.get_data_source()
171    }
172    /// <p>The ARN of the IAM role that has permissions to read from the Amazon S3 data source.</p>
173    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.inner = self.inner.role_arn(input.into());
175        self
176    }
177    /// <p>The ARN of the IAM role that has permissions to read from the Amazon S3 data source.</p>
178    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.inner = self.inner.set_role_arn(input);
180        self
181    }
182    /// <p>The ARN of the IAM role that has permissions to read from the Amazon S3 data source.</p>
183    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
184        self.inner.get_role_arn()
185    }
186    ///
187    /// Appends an item to `tags`.
188    ///
189    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
190    ///
191    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset import job.</p>
192    pub fn tags(mut self, input: crate::types::Tag) -> Self {
193        self.inner = self.inner.tags(input);
194        self
195    }
196    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset import job.</p>
197    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
198        self.inner = self.inner.set_tags(input);
199        self
200    }
201    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset import job.</p>
202    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
203        self.inner.get_tags()
204    }
205    /// <p>Specify how to add the new records to an existing dataset. The default import mode is <code>FULL</code>. If you haven't imported bulk records into the dataset previously, you can only specify <code>FULL</code>.</p>
206    /// <ul>
207    /// <li>
208    /// <p>Specify <code>FULL</code> to overwrite all existing bulk data in your dataset. Data you imported individually is not replaced.</p></li>
209    /// <li>
210    /// <p>Specify <code>INCREMENTAL</code> to append the new records to the existing data in your dataset. Amazon Personalize replaces any record with the same ID with the new one.</p></li>
211    /// </ul>
212    pub fn import_mode(mut self, input: crate::types::ImportMode) -> Self {
213        self.inner = self.inner.import_mode(input);
214        self
215    }
216    /// <p>Specify how to add the new records to an existing dataset. The default import mode is <code>FULL</code>. If you haven't imported bulk records into the dataset previously, you can only specify <code>FULL</code>.</p>
217    /// <ul>
218    /// <li>
219    /// <p>Specify <code>FULL</code> to overwrite all existing bulk data in your dataset. Data you imported individually is not replaced.</p></li>
220    /// <li>
221    /// <p>Specify <code>INCREMENTAL</code> to append the new records to the existing data in your dataset. Amazon Personalize replaces any record with the same ID with the new one.</p></li>
222    /// </ul>
223    pub fn set_import_mode(mut self, input: ::std::option::Option<crate::types::ImportMode>) -> Self {
224        self.inner = self.inner.set_import_mode(input);
225        self
226    }
227    /// <p>Specify how to add the new records to an existing dataset. The default import mode is <code>FULL</code>. If you haven't imported bulk records into the dataset previously, you can only specify <code>FULL</code>.</p>
228    /// <ul>
229    /// <li>
230    /// <p>Specify <code>FULL</code> to overwrite all existing bulk data in your dataset. Data you imported individually is not replaced.</p></li>
231    /// <li>
232    /// <p>Specify <code>INCREMENTAL</code> to append the new records to the existing data in your dataset. Amazon Personalize replaces any record with the same ID with the new one.</p></li>
233    /// </ul>
234    pub fn get_import_mode(&self) -> &::std::option::Option<crate::types::ImportMode> {
235        self.inner.get_import_mode()
236    }
237    /// <p>If you created a metric attribution, specify whether to publish metrics for this import job to Amazon S3</p>
238    pub fn publish_attribution_metrics_to_s3(mut self, input: bool) -> Self {
239        self.inner = self.inner.publish_attribution_metrics_to_s3(input);
240        self
241    }
242    /// <p>If you created a metric attribution, specify whether to publish metrics for this import job to Amazon S3</p>
243    pub fn set_publish_attribution_metrics_to_s3(mut self, input: ::std::option::Option<bool>) -> Self {
244        self.inner = self.inner.set_publish_attribution_metrics_to_s3(input);
245        self
246    }
247    /// <p>If you created a metric attribution, specify whether to publish metrics for this import job to Amazon S3</p>
248    pub fn get_publish_attribution_metrics_to_s3(&self) -> &::std::option::Option<bool> {
249        self.inner.get_publish_attribution_metrics_to_s3()
250    }
251}