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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Inspect all headers in the web request. You can specify the parts of the headers to inspect and you can narrow the set of headers to inspect by including or excluding specific keys.</p>
/// <p>This is used to indicate the web request component to inspect, in the <code>FieldToMatch</code> specification.</p>
/// <p>If you want to inspect just the value of a single header, use the <code>SingleHeader</code> <code>FieldToMatch</code> setting instead.</p>
/// <p>Example JSON: <code>"Headers": { "MatchPattern": { "All": {} }, "MatchScope": "KEY", "OversizeHandling": "MATCH" }</code></p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Headers {
    /// <p>The filter to use to identify the subset of headers to inspect in a web request.</p>
    /// <p>You must specify exactly one setting: either <code>All</code>, <code>IncludedHeaders</code>, or <code>ExcludedHeaders</code>.</p>
    /// <p>Example JSON: <code>"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }</code></p>
    pub match_pattern: ::std::option::Option<crate::types::HeaderMatchPattern>,
    /// <p>The parts of the headers to match with the rule inspection criteria. If you specify <code>ALL</code>, WAF inspects both keys and values.</p>
    /// <p><code>All</code> does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical <code>AND</code> statement to combine two match rules, one that inspects the keys and another that inspects the values.</p>
    pub match_scope: crate::types::MapMatchScope,
    /// <p>What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.</p>
    /// <p>The options for oversize handling are the following:</p>
    /// <ul>
    /// <li>
    /// <p><code>CONTINUE</code> - Inspect the available headers normally, according to the rule inspection criteria.</p></li>
    /// <li>
    /// <p><code>MATCH</code> - Treat the web request as matching the rule statement. WAF applies the rule action to the request.</p></li>
    /// <li>
    /// <p><code>NO_MATCH</code> - Treat the web request as not matching the rule statement.</p></li>
    /// </ul>
    pub oversize_handling: crate::types::OversizeHandling,
}
impl Headers {
    /// <p>The filter to use to identify the subset of headers to inspect in a web request.</p>
    /// <p>You must specify exactly one setting: either <code>All</code>, <code>IncludedHeaders</code>, or <code>ExcludedHeaders</code>.</p>
    /// <p>Example JSON: <code>"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }</code></p>
    pub fn match_pattern(&self) -> ::std::option::Option<&crate::types::HeaderMatchPattern> {
        self.match_pattern.as_ref()
    }
    /// <p>The parts of the headers to match with the rule inspection criteria. If you specify <code>ALL</code>, WAF inspects both keys and values.</p>
    /// <p><code>All</code> does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical <code>AND</code> statement to combine two match rules, one that inspects the keys and another that inspects the values.</p>
    pub fn match_scope(&self) -> &crate::types::MapMatchScope {
        &self.match_scope
    }
    /// <p>What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.</p>
    /// <p>The options for oversize handling are the following:</p>
    /// <ul>
    /// <li>
    /// <p><code>CONTINUE</code> - Inspect the available headers normally, according to the rule inspection criteria.</p></li>
    /// <li>
    /// <p><code>MATCH</code> - Treat the web request as matching the rule statement. WAF applies the rule action to the request.</p></li>
    /// <li>
    /// <p><code>NO_MATCH</code> - Treat the web request as not matching the rule statement.</p></li>
    /// </ul>
    pub fn oversize_handling(&self) -> &crate::types::OversizeHandling {
        &self.oversize_handling
    }
}
impl Headers {
    /// Creates a new builder-style object to manufacture [`Headers`](crate::types::Headers).
    pub fn builder() -> crate::types::builders::HeadersBuilder {
        crate::types::builders::HeadersBuilder::default()
    }
}

/// A builder for [`Headers`](crate::types::Headers).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct HeadersBuilder {
    pub(crate) match_pattern: ::std::option::Option<crate::types::HeaderMatchPattern>,
    pub(crate) match_scope: ::std::option::Option<crate::types::MapMatchScope>,
    pub(crate) oversize_handling: ::std::option::Option<crate::types::OversizeHandling>,
}
impl HeadersBuilder {
    /// <p>The filter to use to identify the subset of headers to inspect in a web request.</p>
    /// <p>You must specify exactly one setting: either <code>All</code>, <code>IncludedHeaders</code>, or <code>ExcludedHeaders</code>.</p>
    /// <p>Example JSON: <code>"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }</code></p>
    /// This field is required.
    pub fn match_pattern(mut self, input: crate::types::HeaderMatchPattern) -> Self {
        self.match_pattern = ::std::option::Option::Some(input);
        self
    }
    /// <p>The filter to use to identify the subset of headers to inspect in a web request.</p>
    /// <p>You must specify exactly one setting: either <code>All</code>, <code>IncludedHeaders</code>, or <code>ExcludedHeaders</code>.</p>
    /// <p>Example JSON: <code>"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }</code></p>
    pub fn set_match_pattern(mut self, input: ::std::option::Option<crate::types::HeaderMatchPattern>) -> Self {
        self.match_pattern = input;
        self
    }
    /// <p>The filter to use to identify the subset of headers to inspect in a web request.</p>
    /// <p>You must specify exactly one setting: either <code>All</code>, <code>IncludedHeaders</code>, or <code>ExcludedHeaders</code>.</p>
    /// <p>Example JSON: <code>"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }</code></p>
    pub fn get_match_pattern(&self) -> &::std::option::Option<crate::types::HeaderMatchPattern> {
        &self.match_pattern
    }
    /// <p>The parts of the headers to match with the rule inspection criteria. If you specify <code>ALL</code>, WAF inspects both keys and values.</p>
    /// <p><code>All</code> does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical <code>AND</code> statement to combine two match rules, one that inspects the keys and another that inspects the values.</p>
    /// This field is required.
    pub fn match_scope(mut self, input: crate::types::MapMatchScope) -> Self {
        self.match_scope = ::std::option::Option::Some(input);
        self
    }
    /// <p>The parts of the headers to match with the rule inspection criteria. If you specify <code>ALL</code>, WAF inspects both keys and values.</p>
    /// <p><code>All</code> does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical <code>AND</code> statement to combine two match rules, one that inspects the keys and another that inspects the values.</p>
    pub fn set_match_scope(mut self, input: ::std::option::Option<crate::types::MapMatchScope>) -> Self {
        self.match_scope = input;
        self
    }
    /// <p>The parts of the headers to match with the rule inspection criteria. If you specify <code>ALL</code>, WAF inspects both keys and values.</p>
    /// <p><code>All</code> does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical <code>AND</code> statement to combine two match rules, one that inspects the keys and another that inspects the values.</p>
    pub fn get_match_scope(&self) -> &::std::option::Option<crate::types::MapMatchScope> {
        &self.match_scope
    }
    /// <p>What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.</p>
    /// <p>The options for oversize handling are the following:</p>
    /// <ul>
    /// <li>
    /// <p><code>CONTINUE</code> - Inspect the available headers normally, according to the rule inspection criteria.</p></li>
    /// <li>
    /// <p><code>MATCH</code> - Treat the web request as matching the rule statement. WAF applies the rule action to the request.</p></li>
    /// <li>
    /// <p><code>NO_MATCH</code> - Treat the web request as not matching the rule statement.</p></li>
    /// </ul>
    /// This field is required.
    pub fn oversize_handling(mut self, input: crate::types::OversizeHandling) -> Self {
        self.oversize_handling = ::std::option::Option::Some(input);
        self
    }
    /// <p>What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.</p>
    /// <p>The options for oversize handling are the following:</p>
    /// <ul>
    /// <li>
    /// <p><code>CONTINUE</code> - Inspect the available headers normally, according to the rule inspection criteria.</p></li>
    /// <li>
    /// <p><code>MATCH</code> - Treat the web request as matching the rule statement. WAF applies the rule action to the request.</p></li>
    /// <li>
    /// <p><code>NO_MATCH</code> - Treat the web request as not matching the rule statement.</p></li>
    /// </ul>
    pub fn set_oversize_handling(mut self, input: ::std::option::Option<crate::types::OversizeHandling>) -> Self {
        self.oversize_handling = input;
        self
    }
    /// <p>What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.</p>
    /// <p>The options for oversize handling are the following:</p>
    /// <ul>
    /// <li>
    /// <p><code>CONTINUE</code> - Inspect the available headers normally, according to the rule inspection criteria.</p></li>
    /// <li>
    /// <p><code>MATCH</code> - Treat the web request as matching the rule statement. WAF applies the rule action to the request.</p></li>
    /// <li>
    /// <p><code>NO_MATCH</code> - Treat the web request as not matching the rule statement.</p></li>
    /// </ul>
    pub fn get_oversize_handling(&self) -> &::std::option::Option<crate::types::OversizeHandling> {
        &self.oversize_handling
    }
    /// Consumes the builder and constructs a [`Headers`](crate::types::Headers).
    /// This method will fail if any of the following fields are not set:
    /// - [`match_scope`](crate::types::builders::HeadersBuilder::match_scope)
    /// - [`oversize_handling`](crate::types::builders::HeadersBuilder::oversize_handling)
    pub fn build(self) -> ::std::result::Result<crate::types::Headers, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Headers {
            match_pattern: self.match_pattern,
            match_scope: self.match_scope.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "match_scope",
                    "match_scope was not specified but it is required when building Headers",
                )
            })?,
            oversize_handling: self.oversize_handling.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "oversize_handling",
                    "oversize_handling was not specified but it is required when building Headers",
                )
            })?,
        })
    }
}