com.amazonaws.services.wafv2.model.JsonMatchPattern 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 patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule
* inspection criteria. This is used with the FieldToMatch option JsonBody
.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class JsonMatchPattern implements Serializable, Cloneable, StructuredPojo {
/**
*
* Match all of the elements. See also MatchScope
in JsonBody.
*
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*
*/
private All all;
/**
*
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript
* Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*
*/
private java.util.List includedPaths;
/**
*
* Match all of the elements. See also MatchScope
in JsonBody.
*
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*
*
* @param all
* Match all of the elements. See also MatchScope
in JsonBody.
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*/
public void setAll(All all) {
this.all = all;
}
/**
*
* Match all of the elements. See also MatchScope
in JsonBody.
*
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*
*
* @return Match all of the elements. See also MatchScope
in JsonBody.
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*/
public All getAll() {
return this.all;
}
/**
*
* Match all of the elements. See also MatchScope
in JsonBody.
*
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
*
*
* @param all
* Match all of the elements. See also MatchScope
in JsonBody.
*
* You must specify either this setting or the IncludedPaths
setting, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public JsonMatchPattern withAll(All all) {
setAll(all);
return this;
}
/**
*
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript
* Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*
*
* @return Match only the specified include paths. See also MatchScope
in JsonBody.
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see
* the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*/
public java.util.List getIncludedPaths() {
return includedPaths;
}
/**
*
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript
* Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*
*
* @param includedPaths
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*/
public void setIncludedPaths(java.util.Collection includedPaths) {
if (includedPaths == null) {
this.includedPaths = null;
return;
}
this.includedPaths = new java.util.ArrayList(includedPaths);
}
/**
*
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript
* Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setIncludedPaths(java.util.Collection)} or {@link #withIncludedPaths(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param includedPaths
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public JsonMatchPattern withIncludedPaths(String... includedPaths) {
if (this.includedPaths == null) {
setIncludedPaths(new java.util.ArrayList(includedPaths.length));
}
for (String ele : includedPaths) {
this.includedPaths.add(ele);
}
return this;
}
/**
*
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript
* Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
*
*
* @param includedPaths
* Match only the specified include paths. See also MatchScope
in JsonBody.
*
* Provide the include paths using JSON Pointer syntax. For example,
* "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the
* Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer.
*
*
* You must specify either this setting or the All
setting, but not both.
*
*
*
* Don't use this option to include all paths. Instead, use the All
setting.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public JsonMatchPattern withIncludedPaths(java.util.Collection includedPaths) {
setIncludedPaths(includedPaths);
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 (getAll() != null)
sb.append("All: ").append(getAll()).append(",");
if (getIncludedPaths() != null)
sb.append("IncludedPaths: ").append(getIncludedPaths());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof JsonMatchPattern == false)
return false;
JsonMatchPattern other = (JsonMatchPattern) obj;
if (other.getAll() == null ^ this.getAll() == null)
return false;
if (other.getAll() != null && other.getAll().equals(this.getAll()) == false)
return false;
if (other.getIncludedPaths() == null ^ this.getIncludedPaths() == null)
return false;
if (other.getIncludedPaths() != null && other.getIncludedPaths().equals(this.getIncludedPaths()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAll() == null) ? 0 : getAll().hashCode());
hashCode = prime * hashCode + ((getIncludedPaths() == null) ? 0 : getIncludedPaths().hashCode());
return hashCode;
}
@Override
public JsonMatchPattern clone() {
try {
return (JsonMatchPattern) 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.JsonMatchPatternMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}