com.amazonaws.services.wafv2.model.FieldToMatch Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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;
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information, including
* how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* The part of a web request that you want AWS WAF to inspect. Include the single FieldToMatch
type that
* you want to inspect, with additional specifications as needed, according to the type. You specify a single request
* component in FieldToMatch
for each rule statement that requires it. To inspect more than one component
* of a web request, create a separate rule statement for each component.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FieldToMatch implements Serializable, Cloneable, StructuredPojo {
/**
*
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
or
* Referer
. This setting isn't case sensitive.
*
*/
private SingleHeader singleHeader;
/**
*
* Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or
* SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
*
*/
private SingleQueryArgument singleQueryArgument;
/**
*
* Inspect all query arguments.
*
*/
private AllQueryArguments allQueryArguments;
/**
*
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*
*/
private UriPath uriPath;
/**
*
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
*
*/
private QueryString queryString;
/**
*
* Inspect the request body, which immediately follows the request headers. This is the part of a request that
* contains any additional data that you want to send to your web server as the HTTP request body, such as data from
* a form.
*
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the
* underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow
* additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that
* enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of
* web requests whose bodies exceed the 8 KB limit.
*
*/
private Body body;
/**
*
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to
* perform.
*
*/
private Method method;
/**
*
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
or
* Referer
. This setting isn't case sensitive.
*
*
* @param singleHeader
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
* or Referer
. This setting isn't case sensitive.
*/
public void setSingleHeader(SingleHeader singleHeader) {
this.singleHeader = singleHeader;
}
/**
*
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
or
* Referer
. This setting isn't case sensitive.
*
*
* @return Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
* or Referer
. This setting isn't case sensitive.
*/
public SingleHeader getSingleHeader() {
return this.singleHeader;
}
/**
*
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
or
* Referer
. This setting isn't case sensitive.
*
*
* @param singleHeader
* Inspect a single header. Provide the name of the header to inspect, for example, User-Agent
* or Referer
. This setting isn't case sensitive.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withSingleHeader(SingleHeader singleHeader) {
setSingleHeader(singleHeader);
return this;
}
/**
*
* Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or
* SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
*
*
* @param singleQueryArgument
* Inspect a single query argument. Provide the name of the query argument to inspect, such as
* UserName or SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
*/
public void setSingleQueryArgument(SingleQueryArgument singleQueryArgument) {
this.singleQueryArgument = singleQueryArgument;
}
/**
*
* Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or
* SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
*
*
* @return Inspect a single query argument. Provide the name of the query argument to inspect, such as
* UserName or SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the
* FieldToMatch specification.
*/
public SingleQueryArgument getSingleQueryArgument() {
return this.singleQueryArgument;
}
/**
*
* Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or
* SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
*
*
* @param singleQueryArgument
* Inspect a single query argument. Provide the name of the query argument to inspect, such as
* UserName or SalesRegion. The name can be up to 30 characters long and isn't case sensitive.
*
*
* This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch
* specification.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withSingleQueryArgument(SingleQueryArgument singleQueryArgument) {
setSingleQueryArgument(singleQueryArgument);
return this;
}
/**
*
* Inspect all query arguments.
*
*
* @param allQueryArguments
* Inspect all query arguments.
*/
public void setAllQueryArguments(AllQueryArguments allQueryArguments) {
this.allQueryArguments = allQueryArguments;
}
/**
*
* Inspect all query arguments.
*
*
* @return Inspect all query arguments.
*/
public AllQueryArguments getAllQueryArguments() {
return this.allQueryArguments;
}
/**
*
* Inspect all query arguments.
*
*
* @param allQueryArguments
* Inspect all query arguments.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withAllQueryArguments(AllQueryArguments allQueryArguments) {
setAllQueryArguments(allQueryArguments);
return this;
}
/**
*
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*
*
* @param uriPath
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*/
public void setUriPath(UriPath uriPath) {
this.uriPath = uriPath;
}
/**
*
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*
*
* @return Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*/
public UriPath getUriPath() {
return this.uriPath;
}
/**
*
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
*
*
* @param uriPath
* Inspect the request URI path. This is the part of a web request that identifies a resource, for example,
* /images/daily-ad.jpg
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withUriPath(UriPath uriPath) {
setUriPath(uriPath);
return this;
}
/**
*
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
*
*
* @param queryString
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
*/
public void setQueryString(QueryString queryString) {
this.queryString = queryString;
}
/**
*
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
*
*
* @return Inspect the query string. This is the part of a URL that appears after a ?
character, if
* any.
*/
public QueryString getQueryString() {
return this.queryString;
}
/**
*
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
*
*
* @param queryString
* Inspect the query string. This is the part of a URL that appears after a ?
character, if any.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withQueryString(QueryString queryString) {
setQueryString(queryString);
return this;
}
/**
*
* Inspect the request body, which immediately follows the request headers. This is the part of a request that
* contains any additional data that you want to send to your web server as the HTTP request body, such as data from
* a form.
*
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the
* underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow
* additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that
* enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of
* web requests whose bodies exceed the 8 KB limit.
*
*
* @param body
* Inspect the request body, which immediately follows the request headers. This is the part of a request
* that contains any additional data that you want to send to your web server as the HTTP request body, such
* as data from a form.
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by
* the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't
* allow additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a
* SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF
* doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.
*/
public void setBody(Body body) {
this.body = body;
}
/**
*
* Inspect the request body, which immediately follows the request headers. This is the part of a request that
* contains any additional data that you want to send to your web server as the HTTP request body, such as data from
* a form.
*
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the
* underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow
* additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that
* enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of
* web requests whose bodies exceed the 8 KB limit.
*
*
* @return Inspect the request body, which immediately follows the request headers. This is the part of a request
* that contains any additional data that you want to send to your web server as the HTTP request body, such
* as data from a form.
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by
* the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you
* don't allow additional bytes in by combining a statement that inspects the body of the web request, such
* as ByteMatchStatement or RegexPatternSetReferenceStatement, with a
* SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF
* doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.
*/
public Body getBody() {
return this.body;
}
/**
*
* Inspect the request body, which immediately follows the request headers. This is the part of a request that
* contains any additional data that you want to send to your web server as the HTTP request body, such as data from
* a form.
*
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the
* underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow
* additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that
* enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of
* web requests whose bodies exceed the 8 KB limit.
*
*
* @param body
* Inspect the request body, which immediately follows the request headers. This is the part of a request
* that contains any additional data that you want to send to your web server as the HTTP request body, such
* as data from a form.
*
* Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by
* the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't
* allow additional bytes in by combining a statement that inspects the body of the web request, such as
* ByteMatchStatement or RegexPatternSetReferenceStatement, with a
* SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF
* doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withBody(Body body) {
setBody(body);
return this;
}
/**
*
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to
* perform.
*
*
* @param method
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin
* to perform.
*/
public void setMethod(Method method) {
this.method = method;
}
/**
*
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to
* perform.
*
*
* @return Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin
* to perform.
*/
public Method getMethod() {
return this.method;
}
/**
*
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to
* perform.
*
*
* @param method
* Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin
* to perform.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldToMatch withMethod(Method method) {
setMethod(method);
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 (getSingleHeader() != null)
sb.append("SingleHeader: ").append(getSingleHeader()).append(",");
if (getSingleQueryArgument() != null)
sb.append("SingleQueryArgument: ").append(getSingleQueryArgument()).append(",");
if (getAllQueryArguments() != null)
sb.append("AllQueryArguments: ").append(getAllQueryArguments()).append(",");
if (getUriPath() != null)
sb.append("UriPath: ").append(getUriPath()).append(",");
if (getQueryString() != null)
sb.append("QueryString: ").append(getQueryString()).append(",");
if (getBody() != null)
sb.append("Body: ").append(getBody()).append(",");
if (getMethod() != null)
sb.append("Method: ").append(getMethod());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof FieldToMatch == false)
return false;
FieldToMatch other = (FieldToMatch) obj;
if (other.getSingleHeader() == null ^ this.getSingleHeader() == null)
return false;
if (other.getSingleHeader() != null && other.getSingleHeader().equals(this.getSingleHeader()) == false)
return false;
if (other.getSingleQueryArgument() == null ^ this.getSingleQueryArgument() == null)
return false;
if (other.getSingleQueryArgument() != null && other.getSingleQueryArgument().equals(this.getSingleQueryArgument()) == false)
return false;
if (other.getAllQueryArguments() == null ^ this.getAllQueryArguments() == null)
return false;
if (other.getAllQueryArguments() != null && other.getAllQueryArguments().equals(this.getAllQueryArguments()) == false)
return false;
if (other.getUriPath() == null ^ this.getUriPath() == null)
return false;
if (other.getUriPath() != null && other.getUriPath().equals(this.getUriPath()) == 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.getBody() == null ^ this.getBody() == null)
return false;
if (other.getBody() != null && other.getBody().equals(this.getBody()) == false)
return false;
if (other.getMethod() == null ^ this.getMethod() == null)
return false;
if (other.getMethod() != null && other.getMethod().equals(this.getMethod()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSingleHeader() == null) ? 0 : getSingleHeader().hashCode());
hashCode = prime * hashCode + ((getSingleQueryArgument() == null) ? 0 : getSingleQueryArgument().hashCode());
hashCode = prime * hashCode + ((getAllQueryArguments() == null) ? 0 : getAllQueryArguments().hashCode());
hashCode = prime * hashCode + ((getUriPath() == null) ? 0 : getUriPath().hashCode());
hashCode = prime * hashCode + ((getQueryString() == null) ? 0 : getQueryString().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getMethod() == null) ? 0 : getMethod().hashCode());
return hashCode;
}
@Override
public FieldToMatch clone() {
try {
return (FieldToMatch) 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.FieldToMatchMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}