1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// 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,
}
}
}