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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Filtering that specifies which web requests are kept in the logs and which are dropped, defined for a web ACL's <code>LoggingConfiguration</code>.</p>
/// <p>You can filter on the rule action and on the web request labels that were applied by matching rules during web ACL evaluation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct LoggingFilter {
/// <p>The filters that you want to apply to the logs.</p>
pub filters: ::std::vec::Vec<crate::types::Filter>,
/// <p>Default handling for logs that don't match any of the specified filtering conditions.</p>
pub default_behavior: crate::types::FilterBehavior,
}
impl LoggingFilter {
/// <p>The filters that you want to apply to the logs.</p>
pub fn filters(&self) -> &[crate::types::Filter] {
use std::ops::Deref;
self.filters.deref()
}
/// <p>Default handling for logs that don't match any of the specified filtering conditions.</p>
pub fn default_behavior(&self) -> &crate::types::FilterBehavior {
&self.default_behavior
}
}
impl LoggingFilter {
/// Creates a new builder-style object to manufacture [`LoggingFilter`](crate::types::LoggingFilter).
pub fn builder() -> crate::types::builders::LoggingFilterBuilder {
crate::types::builders::LoggingFilterBuilder::default()
}
}
/// A builder for [`LoggingFilter`](crate::types::LoggingFilter).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct LoggingFilterBuilder {
pub(crate) filters: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>,
pub(crate) default_behavior: ::std::option::Option<crate::types::FilterBehavior>,
}
impl LoggingFilterBuilder {
/// Appends an item to `filters`.
///
/// To override the contents of this collection use [`set_filters`](Self::set_filters).
///
/// <p>The filters that you want to apply to the logs.</p>
pub fn filters(mut self, input: crate::types::Filter) -> Self {
let mut v = self.filters.unwrap_or_default();
v.push(input);
self.filters = ::std::option::Option::Some(v);
self
}
/// <p>The filters that you want to apply to the logs.</p>
pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
self.filters = input;
self
}
/// <p>The filters that you want to apply to the logs.</p>
pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
&self.filters
}
/// <p>Default handling for logs that don't match any of the specified filtering conditions.</p>
/// This field is required.
pub fn default_behavior(mut self, input: crate::types::FilterBehavior) -> Self {
self.default_behavior = ::std::option::Option::Some(input);
self
}
/// <p>Default handling for logs that don't match any of the specified filtering conditions.</p>
pub fn set_default_behavior(mut self, input: ::std::option::Option<crate::types::FilterBehavior>) -> Self {
self.default_behavior = input;
self
}
/// <p>Default handling for logs that don't match any of the specified filtering conditions.</p>
pub fn get_default_behavior(&self) -> &::std::option::Option<crate::types::FilterBehavior> {
&self.default_behavior
}
/// Consumes the builder and constructs a [`LoggingFilter`](crate::types::LoggingFilter).
/// This method will fail if any of the following fields are not set:
/// - [`filters`](crate::types::builders::LoggingFilterBuilder::filters)
/// - [`default_behavior`](crate::types::builders::LoggingFilterBuilder::default_behavior)
pub fn build(self) -> ::std::result::Result<crate::types::LoggingFilter, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::LoggingFilter {
filters: self.filters.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"filters",
"filters was not specified but it is required when building LoggingFilter",
)
})?,
default_behavior: self.default_behavior.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"default_behavior",
"default_behavior was not specified but it is required when building LoggingFilter",
)
})?,
})
}
}