aws_sdk_ssmsap/types/
_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A specific result obtained by specifying the name, value, and operator.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Filter {
7    /// <p>The name of the filter. Filter names are case-sensitive.</p>
8    pub name: ::std::string::String,
9    /// <p>The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values</p>
10    pub value: ::std::string::String,
11    /// <p>The operator for the filter.</p>
12    pub operator: crate::types::FilterOperator,
13}
14impl Filter {
15    /// <p>The name of the filter. Filter names are case-sensitive.</p>
16    pub fn name(&self) -> &str {
17        use std::ops::Deref;
18        self.name.deref()
19    }
20    /// <p>The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values</p>
21    pub fn value(&self) -> &str {
22        use std::ops::Deref;
23        self.value.deref()
24    }
25    /// <p>The operator for the filter.</p>
26    pub fn operator(&self) -> &crate::types::FilterOperator {
27        &self.operator
28    }
29}
30impl Filter {
31    /// Creates a new builder-style object to manufacture [`Filter`](crate::types::Filter).
32    pub fn builder() -> crate::types::builders::FilterBuilder {
33        crate::types::builders::FilterBuilder::default()
34    }
35}
36
37/// A builder for [`Filter`](crate::types::Filter).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct FilterBuilder {
41    pub(crate) name: ::std::option::Option<::std::string::String>,
42    pub(crate) value: ::std::option::Option<::std::string::String>,
43    pub(crate) operator: ::std::option::Option<crate::types::FilterOperator>,
44}
45impl FilterBuilder {
46    /// <p>The name of the filter. Filter names are case-sensitive.</p>
47    /// This field is required.
48    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49        self.name = ::std::option::Option::Some(input.into());
50        self
51    }
52    /// <p>The name of the filter. Filter names are case-sensitive.</p>
53    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54        self.name = input;
55        self
56    }
57    /// <p>The name of the filter. Filter names are case-sensitive.</p>
58    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
59        &self.name
60    }
61    /// <p>The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values</p>
62    /// This field is required.
63    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.value = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values</p>
68    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.value = input;
70        self
71    }
72    /// <p>The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values</p>
73    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
74        &self.value
75    }
76    /// <p>The operator for the filter.</p>
77    /// This field is required.
78    pub fn operator(mut self, input: crate::types::FilterOperator) -> Self {
79        self.operator = ::std::option::Option::Some(input);
80        self
81    }
82    /// <p>The operator for the filter.</p>
83    pub fn set_operator(mut self, input: ::std::option::Option<crate::types::FilterOperator>) -> Self {
84        self.operator = input;
85        self
86    }
87    /// <p>The operator for the filter.</p>
88    pub fn get_operator(&self) -> &::std::option::Option<crate::types::FilterOperator> {
89        &self.operator
90    }
91    /// Consumes the builder and constructs a [`Filter`](crate::types::Filter).
92    /// This method will fail if any of the following fields are not set:
93    /// - [`name`](crate::types::builders::FilterBuilder::name)
94    /// - [`value`](crate::types::builders::FilterBuilder::value)
95    /// - [`operator`](crate::types::builders::FilterBuilder::operator)
96    pub fn build(self) -> ::std::result::Result<crate::types::Filter, ::aws_smithy_types::error::operation::BuildError> {
97        ::std::result::Result::Ok(crate::types::Filter {
98            name: self.name.ok_or_else(|| {
99                ::aws_smithy_types::error::operation::BuildError::missing_field(
100                    "name",
101                    "name was not specified but it is required when building Filter",
102                )
103            })?,
104            value: self.value.ok_or_else(|| {
105                ::aws_smithy_types::error::operation::BuildError::missing_field(
106                    "value",
107                    "value was not specified but it is required when building Filter",
108                )
109            })?,
110            operator: self.operator.ok_or_else(|| {
111                ::aws_smithy_types::error::operation::BuildError::missing_field(
112                    "operator",
113                    "operator was not specified but it is required when building Filter",
114                )
115            })?,
116        })
117    }
118}