aws-sdk-cloudwatch 1.111.0

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

pub use crate::operation::set_alarm_state::_set_alarm_state_output::SetAlarmStateOutputBuilder;

impl crate::operation::set_alarm_state::builders::SetAlarmStateInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::set_alarm_state::SetAlarmStateOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::set_alarm_state::SetAlarmStateError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.set_alarm_state();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `SetAlarmState`.
///
/// <p>Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for the appropriate state is invoked. For example, if your alarm is configured to send an Amazon SNS message when an alarm is triggered, temporarily changing the alarm state to <code>ALARM</code> sends an SNS message.</p>
/// <p>Metric alarms returns to their actual state quickly, often within seconds. Because the metric alarm state change happens quickly, it is typically only visible in the alarm's <b>History</b> tab in the Amazon CloudWatch console or through <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarmHistory.html">DescribeAlarmHistory</a>.</p>
/// <p>If you use <code>SetAlarmState</code> on a composite alarm, the composite alarm is not guaranteed to return to its actual state. It returns to its actual state only once any of its children alarms change state. It is also reevaluated if you update its configuration.</p>
/// <p>If an alarm triggers EC2 Auto Scaling policies or application Auto Scaling policies, you must include information in the <code>StateReasonData</code> parameter to enable the policy to take the correct action.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct SetAlarmStateFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::set_alarm_state::builders::SetAlarmStateInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::set_alarm_state::SetAlarmStateOutput,
        crate::operation::set_alarm_state::SetAlarmStateError,
    > for SetAlarmStateFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::set_alarm_state::SetAlarmStateOutput,
            crate::operation::set_alarm_state::SetAlarmStateError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl SetAlarmStateFluentBuilder {
    /// Creates a new `SetAlarmStateFluentBuilder`.
    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 SetAlarmState as a reference.
    pub fn as_input(&self) -> &crate::operation::set_alarm_state::builders::SetAlarmStateInputBuilder {
        &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::set_alarm_state::SetAlarmStateOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::set_alarm_state::SetAlarmStateError,
            ::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::set_alarm_state::SetAlarmState::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::set_alarm_state::SetAlarmState::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::set_alarm_state::SetAlarmStateOutput,
        crate::operation::set_alarm_state::SetAlarmStateError,
        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 alarm.</p>
    pub fn alarm_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.alarm_name(input.into());
        self
    }
    /// <p>The name of the alarm.</p>
    pub fn set_alarm_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_alarm_name(input);
        self
    }
    /// <p>The name of the alarm.</p>
    pub fn get_alarm_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_alarm_name()
    }
    /// <p>The value of the state.</p>
    pub fn state_value(mut self, input: crate::types::StateValue) -> Self {
        self.inner = self.inner.state_value(input);
        self
    }
    /// <p>The value of the state.</p>
    pub fn set_state_value(mut self, input: ::std::option::Option<crate::types::StateValue>) -> Self {
        self.inner = self.inner.set_state_value(input);
        self
    }
    /// <p>The value of the state.</p>
    pub fn get_state_value(&self) -> &::std::option::Option<crate::types::StateValue> {
        self.inner.get_state_value()
    }
    /// <p>The reason that this alarm is set to this specific state, in text format.</p>
    pub fn state_reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.state_reason(input.into());
        self
    }
    /// <p>The reason that this alarm is set to this specific state, in text format.</p>
    pub fn set_state_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_state_reason(input);
        self
    }
    /// <p>The reason that this alarm is set to this specific state, in text format.</p>
    pub fn get_state_reason(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_state_reason()
    }
    /// <p>The reason that this alarm is set to this specific state, in JSON format.</p>
    /// <p>For SNS or EC2 alarm actions, this is just informational. But for EC2 Auto Scaling or application Auto Scaling alarm actions, the Auto Scaling policy uses the information in this field to take the correct action.</p>
    pub fn state_reason_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.state_reason_data(input.into());
        self
    }
    /// <p>The reason that this alarm is set to this specific state, in JSON format.</p>
    /// <p>For SNS or EC2 alarm actions, this is just informational. But for EC2 Auto Scaling or application Auto Scaling alarm actions, the Auto Scaling policy uses the information in this field to take the correct action.</p>
    pub fn set_state_reason_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_state_reason_data(input);
        self
    }
    /// <p>The reason that this alarm is set to this specific state, in JSON format.</p>
    /// <p>For SNS or EC2 alarm actions, this is just informational. But for EC2 Auto Scaling or application Auto Scaling alarm actions, the Auto Scaling policy uses the information in this field to take the correct action.</p>
    pub fn get_state_reason_data(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_state_reason_data()
    }
}