/* * Copyright 2018-2023 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; /** *
* Specifies a single custom aggregate key for a rate-base rule. *
** Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based * rule evaluation and handling. *
** Use the value of a header in the request as an aggregate key. Each distinct value in the header contributes to * the aggregation instance. If you use a single header as your custom key, then each value fully defines an * aggregation instance. *
*/ private RateLimitHeader header; /** ** Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie contributes to * the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an * aggregation instance. *
*/ private RateLimitCookie cookie; /** ** Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each value * fully defines an aggregation instance. *
*/ private RateLimitQueryArgument queryArgument; /** ** Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation instance. * If you use just the query string as your custom key, then each string fully defines an aggregation instance. *
*/ private RateLimitQueryString queryString; /** ** Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the aggregation * instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation * instance. *
*/ private RateLimitHTTPMethod hTTPMethod; /** ** Use the first IP address in an HTTP header as an aggregate key. Each distinct forwarded IP address contributes to * the aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP
in your
* rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's ForwardedIPConfig
* property.
*
* Use the request's originating IP address as an aggregate key. Each distinct IP address contributes to the * aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the IP address by specifying IP
in your rate-based statement's
* AggregateKeyType
.
*
* Use the specified label namespace as an aggregate key. 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. *
** 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. *
** For information about label namespaces and names, see Label syntax and * naming requirements in the WAF Developer Guide. *
*/ private RateLimitLabelNamespace labelNamespace; /** ** Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation instance. * If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance. *
*/ private RateLimitUriPath uriPath; /** ** Use the value of a header in the request as an aggregate key. Each distinct value in the header contributes to * the aggregation instance. If you use a single header as your custom key, then each value fully defines an * aggregation instance. *
* * @param header * Use the value of a header in the request as an aggregate key. Each distinct value in the header * contributes to the aggregation instance. If you use a single header as your custom key, then each value * fully defines an aggregation instance. */ public void setHeader(RateLimitHeader header) { this.header = header; } /** ** Use the value of a header in the request as an aggregate key. Each distinct value in the header contributes to * the aggregation instance. If you use a single header as your custom key, then each value fully defines an * aggregation instance. *
* * @return Use the value of a header in the request as an aggregate key. Each distinct value in the header * contributes to the aggregation instance. If you use a single header as your custom key, then each value * fully defines an aggregation instance. */ public RateLimitHeader getHeader() { return this.header; } /** ** Use the value of a header in the request as an aggregate key. Each distinct value in the header contributes to * the aggregation instance. If you use a single header as your custom key, then each value fully defines an * aggregation instance. *
* * @param header * Use the value of a header in the request as an aggregate key. Each distinct value in the header * contributes to the aggregation instance. If you use a single header as your custom key, then each value * fully defines an aggregation instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withHeader(RateLimitHeader header) { setHeader(header); return this; } /** ** Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie contributes to * the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an * aggregation instance. *
* * @param cookie * Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie * contributes to the aggregation instance. If you use a single cookie as your custom key, then each value * fully defines an aggregation instance. */ public void setCookie(RateLimitCookie cookie) { this.cookie = cookie; } /** ** Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie contributes to * the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an * aggregation instance. *
* * @return Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie * contributes to the aggregation instance. If you use a single cookie as your custom key, then each value * fully defines an aggregation instance. */ public RateLimitCookie getCookie() { return this.cookie; } /** ** Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie contributes to * the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an * aggregation instance. *
* * @param cookie * Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie * contributes to the aggregation instance. If you use a single cookie as your custom key, then each value * fully defines an aggregation instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withCookie(RateLimitCookie cookie) { setCookie(cookie); return this; } /** ** Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each value * fully defines an aggregation instance. *
* * @param queryArgument * Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each * value fully defines an aggregation instance. */ public void setQueryArgument(RateLimitQueryArgument queryArgument) { this.queryArgument = queryArgument; } /** ** Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each value * fully defines an aggregation instance. *
* * @return Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each * value fully defines an aggregation instance. */ public RateLimitQueryArgument getQueryArgument() { return this.queryArgument; } /** ** Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each value * fully defines an aggregation instance. *
* * @param queryArgument * Use the specified query argument as an aggregate key. Each distinct value for the named query argument * contributes to the aggregation instance. If you use a single query argument as your custom key, then each * value fully defines an aggregation instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withQueryArgument(RateLimitQueryArgument queryArgument) { setQueryArgument(queryArgument); return this; } /** ** Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation instance. * If you use just the query string as your custom key, then each string fully defines an aggregation instance. *
* * @param queryString * Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation * instance. If you use just the query string as your custom key, then each string fully defines an * aggregation instance. */ public void setQueryString(RateLimitQueryString queryString) { this.queryString = queryString; } /** ** Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation instance. * If you use just the query string as your custom key, then each string fully defines an aggregation instance. *
* * @return Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation * instance. If you use just the query string as your custom key, then each string fully defines an * aggregation instance. */ public RateLimitQueryString getQueryString() { return this.queryString; } /** ** Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation instance. * If you use just the query string as your custom key, then each string fully defines an aggregation instance. *
* * @param queryString * Use the request's query string as an aggregate key. Each distinct string contributes to the aggregation * instance. If you use just the query string as your custom key, then each string fully defines an * aggregation instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withQueryString(RateLimitQueryString queryString) { setQueryString(queryString); return this; } /** ** Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the aggregation * instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation * instance. *
* * @param hTTPMethod * Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the * aggregation instance. If you use just the HTTP method as your custom key, then each method fully defines * an aggregation instance. */ public void setHTTPMethod(RateLimitHTTPMethod hTTPMethod) { this.hTTPMethod = hTTPMethod; } /** ** Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the aggregation * instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation * instance. *
* * @return Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the * aggregation instance. If you use just the HTTP method as your custom key, then each method fully defines * an aggregation instance. */ public RateLimitHTTPMethod getHTTPMethod() { return this.hTTPMethod; } /** ** Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the aggregation * instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation * instance. *
* * @param hTTPMethod * Use the request's HTTP method as an aggregate key. Each distinct HTTP method contributes to the * aggregation instance. If you use just the HTTP method as your custom key, then each method fully defines * an aggregation instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withHTTPMethod(RateLimitHTTPMethod hTTPMethod) { setHTTPMethod(hTTPMethod); return this; } /** ** Use the first IP address in an HTTP header as an aggregate key. Each distinct forwarded IP address contributes to * the aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP
in your
* rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's ForwardedIPConfig
* property.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the forwarded IP address by specifying
* FORWARDED_IP
in your rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's
* ForwardedIPConfig
property.
*/
public void setForwardedIP(RateLimitForwardedIP forwardedIP) {
this.forwardedIP = forwardedIP;
}
/**
*
* Use the first IP address in an HTTP header as an aggregate key. Each distinct forwarded IP address contributes to * the aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP
in your
* rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's ForwardedIPConfig
* property.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the forwarded IP address by specifying
* FORWARDED_IP
in your rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's
* ForwardedIPConfig
property.
*/
public RateLimitForwardedIP getForwardedIP() {
return this.forwardedIP;
}
/**
*
* Use the first IP address in an HTTP header as an aggregate key. Each distinct forwarded IP address contributes to * the aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP
in your
* rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's ForwardedIPConfig
* property.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the forwarded IP address by specifying
* FORWARDED_IP
in your rate-based statement's AggregateKeyType
.
*
* With this option, you must specify the header to use in the rate-based rule's
* ForwardedIPConfig
property.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RateBasedStatementCustomKey withForwardedIP(RateLimitForwardedIP forwardedIP) {
setForwardedIP(forwardedIP);
return this;
}
/**
*
* Use the request's originating IP address as an aggregate key. Each distinct IP address contributes to the * aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the IP address by specifying IP
in your rate-based statement's
* AggregateKeyType
.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the IP address by specifying IP
in your
* rate-based statement's AggregateKeyType
.
*/
public void setIP(RateLimitIP iP) {
this.iP = iP;
}
/**
*
* Use the request's originating IP address as an aggregate key. Each distinct IP address contributes to the * aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the IP address by specifying IP
in your rate-based statement's
* AggregateKeyType
.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the IP address by specifying IP
in your
* rate-based statement's AggregateKeyType
.
*/
public RateLimitIP getIP() {
return this.iP;
}
/**
*
* Use the request's originating IP address as an aggregate key. Each distinct IP address contributes to the * aggregation instance. *
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key
* to use. You can aggregate on only the IP address by specifying IP
in your rate-based statement's
* AggregateKeyType
.
*
* When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one
* other key to use. You can aggregate on only the IP address by specifying IP
in your
* rate-based statement's AggregateKeyType
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RateBasedStatementCustomKey withIP(RateLimitIP iP) {
setIP(iP);
return this;
}
/**
*
* Use the specified label namespace as an aggregate key. 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. *
** 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. *
** For information about label namespaces and names, see Label syntax and * naming requirements in the WAF Developer Guide. *
* * @param labelNamespace * Use the specified label namespace as an aggregate key. 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. ** 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. *
** For information about label namespaces and names, see Label syntax * and naming requirements in the WAF Developer Guide. */ public void setLabelNamespace(RateLimitLabelNamespace labelNamespace) { this.labelNamespace = labelNamespace; } /** *
* Use the specified label namespace as an aggregate key. 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. *
** 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. *
** For information about label namespaces and names, see Label syntax and * naming requirements in the WAF Developer Guide. *
* * @return Use the specified label namespace as an aggregate key. 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. ** 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. *
** For information about label namespaces and names, see Label * syntax and naming requirements in the WAF Developer Guide. */ public RateLimitLabelNamespace getLabelNamespace() { return this.labelNamespace; } /** *
* Use the specified label namespace as an aggregate key. 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. *
** 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. *
** For information about label namespaces and names, see Label syntax and * naming requirements in the WAF Developer Guide. *
* * @param labelNamespace * Use the specified label namespace as an aggregate key. 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. ** 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. *
** For information about label namespaces and names, see Label syntax * and naming requirements in the WAF Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withLabelNamespace(RateLimitLabelNamespace labelNamespace) { setLabelNamespace(labelNamespace); return this; } /** *
* Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation instance. * If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance. *
* * @param uriPath * Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation * instance. If you use just the URI path as your custom key, then each URI path fully defines an aggregation * instance. */ public void setUriPath(RateLimitUriPath uriPath) { this.uriPath = uriPath; } /** ** Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation instance. * If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance. *
* * @return Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation * instance. If you use just the URI path as your custom key, then each URI path fully defines an * aggregation instance. */ public RateLimitUriPath getUriPath() { return this.uriPath; } /** ** Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation instance. * If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance. *
* * @param uriPath * Use the request's URI path as an aggregate key. Each distinct URI path contributes to the aggregation * instance. If you use just the URI path as your custom key, then each URI path fully defines an aggregation * instance. * @return Returns a reference to this object so that method calls can be chained together. */ public RateBasedStatementCustomKey withUriPath(RateLimitUriPath uriPath) { setUriPath(uriPath); 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 (getHeader() != null) sb.append("Header: ").append(getHeader()).append(","); if (getCookie() != null) sb.append("Cookie: ").append(getCookie()).append(","); if (getQueryArgument() != null) sb.append("QueryArgument: ").append(getQueryArgument()).append(","); if (getQueryString() != null) sb.append("QueryString: ").append(getQueryString()).append(","); if (getHTTPMethod() != null) sb.append("HTTPMethod: ").append(getHTTPMethod()).append(","); if (getForwardedIP() != null) sb.append("ForwardedIP: ").append(getForwardedIP()).append(","); if (getIP() != null) sb.append("IP: ").append(getIP()).append(","); if (getLabelNamespace() != null) sb.append("LabelNamespace: ").append(getLabelNamespace()).append(","); if (getUriPath() != null) sb.append("UriPath: ").append(getUriPath()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RateBasedStatementCustomKey == false) return false; RateBasedStatementCustomKey other = (RateBasedStatementCustomKey) obj; if (other.getHeader() == null ^ this.getHeader() == null) return false; if (other.getHeader() != null && other.getHeader().equals(this.getHeader()) == false) return false; if (other.getCookie() == null ^ this.getCookie() == null) return false; if (other.getCookie() != null && other.getCookie().equals(this.getCookie()) == false) return false; if (other.getQueryArgument() == null ^ this.getQueryArgument() == null) return false; if (other.getQueryArgument() != null && other.getQueryArgument().equals(this.getQueryArgument()) == false) return false; if (other.getQueryString() == null ^ this.getQueryString() == null) return false; if (other.getQueryString() != null && other.getQueryString().equals(this.getQueryString()) == false) return false; if (other.getHTTPMethod() == null ^ this.getHTTPMethod() == null) return false; if (other.getHTTPMethod() != null && other.getHTTPMethod().equals(this.getHTTPMethod()) == false) return false; if (other.getForwardedIP() == null ^ this.getForwardedIP() == null) return false; if (other.getForwardedIP() != null && other.getForwardedIP().equals(this.getForwardedIP()) == false) return false; if (other.getIP() == null ^ this.getIP() == null) return false; if (other.getIP() != null && other.getIP().equals(this.getIP()) == false) return false; if (other.getLabelNamespace() == null ^ this.getLabelNamespace() == null) return false; if (other.getLabelNamespace() != null && other.getLabelNamespace().equals(this.getLabelNamespace()) == false) return false; if (other.getUriPath() == null ^ this.getUriPath() == null) return false; if (other.getUriPath() != null && other.getUriPath().equals(this.getUriPath()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getHeader() == null) ? 0 : getHeader().hashCode()); hashCode = prime * hashCode + ((getCookie() == null) ? 0 : getCookie().hashCode()); hashCode = prime * hashCode + ((getQueryArgument() == null) ? 0 : getQueryArgument().hashCode()); hashCode = prime * hashCode + ((getQueryString() == null) ? 0 : getQueryString().hashCode()); hashCode = prime * hashCode + ((getHTTPMethod() == null) ? 0 : getHTTPMethod().hashCode()); hashCode = prime * hashCode + ((getForwardedIP() == null) ? 0 : getForwardedIP().hashCode()); hashCode = prime * hashCode + ((getIP() == null) ? 0 : getIP().hashCode()); hashCode = prime * hashCode + ((getLabelNamespace() == null) ? 0 : getLabelNamespace().hashCode()); hashCode = prime * hashCode + ((getUriPath() == null) ? 0 : getUriPath().hashCode()); return hashCode; } @Override public RateBasedStatementCustomKey clone() { try { return (RateBasedStatementCustomKey) 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.RateBasedStatementCustomKeyMarshaller.getInstance().marshall(this, protocolMarshaller); } }