com.amazonaws.services.wafv2.model.CookieMatchPattern Maven / Gradle / Ivy
Show all versions of aws-java-sdk-wafv2 Show documentation
/*
* 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;
/**
*
* The filter to use to identify the subset of cookies to inspect in a web request.
*
*
* You must specify exactly one setting: either All
, IncludedCookies
, or
* ExcludedCookies
.
*
*
* Example JSON: "MatchPattern": { "IncludedCookies": {"KeyToInclude1", "KeyToInclude2", "KeyToInclude3"} }
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CookieMatchPattern implements Serializable, Cloneable, StructuredPojo {
/**
*
* Inspect all cookies.
*
*/
private All all;
/**
*
* Inspect only the cookies that have a key that matches one of the strings specified here.
*
*/
private java.util.List includedCookies;
/**
*
* Inspect only the cookies whose keys don't match any of the strings specified here.
*
*/
private java.util.List excludedCookies;
/**
*
* Inspect all cookies.
*
*
* @param all
* Inspect all cookies.
*/
public void setAll(All all) {
this.all = all;
}
/**
*
* Inspect all cookies.
*
*
* @return Inspect all cookies.
*/
public All getAll() {
return this.all;
}
/**
*
* Inspect all cookies.
*
*
* @param all
* Inspect all cookies.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CookieMatchPattern withAll(All all) {
setAll(all);
return this;
}
/**
*
* Inspect only the cookies that have a key that matches one of the strings specified here.
*
*
* @return Inspect only the cookies that have a key that matches one of the strings specified here.
*/
public java.util.List getIncludedCookies() {
return includedCookies;
}
/**
*
* Inspect only the cookies that have a key that matches one of the strings specified here.
*
*
* @param includedCookies
* Inspect only the cookies that have a key that matches one of the strings specified here.
*/
public void setIncludedCookies(java.util.Collection includedCookies) {
if (includedCookies == null) {
this.includedCookies = null;
return;
}
this.includedCookies = new java.util.ArrayList(includedCookies);
}
/**
*
* Inspect only the cookies that have a key that matches one of the strings specified here.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setIncludedCookies(java.util.Collection)} or {@link #withIncludedCookies(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param includedCookies
* Inspect only the cookies that have a key that matches one of the strings specified here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CookieMatchPattern withIncludedCookies(String... includedCookies) {
if (this.includedCookies == null) {
setIncludedCookies(new java.util.ArrayList(includedCookies.length));
}
for (String ele : includedCookies) {
this.includedCookies.add(ele);
}
return this;
}
/**
*
* Inspect only the cookies that have a key that matches one of the strings specified here.
*
*
* @param includedCookies
* Inspect only the cookies that have a key that matches one of the strings specified here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CookieMatchPattern withIncludedCookies(java.util.Collection includedCookies) {
setIncludedCookies(includedCookies);
return this;
}
/**
*
* Inspect only the cookies whose keys don't match any of the strings specified here.
*
*
* @return Inspect only the cookies whose keys don't match any of the strings specified here.
*/
public java.util.List getExcludedCookies() {
return excludedCookies;
}
/**
*
* Inspect only the cookies whose keys don't match any of the strings specified here.
*
*
* @param excludedCookies
* Inspect only the cookies whose keys don't match any of the strings specified here.
*/
public void setExcludedCookies(java.util.Collection excludedCookies) {
if (excludedCookies == null) {
this.excludedCookies = null;
return;
}
this.excludedCookies = new java.util.ArrayList(excludedCookies);
}
/**
*
* Inspect only the cookies whose keys don't match any of the strings specified here.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setExcludedCookies(java.util.Collection)} or {@link #withExcludedCookies(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param excludedCookies
* Inspect only the cookies whose keys don't match any of the strings specified here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CookieMatchPattern withExcludedCookies(String... excludedCookies) {
if (this.excludedCookies == null) {
setExcludedCookies(new java.util.ArrayList(excludedCookies.length));
}
for (String ele : excludedCookies) {
this.excludedCookies.add(ele);
}
return this;
}
/**
*
* Inspect only the cookies whose keys don't match any of the strings specified here.
*
*
* @param excludedCookies
* Inspect only the cookies whose keys don't match any of the strings specified here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CookieMatchPattern withExcludedCookies(java.util.Collection excludedCookies) {
setExcludedCookies(excludedCookies);
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 (getIncludedCookies() != null)
sb.append("IncludedCookies: ").append(getIncludedCookies()).append(",");
if (getExcludedCookies() != null)
sb.append("ExcludedCookies: ").append(getExcludedCookies());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CookieMatchPattern == false)
return false;
CookieMatchPattern other = (CookieMatchPattern) obj;
if (other.getAll() == null ^ this.getAll() == null)
return false;
if (other.getAll() != null && other.getAll().equals(this.getAll()) == false)
return false;
if (other.getIncludedCookies() == null ^ this.getIncludedCookies() == null)
return false;
if (other.getIncludedCookies() != null && other.getIncludedCookies().equals(this.getIncludedCookies()) == false)
return false;
if (other.getExcludedCookies() == null ^ this.getExcludedCookies() == null)
return false;
if (other.getExcludedCookies() != null && other.getExcludedCookies().equals(this.getExcludedCookies()) == 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 + ((getIncludedCookies() == null) ? 0 : getIncludedCookies().hashCode());
hashCode = prime * hashCode + ((getExcludedCookies() == null) ? 0 : getExcludedCookies().hashCode());
return hashCode;
}
@Override
public CookieMatchPattern clone() {
try {
return (CookieMatchPattern) 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.CookieMatchPatternMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}