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>The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule inspection criteria. This is used with the <code>FieldToMatch</code> option <code>JsonBody</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct JsonMatchPattern {
/// <p>Match all of the elements. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>You must specify either this setting or the <code>IncludedPaths</code> setting, but not both.</p>
pub all: ::std::option::Option<crate::types::All>,
/// <p>Match only the specified include paths. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>Provide the include paths using JSON Pointer syntax. For example, <code>"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]</code>. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>You must specify either this setting or the <code>All</code> setting, but not both.</p><note>
/// <p>Don't use this option to include all paths. Instead, use the <code>All</code> setting.</p>
/// </note>
pub included_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl JsonMatchPattern {
/// <p>Match all of the elements. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>You must specify either this setting or the <code>IncludedPaths</code> setting, but not both.</p>
pub fn all(&self) -> ::std::option::Option<&crate::types::All> {
self.all.as_ref()
}
/// <p>Match only the specified include paths. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>Provide the include paths using JSON Pointer syntax. For example, <code>"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]</code>. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>You must specify either this setting or the <code>All</code> setting, but not both.</p><note>
/// <p>Don't use this option to include all paths. Instead, use the <code>All</code> setting.</p>
/// </note>
///
/// 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_paths.is_none()`.
pub fn included_paths(&self) -> &[::std::string::String] {
self.included_paths.as_deref().unwrap_or_default()
}
}
impl JsonMatchPattern {
/// Creates a new builder-style object to manufacture [`JsonMatchPattern`](crate::types::JsonMatchPattern).
pub fn builder() -> crate::types::builders::JsonMatchPatternBuilder {
crate::types::builders::JsonMatchPatternBuilder::default()
}
}
/// A builder for [`JsonMatchPattern`](crate::types::JsonMatchPattern).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct JsonMatchPatternBuilder {
pub(crate) all: ::std::option::Option<crate::types::All>,
pub(crate) included_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl JsonMatchPatternBuilder {
/// <p>Match all of the elements. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>You must specify either this setting or the <code>IncludedPaths</code> setting, but not both.</p>
pub fn all(mut self, input: crate::types::All) -> Self {
self.all = ::std::option::Option::Some(input);
self
}
/// <p>Match all of the elements. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>You must specify either this setting or the <code>IncludedPaths</code> setting, but not both.</p>
pub fn set_all(mut self, input: ::std::option::Option<crate::types::All>) -> Self {
self.all = input;
self
}
/// <p>Match all of the elements. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>You must specify either this setting or the <code>IncludedPaths</code> setting, but not both.</p>
pub fn get_all(&self) -> &::std::option::Option<crate::types::All> {
&self.all
}
/// Appends an item to `included_paths`.
///
/// To override the contents of this collection use [`set_included_paths`](Self::set_included_paths).
///
/// <p>Match only the specified include paths. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>Provide the include paths using JSON Pointer syntax. For example, <code>"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]</code>. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>You must specify either this setting or the <code>All</code> setting, but not both.</p><note>
/// <p>Don't use this option to include all paths. Instead, use the <code>All</code> setting.</p>
/// </note>
pub fn included_paths(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.included_paths.unwrap_or_default();
v.push(input.into());
self.included_paths = ::std::option::Option::Some(v);
self
}
/// <p>Match only the specified include paths. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>Provide the include paths using JSON Pointer syntax. For example, <code>"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]</code>. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>You must specify either this setting or the <code>All</code> setting, but not both.</p><note>
/// <p>Don't use this option to include all paths. Instead, use the <code>All</code> setting.</p>
/// </note>
pub fn set_included_paths(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.included_paths = input;
self
}
/// <p>Match only the specified include paths. See also <code>MatchScope</code> in <code>JsonBody</code>.</p>
/// <p>Provide the include paths using JSON Pointer syntax. For example, <code>"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]</code>. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>You must specify either this setting or the <code>All</code> setting, but not both.</p><note>
/// <p>Don't use this option to include all paths. Instead, use the <code>All</code> setting.</p>
/// </note>
pub fn get_included_paths(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.included_paths
}
/// Consumes the builder and constructs a [`JsonMatchPattern`](crate::types::JsonMatchPattern).
pub fn build(self) -> crate::types::JsonMatchPattern {
crate::types::JsonMatchPattern {
all: self.all,
included_paths: self.included_paths,
}
}
}