All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.waf.model.WebACL Maven / Gradle / Ivy

/*
 * Copyright 2010-2016 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;

/**
 * 

* 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. *

*/ public class WebACL implements Serializable, Cloneable { /** *

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

* 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; } /** * @param metricName */ public void setMetricName(String metricName) { this.metricName = metricName; } /** * @return */ public String getMetricName() { return this.metricName; } /** * @param metricName * @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; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @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: " + getWebACLId() + ","); if (getName() != null) sb.append("Name: " + getName() + ","); if (getMetricName() != null) sb.append("MetricName: " + getMetricName() + ","); if (getDefaultAction() != null) sb.append("DefaultAction: " + getDefaultAction() + ","); if (getRules() != null) sb.append("Rules: " + getRules()); 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; 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()); 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); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy