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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <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>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct HeaderMatchPattern {
/// <p>Inspect all headers.</p>
pub all: ::std::option::Option<crate::types::All>,
/// <p>Inspect only the headers that have a key that matches one of the strings specified here.</p>
pub included_headers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>Inspect only the headers whose keys don't match any of the strings specified here.</p>
pub excluded_headers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl HeaderMatchPattern {
/// <p>Inspect all headers.</p>
pub fn all(&self) -> ::std::option::Option<&crate::types::All> {
self.all.as_ref()
}
/// <p>Inspect only the headers that have a key that matches one of the strings specified here.</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 `.included_headers.is_none()`.
pub fn included_headers(&self) -> &[::std::string::String] {
self.included_headers.as_deref().unwrap_or_default()
}
/// <p>Inspect only the headers whose keys don't match any of the strings specified here.</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 `.excluded_headers.is_none()`.
pub fn excluded_headers(&self) -> &[::std::string::String] {
self.excluded_headers.as_deref().unwrap_or_default()
}
}
impl HeaderMatchPattern {
/// Creates a new builder-style object to manufacture [`HeaderMatchPattern`](crate::types::HeaderMatchPattern).
pub fn builder() -> crate::types::builders::HeaderMatchPatternBuilder {
crate::types::builders::HeaderMatchPatternBuilder::default()
}
}
/// A builder for [`HeaderMatchPattern`](crate::types::HeaderMatchPattern).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct HeaderMatchPatternBuilder {
pub(crate) all: ::std::option::Option<crate::types::All>,
pub(crate) included_headers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) excluded_headers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl HeaderMatchPatternBuilder {
/// <p>Inspect all headers.</p>
pub fn all(mut self, input: crate::types::All) -> Self {
self.all = ::std::option::Option::Some(input);
self
}
/// <p>Inspect all headers.</p>
pub fn set_all(mut self, input: ::std::option::Option<crate::types::All>) -> Self {
self.all = input;
self
}
/// <p>Inspect all headers.</p>
pub fn get_all(&self) -> &::std::option::Option<crate::types::All> {
&self.all
}
/// Appends an item to `included_headers`.
///
/// To override the contents of this collection use [`set_included_headers`](Self::set_included_headers).
///
/// <p>Inspect only the headers that have a key that matches one of the strings specified here.</p>
pub fn included_headers(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.included_headers.unwrap_or_default();
v.push(input.into());
self.included_headers = ::std::option::Option::Some(v);
self
}
/// <p>Inspect only the headers that have a key that matches one of the strings specified here.</p>
pub fn set_included_headers(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.included_headers = input;
self
}
/// <p>Inspect only the headers that have a key that matches one of the strings specified here.</p>
pub fn get_included_headers(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.included_headers
}
/// Appends an item to `excluded_headers`.
///
/// To override the contents of this collection use [`set_excluded_headers`](Self::set_excluded_headers).
///
/// <p>Inspect only the headers whose keys don't match any of the strings specified here.</p>
pub fn excluded_headers(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.excluded_headers.unwrap_or_default();
v.push(input.into());
self.excluded_headers = ::std::option::Option::Some(v);
self
}
/// <p>Inspect only the headers whose keys don't match any of the strings specified here.</p>
pub fn set_excluded_headers(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.excluded_headers = input;
self
}
/// <p>Inspect only the headers whose keys don't match any of the strings specified here.</p>
pub fn get_excluded_headers(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.excluded_headers
}
/// Consumes the builder and constructs a [`HeaderMatchPattern`](crate::types::HeaderMatchPattern).
pub fn build(self) -> crate::types::HeaderMatchPattern {
crate::types::HeaderMatchPattern {
all: self.all,
included_headers: self.included_headers,
excluded_headers: self.excluded_headers,
}
}
}