Skip to main content

aws_sdk_sagemaker/types/
_search_expression.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <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>
4/// <p>A <code>SearchExpression</code> contains the following components:</p>
5/// <ul>
6/// <li>
7/// <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>
8/// <li>
9/// <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>
10/// <li>
11/// <p>A list of <code>SearchExpression</code> objects. A search expression object can be nested in a list of search expression objects.</p></li>
12/// <li>
13/// <p>A Boolean operator: <code>And</code> or <code>Or</code>.</p></li>
14/// </ul>
15#[non_exhaustive]
16#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
17pub struct SearchExpression {
18    /// <p>A list of filter objects.</p>
19    pub filters: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>,
20    /// <p>A list of nested filter objects.</p>
21    pub nested_filters: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>,
22    /// <p>A list of search expression objects.</p>
23    pub sub_expressions: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>,
24    /// <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>
25    pub operator: ::std::option::Option<crate::types::BooleanOperator>,
26}
27impl SearchExpression {
28    /// <p>A list of filter objects.</p>
29    ///
30    /// 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()`.
31    pub fn filters(&self) -> &[crate::types::Filter] {
32        self.filters.as_deref().unwrap_or_default()
33    }
34    /// <p>A list of nested filter objects.</p>
35    ///
36    /// 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()`.
37    pub fn nested_filters(&self) -> &[crate::types::NestedFilters] {
38        self.nested_filters.as_deref().unwrap_or_default()
39    }
40    /// <p>A list of search expression objects.</p>
41    ///
42    /// 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()`.
43    pub fn sub_expressions(&self) -> &[crate::types::SearchExpression] {
44        self.sub_expressions.as_deref().unwrap_or_default()
45    }
46    /// <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>
47    pub fn operator(&self) -> ::std::option::Option<&crate::types::BooleanOperator> {
48        self.operator.as_ref()
49    }
50}
51impl SearchExpression {
52    /// Creates a new builder-style object to manufacture [`SearchExpression`](crate::types::SearchExpression).
53    pub fn builder() -> crate::types::builders::SearchExpressionBuilder {
54        crate::types::builders::SearchExpressionBuilder::default()
55    }
56}
57
58/// A builder for [`SearchExpression`](crate::types::SearchExpression).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct SearchExpressionBuilder {
62    pub(crate) filters: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>,
63    pub(crate) nested_filters: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>,
64    pub(crate) sub_expressions: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>,
65    pub(crate) operator: ::std::option::Option<crate::types::BooleanOperator>,
66}
67impl SearchExpressionBuilder {
68    /// Appends an item to `filters`.
69    ///
70    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
71    ///
72    /// <p>A list of filter objects.</p>
73    pub fn filters(mut self, input: crate::types::Filter) -> Self {
74        let mut v = self.filters.unwrap_or_default();
75        v.push(input);
76        self.filters = ::std::option::Option::Some(v);
77        self
78    }
79    /// <p>A list of filter objects.</p>
80    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
81        self.filters = input;
82        self
83    }
84    /// <p>A list of filter objects.</p>
85    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
86        &self.filters
87    }
88    /// Appends an item to `nested_filters`.
89    ///
90    /// To override the contents of this collection use [`set_nested_filters`](Self::set_nested_filters).
91    ///
92    /// <p>A list of nested filter objects.</p>
93    pub fn nested_filters(mut self, input: crate::types::NestedFilters) -> Self {
94        let mut v = self.nested_filters.unwrap_or_default();
95        v.push(input);
96        self.nested_filters = ::std::option::Option::Some(v);
97        self
98    }
99    /// <p>A list of nested filter objects.</p>
100    pub fn set_nested_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>>) -> Self {
101        self.nested_filters = input;
102        self
103    }
104    /// <p>A list of nested filter objects.</p>
105    pub fn get_nested_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NestedFilters>> {
106        &self.nested_filters
107    }
108    /// Appends an item to `sub_expressions`.
109    ///
110    /// To override the contents of this collection use [`set_sub_expressions`](Self::set_sub_expressions).
111    ///
112    /// <p>A list of search expression objects.</p>
113    pub fn sub_expressions(mut self, input: crate::types::SearchExpression) -> Self {
114        let mut v = self.sub_expressions.unwrap_or_default();
115        v.push(input);
116        self.sub_expressions = ::std::option::Option::Some(v);
117        self
118    }
119    /// <p>A list of search expression objects.</p>
120    pub fn set_sub_expressions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>>) -> Self {
121        self.sub_expressions = input;
122        self
123    }
124    /// <p>A list of search expression objects.</p>
125    pub fn get_sub_expressions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SearchExpression>> {
126        &self.sub_expressions
127    }
128    /// <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>
129    pub fn operator(mut self, input: crate::types::BooleanOperator) -> Self {
130        self.operator = ::std::option::Option::Some(input);
131        self
132    }
133    /// <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>
134    pub fn set_operator(mut self, input: ::std::option::Option<crate::types::BooleanOperator>) -> Self {
135        self.operator = input;
136        self
137    }
138    /// <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>
139    pub fn get_operator(&self) -> &::std::option::Option<crate::types::BooleanOperator> {
140        &self.operator
141    }
142    /// Consumes the builder and constructs a [`SearchExpression`](crate::types::SearchExpression).
143    pub fn build(self) -> crate::types::SearchExpression {
144        crate::types::SearchExpression {
145            filters: self.filters,
146            nested_filters: self.nested_filters,
147            sub_expressions: self.sub_expressions,
148            operator: self.operator,
149        }
150    }
151}