com.amazonaws.services.wafv2.model.RateBasedStatementManagedKeysIPSet Maven / Gradle / Ivy
Show all versions of aws-java-sdk-wafv2 Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.wafv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The set of IP addresses that are currently blocked for a RateBasedStatement. This is only available for
* rate-based rules that aggregate on just the IP address, with the AggregateKeyType
set to IP
* or FORWARDED_IP
.
*
*
* 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.
*
*
* 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.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RateBasedStatementManagedKeysIPSet implements Serializable, Cloneable, StructuredPojo {
/**
*
* The version of the IP addresses, either IPV4
or IPV6
.
*
*/
private String iPAddressVersion;
/**
*
* The IP addresses that are currently blocked.
*
*/
private java.util.List addresses;
/**
*
* The version of the IP addresses, either IPV4
or IPV6
.
*
*
* @param iPAddressVersion
* The version of the IP addresses, either IPV4
or IPV6
.
* @see IPAddressVersion
*/
public void setIPAddressVersion(String iPAddressVersion) {
this.iPAddressVersion = iPAddressVersion;
}
/**
*
* The version of the IP addresses, either IPV4
or IPV6
.
*
*
* @return The version of the IP addresses, either IPV4
or IPV6
.
* @see IPAddressVersion
*/
public String getIPAddressVersion() {
return this.iPAddressVersion;
}
/**
*
* The version of the IP addresses, either IPV4
or IPV6
.
*
*
* @param iPAddressVersion
* The version of the IP addresses, either IPV4
or IPV6
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IPAddressVersion
*/
public RateBasedStatementManagedKeysIPSet withIPAddressVersion(String iPAddressVersion) {
setIPAddressVersion(iPAddressVersion);
return this;
}
/**
*
* The version of the IP addresses, either IPV4
or IPV6
.
*
*
* @param iPAddressVersion
* The version of the IP addresses, either IPV4
or IPV6
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IPAddressVersion
*/
public RateBasedStatementManagedKeysIPSet withIPAddressVersion(IPAddressVersion iPAddressVersion) {
this.iPAddressVersion = iPAddressVersion.toString();
return this;
}
/**
*
* The IP addresses that are currently blocked.
*
*
* @return The IP addresses that are currently blocked.
*/
public java.util.List getAddresses() {
return addresses;
}
/**
*
* The IP addresses that are currently blocked.
*
*
* @param addresses
* The IP addresses that are currently blocked.
*/
public void setAddresses(java.util.Collection addresses) {
if (addresses == null) {
this.addresses = null;
return;
}
this.addresses = new java.util.ArrayList(addresses);
}
/**
*
* The IP addresses that are currently blocked.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setAddresses(java.util.Collection)} or {@link #withAddresses(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param addresses
* The IP addresses that are currently blocked.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RateBasedStatementManagedKeysIPSet withAddresses(String... addresses) {
if (this.addresses == null) {
setAddresses(new java.util.ArrayList(addresses.length));
}
for (String ele : addresses) {
this.addresses.add(ele);
}
return this;
}
/**
*
* The IP addresses that are currently blocked.
*
*
* @param addresses
* The IP addresses that are currently blocked.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RateBasedStatementManagedKeysIPSet withAddresses(java.util.Collection addresses) {
setAddresses(addresses);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getIPAddressVersion() != null)
sb.append("IPAddressVersion: ").append(getIPAddressVersion()).append(",");
if (getAddresses() != null)
sb.append("Addresses: ").append(getAddresses());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RateBasedStatementManagedKeysIPSet == false)
return false;
RateBasedStatementManagedKeysIPSet other = (RateBasedStatementManagedKeysIPSet) obj;
if (other.getIPAddressVersion() == null ^ this.getIPAddressVersion() == null)
return false;
if (other.getIPAddressVersion() != null && other.getIPAddressVersion().equals(this.getIPAddressVersion()) == false)
return false;
if (other.getAddresses() == null ^ this.getAddresses() == null)
return false;
if (other.getAddresses() != null && other.getAddresses().equals(this.getAddresses()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getIPAddressVersion() == null) ? 0 : getIPAddressVersion().hashCode());
hashCode = prime * hashCode + ((getAddresses() == null) ? 0 : getAddresses().hashCode());
return hashCode;
}
@Override
public RateBasedStatementManagedKeysIPSet clone() {
try {
return (RateBasedStatementManagedKeysIPSet) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.wafv2.model.transform.RateBasedStatementManagedKeysIPSetMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}