aws-sdk-glue 1.149.0

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

/// <p>Defines the predicate of the trigger, which determines when it fires.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Predicate {
    /// <p>An optional field if only one condition is listed. If multiple conditions are listed, then this field is required.</p>
    pub logical: ::std::option::Option<crate::types::Logical>,
    /// <p>A list of the conditions that determine when the trigger will fire.</p>
    pub conditions: ::std::option::Option<::std::vec::Vec<crate::types::Condition>>,
}
impl Predicate {
    /// <p>An optional field if only one condition is listed. If multiple conditions are listed, then this field is required.</p>
    pub fn logical(&self) -> ::std::option::Option<&crate::types::Logical> {
        self.logical.as_ref()
    }
    /// <p>A list of the conditions that determine when the trigger will fire.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.conditions.is_none()`.
    pub fn conditions(&self) -> &[crate::types::Condition] {
        self.conditions.as_deref().unwrap_or_default()
    }
}
impl Predicate {
    /// Creates a new builder-style object to manufacture [`Predicate`](crate::types::Predicate).
    pub fn builder() -> crate::types::builders::PredicateBuilder {
        crate::types::builders::PredicateBuilder::default()
    }
}

/// A builder for [`Predicate`](crate::types::Predicate).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PredicateBuilder {
    pub(crate) logical: ::std::option::Option<crate::types::Logical>,
    pub(crate) conditions: ::std::option::Option<::std::vec::Vec<crate::types::Condition>>,
}
impl PredicateBuilder {
    /// <p>An optional field if only one condition is listed. If multiple conditions are listed, then this field is required.</p>
    pub fn logical(mut self, input: crate::types::Logical) -> Self {
        self.logical = ::std::option::Option::Some(input);
        self
    }
    /// <p>An optional field if only one condition is listed. If multiple conditions are listed, then this field is required.</p>
    pub fn set_logical(mut self, input: ::std::option::Option<crate::types::Logical>) -> Self {
        self.logical = input;
        self
    }
    /// <p>An optional field if only one condition is listed. If multiple conditions are listed, then this field is required.</p>
    pub fn get_logical(&self) -> &::std::option::Option<crate::types::Logical> {
        &self.logical
    }
    /// Appends an item to `conditions`.
    ///
    /// To override the contents of this collection use [`set_conditions`](Self::set_conditions).
    ///
    /// <p>A list of the conditions that determine when the trigger will fire.</p>
    pub fn conditions(mut self, input: crate::types::Condition) -> Self {
        let mut v = self.conditions.unwrap_or_default();
        v.push(input);
        self.conditions = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of the conditions that determine when the trigger will fire.</p>
    pub fn set_conditions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Condition>>) -> Self {
        self.conditions = input;
        self
    }
    /// <p>A list of the conditions that determine when the trigger will fire.</p>
    pub fn get_conditions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Condition>> {
        &self.conditions
    }
    /// Consumes the builder and constructs a [`Predicate`](crate::types::Predicate).
    pub fn build(self) -> crate::types::Predicate {
        crate::types::Predicate {
            logical: self.logical,
            conditions: self.conditions,
        }
    }
}