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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A multi-expression that searches for the specified resource or resources in a search. All resource objects that satisfy the expression's condition are included in the search results. You must specify at least one subexpression, filter, or nested filter. A <code>SearchExpression</code> can contain up to twenty elements.</p>
/// <p>A <code>SearchExpression</code> contains the following components:</p>
/// <ul>
/// <li> <p>A list of <code>Filter</code> objects. Each filter defines a simple Boolean expression comprised of a resource property name, Boolean operator, and value.</p> </li>
/// <li> <p>A list of <code>NestedFilter</code> objects. Each nested filter defines a list of Boolean expressions using a list of resource properties. A nested filter is satisfied if a single object in the list satisfies all Boolean expressions.</p> </li>
/// <li> <p>A list of <code>SearchExpression</code> objects. A search expression object can be nested in a list of search expression objects.</p> </li>
/// <li> <p>A Boolean operator: <code>And</code> or <code>Or</code>.</p> </li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct SearchExpression {
    /// <p>A list of filter objects.</p>
    pub filters: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>,
    /// <p>A list of nested filter objects.</p>
    pub nested_filters: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>,
    /// <p>A list of search expression objects.</p>
    pub sub_expressions: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>,
    /// <p>A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists to be satisfied for the entire search expression to be true, specify <code>And</code>. If only a single conditional statement needs to be true for the entire search expression to be true, specify <code>Or</code>. The default value is <code>And</code>.</p>
    pub operator: ::std::option::Option<crate::types::BooleanOperator>,
}
impl SearchExpression {
    /// <p>A list of filter objects.</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 `.filters.is_none()`.
    pub fn filters(&self) -> &[crate::types::Filter] {
        self.filters.as_deref().unwrap_or_default()
    }
    /// <p>A list of nested filter objects.</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 `.nested_filters.is_none()`.
    pub fn nested_filters(&self) -> &[crate::types::NestedFilters] {
        self.nested_filters.as_deref().unwrap_or_default()
    }
    /// <p>A list of search expression objects.</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 `.sub_expressions.is_none()`.
    pub fn sub_expressions(&self) -> &[crate::types::SearchExpression] {
        self.sub_expressions.as_deref().unwrap_or_default()
    }
    /// <p>A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists to be satisfied for the entire search expression to be true, specify <code>And</code>. If only a single conditional statement needs to be true for the entire search expression to be true, specify <code>Or</code>. The default value is <code>And</code>.</p>
    pub fn operator(&self) -> ::std::option::Option<&crate::types::BooleanOperator> {
        self.operator.as_ref()
    }
}
impl SearchExpression {
    /// Creates a new builder-style object to manufacture [`SearchExpression`](crate::types::SearchExpression).
    pub fn builder() -> crate::types::builders::SearchExpressionBuilder {
        crate::types::builders::SearchExpressionBuilder::default()
    }
}

/// A builder for [`SearchExpression`](crate::types::SearchExpression).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct SearchExpressionBuilder {
    pub(crate) filters: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>,
    pub(crate) nested_filters: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>,
    pub(crate) sub_expressions: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>,
    pub(crate) operator: ::std::option::Option<crate::types::BooleanOperator>,
}
impl SearchExpressionBuilder {
    /// Appends an item to `filters`.
    ///
    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
    ///
    /// <p>A list of filter objects.</p>
    pub fn filters(mut self, input: crate::types::Filter) -> Self {
        let mut v = self.filters.unwrap_or_default();
        v.push(input);
        self.filters = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of filter objects.</p>
    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
        self.filters = input;
        self
    }
    /// <p>A list of filter objects.</p>
    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
        &self.filters
    }
    /// Appends an item to `nested_filters`.
    ///
    /// To override the contents of this collection use [`set_nested_filters`](Self::set_nested_filters).
    ///
    /// <p>A list of nested filter objects.</p>
    pub fn nested_filters(mut self, input: crate::types::NestedFilters) -> Self {
        let mut v = self.nested_filters.unwrap_or_default();
        v.push(input);
        self.nested_filters = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of nested filter objects.</p>
    pub fn set_nested_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>) -> Self {
        self.nested_filters = input;
        self
    }
    /// <p>A list of nested filter objects.</p>
    pub fn get_nested_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>> {
        &self.nested_filters
    }
    /// Appends an item to `sub_expressions`.
    ///
    /// To override the contents of this collection use [`set_sub_expressions`](Self::set_sub_expressions).
    ///
    /// <p>A list of search expression objects.</p>
    pub fn sub_expressions(mut self, input: crate::types::SearchExpression) -> Self {
        let mut v = self.sub_expressions.unwrap_or_default();
        v.push(input);
        self.sub_expressions = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of search expression objects.</p>
    pub fn set_sub_expressions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>) -> Self {
        self.sub_expressions = input;
        self
    }
    /// <p>A list of search expression objects.</p>
    pub fn get_sub_expressions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>> {
        &self.sub_expressions
    }
    /// <p>A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists to be satisfied for the entire search expression to be true, specify <code>And</code>. If only a single conditional statement needs to be true for the entire search expression to be true, specify <code>Or</code>. The default value is <code>And</code>.</p>
    pub fn operator(mut self, input: crate::types::BooleanOperator) -> Self {
        self.operator = ::std::option::Option::Some(input);
        self
    }
    /// <p>A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists to be satisfied for the entire search expression to be true, specify <code>And</code>. If only a single conditional statement needs to be true for the entire search expression to be true, specify <code>Or</code>. The default value is <code>And</code>.</p>
    pub fn set_operator(mut self, input: ::std::option::Option<crate::types::BooleanOperator>) -> Self {
        self.operator = input;
        self
    }
    /// <p>A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists to be satisfied for the entire search expression to be true, specify <code>And</code>. If only a single conditional statement needs to be true for the entire search expression to be true, specify <code>Or</code>. The default value is <code>And</code>.</p>
    pub fn get_operator(&self) -> &::std::option::Option<crate::types::BooleanOperator> {
        &self.operator
    }
    /// Consumes the builder and constructs a [`SearchExpression`](crate::types::SearchExpression).
    pub fn build(self) -> crate::types::SearchExpression {
        crate::types::SearchExpression {
            filters: self.filters,
            nested_filters: self.nested_filters,
            sub_expressions: self.sub_expressions,
            operator: self.operator,
        }
    }
}