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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes criteria to restrict a list of results.</p>
/// <p>For operators that apply a single value to the attribute, the filter is evaluated as follows: <code>Attribute Operator Values\[1\]</code></p>
/// <p>Some operators, e.g. <code>in</code>, can apply multiple values. In this case, the filter is evaluated as a logical union (OR) of applications of the operator to the attribute with each one of the values: <code>(Attribute Operator Values\[1\]) OR (Attribute Operator Values\[2\]) OR ...</code></p>
/// <p>The valid values for attributes of <code>SearchFilter</code> depend on the API action. For valid values, see the reference page for the API action you're calling that takes a <code>SearchFilter</code> parameter.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct SearchFilter {
/// <p>The result attribute to which the filter values are applied. Valid values vary by API action.</p>
pub attribute: ::std::option::Option<::std::string::String>,
/// <p>The operator to apply to the <code>Attribute</code> with each of the <code>Values</code>. Valid values vary by <code>Attribute</code>.</p>
pub operator: ::std::option::Option<::std::string::String>,
/// <p>The list of values applied to the <code>Attribute</code> and <code>Operator</code> attributes. Number of values and valid values vary by <code>Attribute</code>.</p>
pub values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl SearchFilter {
/// <p>The result attribute to which the filter values are applied. Valid values vary by API action.</p>
pub fn attribute(&self) -> ::std::option::Option<&str> {
self.attribute.as_deref()
}
/// <p>The operator to apply to the <code>Attribute</code> with each of the <code>Values</code>. Valid values vary by <code>Attribute</code>.</p>
pub fn operator(&self) -> ::std::option::Option<&str> {
self.operator.as_deref()
}
/// <p>The list of values applied to the <code>Attribute</code> and <code>Operator</code> attributes. Number of values and valid values vary by <code>Attribute</code>.</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 `.values.is_none()`.
pub fn values(&self) -> &[::std::string::String] {
self.values.as_deref().unwrap_or_default()
}
}
impl SearchFilter {
/// Creates a new builder-style object to manufacture [`SearchFilter`](crate::types::SearchFilter).
pub fn builder() -> crate::types::builders::SearchFilterBuilder {
crate::types::builders::SearchFilterBuilder::default()
}
}
/// A builder for [`SearchFilter`](crate::types::SearchFilter).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct SearchFilterBuilder {
pub(crate) attribute: ::std::option::Option<::std::string::String>,
pub(crate) operator: ::std::option::Option<::std::string::String>,
pub(crate) values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl SearchFilterBuilder {
/// <p>The result attribute to which the filter values are applied. Valid values vary by API action.</p>
pub fn attribute(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.attribute = ::std::option::Option::Some(input.into());
self
}
/// <p>The result attribute to which the filter values are applied. Valid values vary by API action.</p>
pub fn set_attribute(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.attribute = input;
self
}
/// <p>The result attribute to which the filter values are applied. Valid values vary by API action.</p>
pub fn get_attribute(&self) -> &::std::option::Option<::std::string::String> {
&self.attribute
}
/// <p>The operator to apply to the <code>Attribute</code> with each of the <code>Values</code>. Valid values vary by <code>Attribute</code>.</p>
pub fn operator(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.operator = ::std::option::Option::Some(input.into());
self
}
/// <p>The operator to apply to the <code>Attribute</code> with each of the <code>Values</code>. Valid values vary by <code>Attribute</code>.</p>
pub fn set_operator(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.operator = input;
self
}
/// <p>The operator to apply to the <code>Attribute</code> with each of the <code>Values</code>. Valid values vary by <code>Attribute</code>.</p>
pub fn get_operator(&self) -> &::std::option::Option<::std::string::String> {
&self.operator
}
/// Appends an item to `values`.
///
/// To override the contents of this collection use [`set_values`](Self::set_values).
///
/// <p>The list of values applied to the <code>Attribute</code> and <code>Operator</code> attributes. Number of values and valid values vary by <code>Attribute</code>.</p>
pub fn values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.values.unwrap_or_default();
v.push(input.into());
self.values = ::std::option::Option::Some(v);
self
}
/// <p>The list of values applied to the <code>Attribute</code> and <code>Operator</code> attributes. Number of values and valid values vary by <code>Attribute</code>.</p>
pub fn set_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.values = input;
self
}
/// <p>The list of values applied to the <code>Attribute</code> and <code>Operator</code> attributes. Number of values and valid values vary by <code>Attribute</code>.</p>
pub fn get_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.values
}
/// Consumes the builder and constructs a [`SearchFilter`](crate::types::SearchFilter).
pub fn build(self) -> crate::types::SearchFilter {
crate::types::SearchFilter {
attribute: self.attribute,
operator: self.operator,
values: self.values,
}
}
}