aws-sdk-costoptimizationhub 1.102.0

AWS SDK for Cost Optimization Hub
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::list_efficiency_metrics::_list_efficiency_metrics_input::ListEfficiencyMetricsInputBuilder;

pub use crate::operation::list_efficiency_metrics::_list_efficiency_metrics_output::ListEfficiencyMetricsOutputBuilder;

impl crate::operation::list_efficiency_metrics::builders::ListEfficiencyMetricsInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::list_efficiency_metrics::ListEfficiencyMetricsError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.list_efficiency_metrics();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `ListEfficiencyMetrics`.
///
/// <p>Returns cost efficiency metrics aggregated over time and optionally grouped by a specified dimension. The metrics provide insights into your cost optimization progress by tracking estimated savings, spending, and measures how effectively you're optimizing your Cloud resources.</p>
/// <p>The operation supports both daily and monthly time granularities and allows grouping results by account ID, Amazon Web Services Region. Results are returned as time-series data, enabling you to analyze trends in your cost optimization performance over the specified time period.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct ListEfficiencyMetricsFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::list_efficiency_metrics::builders::ListEfficiencyMetricsInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsOutput,
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsError,
    > for ListEfficiencyMetricsFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::list_efficiency_metrics::ListEfficiencyMetricsOutput,
            crate::operation::list_efficiency_metrics::ListEfficiencyMetricsError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl ListEfficiencyMetricsFluentBuilder {
    /// Creates a new `ListEfficiencyMetricsFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the ListEfficiencyMetrics as a reference.
    pub fn as_input(&self) -> &crate::operation::list_efficiency_metrics::builders::ListEfficiencyMetricsInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::list_efficiency_metrics::ListEfficiencyMetricsError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::list_efficiency_metrics::ListEfficiencyMetrics::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::list_efficiency_metrics::ListEfficiencyMetrics::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsOutput,
        crate::operation::list_efficiency_metrics::ListEfficiencyMetricsError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// Create a paginator for this request
    ///
    /// Paginators are used by calling [`send().await`](crate::operation::list_efficiency_metrics::paginator::ListEfficiencyMetricsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
    pub fn into_paginator(self) -> crate::operation::list_efficiency_metrics::paginator::ListEfficiencyMetricsPaginator {
        crate::operation::list_efficiency_metrics::paginator::ListEfficiencyMetricsPaginator::new(self.handle, self.inner)
    }
    /// <p>The dimension by which to group the cost efficiency metrics. Valid values include account ID, Amazon Web Services Region. When no grouping is specified, metrics are aggregated across all resources in the specified time period.</p>
    pub fn group_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.group_by(input.into());
        self
    }
    /// <p>The dimension by which to group the cost efficiency metrics. Valid values include account ID, Amazon Web Services Region. When no grouping is specified, metrics are aggregated across all resources in the specified time period.</p>
    pub fn set_group_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_group_by(input);
        self
    }
    /// <p>The dimension by which to group the cost efficiency metrics. Valid values include account ID, Amazon Web Services Region. When no grouping is specified, metrics are aggregated across all resources in the specified time period.</p>
    pub fn get_group_by(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_group_by()
    }
    /// <p>The time granularity for the cost efficiency metrics. Specify <code>Daily</code> for metrics aggregated by day, or <code>Monthly</code> for metrics aggregated by month.</p>
    pub fn granularity(mut self, input: crate::types::GranularityType) -> Self {
        self.inner = self.inner.granularity(input);
        self
    }
    /// <p>The time granularity for the cost efficiency metrics. Specify <code>Daily</code> for metrics aggregated by day, or <code>Monthly</code> for metrics aggregated by month.</p>
    pub fn set_granularity(mut self, input: ::std::option::Option<crate::types::GranularityType>) -> Self {
        self.inner = self.inner.set_granularity(input);
        self
    }
    /// <p>The time granularity for the cost efficiency metrics. Specify <code>Daily</code> for metrics aggregated by day, or <code>Monthly</code> for metrics aggregated by month.</p>
    pub fn get_granularity(&self) -> &::std::option::Option<crate::types::GranularityType> {
        self.inner.get_granularity()
    }
    /// <p>The time period for which to retrieve the cost efficiency metrics. The start date is inclusive and the end date is exclusive. Dates can be specified in either YYYY-MM-DD format or YYYY-MM format depending on the desired granularity.</p>
    pub fn time_period(mut self, input: crate::types::TimePeriod) -> Self {
        self.inner = self.inner.time_period(input);
        self
    }
    /// <p>The time period for which to retrieve the cost efficiency metrics. The start date is inclusive and the end date is exclusive. Dates can be specified in either YYYY-MM-DD format or YYYY-MM format depending on the desired granularity.</p>
    pub fn set_time_period(mut self, input: ::std::option::Option<crate::types::TimePeriod>) -> Self {
        self.inner = self.inner.set_time_period(input);
        self
    }
    /// <p>The time period for which to retrieve the cost efficiency metrics. The start date is inclusive and the end date is exclusive. Dates can be specified in either YYYY-MM-DD format or YYYY-MM format depending on the desired granularity.</p>
    pub fn get_time_period(&self) -> &::std::option::Option<crate::types::TimePeriod> {
        self.inner.get_time_period()
    }
    /// <p>The maximum number of groups to return in the response. Valid values range from 0 to 1000. Use in conjunction with <code>nextToken</code> to paginate through results when the total number of groups exceeds this limit.</p>
    pub fn max_results(mut self, input: i32) -> Self {
        self.inner = self.inner.max_results(input);
        self
    }
    /// <p>The maximum number of groups to return in the response. Valid values range from 0 to 1000. Use in conjunction with <code>nextToken</code> to paginate through results when the total number of groups exceeds this limit.</p>
    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_max_results(input);
        self
    }
    /// <p>The maximum number of groups to return in the response. Valid values range from 0 to 1000. Use in conjunction with <code>nextToken</code> to paginate through results when the total number of groups exceeds this limit.</p>
    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
        self.inner.get_max_results()
    }
    /// <p>The ordering specification for the results. Defines which dimension to sort by and whether to sort in ascending or descending order.</p>
    pub fn order_by(mut self, input: crate::types::OrderBy) -> Self {
        self.inner = self.inner.order_by(input);
        self
    }
    /// <p>The ordering specification for the results. Defines which dimension to sort by and whether to sort in ascending or descending order.</p>
    pub fn set_order_by(mut self, input: ::std::option::Option<crate::types::OrderBy>) -> Self {
        self.inner = self.inner.set_order_by(input);
        self
    }
    /// <p>The ordering specification for the results. Defines which dimension to sort by and whether to sort in ascending or descending order.</p>
    pub fn get_order_by(&self) -> &::std::option::Option<crate::types::OrderBy> {
        self.inner.get_order_by()
    }
    /// <p>The token to retrieve the next page of results. This value is returned in the response when the number of groups exceeds the specified <code>maxResults</code> value.</p>
    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.next_token(input.into());
        self
    }
    /// <p>The token to retrieve the next page of results. This value is returned in the response when the number of groups exceeds the specified <code>maxResults</code> value.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_next_token(input);
        self
    }
    /// <p>The token to retrieve the next page of results. This value is returned in the response when the number of groups exceeds the specified <code>maxResults</code> value.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_next_token()
    }
}