aws-sdk-cloudwatch 1.112.0

AWS SDK for Amazon CloudWatch
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::describe_alarms_for_metric::_describe_alarms_for_metric_input::DescribeAlarmsForMetricInputBuilder;

pub use crate::operation::describe_alarms_for_metric::_describe_alarms_for_metric_output::DescribeAlarmsForMetricOutputBuilder;

impl crate::operation::describe_alarms_for_metric::builders::DescribeAlarmsForMetricInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.describe_alarms_for_metric();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `DescribeAlarmsForMetric`.
///
/// <p>Retrieves the alarms for the specified metric. To filter the results, specify a statistic, period, or unit.</p>
/// <p>This operation retrieves only standard alarms that are based on the specified metric. It does not return alarms based on math expressions that use the specified metric, or composite alarms that use the specified metric.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct DescribeAlarmsForMetricFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::describe_alarms_for_metric::builders::DescribeAlarmsForMetricInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricOutput,
        crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricError,
    > for DescribeAlarmsForMetricFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricOutput,
            crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl DescribeAlarmsForMetricFluentBuilder {
    /// Creates a new `DescribeAlarmsForMetricFluentBuilder`.
    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 DescribeAlarmsForMetric as a reference.
    pub fn as_input(&self) -> &crate::operation::describe_alarms_for_metric::builders::DescribeAlarmsForMetricInputBuilder {
        &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::describe_alarms_for_metric::DescribeAlarmsForMetricOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricError,
            ::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::describe_alarms_for_metric::DescribeAlarmsForMetric::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetric::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::describe_alarms_for_metric::DescribeAlarmsForMetricOutput,
        crate::operation::describe_alarms_for_metric::DescribeAlarmsForMetricError,
        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
    }
    /// <p>The name of the metric.</p>
    pub fn metric_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.metric_name(input.into());
        self
    }
    /// <p>The name of the metric.</p>
    pub fn set_metric_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_metric_name(input);
        self
    }
    /// <p>The name of the metric.</p>
    pub fn get_metric_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_metric_name()
    }
    /// <p>The namespace of the metric.</p>
    pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.namespace(input.into());
        self
    }
    /// <p>The namespace of the metric.</p>
    pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_namespace(input);
        self
    }
    /// <p>The namespace of the metric.</p>
    pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_namespace()
    }
    /// <p>The statistic for the metric, other than percentiles. For percentile statistics, use <code>ExtendedStatistics</code>.</p>
    pub fn statistic(mut self, input: crate::types::Statistic) -> Self {
        self.inner = self.inner.statistic(input);
        self
    }
    /// <p>The statistic for the metric, other than percentiles. For percentile statistics, use <code>ExtendedStatistics</code>.</p>
    pub fn set_statistic(mut self, input: ::std::option::Option<crate::types::Statistic>) -> Self {
        self.inner = self.inner.set_statistic(input);
        self
    }
    /// <p>The statistic for the metric, other than percentiles. For percentile statistics, use <code>ExtendedStatistics</code>.</p>
    pub fn get_statistic(&self) -> &::std::option::Option<crate::types::Statistic> {
        self.inner.get_statistic()
    }
    /// <p>The percentile statistic for the metric. Specify a value between p0.0 and p100.</p>
    pub fn extended_statistic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.extended_statistic(input.into());
        self
    }
    /// <p>The percentile statistic for the metric. Specify a value between p0.0 and p100.</p>
    pub fn set_extended_statistic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_extended_statistic(input);
        self
    }
    /// <p>The percentile statistic for the metric. Specify a value between p0.0 and p100.</p>
    pub fn get_extended_statistic(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_extended_statistic()
    }
    ///
    /// Appends an item to `Dimensions`.
    ///
    /// To override the contents of this collection use [`set_dimensions`](Self::set_dimensions).
    ///
    /// <p>The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed.</p>
    pub fn dimensions(mut self, input: crate::types::Dimension) -> Self {
        self.inner = self.inner.dimensions(input);
        self
    }
    /// <p>The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed.</p>
    pub fn set_dimensions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Dimension>>) -> Self {
        self.inner = self.inner.set_dimensions(input);
        self
    }
    /// <p>The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed.</p>
    pub fn get_dimensions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Dimension>> {
        self.inner.get_dimensions()
    }
    /// <p>The period, in seconds, over which the statistic is applied.</p>
    pub fn period(mut self, input: i32) -> Self {
        self.inner = self.inner.period(input);
        self
    }
    /// <p>The period, in seconds, over which the statistic is applied.</p>
    pub fn set_period(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_period(input);
        self
    }
    /// <p>The period, in seconds, over which the statistic is applied.</p>
    pub fn get_period(&self) -> &::std::option::Option<i32> {
        self.inner.get_period()
    }
    /// <p>The unit for the metric.</p>
    pub fn unit(mut self, input: crate::types::StandardUnit) -> Self {
        self.inner = self.inner.unit(input);
        self
    }
    /// <p>The unit for the metric.</p>
    pub fn set_unit(mut self, input: ::std::option::Option<crate::types::StandardUnit>) -> Self {
        self.inner = self.inner.set_unit(input);
        self
    }
    /// <p>The unit for the metric.</p>
    pub fn get_unit(&self) -> &::std::option::Option<crate::types::StandardUnit> {
        self.inner.get_unit()
    }
}