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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Specifies a label namespace to use as an aggregate key for a rate-based rule. Each distinct fully qualified label name that has the specified label namespace contributes to the aggregation instance. If you use just one label namespace as your custom key, then each label name fully defines an aggregation instance. </p>
/// <p>This uses only labels that have been added to the request by rules that are evaluated before this rate-based rule in the web ACL. </p>
/// <p>For information about label namespaces and names, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-label-requirements.html">Label syntax and naming requirements</a> in the <i>WAF Developer Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct RateLimitLabelNamespace {
/// <p>The namespace to use for aggregation. </p>
pub namespace: ::std::string::String,
}
impl RateLimitLabelNamespace {
/// <p>The namespace to use for aggregation. </p>
pub fn namespace(&self) -> &str {
use std::ops::Deref;
self.namespace.deref()
}
}
impl RateLimitLabelNamespace {
/// Creates a new builder-style object to manufacture [`RateLimitLabelNamespace`](crate::types::RateLimitLabelNamespace).
pub fn builder() -> crate::types::builders::RateLimitLabelNamespaceBuilder {
crate::types::builders::RateLimitLabelNamespaceBuilder::default()
}
}
/// A builder for [`RateLimitLabelNamespace`](crate::types::RateLimitLabelNamespace).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct RateLimitLabelNamespaceBuilder {
pub(crate) namespace: ::std::option::Option<::std::string::String>,
}
impl RateLimitLabelNamespaceBuilder {
/// <p>The namespace to use for aggregation. </p>
/// This field is required.
pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.namespace = ::std::option::Option::Some(input.into());
self
}
/// <p>The namespace to use for aggregation. </p>
pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.namespace = input;
self
}
/// <p>The namespace to use for aggregation. </p>
pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
&self.namespace
}
/// Consumes the builder and constructs a [`RateLimitLabelNamespace`](crate::types::RateLimitLabelNamespace).
/// This method will fail if any of the following fields are not set:
/// - [`namespace`](crate::types::builders::RateLimitLabelNamespaceBuilder::namespace)
pub fn build(self) -> ::std::result::Result<crate::types::RateLimitLabelNamespace, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::RateLimitLabelNamespace {
namespace: self.namespace.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"namespace",
"namespace was not specified but it is required when building RateLimitLabelNamespace",
)
})?,
})
}
}