software.amazon.awssdk.services.waf.model.SizeConstraint Maven / Gradle / Ivy
Show all versions of waf Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.waf.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*
* This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the
* developer guide.
*
*
* For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the
* latest version, AWS WAF has a single set of endpoints for regional and global use.
*
*
*
* Specifies a constraint on the size of a part of the web request. AWS WAF uses the Size
,
* ComparisonOperator
, and FieldToMatch
to build an expression in the form of "
* Size
ComparisonOperator
size in bytes of FieldToMatch
". If that expression is
* true, the SizeConstraint
is considered to match.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SizeConstraint implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField FIELD_TO_MATCH_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("FieldToMatch").getter(getter(SizeConstraint::fieldToMatch)).setter(setter(Builder::fieldToMatch))
.constructor(FieldToMatch::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FieldToMatch").build()).build();
private static final SdkField TEXT_TRANSFORMATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TextTransformation").getter(getter(SizeConstraint::textTransformationAsString))
.setter(setter(Builder::textTransformation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TextTransformation").build())
.build();
private static final SdkField COMPARISON_OPERATOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ComparisonOperator").getter(getter(SizeConstraint::comparisonOperatorAsString))
.setter(setter(Builder::comparisonOperator))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComparisonOperator").build())
.build();
private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Size")
.getter(getter(SizeConstraint::size)).setter(setter(Builder::size))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FIELD_TO_MATCH_FIELD,
TEXT_TRANSFORMATION_FIELD, COMPARISON_OPERATOR_FIELD, SIZE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("FieldToMatch", FIELD_TO_MATCH_FIELD);
put("TextTransformation", TEXT_TRANSFORMATION_FIELD);
put("ComparisonOperator", COMPARISON_OPERATOR_FIELD);
put("Size", SIZE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final FieldToMatch fieldToMatch;
private final String textTransformation;
private final String comparisonOperator;
private final Long size;
private SizeConstraint(BuilderImpl builder) {
this.fieldToMatch = builder.fieldToMatch;
this.textTransformation = builder.textTransformation;
this.comparisonOperator = builder.comparisonOperator;
this.size = builder.size;
}
/**
*
* Specifies where in a web request to look for the size constraint.
*
*
* @return Specifies where in a web request to look for the size constraint.
*/
public final FieldToMatch fieldToMatch() {
return fieldToMatch;
}
/**
*
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on FieldToMatch
* before inspecting it for a match.
*
*
* You can only specify a single type of TextTransformation.
*
*
* Note that if you choose BODY
for the value of Type
, you must choose NONE
* for TextTransformation
because CloudFront forwards only the first 8192 bytes for inspection.
*
*
* NONE
*
*
* Specify NONE
if you don't want to perform any text transformations.
*
*
* CMD_LINE
*
*
* When you're concerned that attackers are injecting an operating system command line command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
*
*
* -
*
* Delete the following characters: \ " ' ^
*
*
* -
*
* Delete spaces before the following characters: / (
*
*
* -
*
* Replace the following characters with a space: , ;
*
*
* -
*
* Replace multiple spaces with one space
*
*
* -
*
* Convert uppercase letters (A-Z) to lowercase (a-z)
*
*
*
*
* COMPRESS_WHITE_SPACE
*
*
* Use this option to replace the following characters with a space character (decimal 32):
*
*
* -
*
* \f, formfeed, decimal 12
*
*
* -
*
* \t, tab, decimal 9
*
*
* -
*
* \n, newline, decimal 10
*
*
* -
*
* \r, carriage return, decimal 13
*
*
* -
*
* \v, vertical tab, decimal 11
*
*
* -
*
* non-breaking space, decimal 160
*
*
*
*
* COMPRESS_WHITE_SPACE
also replaces multiple spaces with one space.
*
*
* HTML_ENTITY_DECODE
*
*
* Use this option to replace HTML-encoded characters with unencoded characters. HTML_ENTITY_DECODE
* performs the following operations:
*
*
* -
*
* Replaces (ampersand)quot;
with "
*
*
* -
*
* Replaces (ampersand)nbsp;
with a non-breaking space, decimal 160
*
*
* -
*
* Replaces (ampersand)lt;
with a "less than" symbol
*
*
* -
*
* Replaces (ampersand)gt;
with >
*
*
* -
*
* Replaces characters that are represented in hexadecimal format, (ampersand)#xhhhh;
, with the
* corresponding characters
*
*
* -
*
* Replaces characters that are represented in decimal format, (ampersand)#nnnn;
, with the
* corresponding characters
*
*
*
*
* LOWERCASE
*
*
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
*
*
* URL_DECODE
*
*
* Use this option to decode a URL-encoded value.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #textTransformation} will return {@link TextTransformation#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #textTransformationAsString}.
*
*
* @return Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* FieldToMatch
before inspecting it for a match.
*
* You can only specify a single type of TextTransformation.
*
*
* Note that if you choose BODY
for the value of Type
, you must choose
* NONE
for TextTransformation
because CloudFront forwards only the first 8192
* bytes for inspection.
*
*
* NONE
*
*
* Specify NONE
if you don't want to perform any text transformations.
*
*
* CMD_LINE
*
*
* When you're concerned that attackers are injecting an operating system command line command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
*
*
* -
*
* Delete the following characters: \ " ' ^
*
*
* -
*
* Delete spaces before the following characters: / (
*
*
* -
*
* Replace the following characters with a space: , ;
*
*
* -
*
* Replace multiple spaces with one space
*
*
* -
*
* Convert uppercase letters (A-Z) to lowercase (a-z)
*
*
*
*
* COMPRESS_WHITE_SPACE
*
*
* Use this option to replace the following characters with a space character (decimal 32):
*
*
* -
*
* \f, formfeed, decimal 12
*
*
* -
*
* \t, tab, decimal 9
*
*
* -
*
* \n, newline, decimal 10
*
*
* -
*
* \r, carriage return, decimal 13
*
*
* -
*
* \v, vertical tab, decimal 11
*
*
* -
*
* non-breaking space, decimal 160
*
*
*
*
* COMPRESS_WHITE_SPACE
also replaces multiple spaces with one space.
*
*
* HTML_ENTITY_DECODE
*
*
* Use this option to replace HTML-encoded characters with unencoded characters.
* HTML_ENTITY_DECODE
performs the following operations:
*
*
* -
*
* Replaces (ampersand)quot;
with "
*
*
* -
*
* Replaces (ampersand)nbsp;
with a non-breaking space, decimal 160
*
*
* -
*
* Replaces (ampersand)lt;
with a "less than" symbol
*
*
* -
*
* Replaces (ampersand)gt;
with >
*
*
* -
*
* Replaces characters that are represented in hexadecimal format, (ampersand)#xhhhh;
, with the
* corresponding characters
*
*
* -
*
* Replaces characters that are represented in decimal format, (ampersand)#nnnn;
, with the
* corresponding characters
*
*
*
*
* LOWERCASE
*
*
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
*
*
* URL_DECODE
*
*
* Use this option to decode a URL-encoded value.
* @see TextTransformation
*/
public final TextTransformation textTransformation() {
return TextTransformation.fromValue(textTransformation);
}
/**
*
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on FieldToMatch
* before inspecting it for a match.
*
*
* You can only specify a single type of TextTransformation.
*
*
* Note that if you choose BODY
for the value of Type
, you must choose NONE
* for TextTransformation
because CloudFront forwards only the first 8192 bytes for inspection.
*
*
* NONE
*
*
* Specify NONE
if you don't want to perform any text transformations.
*
*
* CMD_LINE
*
*
* When you're concerned that attackers are injecting an operating system command line command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
*
*
* -
*
* Delete the following characters: \ " ' ^
*
*
* -
*
* Delete spaces before the following characters: / (
*
*
* -
*
* Replace the following characters with a space: , ;
*
*
* -
*
* Replace multiple spaces with one space
*
*
* -
*
* Convert uppercase letters (A-Z) to lowercase (a-z)
*
*
*
*
* COMPRESS_WHITE_SPACE
*
*
* Use this option to replace the following characters with a space character (decimal 32):
*
*
* -
*
* \f, formfeed, decimal 12
*
*
* -
*
* \t, tab, decimal 9
*
*
* -
*
* \n, newline, decimal 10
*
*
* -
*
* \r, carriage return, decimal 13
*
*
* -
*
* \v, vertical tab, decimal 11
*
*
* -
*
* non-breaking space, decimal 160
*
*
*
*
* COMPRESS_WHITE_SPACE
also replaces multiple spaces with one space.
*
*
* HTML_ENTITY_DECODE
*
*
* Use this option to replace HTML-encoded characters with unencoded characters. HTML_ENTITY_DECODE
* performs the following operations:
*
*
* -
*
* Replaces (ampersand)quot;
with "
*
*
* -
*
* Replaces (ampersand)nbsp;
with a non-breaking space, decimal 160
*
*
* -
*
* Replaces (ampersand)lt;
with a "less than" symbol
*
*
* -
*
* Replaces (ampersand)gt;
with >
*
*
* -
*
* Replaces characters that are represented in hexadecimal format, (ampersand)#xhhhh;
, with the
* corresponding characters
*
*
* -
*
* Replaces characters that are represented in decimal format, (ampersand)#nnnn;
, with the
* corresponding characters
*
*
*
*
* LOWERCASE
*
*
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
*
*
* URL_DECODE
*
*
* Use this option to decode a URL-encoded value.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #textTransformation} will return {@link TextTransformation#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #textTransformationAsString}.
*
*
* @return Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* FieldToMatch
before inspecting it for a match.
*
* You can only specify a single type of TextTransformation.
*
*
* Note that if you choose BODY
for the value of Type
, you must choose
* NONE
for TextTransformation
because CloudFront forwards only the first 8192
* bytes for inspection.
*
*
* NONE
*
*
* Specify NONE
if you don't want to perform any text transformations.
*
*
* CMD_LINE
*
*
* When you're concerned that attackers are injecting an operating system command line command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
*
*
* -
*
* Delete the following characters: \ " ' ^
*
*
* -
*
* Delete spaces before the following characters: / (
*
*
* -
*
* Replace the following characters with a space: , ;
*
*
* -
*
* Replace multiple spaces with one space
*
*
* -
*
* Convert uppercase letters (A-Z) to lowercase (a-z)
*
*
*
*
* COMPRESS_WHITE_SPACE
*
*
* Use this option to replace the following characters with a space character (decimal 32):
*
*
* -
*
* \f, formfeed, decimal 12
*
*
* -
*
* \t, tab, decimal 9
*
*
* -
*
* \n, newline, decimal 10
*
*
* -
*
* \r, carriage return, decimal 13
*
*
* -
*
* \v, vertical tab, decimal 11
*
*
* -
*
* non-breaking space, decimal 160
*
*
*
*
* COMPRESS_WHITE_SPACE
also replaces multiple spaces with one space.
*
*
* HTML_ENTITY_DECODE
*
*
* Use this option to replace HTML-encoded characters with unencoded characters.
* HTML_ENTITY_DECODE
performs the following operations:
*
*
* -
*
* Replaces (ampersand)quot;
with "
*
*
* -
*
* Replaces (ampersand)nbsp;
with a non-breaking space, decimal 160
*
*
* -
*
* Replaces (ampersand)lt;
with a "less than" symbol
*
*
* -
*
* Replaces (ampersand)gt;
with >
*
*
* -
*
* Replaces characters that are represented in hexadecimal format, (ampersand)#xhhhh;
, with the
* corresponding characters
*
*
* -
*
* Replaces characters that are represented in decimal format, (ampersand)#nnnn;
, with the
* corresponding characters
*
*
*
*
* LOWERCASE
*
*
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
*
*
* URL_DECODE
*
*
* Use this option to decode a URL-encoded value.
* @see TextTransformation
*/
public final String textTransformationAsString() {
return textTransformation;
}
/**
*
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true, the
* SizeConstraint
is considered to match.
*
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #comparisonOperator} will return {@link ComparisonOperator#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #comparisonOperatorAsString}.
*
*
* @return The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true,
* the SizeConstraint
is considered to match.
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the
* FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
* @see ComparisonOperator
*/
public final ComparisonOperator comparisonOperator() {
return ComparisonOperator.fromValue(comparisonOperator);
}
/**
*
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true, the
* SizeConstraint
is considered to match.
*
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #comparisonOperator} will return {@link ComparisonOperator#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #comparisonOperatorAsString}.
*
*
* @return The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true,
* the SizeConstraint
is considered to match.
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the
* FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
* @see ComparisonOperator
*/
public final String comparisonOperatorAsString() {
return comparisonOperator;
}
/**
*
* The size in bytes that you want AWS WAF to compare against the size of the specified FieldToMatch
.
* AWS WAF uses this in combination with ComparisonOperator
and FieldToMatch
to build an
* expression in the form of "Size
ComparisonOperator
size in bytes of
* FieldToMatch
". If that expression is true, the SizeConstraint
is considered to match.
*
*
* Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
*
*
* If you specify URI
for the value of Type
, the / in the URI counts as one character. For
* example, the URI /logo.jpg
is nine characters long.
*
*
* @return The size in bytes that you want AWS WAF to compare against the size of the specified
* FieldToMatch
. AWS WAF uses this in combination with ComparisonOperator
and
* FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true,
* the SizeConstraint
is considered to match.
*
* Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
*
*
* If you specify URI
for the value of Type
, the / in the URI counts as one
* character. For example, the URI /logo.jpg
is nine characters long.
*/
public final Long size() {
return size;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(fieldToMatch());
hashCode = 31 * hashCode + Objects.hashCode(textTransformationAsString());
hashCode = 31 * hashCode + Objects.hashCode(comparisonOperatorAsString());
hashCode = 31 * hashCode + Objects.hashCode(size());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SizeConstraint)) {
return false;
}
SizeConstraint other = (SizeConstraint) obj;
return Objects.equals(fieldToMatch(), other.fieldToMatch())
&& Objects.equals(textTransformationAsString(), other.textTransformationAsString())
&& Objects.equals(comparisonOperatorAsString(), other.comparisonOperatorAsString())
&& Objects.equals(size(), other.size());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("SizeConstraint").add("FieldToMatch", fieldToMatch())
.add("TextTransformation", textTransformationAsString()).add("ComparisonOperator", comparisonOperatorAsString())
.add("Size", size()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FieldToMatch":
return Optional.ofNullable(clazz.cast(fieldToMatch()));
case "TextTransformation":
return Optional.ofNullable(clazz.cast(textTransformationAsString()));
case "ComparisonOperator":
return Optional.ofNullable(clazz.cast(comparisonOperatorAsString()));
case "Size":
return Optional.ofNullable(clazz.cast(size()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function
*
* You can only specify a single type of TextTransformation.
*
*
* Note that if you choose BODY
for the value of Type
, you must choose
* NONE
for TextTransformation
because CloudFront forwards only the first 8192
* bytes for inspection.
*
*
* NONE
*
*
* Specify NONE
if you don't want to perform any text transformations.
*
*
* CMD_LINE
*
*
* When you're concerned that attackers are injecting an operating system command line command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
*
*
* -
*
* Delete the following characters: \ " ' ^
*
*
* -
*
* Delete spaces before the following characters: / (
*
*
* -
*
* Replace the following characters with a space: , ;
*
*
* -
*
* Replace multiple spaces with one space
*
*
* -
*
* Convert uppercase letters (A-Z) to lowercase (a-z)
*
*
*
*
* COMPRESS_WHITE_SPACE
*
*
* Use this option to replace the following characters with a space character (decimal 32):
*
*
* -
*
* \f, formfeed, decimal 12
*
*
* -
*
* \t, tab, decimal 9
*
*
* -
*
* \n, newline, decimal 10
*
*
* -
*
* \r, carriage return, decimal 13
*
*
* -
*
* \v, vertical tab, decimal 11
*
*
* -
*
* non-breaking space, decimal 160
*
*
*
*
* COMPRESS_WHITE_SPACE
also replaces multiple spaces with one space.
*
*
* HTML_ENTITY_DECODE
*
*
* Use this option to replace HTML-encoded characters with unencoded characters.
* HTML_ENTITY_DECODE
performs the following operations:
*
*
* -
*
* Replaces (ampersand)quot;
with "
*
*
* -
*
* Replaces (ampersand)nbsp;
with a non-breaking space, decimal 160
*
*
* -
*
* Replaces (ampersand)lt;
with a "less than" symbol
*
*
* -
*
* Replaces (ampersand)gt;
with >
*
*
* -
*
* Replaces characters that are represented in hexadecimal format, (ampersand)#xhhhh;
, with
* the corresponding characters
*
*
* -
*
* Replaces characters that are represented in decimal format, (ampersand)#nnnn;
, with the
* corresponding characters
*
*
*
*
* LOWERCASE
*
*
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
*
*
* URL_DECODE
*
*
* Use this option to decode a URL-encoded value.
* @see TextTransformation
* @return Returns a reference to this object so that method calls can be chained together.
* @see TextTransformation
*/
Builder textTransformation(TextTransformation textTransformation);
/**
*
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true, the
* SizeConstraint
is considered to match.
*
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
*
*
* @param comparisonOperator
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "
* Size
ComparisonOperator
size in bytes of FieldToMatch
". If that
* expression is true, the SizeConstraint
is considered to match.
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the
* FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
* @see ComparisonOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
Builder comparisonOperator(String comparisonOperator);
/**
*
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true, the
* SizeConstraint
is considered to match.
*
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
*
*
* @param comparisonOperator
* The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided
* Size
and FieldToMatch
to build an expression in the form of "
* Size
ComparisonOperator
size in bytes of FieldToMatch
". If that
* expression is true, the SizeConstraint
is considered to match.
*
* EQ: Used to test if the Size
is equal to the size of the FieldToMatch
*
*
* NE: Used to test if the Size
is not equal to the size of the
* FieldToMatch
*
*
* LE: Used to test if the Size
is less than or equal to the size of the
* FieldToMatch
*
*
* LT: Used to test if the Size
is strictly less than the size of the
* FieldToMatch
*
*
* GE: Used to test if the Size
is greater than or equal to the size of the
* FieldToMatch
*
*
* GT: Used to test if the Size
is strictly greater than the size of the
* FieldToMatch
* @see ComparisonOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
Builder comparisonOperator(ComparisonOperator comparisonOperator);
/**
*
* The size in bytes that you want AWS WAF to compare against the size of the specified
* FieldToMatch
. AWS WAF uses this in combination with ComparisonOperator
and
* FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is true, the
* SizeConstraint
is considered to match.
*
*
* Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
*
*
* If you specify URI
for the value of Type
, the / in the URI counts as one character.
* For example, the URI /logo.jpg
is nine characters long.
*
*
* @param size
* The size in bytes that you want AWS WAF to compare against the size of the specified
* FieldToMatch
. AWS WAF uses this in combination with ComparisonOperator
and
* FieldToMatch
to build an expression in the form of "Size
* ComparisonOperator
size in bytes of FieldToMatch
". If that expression is
* true, the SizeConstraint
is considered to match.
*
* Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
*
*
* If you specify URI
for the value of Type
, the / in the URI counts as one
* character. For example, the URI /logo.jpg
is nine characters long.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder size(Long size);
}
static final class BuilderImpl implements Builder {
private FieldToMatch fieldToMatch;
private String textTransformation;
private String comparisonOperator;
private Long size;
private BuilderImpl() {
}
private BuilderImpl(SizeConstraint model) {
fieldToMatch(model.fieldToMatch);
textTransformation(model.textTransformation);
comparisonOperator(model.comparisonOperator);
size(model.size);
}
public final FieldToMatch.Builder getFieldToMatch() {
return fieldToMatch != null ? fieldToMatch.toBuilder() : null;
}
public final void setFieldToMatch(FieldToMatch.BuilderImpl fieldToMatch) {
this.fieldToMatch = fieldToMatch != null ? fieldToMatch.build() : null;
}
@Override
public final Builder fieldToMatch(FieldToMatch fieldToMatch) {
this.fieldToMatch = fieldToMatch;
return this;
}
public final String getTextTransformation() {
return textTransformation;
}
public final void setTextTransformation(String textTransformation) {
this.textTransformation = textTransformation;
}
@Override
public final Builder textTransformation(String textTransformation) {
this.textTransformation = textTransformation;
return this;
}
@Override
public final Builder textTransformation(TextTransformation textTransformation) {
this.textTransformation(textTransformation == null ? null : textTransformation.toString());
return this;
}
public final String getComparisonOperator() {
return comparisonOperator;
}
public final void setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
}
@Override
public final Builder comparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
return this;
}
@Override
public final Builder comparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator(comparisonOperator == null ? null : comparisonOperator.toString());
return this;
}
public final Long getSize() {
return size;
}
public final void setSize(Long size) {
this.size = size;
}
@Override
public final Builder size(Long size) {
this.size = size;
return this;
}
@Override
public SizeConstraint build() {
return new SizeConstraint(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}