aws-sdk-budgets 1.89.0

AWS SDK for AWS Budgets
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A budget action resource.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Action {
    /// <p>A system-generated universally unique identifier (UUID) for the action.</p>
    pub action_id: ::std::string::String,
    /// <p>A string that represents the budget name. The ":" and "\" characters, and the "/action/" substring, aren't allowed.</p>
    pub budget_name: ::std::string::String,
    /// <p>The type of a notification. It must be ACTUAL or FORECASTED.</p>
    pub notification_type: crate::types::NotificationType,
    /// <p>The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.</p>
    pub action_type: crate::types::ActionType,
    /// <p>The trigger threshold of the action.</p>
    pub action_threshold: ::std::option::Option<crate::types::ActionThreshold>,
    /// <p>Where you specify all of the type-specific parameters.</p>
    pub definition: ::std::option::Option<crate::types::Definition>,
    /// <p>The role passed for action execution and reversion. Roles and actions must be in the same account.</p>
    pub execution_role_arn: ::std::string::String,
    /// <p>This specifies if the action needs manual or automatic approval.</p>
    pub approval_model: crate::types::ApprovalModel,
    /// <p>The status of the action.</p>
    pub status: crate::types::ActionStatus,
    /// <p>A list of subscribers.</p>
    pub subscribers: ::std::vec::Vec<crate::types::Subscriber>,
}
impl Action {
    /// <p>A system-generated universally unique identifier (UUID) for the action.</p>
    pub fn action_id(&self) -> &str {
        use std::ops::Deref;
        self.action_id.deref()
    }
    /// <p>A string that represents the budget name. The ":" and "\" characters, and the "/action/" substring, aren't allowed.</p>
    pub fn budget_name(&self) -> &str {
        use std::ops::Deref;
        self.budget_name.deref()
    }
    /// <p>The type of a notification. It must be ACTUAL or FORECASTED.</p>
    pub fn notification_type(&self) -> &crate::types::NotificationType {
        &self.notification_type
    }
    /// <p>The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.</p>
    pub fn action_type(&self) -> &crate::types::ActionType {
        &self.action_type
    }
    /// <p>The trigger threshold of the action.</p>
    pub fn action_threshold(&self) -> ::std::option::Option<&crate::types::ActionThreshold> {
        self.action_threshold.as_ref()
    }
    /// <p>Where you specify all of the type-specific parameters.</p>
    pub fn definition(&self) -> ::std::option::Option<&crate::types::Definition> {
        self.definition.as_ref()
    }
    /// <p>The role passed for action execution and reversion. Roles and actions must be in the same account.</p>
    pub fn execution_role_arn(&self) -> &str {
        use std::ops::Deref;
        self.execution_role_arn.deref()
    }
    /// <p>This specifies if the action needs manual or automatic approval.</p>
    pub fn approval_model(&self) -> &crate::types::ApprovalModel {
        &self.approval_model
    }
    /// <p>The status of the action.</p>
    pub fn status(&self) -> &crate::types::ActionStatus {
        &self.status
    }
    /// <p>A list of subscribers.</p>
    pub fn subscribers(&self) -> &[crate::types::Subscriber] {
        use std::ops::Deref;
        self.subscribers.deref()
    }
}
impl Action {
    /// Creates a new builder-style object to manufacture [`Action`](crate::types::Action).
    pub fn builder() -> crate::types::builders::ActionBuilder {
        crate::types::builders::ActionBuilder::default()
    }
}

/// A builder for [`Action`](crate::types::Action).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ActionBuilder {
    pub(crate) action_id: ::std::option::Option<::std::string::String>,
    pub(crate) budget_name: ::std::option::Option<::std::string::String>,
    pub(crate) notification_type: ::std::option::Option<crate::types::NotificationType>,
    pub(crate) action_type: ::std::option::Option<crate::types::ActionType>,
    pub(crate) action_threshold: ::std::option::Option<crate::types::ActionThreshold>,
    pub(crate) definition: ::std::option::Option<crate::types::Definition>,
    pub(crate) execution_role_arn: ::std::option::Option<::std::string::String>,
    pub(crate) approval_model: ::std::option::Option<crate::types::ApprovalModel>,
    pub(crate) status: ::std::option::Option<crate::types::ActionStatus>,
    pub(crate) subscribers: ::std::option::Option<::std::vec::Vec<crate::types::Subscriber>>,
}
impl ActionBuilder {
    /// <p>A system-generated universally unique identifier (UUID) for the action.</p>
    /// This field is required.
    pub fn action_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.action_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A system-generated universally unique identifier (UUID) for the action.</p>
    pub fn set_action_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.action_id = input;
        self
    }
    /// <p>A system-generated universally unique identifier (UUID) for the action.</p>
    pub fn get_action_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.action_id
    }
    /// <p>A string that represents the budget name. The ":" and "\" characters, and the "/action/" substring, aren't allowed.</p>
    /// This field is required.
    pub fn budget_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.budget_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A string that represents the budget name. The ":" and "\" characters, and the "/action/" substring, aren't allowed.</p>
    pub fn set_budget_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.budget_name = input;
        self
    }
    /// <p>A string that represents the budget name. The ":" and "\" characters, and the "/action/" substring, aren't allowed.</p>
    pub fn get_budget_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.budget_name
    }
    /// <p>The type of a notification. It must be ACTUAL or FORECASTED.</p>
    /// This field is required.
    pub fn notification_type(mut self, input: crate::types::NotificationType) -> Self {
        self.notification_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of a notification. It must be ACTUAL or FORECASTED.</p>
    pub fn set_notification_type(mut self, input: ::std::option::Option<crate::types::NotificationType>) -> Self {
        self.notification_type = input;
        self
    }
    /// <p>The type of a notification. It must be ACTUAL or FORECASTED.</p>
    pub fn get_notification_type(&self) -> &::std::option::Option<crate::types::NotificationType> {
        &self.notification_type
    }
    /// <p>The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.</p>
    /// This field is required.
    pub fn action_type(mut self, input: crate::types::ActionType) -> Self {
        self.action_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.</p>
    pub fn set_action_type(mut self, input: ::std::option::Option<crate::types::ActionType>) -> Self {
        self.action_type = input;
        self
    }
    /// <p>The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.</p>
    pub fn get_action_type(&self) -> &::std::option::Option<crate::types::ActionType> {
        &self.action_type
    }
    /// <p>The trigger threshold of the action.</p>
    /// This field is required.
    pub fn action_threshold(mut self, input: crate::types::ActionThreshold) -> Self {
        self.action_threshold = ::std::option::Option::Some(input);
        self
    }
    /// <p>The trigger threshold of the action.</p>
    pub fn set_action_threshold(mut self, input: ::std::option::Option<crate::types::ActionThreshold>) -> Self {
        self.action_threshold = input;
        self
    }
    /// <p>The trigger threshold of the action.</p>
    pub fn get_action_threshold(&self) -> &::std::option::Option<crate::types::ActionThreshold> {
        &self.action_threshold
    }
    /// <p>Where you specify all of the type-specific parameters.</p>
    /// This field is required.
    pub fn definition(mut self, input: crate::types::Definition) -> Self {
        self.definition = ::std::option::Option::Some(input);
        self
    }
    /// <p>Where you specify all of the type-specific parameters.</p>
    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::Definition>) -> Self {
        self.definition = input;
        self
    }
    /// <p>Where you specify all of the type-specific parameters.</p>
    pub fn get_definition(&self) -> &::std::option::Option<crate::types::Definition> {
        &self.definition
    }
    /// <p>The role passed for action execution and reversion. Roles and actions must be in the same account.</p>
    /// This field is required.
    pub fn execution_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.execution_role_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The role passed for action execution and reversion. Roles and actions must be in the same account.</p>
    pub fn set_execution_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.execution_role_arn = input;
        self
    }
    /// <p>The role passed for action execution and reversion. Roles and actions must be in the same account.</p>
    pub fn get_execution_role_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.execution_role_arn
    }
    /// <p>This specifies if the action needs manual or automatic approval.</p>
    /// This field is required.
    pub fn approval_model(mut self, input: crate::types::ApprovalModel) -> Self {
        self.approval_model = ::std::option::Option::Some(input);
        self
    }
    /// <p>This specifies if the action needs manual or automatic approval.</p>
    pub fn set_approval_model(mut self, input: ::std::option::Option<crate::types::ApprovalModel>) -> Self {
        self.approval_model = input;
        self
    }
    /// <p>This specifies if the action needs manual or automatic approval.</p>
    pub fn get_approval_model(&self) -> &::std::option::Option<crate::types::ApprovalModel> {
        &self.approval_model
    }
    /// <p>The status of the action.</p>
    /// This field is required.
    pub fn status(mut self, input: crate::types::ActionStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The status of the action.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::ActionStatus>) -> Self {
        self.status = input;
        self
    }
    /// <p>The status of the action.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::ActionStatus> {
        &self.status
    }
    /// Appends an item to `subscribers`.
    ///
    /// To override the contents of this collection use [`set_subscribers`](Self::set_subscribers).
    ///
    /// <p>A list of subscribers.</p>
    pub fn subscribers(mut self, input: crate::types::Subscriber) -> Self {
        let mut v = self.subscribers.unwrap_or_default();
        v.push(input);
        self.subscribers = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of subscribers.</p>
    pub fn set_subscribers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Subscriber>>) -> Self {
        self.subscribers = input;
        self
    }
    /// <p>A list of subscribers.</p>
    pub fn get_subscribers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Subscriber>> {
        &self.subscribers
    }
    /// Consumes the builder and constructs a [`Action`](crate::types::Action).
    /// This method will fail if any of the following fields are not set:
    /// - [`action_id`](crate::types::builders::ActionBuilder::action_id)
    /// - [`budget_name`](crate::types::builders::ActionBuilder::budget_name)
    /// - [`notification_type`](crate::types::builders::ActionBuilder::notification_type)
    /// - [`action_type`](crate::types::builders::ActionBuilder::action_type)
    /// - [`execution_role_arn`](crate::types::builders::ActionBuilder::execution_role_arn)
    /// - [`approval_model`](crate::types::builders::ActionBuilder::approval_model)
    /// - [`status`](crate::types::builders::ActionBuilder::status)
    /// - [`subscribers`](crate::types::builders::ActionBuilder::subscribers)
    pub fn build(self) -> ::std::result::Result<crate::types::Action, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Action {
            action_id: self.action_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "action_id",
                    "action_id was not specified but it is required when building Action",
                )
            })?,
            budget_name: self.budget_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "budget_name",
                    "budget_name was not specified but it is required when building Action",
                )
            })?,
            notification_type: self.notification_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "notification_type",
                    "notification_type was not specified but it is required when building Action",
                )
            })?,
            action_type: self.action_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "action_type",
                    "action_type was not specified but it is required when building Action",
                )
            })?,
            action_threshold: self.action_threshold,
            definition: self.definition,
            execution_role_arn: self.execution_role_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "execution_role_arn",
                    "execution_role_arn was not specified but it is required when building Action",
                )
            })?,
            approval_model: self.approval_model.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "approval_model",
                    "approval_model was not specified but it is required when building Action",
                )
            })?,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building Action",
                )
            })?,
            subscribers: self.subscribers.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "subscribers",
                    "subscribers was not specified but it is required when building Action",
                )
            })?,
        })
    }
}