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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A single logging filter, used in <code>LoggingFilter</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Filter {
    /// <p>How to handle logs that satisfy the filter's conditions and requirement.</p>
    pub behavior: crate::types::FilterBehavior,
    /// <p>Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.</p>
    pub requirement: crate::types::FilterRequirement,
    /// <p>Match conditions for the filter.</p>
    pub conditions: ::std::vec::Vec<crate::types::Condition>,
}
impl Filter {
    /// <p>How to handle logs that satisfy the filter's conditions and requirement.</p>
    pub fn behavior(&self) -> &crate::types::FilterBehavior {
        &self.behavior
    }
    /// <p>Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.</p>
    pub fn requirement(&self) -> &crate::types::FilterRequirement {
        &self.requirement
    }
    /// <p>Match conditions for the filter.</p>
    pub fn conditions(&self) -> &[crate::types::Condition] {
        use std::ops::Deref;
        self.conditions.deref()
    }
}
impl Filter {
    /// Creates a new builder-style object to manufacture [`Filter`](crate::types::Filter).
    pub fn builder() -> crate::types::builders::FilterBuilder {
        crate::types::builders::FilterBuilder::default()
    }
}

/// A builder for [`Filter`](crate::types::Filter).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct FilterBuilder {
    pub(crate) behavior: ::std::option::Option<crate::types::FilterBehavior>,
    pub(crate) requirement: ::std::option::Option<crate::types::FilterRequirement>,
    pub(crate) conditions: ::std::option::Option<::std::vec::Vec<crate::types::Condition>>,
}
impl FilterBuilder {
    /// <p>How to handle logs that satisfy the filter's conditions and requirement.</p>
    /// This field is required.
    pub fn behavior(mut self, input: crate::types::FilterBehavior) -> Self {
        self.behavior = ::std::option::Option::Some(input);
        self
    }
    /// <p>How to handle logs that satisfy the filter's conditions and requirement.</p>
    pub fn set_behavior(mut self, input: ::std::option::Option<crate::types::FilterBehavior>) -> Self {
        self.behavior = input;
        self
    }
    /// <p>How to handle logs that satisfy the filter's conditions and requirement.</p>
    pub fn get_behavior(&self) -> &::std::option::Option<crate::types::FilterBehavior> {
        &self.behavior
    }
    /// <p>Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.</p>
    /// This field is required.
    pub fn requirement(mut self, input: crate::types::FilterRequirement) -> Self {
        self.requirement = ::std::option::Option::Some(input);
        self
    }
    /// <p>Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.</p>
    pub fn set_requirement(mut self, input: ::std::option::Option<crate::types::FilterRequirement>) -> Self {
        self.requirement = input;
        self
    }
    /// <p>Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.</p>
    pub fn get_requirement(&self) -> &::std::option::Option<crate::types::FilterRequirement> {
        &self.requirement
    }
    /// Appends an item to `conditions`.
    ///
    /// To override the contents of this collection use [`set_conditions`](Self::set_conditions).
    ///
    /// <p>Match conditions for the filter.</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>Match conditions for the filter.</p>
    pub fn set_conditions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Condition>>) -> Self {
        self.conditions = input;
        self
    }
    /// <p>Match conditions for the filter.</p>
    pub fn get_conditions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Condition>> {
        &self.conditions
    }
    /// Consumes the builder and constructs a [`Filter`](crate::types::Filter).
    /// This method will fail if any of the following fields are not set:
    /// - [`behavior`](crate::types::builders::FilterBuilder::behavior)
    /// - [`requirement`](crate::types::builders::FilterBuilder::requirement)
    /// - [`conditions`](crate::types::builders::FilterBuilder::conditions)
    pub fn build(self) -> ::std::result::Result<crate::types::Filter, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Filter {
            behavior: self.behavior.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "behavior",
                    "behavior was not specified but it is required when building Filter",
                )
            })?,
            requirement: self.requirement.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "requirement",
                    "requirement was not specified but it is required when building Filter",
                )
            })?,
            conditions: self.conditions.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "conditions",
                    "conditions was not specified but it is required when building Filter",
                )
            })?,
        })
    }
}