/* * 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; /** *

* Inspect the body of the web request as JSON. The body immediately follows the request headers. *

*

* This is used to indicate the web request component to inspect, in the FieldToMatch specification. *

*

* Use the specifications in this object to indicate which parts of the JSON body to inspect using the rule's inspection * criteria. WAF inspects only the parts of the JSON that result from the matches that you indicate. *

*

* Example JSON: "JsonBody": { "MatchPattern": { "All": {} }, "MatchScope": "ALL" } *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class JsonBody implements Serializable, Cloneable, StructuredPojo { /** *

* The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule * inspection criteria. *

*/ private JsonMatchPattern matchPattern; /** *

* The parts of the JSON to match against using the MatchPattern. If you specify All, WAF * matches against keys and values. *

*/ private String matchScope; /** *

* What WAF should do if it fails to completely parse the JSON body. The options are the following: *

* *

* If you don't provide this setting, WAF parses and evaluates the content only up to the first parsing failure that * it encounters. *

*

* WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid * characters, duplicate keys, truncation, and any content whose root node isn't an object or an array. *

*

* WAF parses the JSON in the following examples as two valid key, value pairs: *

* */ private String invalidFallbackBehavior; /** *

* What WAF should do if the body is larger than WAF can inspect. WAF does not support inspecting the entire * contents of the web request body if the body exceeds the limit for the resource type. If the body is larger than * the limit, the underlying host service only forwards the contents that are below the limit to WAF for inspection. *

*

* The default limit is 8 KB (8,192 kilobytes) for regional resources and 16 KB (16,384 kilobytes) for CloudFront * distributions. For CloudFront distributions, you can increase the limit in the web ACL * AssociationConfig, for additional processing fees. *

*

* The options for oversize handling are the following: *

* *

* You can combine the MATCH or NO_MATCH settings for oversize handling with your rule and * web ACL action settings, so that you block any request whose body is over the limit. *

*

* Default: CONTINUE *

*/ private String oversizeHandling; /** *

* The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule * inspection criteria. *

* * @param matchPattern * The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the * rule inspection criteria. */ public void setMatchPattern(JsonMatchPattern matchPattern) { this.matchPattern = matchPattern; } /** *

* The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule * inspection criteria. *

* * @return The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the * rule inspection criteria. */ public JsonMatchPattern getMatchPattern() { return this.matchPattern; } /** *

* The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule * inspection criteria. *

* * @param matchPattern * The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the * rule inspection criteria. * @return Returns a reference to this object so that method calls can be chained together. */ public JsonBody withMatchPattern(JsonMatchPattern matchPattern) { setMatchPattern(matchPattern); return this; } /** *

* The parts of the JSON to match against using the MatchPattern. If you specify All, WAF * matches against keys and values. *

* * @param matchScope * The parts of the JSON to match against using the MatchPattern. If you specify * All, WAF matches against keys and values. * @see JsonMatchScope */ public void setMatchScope(String matchScope) { this.matchScope = matchScope; } /** *

* The parts of the JSON to match against using the MatchPattern. If you specify All, WAF * matches against keys and values. *

* * @return The parts of the JSON to match against using the MatchPattern. If you specify * All, WAF matches against keys and values. * @see JsonMatchScope */ public String getMatchScope() { return this.matchScope; } /** *

* The parts of the JSON to match against using the MatchPattern. If you specify All, WAF * matches against keys and values. *

* * @param matchScope * The parts of the JSON to match against using the MatchPattern. If you specify * All, WAF matches against keys and values. * @return Returns a reference to this object so that method calls can be chained together. * @see JsonMatchScope */ public JsonBody withMatchScope(String matchScope) { setMatchScope(matchScope); return this; } /** *

* The parts of the JSON to match against using the MatchPattern. If you specify All, WAF * matches against keys and values. *

* * @param matchScope * The parts of the JSON to match against using the MatchPattern. If you specify * All, WAF matches against keys and values. * @return Returns a reference to this object so that method calls can be chained together. * @see JsonMatchScope */ public JsonBody withMatchScope(JsonMatchScope matchScope) { this.matchScope = matchScope.toString(); return this; } /** *

* What WAF should do if it fails to completely parse the JSON body. The options are the following: *

* *

* If you don't provide this setting, WAF parses and evaluates the content only up to the first parsing failure that * it encounters. *

*

* WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid * characters, duplicate keys, truncation, and any content whose root node isn't an object or an array. *

*

* WAF parses the JSON in the following examples as two valid key, value pairs: *

* * * @param invalidFallbackBehavior * What WAF should do if it fails to completely parse the JSON body. The options are the following:

* *

* If you don't provide this setting, WAF parses and evaluates the content only up to the first parsing * failure that it encounters. *

*

* WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid * characters, duplicate keys, truncation, and any content whose root node isn't an object or an array. *

*

* WAF parses the JSON in the following examples as two valid key, value pairs: *

*