aws_sdk_forecast/operation/create_what_if_analysis/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_what_if_analysis::_create_what_if_analysis_output::CreateWhatIfAnalysisOutputBuilder;
3
4pub use crate::operation::create_what_if_analysis::_create_what_if_analysis_input::CreateWhatIfAnalysisInputBuilder;
5
6impl crate::operation::create_what_if_analysis::builders::CreateWhatIfAnalysisInputBuilder {
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_what_if_analysis::CreateWhatIfAnalysisOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_what_if_analysis();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateWhatIfAnalysis`.
24///
25/// <p>What-if analysis is a scenario modeling technique where you make a hypothetical change to a time series and compare the forecasts generated by these changes against the baseline, unchanged time series. It is important to remember that the purpose of a what-if analysis is to understand how a forecast can change given different modifications to the baseline time series.</p>
26/// <p>For example, imagine you are a clothing retailer who is considering an end of season sale to clear space for new styles. After creating a baseline forecast, you can use a what-if analysis to investigate how different sales tactics might affect your goals.</p>
27/// <p>You could create a scenario where everything is given a 25% markdown, and another where everything is given a fixed dollar markdown. You could create a scenario where the sale lasts for one week and another where the sale lasts for one month. With a what-if analysis, you can compare many different scenarios against each other.</p>
28/// <p>Note that a what-if analysis is meant to display what the forecasting model has learned and how it will behave in the scenarios that you are evaluating. Do not blindly use the results of the what-if analysis to make business decisions. For instance, forecasts might not be accurate for novel scenarios where there is no reference available to determine whether a forecast is good.</p>
29/// <p>The <code>TimeSeriesSelector</code> object defines the items that you want in the what-if analysis.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateWhatIfAnalysisFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::create_what_if_analysis::builders::CreateWhatIfAnalysisInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisOutput,
39 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisError,
40 > for CreateWhatIfAnalysisFluentBuilder
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_what_if_analysis::CreateWhatIfAnalysisOutput,
48 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl CreateWhatIfAnalysisFluentBuilder {
55 /// Creates a new `CreateWhatIfAnalysisFluentBuilder`.
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 CreateWhatIfAnalysis as a reference.
64 pub fn as_input(&self) -> &crate::operation::create_what_if_analysis::builders::CreateWhatIfAnalysisInputBuilder {
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_what_if_analysis::CreateWhatIfAnalysisOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisError,
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_what_if_analysis::CreateWhatIfAnalysis::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::create_what_if_analysis::CreateWhatIfAnalysis::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_what_if_analysis::CreateWhatIfAnalysisOutput,
101 crate::operation::create_what_if_analysis::CreateWhatIfAnalysisError,
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>The name of the what-if analysis. Each name must be unique.</p>
116 pub fn what_if_analysis_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.what_if_analysis_name(input.into());
118 self
119 }
120 /// <p>The name of the what-if analysis. Each name must be unique.</p>
121 pub fn set_what_if_analysis_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_what_if_analysis_name(input);
123 self
124 }
125 /// <p>The name of the what-if analysis. Each name must be unique.</p>
126 pub fn get_what_if_analysis_name(&self) -> &::std::option::Option<::std::string::String> {
127 self.inner.get_what_if_analysis_name()
128 }
129 /// <p>The Amazon Resource Name (ARN) of the baseline forecast.</p>
130 pub fn forecast_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.forecast_arn(input.into());
132 self
133 }
134 /// <p>The Amazon Resource Name (ARN) of the baseline forecast.</p>
135 pub fn set_forecast_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_forecast_arn(input);
137 self
138 }
139 /// <p>The Amazon Resource Name (ARN) of the baseline forecast.</p>
140 pub fn get_forecast_arn(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_forecast_arn()
142 }
143 /// <p>Defines the set of time series that are used in the what-if analysis with a <code>TimeSeriesIdentifiers</code> object. What-if analyses are performed only for the time series in this object.</p>
144 /// <p>The <code>TimeSeriesIdentifiers</code> object needs the following information:</p>
145 /// <ul>
146 /// <li>
147 /// <p><code>DataSource</code></p></li>
148 /// <li>
149 /// <p><code>Format</code></p></li>
150 /// <li>
151 /// <p><code>Schema</code></p></li>
152 /// </ul>
153 pub fn time_series_selector(mut self, input: crate::types::TimeSeriesSelector) -> Self {
154 self.inner = self.inner.time_series_selector(input);
155 self
156 }
157 /// <p>Defines the set of time series that are used in the what-if analysis with a <code>TimeSeriesIdentifiers</code> object. What-if analyses are performed only for the time series in this object.</p>
158 /// <p>The <code>TimeSeriesIdentifiers</code> object needs the following information:</p>
159 /// <ul>
160 /// <li>
161 /// <p><code>DataSource</code></p></li>
162 /// <li>
163 /// <p><code>Format</code></p></li>
164 /// <li>
165 /// <p><code>Schema</code></p></li>
166 /// </ul>
167 pub fn set_time_series_selector(mut self, input: ::std::option::Option<crate::types::TimeSeriesSelector>) -> Self {
168 self.inner = self.inner.set_time_series_selector(input);
169 self
170 }
171 /// <p>Defines the set of time series that are used in the what-if analysis with a <code>TimeSeriesIdentifiers</code> object. What-if analyses are performed only for the time series in this object.</p>
172 /// <p>The <code>TimeSeriesIdentifiers</code> object needs the following information:</p>
173 /// <ul>
174 /// <li>
175 /// <p><code>DataSource</code></p></li>
176 /// <li>
177 /// <p><code>Format</code></p></li>
178 /// <li>
179 /// <p><code>Schema</code></p></li>
180 /// </ul>
181 pub fn get_time_series_selector(&self) -> &::std::option::Option<crate::types::TimeSeriesSelector> {
182 self.inner.get_time_series_selector()
183 }
184 ///
185 /// Appends an item to `Tags`.
186 ///
187 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
188 ///
189 /// <p>A list of <a href="https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html">tags</a> to apply to the what if forecast.</p>
190 pub fn tags(mut self, input: crate::types::Tag) -> Self {
191 self.inner = self.inner.tags(input);
192 self
193 }
194 /// <p>A list of <a href="https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html">tags</a> to apply to the what if forecast.</p>
195 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
196 self.inner = self.inner.set_tags(input);
197 self
198 }
199 /// <p>A list of <a href="https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html">tags</a> to apply to the what if forecast.</p>
200 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
201 self.inner.get_tags()
202 }
203}