// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_alarm_mute_rule::_put_alarm_mute_rule_input::PutAlarmMuteRuleInputBuilder;
pub use crate::operation::put_alarm_mute_rule::_put_alarm_mute_rule_output::PutAlarmMuteRuleOutputBuilder;
impl crate::operation::put_alarm_mute_rule::builders::PutAlarmMuteRuleInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.put_alarm_mute_rule();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `PutAlarmMuteRule`.
///
/// <p>Creates or updates an alarm mute rule.</p>
/// <p>Alarm mute rules automatically mute alarm actions during predefined time windows. When a mute rule is active, targeted alarms continue to evaluate metrics and transition between states, but their configured actions (such as Amazon SNS notifications or Auto Scaling actions) are muted.</p>
/// <p>You can create mute rules with recurring schedules using <code>cron</code> expressions or one-time mute windows using <code>at</code> expressions. Each mute rule can target up to 100 specific alarms by name.</p>
/// <p>If you specify a rule name that already exists, this operation updates the existing rule with the new configuration.</p>
/// <p><b>Permissions</b></p>
/// <p>To create or update a mute rule, you must have the <code>cloudwatch:PutAlarmMuteRule</code> permission on two types of resources: the alarm mute rule resource itself, and each alarm that the rule targets.</p>
/// <p>For example, If you want to allow a user to create mute rules that target only specific alarms named "WebServerCPUAlarm" and "DatabaseConnectionAlarm", you would create an IAM policy with one statement granting <code>cloudwatch:PutAlarmMuteRule</code> on the alarm mute rule resource (<code>arn:aws:cloudwatch:\[REGION\]:123456789012:alarm-mute-rule:*</code>), and another statement granting <code>cloudwatch:PutAlarmMuteRule</code> on the targeted alarm resources (<code>arn:aws:cloudwatch:\[REGION\]:123456789012:alarm:WebServerCPUAlarm</code> and <code>arn:aws:cloudwatch:\[REGION\]:123456789012:alarm:DatabaseConnectionAlarm</code>).</p>
/// <p>You can also use IAM policy conditions to allow targeting alarms based on resource tags. For example, you can restrict users to create/update mute rules to only target alarms that have a specific tag key-value pair, such as <code>Team=TeamA</code>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PutAlarmMuteRuleFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::put_alarm_mute_rule::builders::PutAlarmMuteRuleInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleOutput,
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleError,
> for PutAlarmMuteRuleFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleOutput,
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl PutAlarmMuteRuleFluentBuilder {
/// Creates a new `PutAlarmMuteRuleFluentBuilder`.
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 PutAlarmMuteRule as a reference.
pub fn as_input(&self) -> &crate::operation::put_alarm_mute_rule::builders::PutAlarmMuteRuleInputBuilder {
&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::put_alarm_mute_rule::PutAlarmMuteRuleOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleError,
::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::put_alarm_mute_rule::PutAlarmMuteRule::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::put_alarm_mute_rule::PutAlarmMuteRule::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::put_alarm_mute_rule::PutAlarmMuteRuleOutput,
crate::operation::put_alarm_mute_rule::PutAlarmMuteRuleError,
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 mute rule. This name must be unique within your Amazon Web Services account and region.</p>
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>The name of the alarm mute rule. This name must be unique within your Amazon Web Services account and region.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>The name of the alarm mute rule. This name must be unique within your Amazon Web Services account and region.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_name()
}
/// <p>A description of the alarm mute rule that helps you identify its purpose.</p>
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.description(input.into());
self
}
/// <p>A description of the alarm mute rule that helps you identify its purpose.</p>
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// <p>A description of the alarm mute rule that helps you identify its purpose.</p>
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_description()
}
/// <p>The configuration that defines when and how long alarms should be muted.</p>
pub fn rule(mut self, input: crate::types::Rule) -> Self {
self.inner = self.inner.rule(input);
self
}
/// <p>The configuration that defines when and how long alarms should be muted.</p>
pub fn set_rule(mut self, input: ::std::option::Option<crate::types::Rule>) -> Self {
self.inner = self.inner.set_rule(input);
self
}
/// <p>The configuration that defines when and how long alarms should be muted.</p>
pub fn get_rule(&self) -> &::std::option::Option<crate::types::Rule> {
self.inner.get_rule()
}
/// <p>Specifies which alarms this rule applies to.</p>
pub fn mute_targets(mut self, input: crate::types::MuteTargets) -> Self {
self.inner = self.inner.mute_targets(input);
self
}
/// <p>Specifies which alarms this rule applies to.</p>
pub fn set_mute_targets(mut self, input: ::std::option::Option<crate::types::MuteTargets>) -> Self {
self.inner = self.inner.set_mute_targets(input);
self
}
/// <p>Specifies which alarms this rule applies to.</p>
pub fn get_mute_targets(&self) -> &::std::option::Option<crate::types::MuteTargets> {
self.inner.get_mute_targets()
}
///
/// Appends an item to `Tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// <p>A list of key-value pairs to associate with the alarm mute rule. You can use tags to categorize and manage your mute rules.</p>
pub fn tags(mut self, input: crate::types::Tag) -> Self {
self.inner = self.inner.tags(input);
self
}
/// <p>A list of key-value pairs to associate with the alarm mute rule. You can use tags to categorize and manage your mute rules.</p>
pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
self.inner = self.inner.set_tags(input);
self
}
/// <p>A list of key-value pairs to associate with the alarm mute rule. You can use tags to categorize and manage your mute rules.</p>
pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
self.inner.get_tags()
}
/// <p>The date and time after which the mute rule takes effect, specified as a timestamp in ISO 8601 format (for example, <code>2026-04-15T08:00:00Z</code>). If not specified, the mute rule takes effect immediately upon creation and the mutes are applied as per the schedule expression.</p>
pub fn start_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.inner = self.inner.start_date(input);
self
}
/// <p>The date and time after which the mute rule takes effect, specified as a timestamp in ISO 8601 format (for example, <code>2026-04-15T08:00:00Z</code>). If not specified, the mute rule takes effect immediately upon creation and the mutes are applied as per the schedule expression.</p>
pub fn set_start_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.inner = self.inner.set_start_date(input);
self
}
/// <p>The date and time after which the mute rule takes effect, specified as a timestamp in ISO 8601 format (for example, <code>2026-04-15T08:00:00Z</code>). If not specified, the mute rule takes effect immediately upon creation and the mutes are applied as per the schedule expression.</p>
pub fn get_start_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
self.inner.get_start_date()
}
/// <p>The date and time when the mute rule expires and is no longer evaluated, specified as a timestamp in ISO 8601 format (for example, <code>2026-12-31T23:59:59Z</code>). After this time, the rule status becomes EXPIRED and will no longer mute the targeted alarms.</p>
pub fn expire_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.inner = self.inner.expire_date(input);
self
}
/// <p>The date and time when the mute rule expires and is no longer evaluated, specified as a timestamp in ISO 8601 format (for example, <code>2026-12-31T23:59:59Z</code>). After this time, the rule status becomes EXPIRED and will no longer mute the targeted alarms.</p>
pub fn set_expire_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.inner = self.inner.set_expire_date(input);
self
}
/// <p>The date and time when the mute rule expires and is no longer evaluated, specified as a timestamp in ISO 8601 format (for example, <code>2026-12-31T23:59:59Z</code>). After this time, the rule status becomes EXPIRED and will no longer mute the targeted alarms.</p>
pub fn get_expire_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
self.inner.get_expire_date()
}
}