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.
pub use crate::operation::create_alert::_create_alert_input::CreateAlertInputBuilder;

pub use crate::operation::create_alert::_create_alert_output::CreateAlertOutputBuilder;

impl crate::operation::create_alert::builders::CreateAlertInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::create_alert::CreateAlertOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_alert::CreateAlertError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.create_alert();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `CreateAlert`.
///
/// Creates a new alert within a space. Use GetAlert and ListAlerts to retrieve alerts, UpdateAlert to modify one, and DeleteAlert to remove it.
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateAlertFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::create_alert::builders::CreateAlertInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::create_alert::CreateAlertOutput,
        crate::operation::create_alert::CreateAlertError,
    > for CreateAlertFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::create_alert::CreateAlertOutput,
            crate::operation::create_alert::CreateAlertError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl CreateAlertFluentBuilder {
    /// Creates a new `CreateAlertFluentBuilder`.
    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 CreateAlert as a reference.
    pub fn as_input(&self) -> &crate::operation::create_alert::builders::CreateAlertInputBuilder {
        &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::create_alert::CreateAlertOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_alert::CreateAlertError,
            ::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::create_alert::CreateAlert::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::create_alert::CreateAlert::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::create_alert::CreateAlertOutput,
        crate::operation::create_alert::CreateAlertError,
        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
    }
    /// The unique ID of the space to create the alert in.
    pub fn space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.space_id(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.inner = self.inner.set_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.inner.get_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.
    pub fn profile_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.profile_id(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.inner = self.inner.set_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.inner.get_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.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.name(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.inner = self.inner.set_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.inner.get_name()
    }
    /// An optional description of the alert.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.description(input.into());
        self
    }
    /// An optional description of the alert.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_description(input);
        self
    }
    /// An optional description of the alert.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_description()
    }
    /// The rule that defines how the alert is evaluated.
    pub fn rule(mut self, input: crate::types::Rule) -> Self {
        self.inner = self.inner.rule(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.inner = self.inner.set_rule(input);
        self
    }
    /// The rule that defines how the alert is evaluated.
    pub fn get_rule(&self) -> &::std::option::Option<crate::types::Rule> {
        self.inner.get_rule()
    }
    /// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
    pub fn notifications_enabled(mut self, input: bool) -> Self {
        self.inner = self.inner.notifications_enabled(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.inner = self.inner.set_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.inner.get_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 {
        self.inner = self.inner.tags(k.into(), v.into());
        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.inner = self.inner.set_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.inner.get_tags()
    }
    ///
    /// Appends an item to `notificationRules`.
    ///
    /// 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 {
        self.inner = self.inner.notification_rules(input);
        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.inner = self.inner.set_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.inner.get_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.inner = self.inner.client_token(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.inner = self.inner.set_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.inner.get_client_token()
    }
}