Skip to main content

aws_sdk_costexplorer/operation/get_usage_forecast/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_usage_forecast::_get_usage_forecast_input::GetUsageForecastInputBuilder;
3
4pub use crate::operation::get_usage_forecast::_get_usage_forecast_output::GetUsageForecastOutputBuilder;
5
6impl crate::operation::get_usage_forecast::builders::GetUsageForecastInputBuilder {
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::get_usage_forecast::GetUsageForecastOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_usage_forecast::GetUsageForecastError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_usage_forecast();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetUsageForecast`.
24///
25/// <p>Retrieves a forecast for how much Amazon Web Services predicts that you will use over the forecast time period that you select, based on your past usage.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct GetUsageForecastFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::get_usage_forecast::builders::GetUsageForecastInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::get_usage_forecast::GetUsageForecastOutput,
35        crate::operation::get_usage_forecast::GetUsageForecastError,
36    > for GetUsageForecastFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::get_usage_forecast::GetUsageForecastOutput,
44            crate::operation::get_usage_forecast::GetUsageForecastError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl GetUsageForecastFluentBuilder {
51    /// Creates a new `GetUsageForecastFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the GetUsageForecast as a reference.
60    pub fn as_input(&self) -> &crate::operation::get_usage_forecast::builders::GetUsageForecastInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::get_usage_forecast::GetUsageForecastOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::get_usage_forecast::GetUsageForecastError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::get_usage_forecast::GetUsageForecast::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::get_usage_forecast::GetUsageForecast::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::get_usage_forecast::GetUsageForecastOutput,
97        crate::operation::get_usage_forecast::GetUsageForecastError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The start and end dates of the period that you want to retrieve usage forecast for. The start date is included in the period, but the end date isn't included in the period. For example, if <code>start</code> is <code>2017-01-01</code> and <code>end</code> is <code>2017-05-01</code>, then the cost and usage data is retrieved from <code>2017-01-01</code> up to and including <code>2017-04-30</code> but not including <code>2017-05-01</code>. The start date must be equal to or later than the current date to avoid a validation error.</p>
112    pub fn time_period(mut self, input: crate::types::DateInterval) -> Self {
113        self.inner = self.inner.time_period(input);
114        self
115    }
116    /// <p>The start and end dates of the period that you want to retrieve usage forecast for. The start date is included in the period, but the end date isn't included in the period. For example, if <code>start</code> is <code>2017-01-01</code> and <code>end</code> is <code>2017-05-01</code>, then the cost and usage data is retrieved from <code>2017-01-01</code> up to and including <code>2017-04-30</code> but not including <code>2017-05-01</code>. The start date must be equal to or later than the current date to avoid a validation error.</p>
117    pub fn set_time_period(mut self, input: ::std::option::Option<crate::types::DateInterval>) -> Self {
118        self.inner = self.inner.set_time_period(input);
119        self
120    }
121    /// <p>The start and end dates of the period that you want to retrieve usage forecast for. The start date is included in the period, but the end date isn't included in the period. For example, if <code>start</code> is <code>2017-01-01</code> and <code>end</code> is <code>2017-05-01</code>, then the cost and usage data is retrieved from <code>2017-01-01</code> up to and including <code>2017-04-30</code> but not including <code>2017-05-01</code>. The start date must be equal to or later than the current date to avoid a validation error.</p>
122    pub fn get_time_period(&self) -> &::std::option::Option<crate::types::DateInterval> {
123        self.inner.get_time_period()
124    }
125    /// <p>Which metric Cost Explorer uses to create your forecast.</p>
126    /// <p>Valid values for a <code>GetUsageForecast</code> call are the following:</p>
127    /// <ul>
128    /// <li>
129    /// <p>USAGE_QUANTITY</p></li>
130    /// <li>
131    /// <p>NORMALIZED_USAGE_AMOUNT</p></li>
132    /// </ul>
133    pub fn metric(mut self, input: crate::types::Metric) -> Self {
134        self.inner = self.inner.metric(input);
135        self
136    }
137    /// <p>Which metric Cost Explorer uses to create your forecast.</p>
138    /// <p>Valid values for a <code>GetUsageForecast</code> call are the following:</p>
139    /// <ul>
140    /// <li>
141    /// <p>USAGE_QUANTITY</p></li>
142    /// <li>
143    /// <p>NORMALIZED_USAGE_AMOUNT</p></li>
144    /// </ul>
145    pub fn set_metric(mut self, input: ::std::option::Option<crate::types::Metric>) -> Self {
146        self.inner = self.inner.set_metric(input);
147        self
148    }
149    /// <p>Which metric Cost Explorer uses to create your forecast.</p>
150    /// <p>Valid values for a <code>GetUsageForecast</code> call are the following:</p>
151    /// <ul>
152    /// <li>
153    /// <p>USAGE_QUANTITY</p></li>
154    /// <li>
155    /// <p>NORMALIZED_USAGE_AMOUNT</p></li>
156    /// </ul>
157    pub fn get_metric(&self) -> &::std::option::Option<crate::types::Metric> {
158        self.inner.get_metric()
159    }
160    /// <p>How granular you want the forecast to be. You can get 3 months of <code>DAILY</code> forecasts or 18 months of <code>MONTHLY</code> forecasts.</p>
161    /// <p>The <code>GetUsageForecast</code> operation supports only <code>DAILY</code> and <code>MONTHLY</code> granularities.</p>
162    pub fn granularity(mut self, input: crate::types::Granularity) -> Self {
163        self.inner = self.inner.granularity(input);
164        self
165    }
166    /// <p>How granular you want the forecast to be. You can get 3 months of <code>DAILY</code> forecasts or 18 months of <code>MONTHLY</code> forecasts.</p>
167    /// <p>The <code>GetUsageForecast</code> operation supports only <code>DAILY</code> and <code>MONTHLY</code> granularities.</p>
168    pub fn set_granularity(mut self, input: ::std::option::Option<crate::types::Granularity>) -> Self {
169        self.inner = self.inner.set_granularity(input);
170        self
171    }
172    /// <p>How granular you want the forecast to be. You can get 3 months of <code>DAILY</code> forecasts or 18 months of <code>MONTHLY</code> forecasts.</p>
173    /// <p>The <code>GetUsageForecast</code> operation supports only <code>DAILY</code> and <code>MONTHLY</code> granularities.</p>
174    pub fn get_granularity(&self) -> &::std::option::Option<crate::types::Granularity> {
175        self.inner.get_granularity()
176    }
177    /// <p>The filters that you want to use to filter your forecast. The <code>GetUsageForecast</code> API supports filtering by the following dimensions:</p>
178    /// <ul>
179    /// <li>
180    /// <p><code>AZ</code></p></li>
181    /// <li>
182    /// <p><code>INSTANCE_TYPE</code></p></li>
183    /// <li>
184    /// <p><code>LINKED_ACCOUNT</code></p></li>
185    /// <li>
186    /// <p><code>LINKED_ACCOUNT_NAME</code></p></li>
187    /// <li>
188    /// <p><code>OPERATION</code></p></li>
189    /// <li>
190    /// <p><code>PURCHASE_TYPE</code></p></li>
191    /// <li>
192    /// <p><code>REGION</code></p></li>
193    /// <li>
194    /// <p><code>SERVICE</code></p></li>
195    /// <li>
196    /// <p><code>USAGE_TYPE</code></p></li>
197    /// <li>
198    /// <p><code>USAGE_TYPE_GROUP</code></p></li>
199    /// <li>
200    /// <p><code>RECORD_TYPE</code></p></li>
201    /// <li>
202    /// <p><code>OPERATING_SYSTEM</code></p></li>
203    /// <li>
204    /// <p><code>TENANCY</code></p></li>
205    /// <li>
206    /// <p><code>SCOPE</code></p></li>
207    /// <li>
208    /// <p><code>PLATFORM</code></p></li>
209    /// <li>
210    /// <p><code>SUBSCRIPTION_ID</code></p></li>
211    /// <li>
212    /// <p><code>LEGAL_ENTITY_NAME</code></p></li>
213    /// <li>
214    /// <p><code>DEPLOYMENT_OPTION</code></p></li>
215    /// <li>
216    /// <p><code>DATABASE_ENGINE</code></p></li>
217    /// <li>
218    /// <p><code>INSTANCE_TYPE_FAMILY</code></p></li>
219    /// <li>
220    /// <p><code>BILLING_ENTITY</code></p></li>
221    /// <li>
222    /// <p><code>RESERVATION_ID</code></p></li>
223    /// <li>
224    /// <p><code>SAVINGS_PLAN_ARN</code></p></li>
225    /// </ul>
226    pub fn filter(mut self, input: crate::types::Expression) -> Self {
227        self.inner = self.inner.filter(input);
228        self
229    }
230    /// <p>The filters that you want to use to filter your forecast. The <code>GetUsageForecast</code> API supports filtering by the following dimensions:</p>
231    /// <ul>
232    /// <li>
233    /// <p><code>AZ</code></p></li>
234    /// <li>
235    /// <p><code>INSTANCE_TYPE</code></p></li>
236    /// <li>
237    /// <p><code>LINKED_ACCOUNT</code></p></li>
238    /// <li>
239    /// <p><code>LINKED_ACCOUNT_NAME</code></p></li>
240    /// <li>
241    /// <p><code>OPERATION</code></p></li>
242    /// <li>
243    /// <p><code>PURCHASE_TYPE</code></p></li>
244    /// <li>
245    /// <p><code>REGION</code></p></li>
246    /// <li>
247    /// <p><code>SERVICE</code></p></li>
248    /// <li>
249    /// <p><code>USAGE_TYPE</code></p></li>
250    /// <li>
251    /// <p><code>USAGE_TYPE_GROUP</code></p></li>
252    /// <li>
253    /// <p><code>RECORD_TYPE</code></p></li>
254    /// <li>
255    /// <p><code>OPERATING_SYSTEM</code></p></li>
256    /// <li>
257    /// <p><code>TENANCY</code></p></li>
258    /// <li>
259    /// <p><code>SCOPE</code></p></li>
260    /// <li>
261    /// <p><code>PLATFORM</code></p></li>
262    /// <li>
263    /// <p><code>SUBSCRIPTION_ID</code></p></li>
264    /// <li>
265    /// <p><code>LEGAL_ENTITY_NAME</code></p></li>
266    /// <li>
267    /// <p><code>DEPLOYMENT_OPTION</code></p></li>
268    /// <li>
269    /// <p><code>DATABASE_ENGINE</code></p></li>
270    /// <li>
271    /// <p><code>INSTANCE_TYPE_FAMILY</code></p></li>
272    /// <li>
273    /// <p><code>BILLING_ENTITY</code></p></li>
274    /// <li>
275    /// <p><code>RESERVATION_ID</code></p></li>
276    /// <li>
277    /// <p><code>SAVINGS_PLAN_ARN</code></p></li>
278    /// </ul>
279    pub fn set_filter(mut self, input: ::std::option::Option<crate::types::Expression>) -> Self {
280        self.inner = self.inner.set_filter(input);
281        self
282    }
283    /// <p>The filters that you want to use to filter your forecast. The <code>GetUsageForecast</code> API supports filtering by the following dimensions:</p>
284    /// <ul>
285    /// <li>
286    /// <p><code>AZ</code></p></li>
287    /// <li>
288    /// <p><code>INSTANCE_TYPE</code></p></li>
289    /// <li>
290    /// <p><code>LINKED_ACCOUNT</code></p></li>
291    /// <li>
292    /// <p><code>LINKED_ACCOUNT_NAME</code></p></li>
293    /// <li>
294    /// <p><code>OPERATION</code></p></li>
295    /// <li>
296    /// <p><code>PURCHASE_TYPE</code></p></li>
297    /// <li>
298    /// <p><code>REGION</code></p></li>
299    /// <li>
300    /// <p><code>SERVICE</code></p></li>
301    /// <li>
302    /// <p><code>USAGE_TYPE</code></p></li>
303    /// <li>
304    /// <p><code>USAGE_TYPE_GROUP</code></p></li>
305    /// <li>
306    /// <p><code>RECORD_TYPE</code></p></li>
307    /// <li>
308    /// <p><code>OPERATING_SYSTEM</code></p></li>
309    /// <li>
310    /// <p><code>TENANCY</code></p></li>
311    /// <li>
312    /// <p><code>SCOPE</code></p></li>
313    /// <li>
314    /// <p><code>PLATFORM</code></p></li>
315    /// <li>
316    /// <p><code>SUBSCRIPTION_ID</code></p></li>
317    /// <li>
318    /// <p><code>LEGAL_ENTITY_NAME</code></p></li>
319    /// <li>
320    /// <p><code>DEPLOYMENT_OPTION</code></p></li>
321    /// <li>
322    /// <p><code>DATABASE_ENGINE</code></p></li>
323    /// <li>
324    /// <p><code>INSTANCE_TYPE_FAMILY</code></p></li>
325    /// <li>
326    /// <p><code>BILLING_ENTITY</code></p></li>
327    /// <li>
328    /// <p><code>RESERVATION_ID</code></p></li>
329    /// <li>
330    /// <p><code>SAVINGS_PLAN_ARN</code></p></li>
331    /// </ul>
332    pub fn get_filter(&self) -> &::std::option::Option<crate::types::Expression> {
333        self.inner.get_filter()
334    }
335    /// <p>The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.</p>
336    pub fn billing_view_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
337        self.inner = self.inner.billing_view_arn(input.into());
338        self
339    }
340    /// <p>The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.</p>
341    pub fn set_billing_view_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
342        self.inner = self.inner.set_billing_view_arn(input);
343        self
344    }
345    /// <p>The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.</p>
346    pub fn get_billing_view_arn(&self) -> &::std::option::Option<::std::string::String> {
347        self.inner.get_billing_view_arn()
348    }
349    /// <p>Amazon Web Services Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.</p>
350    pub fn prediction_interval_level(mut self, input: i32) -> Self {
351        self.inner = self.inner.prediction_interval_level(input);
352        self
353    }
354    /// <p>Amazon Web Services Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.</p>
355    pub fn set_prediction_interval_level(mut self, input: ::std::option::Option<i32>) -> Self {
356        self.inner = self.inner.set_prediction_interval_level(input);
357        self
358    }
359    /// <p>Amazon Web Services Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.</p>
360    pub fn get_prediction_interval_level(&self) -> &::std::option::Option<i32> {
361        self.inner.get_prediction_interval_level()
362    }
363}