aws-sdk-cloudwatchomni 1.2.0

AWS SDK for CloudWatch Omni
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct UpdateAlertInput {
    /// The unique ID of the space.
    pub space_id: ::std::option::Option<::std::string::String>,
    /// The alert to update.
    pub alert_id: ::std::option::Option<::std::string::String>,
    /// The ID of the access profile associated with the alert.
    pub profile_id: ::std::option::Option<::std::string::String>,
    /// A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert's identity, so a rename never changes the alertId.
    pub name: ::std::option::Option<::std::string::String>,
    /// A new description of the alert. Omit to leave unchanged.
    pub description: ::std::option::Option<::std::string::String>,
    /// The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.
    pub rule: ::std::option::Option<crate::types::Rule>,
    /// Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.
    pub notifications_enabled: ::std::option::Option<bool>,
    /// Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).
    pub notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
}
impl UpdateAlertInput {
    /// The unique ID of the space.
    pub fn space_id(&self) -> ::std::option::Option<&str> {
        self.space_id.as_deref()
    }
    /// The alert to update.
    pub fn alert_id(&self) -> ::std::option::Option<&str> {
        self.alert_id.as_deref()
    }
    /// The ID of the access profile associated with the alert.
    pub fn profile_id(&self) -> ::std::option::Option<&str> {
        self.profile_id.as_deref()
    }
    /// A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert's identity, so a rename never changes the alertId.
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// A new description of the alert. Omit to leave unchanged.
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.
    pub fn rule(&self) -> ::std::option::Option<&crate::types::Rule> {
        self.rule.as_ref()
    }
    /// Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.
    pub fn notifications_enabled(&self) -> ::std::option::Option<bool> {
        self.notifications_enabled
    }
    /// Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.notification_rules.is_none()`.
    pub fn notification_rules(&self) -> &[crate::types::NotificationRule] {
        self.notification_rules.as_deref().unwrap_or_default()
    }
}
impl UpdateAlertInput {
    /// Creates a new builder-style object to manufacture [`UpdateAlertInput`](crate::operation::update_alert::UpdateAlertInput).
    pub fn builder() -> crate::operation::update_alert::builders::UpdateAlertInputBuilder {
        crate::operation::update_alert::builders::UpdateAlertInputBuilder::default()
    }
}

/// A builder for [`UpdateAlertInput`](crate::operation::update_alert::UpdateAlertInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct UpdateAlertInputBuilder {
    pub(crate) space_id: ::std::option::Option<::std::string::String>,
    pub(crate) alert_id: ::std::option::Option<::std::string::String>,
    pub(crate) profile_id: ::std::option::Option<::std::string::String>,
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) rule: ::std::option::Option<crate::types::Rule>,
    pub(crate) notifications_enabled: ::std::option::Option<bool>,
    pub(crate) notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
}
impl UpdateAlertInputBuilder {
    /// The unique ID of the space.
    /// This field is required.
    pub fn space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.space_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The unique ID of the space.
    pub fn set_space_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.space_id = input;
        self
    }
    /// The unique ID of the space.
    pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.space_id
    }
    /// The alert to update.
    /// This field is required.
    pub fn alert_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.alert_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The alert to update.
    pub fn set_alert_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.alert_id = input;
        self
    }
    /// The alert to update.
    pub fn get_alert_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.alert_id
    }
    /// The ID of the access profile associated with the alert.
    pub fn profile_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.profile_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The ID of the access profile associated with the alert.
    pub fn set_profile_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.profile_id = input;
        self
    }
    /// The ID of the access profile associated with the alert.
    pub fn get_profile_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.profile_id
    }
    /// A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert's identity, so a rename never changes the alertId.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert's identity, so a rename never changes the alertId.
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert's identity, so a rename never changes the alertId.
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// A new description of the alert. Omit to leave unchanged.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// A new description of the alert. Omit to leave unchanged.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// A new description of the alert. Omit to leave unchanged.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.
    pub fn rule(mut self, input: crate::types::Rule) -> Self {
        self.rule = ::std::option::Option::Some(input);
        self
    }
    /// The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.
    pub fn set_rule(mut self, input: ::std::option::Option<crate::types::Rule>) -> Self {
        self.rule = input;
        self
    }
    /// The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.
    pub fn get_rule(&self) -> &::std::option::Option<crate::types::Rule> {
        &self.rule
    }
    /// Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.
    pub fn notifications_enabled(mut self, input: bool) -> Self {
        self.notifications_enabled = ::std::option::Option::Some(input);
        self
    }
    /// Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.
    pub fn set_notifications_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
        self.notifications_enabled = input;
        self
    }
    /// Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.
    pub fn get_notifications_enabled(&self) -> &::std::option::Option<bool> {
        &self.notifications_enabled
    }
    /// Appends an item to `notification_rules`.
    ///
    /// To override the contents of this collection use [`set_notification_rules`](Self::set_notification_rules).
    ///
    /// Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).
    pub fn notification_rules(mut self, input: crate::types::NotificationRule) -> Self {
        let mut v = self.notification_rules.unwrap_or_default();
        v.push(input);
        self.notification_rules = ::std::option::Option::Some(v);
        self
    }
    /// Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).
    pub fn set_notification_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>) -> Self {
        self.notification_rules = input;
        self
    }
    /// Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).
    pub fn get_notification_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>> {
        &self.notification_rules
    }
    /// Consumes the builder and constructs a [`UpdateAlertInput`](crate::operation::update_alert::UpdateAlertInput).
    pub fn build(self) -> ::std::result::Result<crate::operation::update_alert::UpdateAlertInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::update_alert::UpdateAlertInput {
            space_id: self.space_id,
            alert_id: self.alert_id,
            profile_id: self.profile_id,
            name: self.name,
            description: self.description,
            rule: self.rule,
            notifications_enabled: self.notifications_enabled,
            notification_rules: self.notification_rules,
        })
    }
}