aws_sdk_personalize/operation/create_dataset/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_dataset::_create_dataset_output::CreateDatasetOutputBuilder;
3
4pub use crate::operation::create_dataset::_create_dataset_input::CreateDatasetInputBuilder;
5
6impl crate::operation::create_dataset::builders::CreateDatasetInputBuilder {
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::CreateDatasetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_dataset::CreateDatasetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_dataset();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDataset`.
24///
25/// <p>Creates an empty dataset and adds it to the specified dataset group. Use <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateDatasetImportJob.html">CreateDatasetImportJob</a> to import your training data to a dataset.</p>
26/// <p>There are 5 types of datasets:</p>
27/// <ul>
28/// <li>
29/// <p>Item interactions</p></li>
30/// <li>
31/// <p>Items</p></li>
32/// <li>
33/// <p>Users</p></li>
34/// <li>
35/// <p>Action interactions</p></li>
36/// <li>
37/// <p>Actions</p></li>
38/// </ul>
39/// <p>Each dataset type has an associated schema with required field types. Only the <code>Item interactions</code> dataset is required in order to train a model (also referred to as creating a solution).</p>
40/// <p>A dataset can be in one of the following states:</p>
41/// <ul>
42/// <li>
43/// <p>CREATE PENDING &gt; CREATE IN_PROGRESS &gt; ACTIVE -or- CREATE FAILED</p></li>
44/// <li>
45/// <p>DELETE PENDING &gt; DELETE IN_PROGRESS</p></li>
46/// </ul>
47/// <p>To get the status of the dataset, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataset.html">DescribeDataset</a>.</p>
48/// <p class="title"><b>Related APIs</b></p>
49/// <ul>
50/// <li>
51/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateDatasetGroup.html">CreateDatasetGroup</a></p></li>
52/// <li>
53/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListDatasets.html">ListDatasets</a></p></li>
54/// <li>
55/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDataset.html">DescribeDataset</a></p></li>
56/// <li>
57/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DeleteDataset.html">DeleteDataset</a></p></li>
58/// </ul>
59#[derive(::std::clone::Clone, ::std::fmt::Debug)]
60pub struct CreateDatasetFluentBuilder {
61    handle: ::std::sync::Arc<crate::client::Handle>,
62    inner: crate::operation::create_dataset::builders::CreateDatasetInputBuilder,
63    config_override: ::std::option::Option<crate::config::Builder>,
64}
65impl
66    crate::client::customize::internal::CustomizableSend<
67        crate::operation::create_dataset::CreateDatasetOutput,
68        crate::operation::create_dataset::CreateDatasetError,
69    > for CreateDatasetFluentBuilder
70{
71    fn send(
72        self,
73        config_override: crate::config::Builder,
74    ) -> crate::client::customize::internal::BoxFuture<
75        crate::client::customize::internal::SendResult<
76            crate::operation::create_dataset::CreateDatasetOutput,
77            crate::operation::create_dataset::CreateDatasetError,
78        >,
79    > {
80        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
81    }
82}
83impl CreateDatasetFluentBuilder {
84    /// Creates a new `CreateDatasetFluentBuilder`.
85    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
86        Self {
87            handle,
88            inner: ::std::default::Default::default(),
89            config_override: ::std::option::Option::None,
90        }
91    }
92    /// Access the CreateDataset as a reference.
93    pub fn as_input(&self) -> &crate::operation::create_dataset::builders::CreateDatasetInputBuilder {
94        &self.inner
95    }
96    /// Sends the request and returns the response.
97    ///
98    /// If an error occurs, an `SdkError` will be returned with additional details that
99    /// can be matched against.
100    ///
101    /// By default, any retryable failures will be retried twice. Retry behavior
102    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
103    /// set when configuring the client.
104    pub async fn send(
105        self,
106    ) -> ::std::result::Result<
107        crate::operation::create_dataset::CreateDatasetOutput,
108        ::aws_smithy_runtime_api::client::result::SdkError<
109            crate::operation::create_dataset::CreateDatasetError,
110            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
111        >,
112    > {
113        let input = self
114            .inner
115            .build()
116            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
117        let runtime_plugins = crate::operation::create_dataset::CreateDataset::operation_runtime_plugins(
118            self.handle.runtime_plugins.clone(),
119            &self.handle.conf,
120            self.config_override,
121        );
122        crate::operation::create_dataset::CreateDataset::orchestrate(&runtime_plugins, input).await
123    }
124
125    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
126    pub fn customize(
127        self,
128    ) -> crate::client::customize::CustomizableOperation<
129        crate::operation::create_dataset::CreateDatasetOutput,
130        crate::operation::create_dataset::CreateDatasetError,
131        Self,
132    > {
133        crate::client::customize::CustomizableOperation::new(self)
134    }
135    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
136        self.set_config_override(::std::option::Option::Some(config_override.into()));
137        self
138    }
139
140    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
141        self.config_override = config_override;
142        self
143    }
144    /// <p>The name for the dataset.</p>
145    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.name(input.into());
147        self
148    }
149    /// <p>The name for the dataset.</p>
150    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_name(input);
152        self
153    }
154    /// <p>The name for the dataset.</p>
155    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_name()
157    }
158    /// <p>The ARN of the schema to associate with the dataset. The schema defines the dataset fields.</p>
159    pub fn schema_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.schema_arn(input.into());
161        self
162    }
163    /// <p>The ARN of the schema to associate with the dataset. The schema defines the dataset fields.</p>
164    pub fn set_schema_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_schema_arn(input);
166        self
167    }
168    /// <p>The ARN of the schema to associate with the dataset. The schema defines the dataset fields.</p>
169    pub fn get_schema_arn(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_schema_arn()
171    }
172    /// <p>The Amazon Resource Name (ARN) of the dataset group to add the dataset to.</p>
173    pub fn dataset_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.inner = self.inner.dataset_group_arn(input.into());
175        self
176    }
177    /// <p>The Amazon Resource Name (ARN) of the dataset group to add the dataset to.</p>
178    pub fn set_dataset_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.inner = self.inner.set_dataset_group_arn(input);
180        self
181    }
182    /// <p>The Amazon Resource Name (ARN) of the dataset group to add the dataset to.</p>
183    pub fn get_dataset_group_arn(&self) -> &::std::option::Option<::std::string::String> {
184        self.inner.get_dataset_group_arn()
185    }
186    /// <p>The type of dataset.</p>
187    /// <p>One of the following (case insensitive) values:</p>
188    /// <ul>
189    /// <li>
190    /// <p>Interactions</p></li>
191    /// <li>
192    /// <p>Items</p></li>
193    /// <li>
194    /// <p>Users</p></li>
195    /// <li>
196    /// <p>Actions</p></li>
197    /// <li>
198    /// <p>Action_Interactions</p></li>
199    /// </ul>
200    pub fn dataset_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201        self.inner = self.inner.dataset_type(input.into());
202        self
203    }
204    /// <p>The type of dataset.</p>
205    /// <p>One of the following (case insensitive) values:</p>
206    /// <ul>
207    /// <li>
208    /// <p>Interactions</p></li>
209    /// <li>
210    /// <p>Items</p></li>
211    /// <li>
212    /// <p>Users</p></li>
213    /// <li>
214    /// <p>Actions</p></li>
215    /// <li>
216    /// <p>Action_Interactions</p></li>
217    /// </ul>
218    pub fn set_dataset_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_dataset_type(input);
220        self
221    }
222    /// <p>The type of dataset.</p>
223    /// <p>One of the following (case insensitive) values:</p>
224    /// <ul>
225    /// <li>
226    /// <p>Interactions</p></li>
227    /// <li>
228    /// <p>Items</p></li>
229    /// <li>
230    /// <p>Users</p></li>
231    /// <li>
232    /// <p>Actions</p></li>
233    /// <li>
234    /// <p>Action_Interactions</p></li>
235    /// </ul>
236    pub fn get_dataset_type(&self) -> &::std::option::Option<::std::string::String> {
237        self.inner.get_dataset_type()
238    }
239    ///
240    /// Appends an item to `tags`.
241    ///
242    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
243    ///
244    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset.</p>
245    pub fn tags(mut self, input: crate::types::Tag) -> Self {
246        self.inner = self.inner.tags(input);
247        self
248    }
249    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset.</p>
250    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
251        self.inner = self.inner.set_tags(input);
252        self
253    }
254    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset.</p>
255    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
256        self.inner.get_tags()
257    }
258}