com.amazonaws.services.waf.model.WebACL Maven / Gradle / Ivy
Show all versions of aws-java-sdk-waf Show documentation
/*
* Copyright 2017-2022 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.waf.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
*
* 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.
*
*
*
* Contains the Rules
that identify the requests that you want to allow, block, or count. In a
* WebACL
, you also specify a default action (ALLOW
or BLOCK
), and the action for
* each Rule
that you add to a WebACL
, for example, block requests from specified IP addresses
* or block requests from specified referrers. You also associate the WebACL
with a CloudFront distribution
* to identify the requests that you want AWS WAF to filter. If you add more than one Rule
to a
* WebACL
, a request needs to match only one of the specifications to be allowed, blocked, or counted. For
* more information, see UpdateWebACL.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class WebACL implements Serializable, Cloneable, StructuredPojo {
/**
*
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and delete a
* WebACL
from AWS WAF (see DeleteWebACL).
*
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*
*/
private String webACLId;
/**
*
* A friendly name or description of the WebACL
. You can't change the name of a WebACL
* after you create it.
*
*/
private String name;
/**
*
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*
*/
private String metricName;
/**
*
* The action to perform if none of the Rules
contained in the WebACL
match. The action is
* specified by the WafAction object.
*
*/
private WafAction defaultAction;
/**
*
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*
*/
private java.util.List rules;
/**
*
* Tha Amazon Resource Name (ARN) of the web ACL.
*
*/
private String webACLArn;
/**
*
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and delete a
* WebACL
from AWS WAF (see DeleteWebACL).
*
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*
*
* @param webACLId
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and
* delete a WebACL
from AWS WAF (see DeleteWebACL).
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*/
public void setWebACLId(String webACLId) {
this.webACLId = webACLId;
}
/**
*
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and delete a
* WebACL
from AWS WAF (see DeleteWebACL).
*
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*
*
* @return A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and
* delete a WebACL
from AWS WAF (see DeleteWebACL).
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*/
public String getWebACLId() {
return this.webACLId;
}
/**
*
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and delete a
* WebACL
from AWS WAF (see DeleteWebACL).
*
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
*
*
* @param webACLId
* A unique identifier for a WebACL
. You use WebACLId
to get information about a
* WebACL
(see GetWebACL), update a WebACL
(see UpdateWebACL), and
* delete a WebACL
from AWS WAF (see DeleteWebACL).
*
* WebACLId
is returned by CreateWebACL and by ListWebACLs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withWebACLId(String webACLId) {
setWebACLId(webACLId);
return this;
}
/**
*
* A friendly name or description of the WebACL
. You can't change the name of a WebACL
* after you create it.
*
*
* @param name
* A friendly name or description of the WebACL
. You can't change the name of a
* WebACL
after you create it.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* A friendly name or description of the WebACL
. You can't change the name of a WebACL
* after you create it.
*
*
* @return A friendly name or description of the WebACL
. You can't change the name of a
* WebACL
after you create it.
*/
public String getName() {
return this.name;
}
/**
*
* A friendly name or description of the WebACL
. You can't change the name of a WebACL
* after you create it.
*
*
* @param name
* A friendly name or description of the WebACL
. You can't change the name of a
* WebACL
after you create it.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withName(String name) {
setName(name);
return this;
}
/**
*
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*
*
* @param metricName
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*/
public void setMetricName(String metricName) {
this.metricName = metricName;
}
/**
*
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*
*
* @return A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*/
public String getMetricName() {
return this.metricName;
}
/**
*
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
*
*
* @param metricName
* A friendly name or description for the metrics for this WebACL
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* MetricName
after you create the WebACL
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withMetricName(String metricName) {
setMetricName(metricName);
return this;
}
/**
*
* The action to perform if none of the Rules
contained in the WebACL
match. The action is
* specified by the WafAction object.
*
*
* @param defaultAction
* The action to perform if none of the Rules
contained in the WebACL
match. The
* action is specified by the WafAction object.
*/
public void setDefaultAction(WafAction defaultAction) {
this.defaultAction = defaultAction;
}
/**
*
* The action to perform if none of the Rules
contained in the WebACL
match. The action is
* specified by the WafAction object.
*
*
* @return The action to perform if none of the Rules
contained in the WebACL
match. The
* action is specified by the WafAction object.
*/
public WafAction getDefaultAction() {
return this.defaultAction;
}
/**
*
* The action to perform if none of the Rules
contained in the WebACL
match. The action is
* specified by the WafAction object.
*
*
* @param defaultAction
* The action to perform if none of the Rules
contained in the WebACL
match. The
* action is specified by the WafAction object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withDefaultAction(WafAction defaultAction) {
setDefaultAction(defaultAction);
return this;
}
/**
*
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*
*
* @return An array that contains the action for each Rule
in a WebACL
, the priority of
* the Rule
, and the ID of the Rule
.
*/
public java.util.List getRules() {
return rules;
}
/**
*
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*
*
* @param rules
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*/
public void setRules(java.util.Collection rules) {
if (rules == null) {
this.rules = null;
return;
}
this.rules = new java.util.ArrayList(rules);
}
/**
*
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRules(java.util.Collection)} or {@link #withRules(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param rules
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withRules(ActivatedRule... rules) {
if (this.rules == null) {
setRules(new java.util.ArrayList(rules.length));
}
for (ActivatedRule ele : rules) {
this.rules.add(ele);
}
return this;
}
/**
*
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
*
*
* @param rules
* An array that contains the action for each Rule
in a WebACL
, the priority of the
* Rule
, and the ID of the Rule
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withRules(java.util.Collection rules) {
setRules(rules);
return this;
}
/**
*
* Tha Amazon Resource Name (ARN) of the web ACL.
*
*
* @param webACLArn
* Tha Amazon Resource Name (ARN) of the web ACL.
*/
public void setWebACLArn(String webACLArn) {
this.webACLArn = webACLArn;
}
/**
*
* Tha Amazon Resource Name (ARN) of the web ACL.
*
*
* @return Tha Amazon Resource Name (ARN) of the web ACL.
*/
public String getWebACLArn() {
return this.webACLArn;
}
/**
*
* Tha Amazon Resource Name (ARN) of the web ACL.
*
*
* @param webACLArn
* Tha Amazon Resource Name (ARN) of the web ACL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public WebACL withWebACLArn(String webACLArn) {
setWebACLArn(webACLArn);
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 (getWebACLId() != null)
sb.append("WebACLId: ").append(getWebACLId()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getMetricName() != null)
sb.append("MetricName: ").append(getMetricName()).append(",");
if (getDefaultAction() != null)
sb.append("DefaultAction: ").append(getDefaultAction()).append(",");
if (getRules() != null)
sb.append("Rules: ").append(getRules()).append(",");
if (getWebACLArn() != null)
sb.append("WebACLArn: ").append(getWebACLArn());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof WebACL == false)
return false;
WebACL other = (WebACL) obj;
if (other.getWebACLId() == null ^ this.getWebACLId() == null)
return false;
if (other.getWebACLId() != null && other.getWebACLId().equals(this.getWebACLId()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getMetricName() == null ^ this.getMetricName() == null)
return false;
if (other.getMetricName() != null && other.getMetricName().equals(this.getMetricName()) == false)
return false;
if (other.getDefaultAction() == null ^ this.getDefaultAction() == null)
return false;
if (other.getDefaultAction() != null && other.getDefaultAction().equals(this.getDefaultAction()) == false)
return false;
if (other.getRules() == null ^ this.getRules() == null)
return false;
if (other.getRules() != null && other.getRules().equals(this.getRules()) == false)
return false;
if (other.getWebACLArn() == null ^ this.getWebACLArn() == null)
return false;
if (other.getWebACLArn() != null && other.getWebACLArn().equals(this.getWebACLArn()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getWebACLId() == null) ? 0 : getWebACLId().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getMetricName() == null) ? 0 : getMetricName().hashCode());
hashCode = prime * hashCode + ((getDefaultAction() == null) ? 0 : getDefaultAction().hashCode());
hashCode = prime * hashCode + ((getRules() == null) ? 0 : getRules().hashCode());
hashCode = prime * hashCode + ((getWebACLArn() == null) ? 0 : getWebACLArn().hashCode());
return hashCode;
}
@Override
public WebACL clone() {
try {
return (WebACL) 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.waf.model.waf_regional.transform.WebACLMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}