aws-sdk-backup 1.109.0

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

/// <p>Contains an array of triplets made up of a condition type (such as <code>StringEquals</code>), a key, and a value. Used to filter resources using their tags and assign them to a backup plan. Case sensitive.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Condition {
    /// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
    pub condition_type: crate::types::ConditionType,
    /// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
    pub condition_key: ::std::string::String,
    /// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
    pub condition_value: ::std::string::String,
}
impl Condition {
    /// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
    pub fn condition_type(&self) -> &crate::types::ConditionType {
        &self.condition_type
    }
    /// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
    pub fn condition_key(&self) -> &str {
        use std::ops::Deref;
        self.condition_key.deref()
    }
    /// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
    pub fn condition_value(&self) -> &str {
        use std::ops::Deref;
        self.condition_value.deref()
    }
}
impl Condition {
    /// Creates a new builder-style object to manufacture [`Condition`](crate::types::Condition).
    pub fn builder() -> crate::types::builders::ConditionBuilder {
        crate::types::builders::ConditionBuilder::default()
    }
}

/// A builder for [`Condition`](crate::types::Condition).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ConditionBuilder {
    pub(crate) condition_type: ::std::option::Option<crate::types::ConditionType>,
    pub(crate) condition_key: ::std::option::Option<::std::string::String>,
    pub(crate) condition_value: ::std::option::Option<::std::string::String>,
}
impl ConditionBuilder {
    /// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
    /// This field is required.
    pub fn condition_type(mut self, input: crate::types::ConditionType) -> Self {
        self.condition_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
    pub fn set_condition_type(mut self, input: ::std::option::Option<crate::types::ConditionType>) -> Self {
        self.condition_type = input;
        self
    }
    /// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
    pub fn get_condition_type(&self) -> &::std::option::Option<crate::types::ConditionType> {
        &self.condition_type
    }
    /// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
    /// This field is required.
    pub fn condition_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.condition_key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
    pub fn set_condition_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.condition_key = input;
        self
    }
    /// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
    pub fn get_condition_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.condition_key
    }
    /// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
    /// This field is required.
    pub fn condition_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.condition_value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
    pub fn set_condition_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.condition_value = input;
        self
    }
    /// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
    pub fn get_condition_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.condition_value
    }
    /// Consumes the builder and constructs a [`Condition`](crate::types::Condition).
    /// This method will fail if any of the following fields are not set:
    /// - [`condition_type`](crate::types::builders::ConditionBuilder::condition_type)
    /// - [`condition_key`](crate::types::builders::ConditionBuilder::condition_key)
    /// - [`condition_value`](crate::types::builders::ConditionBuilder::condition_value)
    pub fn build(self) -> ::std::result::Result<crate::types::Condition, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Condition {
            condition_type: self.condition_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "condition_type",
                    "condition_type was not specified but it is required when building Condition",
                )
            })?,
            condition_key: self.condition_key.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "condition_key",
                    "condition_key was not specified but it is required when building Condition",
                )
            })?,
            condition_value: self.condition_value.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "condition_value",
                    "condition_value was not specified but it is required when building Condition",
                )
            })?,
        })
    }
}