aws_sdk_forecast/operation/create_explainability/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_explainability::_create_explainability_output::CreateExplainabilityOutputBuilder;
3
4pub use crate::operation::create_explainability::_create_explainability_input::CreateExplainabilityInputBuilder;
5
6impl crate::operation::create_explainability::builders::CreateExplainabilityInputBuilder {
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_explainability::CreateExplainabilityOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_explainability::CreateExplainabilityError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_explainability();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateExplainability`.
24///
25/// <note>
26/// <p>Explainability is only available for Forecasts and Predictors generated from an AutoPredictor (<code>CreateAutoPredictor</code>)</p>
27/// </note>
28/// <p>Creates an Amazon Forecast Explainability.</p>
29/// <p>Explainability helps you better understand how the attributes in your datasets impact forecast. Amazon Forecast uses a metric called Impact scores to quantify the relative impact of each attribute and determine whether they increase or decrease forecast values.</p>
30/// <p>To enable Forecast Explainability, your predictor must include at least one of the following: related time series, item metadata, or additional datasets like Holidays and the Weather Index.</p>
31/// <p>CreateExplainability accepts either a Predictor ARN or Forecast ARN. To receive aggregated Impact scores for all time series and time points in your datasets, provide a Predictor ARN. To receive Impact scores for specific time series and time points, provide a Forecast ARN.</p>
32/// <p><b>CreateExplainability with a Predictor ARN</b></p><note>
33/// <p>You can only have one Explainability resource per predictor. If you already enabled <code>ExplainPredictor</code> in <code>CreateAutoPredictor</code>, that predictor already has an Explainability resource.</p>
34/// </note>
35/// <p>The following parameters are required when providing a Predictor ARN:</p>
36/// <ul>
37/// <li>
38/// <p><code>ExplainabilityName</code> - A unique name for the Explainability.</p></li>
39/// <li>
40/// <p><code>ResourceArn</code> - The Arn of the predictor.</p></li>
41/// <li>
42/// <p><code>TimePointGranularity</code> - Must be set to “ALL”.</p></li>
43/// <li>
44/// <p><code>TimeSeriesGranularity</code> - Must be set to “ALL”.</p></li>
45/// </ul>
46/// <p>Do not specify a value for the following parameters:</p>
47/// <ul>
48/// <li>
49/// <p><code>DataSource</code> - Only valid when TimeSeriesGranularity is “SPECIFIC”.</p></li>
50/// <li>
51/// <p><code>Schema</code> - Only valid when TimeSeriesGranularity is “SPECIFIC”.</p></li>
52/// <li>
53/// <p><code>StartDateTime</code> - Only valid when TimePointGranularity is “SPECIFIC”.</p></li>
54/// <li>
55/// <p><code>EndDateTime</code> - Only valid when TimePointGranularity is “SPECIFIC”.</p></li>
56/// </ul>
57/// <p><b>CreateExplainability with a Forecast ARN</b></p><note>
58/// <p>You can specify a maximum of 50 time series and 500 time points.</p>
59/// </note>
60/// <p>The following parameters are required when providing a Predictor ARN:</p>
61/// <ul>
62/// <li>
63/// <p><code>ExplainabilityName</code> - A unique name for the Explainability.</p></li>
64/// <li>
65/// <p><code>ResourceArn</code> - The Arn of the forecast.</p></li>
66/// <li>
67/// <p><code>TimePointGranularity</code> - Either “ALL” or “SPECIFIC”.</p></li>
68/// <li>
69/// <p><code>TimeSeriesGranularity</code> - Either “ALL” or “SPECIFIC”.</p></li>
70/// </ul>
71/// <p>If you set TimeSeriesGranularity to “SPECIFIC”, you must also provide the following:</p>
72/// <ul>
73/// <li>
74/// <p><code>DataSource</code> - The S3 location of the CSV file specifying your time series.</p></li>
75/// <li>
76/// <p><code>Schema</code> - The Schema defines the attributes and attribute types listed in the Data Source.</p></li>
77/// </ul>
78/// <p>If you set TimePointGranularity to “SPECIFIC”, you must also provide the following:</p>
79/// <ul>
80/// <li>
81/// <p><code>StartDateTime</code> - The first timestamp in the range of time points.</p></li>
82/// <li>
83/// <p><code>EndDateTime</code> - The last timestamp in the range of time points.</p></li>
84/// </ul>
85#[derive(::std::clone::Clone, ::std::fmt::Debug)]
86pub struct CreateExplainabilityFluentBuilder {
87 handle: ::std::sync::Arc<crate::client::Handle>,
88 inner: crate::operation::create_explainability::builders::CreateExplainabilityInputBuilder,
89 config_override: ::std::option::Option<crate::config::Builder>,
90}
91impl
92 crate::client::customize::internal::CustomizableSend<
93 crate::operation::create_explainability::CreateExplainabilityOutput,
94 crate::operation::create_explainability::CreateExplainabilityError,
95 > for CreateExplainabilityFluentBuilder
96{
97 fn send(
98 self,
99 config_override: crate::config::Builder,
100 ) -> crate::client::customize::internal::BoxFuture<
101 crate::client::customize::internal::SendResult<
102 crate::operation::create_explainability::CreateExplainabilityOutput,
103 crate::operation::create_explainability::CreateExplainabilityError,
104 >,
105 > {
106 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
107 }
108}
109impl CreateExplainabilityFluentBuilder {
110 /// Creates a new `CreateExplainabilityFluentBuilder`.
111 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
112 Self {
113 handle,
114 inner: ::std::default::Default::default(),
115 config_override: ::std::option::Option::None,
116 }
117 }
118 /// Access the CreateExplainability as a reference.
119 pub fn as_input(&self) -> &crate::operation::create_explainability::builders::CreateExplainabilityInputBuilder {
120 &self.inner
121 }
122 /// Sends the request and returns the response.
123 ///
124 /// If an error occurs, an `SdkError` will be returned with additional details that
125 /// can be matched against.
126 ///
127 /// By default, any retryable failures will be retried twice. Retry behavior
128 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
129 /// set when configuring the client.
130 pub async fn send(
131 self,
132 ) -> ::std::result::Result<
133 crate::operation::create_explainability::CreateExplainabilityOutput,
134 ::aws_smithy_runtime_api::client::result::SdkError<
135 crate::operation::create_explainability::CreateExplainabilityError,
136 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
137 >,
138 > {
139 let input = self
140 .inner
141 .build()
142 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
143 let runtime_plugins = crate::operation::create_explainability::CreateExplainability::operation_runtime_plugins(
144 self.handle.runtime_plugins.clone(),
145 &self.handle.conf,
146 self.config_override,
147 );
148 crate::operation::create_explainability::CreateExplainability::orchestrate(&runtime_plugins, input).await
149 }
150
151 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
152 pub fn customize(
153 self,
154 ) -> crate::client::customize::CustomizableOperation<
155 crate::operation::create_explainability::CreateExplainabilityOutput,
156 crate::operation::create_explainability::CreateExplainabilityError,
157 Self,
158 > {
159 crate::client::customize::CustomizableOperation::new(self)
160 }
161 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
162 self.set_config_override(::std::option::Option::Some(config_override.into()));
163 self
164 }
165
166 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
167 self.config_override = config_override;
168 self
169 }
170 /// <p>A unique name for the Explainability.</p>
171 pub fn explainability_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
172 self.inner = self.inner.explainability_name(input.into());
173 self
174 }
175 /// <p>A unique name for the Explainability.</p>
176 pub fn set_explainability_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
177 self.inner = self.inner.set_explainability_name(input);
178 self
179 }
180 /// <p>A unique name for the Explainability.</p>
181 pub fn get_explainability_name(&self) -> &::std::option::Option<::std::string::String> {
182 self.inner.get_explainability_name()
183 }
184 /// <p>The Amazon Resource Name (ARN) of the Predictor or Forecast used to create the Explainability.</p>
185 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.inner = self.inner.resource_arn(input.into());
187 self
188 }
189 /// <p>The Amazon Resource Name (ARN) of the Predictor or Forecast used to create the Explainability.</p>
190 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191 self.inner = self.inner.set_resource_arn(input);
192 self
193 }
194 /// <p>The Amazon Resource Name (ARN) of the Predictor or Forecast used to create the Explainability.</p>
195 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
196 self.inner.get_resource_arn()
197 }
198 /// <p>The configuration settings that define the granularity of time series and time points for the Explainability.</p>
199 pub fn explainability_config(mut self, input: crate::types::ExplainabilityConfig) -> Self {
200 self.inner = self.inner.explainability_config(input);
201 self
202 }
203 /// <p>The configuration settings that define the granularity of time series and time points for the Explainability.</p>
204 pub fn set_explainability_config(mut self, input: ::std::option::Option<crate::types::ExplainabilityConfig>) -> Self {
205 self.inner = self.inner.set_explainability_config(input);
206 self
207 }
208 /// <p>The configuration settings that define the granularity of time series and time points for the Explainability.</p>
209 pub fn get_explainability_config(&self) -> &::std::option::Option<crate::types::ExplainabilityConfig> {
210 self.inner.get_explainability_config()
211 }
212 /// <p>The source of your data, an Identity and Access Management (IAM) role that allows Amazon Forecast to access the data and, optionally, an Key Management Service (KMS) key.</p>
213 pub fn data_source(mut self, input: crate::types::DataSource) -> Self {
214 self.inner = self.inner.data_source(input);
215 self
216 }
217 /// <p>The source of your data, an Identity and Access Management (IAM) role that allows Amazon Forecast to access the data and, optionally, an Key Management Service (KMS) key.</p>
218 pub fn set_data_source(mut self, input: ::std::option::Option<crate::types::DataSource>) -> Self {
219 self.inner = self.inner.set_data_source(input);
220 self
221 }
222 /// <p>The source of your data, an Identity and Access Management (IAM) role that allows Amazon Forecast to access the data and, optionally, an Key Management Service (KMS) key.</p>
223 pub fn get_data_source(&self) -> &::std::option::Option<crate::types::DataSource> {
224 self.inner.get_data_source()
225 }
226 /// <p>Defines the fields of a dataset.</p>
227 pub fn schema(mut self, input: crate::types::Schema) -> Self {
228 self.inner = self.inner.schema(input);
229 self
230 }
231 /// <p>Defines the fields of a dataset.</p>
232 pub fn set_schema(mut self, input: ::std::option::Option<crate::types::Schema>) -> Self {
233 self.inner = self.inner.set_schema(input);
234 self
235 }
236 /// <p>Defines the fields of a dataset.</p>
237 pub fn get_schema(&self) -> &::std::option::Option<crate::types::Schema> {
238 self.inner.get_schema()
239 }
240 /// <p>Create an Explainability visualization that is viewable within the Amazon Web Services console.</p>
241 pub fn enable_visualization(mut self, input: bool) -> Self {
242 self.inner = self.inner.enable_visualization(input);
243 self
244 }
245 /// <p>Create an Explainability visualization that is viewable within the Amazon Web Services console.</p>
246 pub fn set_enable_visualization(mut self, input: ::std::option::Option<bool>) -> Self {
247 self.inner = self.inner.set_enable_visualization(input);
248 self
249 }
250 /// <p>Create an Explainability visualization that is viewable within the Amazon Web Services console.</p>
251 pub fn get_enable_visualization(&self) -> &::std::option::Option<bool> {
252 self.inner.get_enable_visualization()
253 }
254 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the first point for the Explainability.</p>
255 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
256 pub fn start_date_time(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257 self.inner = self.inner.start_date_time(input.into());
258 self
259 }
260 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the first point for the Explainability.</p>
261 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
262 pub fn set_start_date_time(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
263 self.inner = self.inner.set_start_date_time(input);
264 self
265 }
266 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the first point for the Explainability.</p>
267 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
268 pub fn get_start_date_time(&self) -> &::std::option::Option<::std::string::String> {
269 self.inner.get_start_date_time()
270 }
271 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the last time point for the Explainability.</p>
272 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
273 pub fn end_date_time(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
274 self.inner = self.inner.end_date_time(input.into());
275 self
276 }
277 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the last time point for the Explainability.</p>
278 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
279 pub fn set_end_date_time(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
280 self.inner = self.inner.set_end_date_time(input);
281 self
282 }
283 /// <p>If <code>TimePointGranularity</code> is set to <code>SPECIFIC</code>, define the last time point for the Explainability.</p>
284 /// <p>Use the following timestamp format: yyyy-MM-ddTHH:mm:ss (example: 2015-01-01T20:00:00)</p>
285 pub fn get_end_date_time(&self) -> &::std::option::Option<::std::string::String> {
286 self.inner.get_end_date_time()
287 }
288 ///
289 /// Appends an item to `Tags`.
290 ///
291 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
292 ///
293 /// <p>Optional metadata to help you categorize and organize your resources. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.</p>
294 /// <p>The following restrictions apply to tags:</p>
295 /// <ul>
296 /// <li>
297 /// <p>For each resource, each tag key must be unique and each tag key must have one value.</p></li>
298 /// <li>
299 /// <p>Maximum number of tags per resource: 50.</p></li>
300 /// <li>
301 /// <p>Maximum key length: 128 Unicode characters in UTF-8.</p></li>
302 /// <li>
303 /// <p>Maximum value length: 256 Unicode characters in UTF-8.</p></li>
304 /// <li>
305 /// <p>Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply.</p></li>
306 /// <li>
307 /// <p>Key prefixes cannot include any upper or lowercase combination of <code>aws:</code> or <code>AWS:</code>. Values can have this prefix. If a tag value has <code>aws</code> as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of <code>aws</code> do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.</p></li>
308 /// </ul>
309 pub fn tags(mut self, input: crate::types::Tag) -> Self {
310 self.inner = self.inner.tags(input);
311 self
312 }
313 /// <p>Optional metadata to help you categorize and organize your resources. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.</p>
314 /// <p>The following restrictions apply to tags:</p>
315 /// <ul>
316 /// <li>
317 /// <p>For each resource, each tag key must be unique and each tag key must have one value.</p></li>
318 /// <li>
319 /// <p>Maximum number of tags per resource: 50.</p></li>
320 /// <li>
321 /// <p>Maximum key length: 128 Unicode characters in UTF-8.</p></li>
322 /// <li>
323 /// <p>Maximum value length: 256 Unicode characters in UTF-8.</p></li>
324 /// <li>
325 /// <p>Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply.</p></li>
326 /// <li>
327 /// <p>Key prefixes cannot include any upper or lowercase combination of <code>aws:</code> or <code>AWS:</code>. Values can have this prefix. If a tag value has <code>aws</code> as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of <code>aws</code> do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.</p></li>
328 /// </ul>
329 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
330 self.inner = self.inner.set_tags(input);
331 self
332 }
333 /// <p>Optional metadata to help you categorize and organize your resources. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.</p>
334 /// <p>The following restrictions apply to tags:</p>
335 /// <ul>
336 /// <li>
337 /// <p>For each resource, each tag key must be unique and each tag key must have one value.</p></li>
338 /// <li>
339 /// <p>Maximum number of tags per resource: 50.</p></li>
340 /// <li>
341 /// <p>Maximum key length: 128 Unicode characters in UTF-8.</p></li>
342 /// <li>
343 /// <p>Maximum value length: 256 Unicode characters in UTF-8.</p></li>
344 /// <li>
345 /// <p>Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply.</p></li>
346 /// <li>
347 /// <p>Key prefixes cannot include any upper or lowercase combination of <code>aws:</code> or <code>AWS:</code>. Values can have this prefix. If a tag value has <code>aws</code> as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of <code>aws</code> do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.</p></li>
348 /// </ul>
349 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
350 self.inner.get_tags()
351 }
352}