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 CreateAlertInput {
    /// The unique ID of the space to create the alert in.
    pub space_id: ::std::option::Option<::std::string::String>,
    /// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
    pub profile_id: ::std::option::Option<::std::string::String>,
    /// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
    pub name: ::std::option::Option<::std::string::String>,
    /// An optional description of the alert.
    pub description: ::std::option::Option<::std::string::String>,
    /// The rule that defines how the alert is evaluated.
    pub rule: ::std::option::Option<crate::types::Rule>,
    /// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
    pub notifications_enabled: ::std::option::Option<bool>,
    /// The tags to associate with the alert.
    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// The notification rules that determine when and where notifications are sent.
    pub notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
    /// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
    pub client_token: ::std::option::Option<::std::string::String>,
}
impl CreateAlertInput {
    /// The unique ID of the space to create the alert in.
    pub fn space_id(&self) -> ::std::option::Option<&str> {
        self.space_id.as_deref()
    }
    /// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
    pub fn profile_id(&self) -> ::std::option::Option<&str> {
        self.profile_id.as_deref()
    }
    /// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// An optional description of the alert.
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// The rule that defines how the alert is evaluated.
    pub fn rule(&self) -> ::std::option::Option<&crate::types::Rule> {
        self.rule.as_ref()
    }
    /// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
    pub fn notifications_enabled(&self) -> ::std::option::Option<bool> {
        self.notifications_enabled
    }
    /// The tags to associate with the alert.
    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.tags.as_ref()
    }
    /// The notification rules that determine when and where notifications are sent.
    ///
    /// 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()
    }
    /// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
    pub fn client_token(&self) -> ::std::option::Option<&str> {
        self.client_token.as_deref()
    }
}
impl CreateAlertInput {
    /// Creates a new builder-style object to manufacture [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
    pub fn builder() -> crate::operation::create_alert::builders::CreateAlertInputBuilder {
        crate::operation::create_alert::builders::CreateAlertInputBuilder::default()
    }
}

/// A builder for [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateAlertInputBuilder {
    pub(crate) space_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) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
    pub(crate) client_token: ::std::option::Option<::std::string::String>,
}
impl CreateAlertInputBuilder {
    /// The unique ID of the space to create the alert in.
    /// 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 to create the alert in.
    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 to create the alert in.
    pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.space_id
    }
    /// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
    /// This field is required.
    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 the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
    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 the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
    pub fn get_profile_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.profile_id
    }
    /// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// An optional description of the alert.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// An optional description of the alert.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// An optional description of the alert.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// The rule that defines how the alert is evaluated.
    /// This field is required.
    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.
    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.
    pub fn get_rule(&self) -> &::std::option::Option<crate::types::Rule> {
        &self.rule
    }
    /// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
    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. Defaults to true when omitted.
    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. Defaults to true when omitted.
    pub fn get_notifications_enabled(&self) -> &::std::option::Option<bool> {
        &self.notifications_enabled
    }
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// The tags to associate with the alert.
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.tags.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.tags = ::std::option::Option::Some(hash_map);
        self
    }
    /// The tags to associate with the alert.
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.tags = input;
        self
    }
    /// The tags to associate with the alert.
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.tags
    }
    /// Appends an item to `notification_rules`.
    ///
    /// To override the contents of this collection use [`set_notification_rules`](Self::set_notification_rules).
    ///
    /// The notification rules that determine when and where notifications are sent.
    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
    }
    /// The notification rules that determine when and where notifications are sent.
    pub fn set_notification_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>) -> Self {
        self.notification_rules = input;
        self
    }
    /// The notification rules that determine when and where notifications are sent.
    pub fn get_notification_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>> {
        &self.notification_rules
    }
    /// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.client_token = ::std::option::Option::Some(input.into());
        self
    }
    /// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.client_token = input;
        self
    }
    /// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.client_token
    }
    /// Consumes the builder and constructs a [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
    pub fn build(self) -> ::std::result::Result<crate::operation::create_alert::CreateAlertInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_alert::CreateAlertInput {
            space_id: self.space_id,
            profile_id: self.profile_id,
            name: self.name,
            description: self.description,
            rule: self.rule,
            notifications_enabled: self.notifications_enabled,
            tags: self.tags,
            notification_rules: self.notification_rules,
            client_token: self.client_token,
        })
    }
}