aws_sdk_machinelearning/operation/create_data_source_from_s3/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_data_source_from_s3::_create_data_source_from_s3_output::CreateDataSourceFromS3OutputBuilder;
3
4pub use crate::operation::create_data_source_from_s3::_create_data_source_from_s3_input::CreateDataSourceFromS3InputBuilder;
5
6impl crate::operation::create_data_source_from_s3::builders::CreateDataSourceFromS3InputBuilder {
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_source_from_s3::CreateDataSourceFromS3Output,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Error,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_data_source_from_s3();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDataSourceFromS3`.
24///
25/// <p>Creates a <code>DataSource</code> object. A <code>DataSource</code> references data that can be used to perform <code>CreateMLModel</code>, <code>CreateEvaluation</code>, or <code>CreateBatchPrediction</code> operations.</p>
26/// <p><code>CreateDataSourceFromS3</code> is an asynchronous operation. In response to <code>CreateDataSourceFromS3</code>, Amazon Machine Learning (Amazon ML) immediately returns and sets the <code>DataSource</code> status to <code>PENDING</code>. After the <code>DataSource</code> has been created and is ready for use, Amazon ML sets the <code>Status</code> parameter to <code>COMPLETED</code>. <code>DataSource</code> in the <code>COMPLETED</code> or <code>PENDING</code> state can be used to perform only <code>CreateMLModel</code>, <code>CreateEvaluation</code> or <code>CreateBatchPrediction</code> operations.</p>
27/// <p>If Amazon ML can't accept the input source, it sets the <code>Status</code> parameter to <code>FAILED</code> and includes an error message in the <code>Message</code> attribute of the <code>GetDataSource</code> operation response.</p>
28/// <p>The observation data used in a <code>DataSource</code> should be ready to use; that is, it should have a consistent structure, and missing data values should be kept to a minimum. The observation data must reside in one or more .csv files in an Amazon Simple Storage Service (Amazon S3) location, along with a schema that describes the data items by name and type. The same schema must be used for all of the data files referenced by the <code>DataSource</code>.</p>
29/// <p>After the <code>DataSource</code> has been created, it's ready to use in evaluations and batch predictions. If you plan to use the <code>DataSource</code> to train an <code>MLModel</code>, the <code>DataSource</code> also needs a recipe. A recipe describes how each input variable will be used in training an <code>MLModel</code>. Will the variable be included or excluded from training? Will the variable be manipulated; for example, will it be combined with another variable or will it be split apart into word combinations? The recipe provides answers to these questions.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateDataSourceFromS3FluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::create_data_source_from_s3::builders::CreateDataSourceFromS3InputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Output,
39        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Error,
40    > for CreateDataSourceFromS3FluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Output,
48            crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Error,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl CreateDataSourceFromS3FluentBuilder {
55    /// Creates a new `CreateDataSourceFromS3FluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the CreateDataSourceFromS3 as a reference.
64    pub fn as_input(&self) -> &crate::operation::create_data_source_from_s3::builders::CreateDataSourceFromS3InputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Output,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Error,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::create_data_source_from_s3::CreateDataSourceFromS3::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Output,
101        crate::operation::create_data_source_from_s3::CreateDataSourceFromS3Error,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>A user-supplied identifier that uniquely identifies the <code>DataSource</code>.</p>
116    pub fn data_source_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.data_source_id(input.into());
118        self
119    }
120    /// <p>A user-supplied identifier that uniquely identifies the <code>DataSource</code>.</p>
121    pub fn set_data_source_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_data_source_id(input);
123        self
124    }
125    /// <p>A user-supplied identifier that uniquely identifies the <code>DataSource</code>.</p>
126    pub fn get_data_source_id(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_data_source_id()
128    }
129    /// <p>A user-supplied name or description of the <code>DataSource</code>.</p>
130    pub fn data_source_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.data_source_name(input.into());
132        self
133    }
134    /// <p>A user-supplied name or description of the <code>DataSource</code>.</p>
135    pub fn set_data_source_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_data_source_name(input);
137        self
138    }
139    /// <p>A user-supplied name or description of the <code>DataSource</code>.</p>
140    pub fn get_data_source_name(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_data_source_name()
142    }
143    /// <p>The data specification of a <code>DataSource</code>:</p>
144    /// <ul>
145    /// <li>
146    /// <p>DataLocationS3 - The Amazon S3 location of the observation data.</p></li>
147    /// <li>
148    /// <p>DataSchemaLocationS3 - The Amazon S3 location of the <code>DataSchema</code>.</p></li>
149    /// <li>
150    /// <p>DataSchema - A JSON string representing the schema. This is not required if <code>DataSchemaUri</code> is specified.</p></li>
151    /// <li>
152    /// <p>DataRearrangement - A JSON string that represents the splitting and rearrangement requirements for the <code>Datasource</code>.</p>
153    /// <p>Sample - <code> "{\"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"</code></p></li>
154    /// </ul>
155    pub fn data_spec(mut self, input: crate::types::S3DataSpec) -> Self {
156        self.inner = self.inner.data_spec(input);
157        self
158    }
159    /// <p>The data specification of a <code>DataSource</code>:</p>
160    /// <ul>
161    /// <li>
162    /// <p>DataLocationS3 - The Amazon S3 location of the observation data.</p></li>
163    /// <li>
164    /// <p>DataSchemaLocationS3 - The Amazon S3 location of the <code>DataSchema</code>.</p></li>
165    /// <li>
166    /// <p>DataSchema - A JSON string representing the schema. This is not required if <code>DataSchemaUri</code> is specified.</p></li>
167    /// <li>
168    /// <p>DataRearrangement - A JSON string that represents the splitting and rearrangement requirements for the <code>Datasource</code>.</p>
169    /// <p>Sample - <code> "{\"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"</code></p></li>
170    /// </ul>
171    pub fn set_data_spec(mut self, input: ::std::option::Option<crate::types::S3DataSpec>) -> Self {
172        self.inner = self.inner.set_data_spec(input);
173        self
174    }
175    /// <p>The data specification of a <code>DataSource</code>:</p>
176    /// <ul>
177    /// <li>
178    /// <p>DataLocationS3 - The Amazon S3 location of the observation data.</p></li>
179    /// <li>
180    /// <p>DataSchemaLocationS3 - The Amazon S3 location of the <code>DataSchema</code>.</p></li>
181    /// <li>
182    /// <p>DataSchema - A JSON string representing the schema. This is not required if <code>DataSchemaUri</code> is specified.</p></li>
183    /// <li>
184    /// <p>DataRearrangement - A JSON string that represents the splitting and rearrangement requirements for the <code>Datasource</code>.</p>
185    /// <p>Sample - <code> "{\"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"</code></p></li>
186    /// </ul>
187    pub fn get_data_spec(&self) -> &::std::option::Option<crate::types::S3DataSpec> {
188        self.inner.get_data_spec()
189    }
190    /// <p>The compute statistics for a <code>DataSource</code>. The statistics are generated from the observation data referenced by a <code>DataSource</code>. Amazon ML uses the statistics internally during <code>MLModel</code> training. This parameter must be set to <code>true</code> if the <code></code>DataSource<code></code> needs to be used for <code>MLModel</code> training.</p>
191    pub fn compute_statistics(mut self, input: bool) -> Self {
192        self.inner = self.inner.compute_statistics(input);
193        self
194    }
195    /// <p>The compute statistics for a <code>DataSource</code>. The statistics are generated from the observation data referenced by a <code>DataSource</code>. Amazon ML uses the statistics internally during <code>MLModel</code> training. This parameter must be set to <code>true</code> if the <code></code>DataSource<code></code> needs to be used for <code>MLModel</code> training.</p>
196    pub fn set_compute_statistics(mut self, input: ::std::option::Option<bool>) -> Self {
197        self.inner = self.inner.set_compute_statistics(input);
198        self
199    }
200    /// <p>The compute statistics for a <code>DataSource</code>. The statistics are generated from the observation data referenced by a <code>DataSource</code>. Amazon ML uses the statistics internally during <code>MLModel</code> training. This parameter must be set to <code>true</code> if the <code></code>DataSource<code></code> needs to be used for <code>MLModel</code> training.</p>
201    pub fn get_compute_statistics(&self) -> &::std::option::Option<bool> {
202        self.inner.get_compute_statistics()
203    }
204}