aws_sdk_wafv2/types/_rate_based_statement_managed_keys_ip_set.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The set of IP addresses that are currently blocked for a <code>RateBasedStatement</code>. This is only available for rate-based rules that aggregate on just the IP address, with the <code>AggregateKeyType</code> set to <code>IP</code> or <code>FORWARDED_IP</code>.</p>
4/// <p>A rate-based rule applies its rule action to requests from IP addresses that are in the rule's managed keys list and that match the rule's scope-down statement. When a rule has no scope-down statement, it applies the action to all requests from the IP addresses that are in the list. The rule applies its rule action to rate limit the matching requests. The action is usually Block but it can be any valid rule action except for Allow.</p>
5/// <p>The maximum number of IP addresses that can be rate limited by a single rate-based rule instance is 10,000. If more than 10,000 addresses exceed the rate limit, WAF limits those with the highest rates.</p>
6#[non_exhaustive]
7#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
8pub struct RateBasedStatementManagedKeysIpSet {
9 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
10 pub ip_address_version: ::std::option::Option<crate::types::IpAddressVersion>,
11 /// <p>The IP addresses that are currently blocked.</p>
12 pub addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13}
14impl RateBasedStatementManagedKeysIpSet {
15 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
16 pub fn ip_address_version(&self) -> ::std::option::Option<&crate::types::IpAddressVersion> {
17 self.ip_address_version.as_ref()
18 }
19 /// <p>The IP addresses that are currently blocked.</p>
20 ///
21 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.addresses.is_none()`.
22 pub fn addresses(&self) -> &[::std::string::String] {
23 self.addresses.as_deref().unwrap_or_default()
24 }
25}
26impl RateBasedStatementManagedKeysIpSet {
27 /// Creates a new builder-style object to manufacture [`RateBasedStatementManagedKeysIpSet`](crate::types::RateBasedStatementManagedKeysIpSet).
28 pub fn builder() -> crate::types::builders::RateBasedStatementManagedKeysIpSetBuilder {
29 crate::types::builders::RateBasedStatementManagedKeysIpSetBuilder::default()
30 }
31}
32
33/// A builder for [`RateBasedStatementManagedKeysIpSet`](crate::types::RateBasedStatementManagedKeysIpSet).
34#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
35#[non_exhaustive]
36pub struct RateBasedStatementManagedKeysIpSetBuilder {
37 pub(crate) ip_address_version: ::std::option::Option<crate::types::IpAddressVersion>,
38 pub(crate) addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
39}
40impl RateBasedStatementManagedKeysIpSetBuilder {
41 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
42 pub fn ip_address_version(mut self, input: crate::types::IpAddressVersion) -> Self {
43 self.ip_address_version = ::std::option::Option::Some(input);
44 self
45 }
46 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
47 pub fn set_ip_address_version(mut self, input: ::std::option::Option<crate::types::IpAddressVersion>) -> Self {
48 self.ip_address_version = input;
49 self
50 }
51 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
52 pub fn get_ip_address_version(&self) -> &::std::option::Option<crate::types::IpAddressVersion> {
53 &self.ip_address_version
54 }
55 /// Appends an item to `addresses`.
56 ///
57 /// To override the contents of this collection use [`set_addresses`](Self::set_addresses).
58 ///
59 /// <p>The IP addresses that are currently blocked.</p>
60 pub fn addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61 let mut v = self.addresses.unwrap_or_default();
62 v.push(input.into());
63 self.addresses = ::std::option::Option::Some(v);
64 self
65 }
66 /// <p>The IP addresses that are currently blocked.</p>
67 pub fn set_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
68 self.addresses = input;
69 self
70 }
71 /// <p>The IP addresses that are currently blocked.</p>
72 pub fn get_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
73 &self.addresses
74 }
75 /// Consumes the builder and constructs a [`RateBasedStatementManagedKeysIpSet`](crate::types::RateBasedStatementManagedKeysIpSet).
76 pub fn build(self) -> crate::types::RateBasedStatementManagedKeysIpSet {
77 crate::types::RateBasedStatementManagedKeysIpSet {
78 ip_address_version: self.ip_address_version,
79 addresses: self.addresses,
80 }
81 }
82}