/* * 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.ec2.model; import java.io.Serializable; import javax.annotation.Generated; /** *
* Describes a stateless rule. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class FirewallStatelessRule implements Serializable, Cloneable { /** ** The ARN of the stateless rule group. *
*/ private String ruleGroupArn; /** ** The source IP addresses, in CIDR notation. *
*/ private com.amazonaws.internal.SdkInternalList* The destination IP addresses, in CIDR notation. *
*/ private com.amazonaws.internal.SdkInternalList* The source ports. *
*/ private com.amazonaws.internal.SdkInternalList* The destination ports. *
*/ private com.amazonaws.internal.SdkInternalList* The protocols. *
*/ private com.amazonaws.internal.SdkInternalList
* The rule action. The possible values are pass
, drop
, and forward_to_site
.
*
* The rule priority. *
*/ private Integer priority; /** ** The ARN of the stateless rule group. *
* * @param ruleGroupArn * The ARN of the stateless rule group. */ public void setRuleGroupArn(String ruleGroupArn) { this.ruleGroupArn = ruleGroupArn; } /** ** The ARN of the stateless rule group. *
* * @return The ARN of the stateless rule group. */ public String getRuleGroupArn() { return this.ruleGroupArn; } /** ** The ARN of the stateless rule group. *
* * @param ruleGroupArn * The ARN of the stateless rule group. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withRuleGroupArn(String ruleGroupArn) { setRuleGroupArn(ruleGroupArn); return this; } /** ** The source IP addresses, in CIDR notation. *
* * @return The source IP addresses, in CIDR notation. */ public java.util.List* The source IP addresses, in CIDR notation. *
* * @param sources * The source IP addresses, in CIDR notation. */ public void setSources(java.util.Collection* The source IP addresses, in CIDR notation. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setSources(java.util.Collection)} or {@link #withSources(java.util.Collection)} if you want to override * the existing values. *
* * @param sources * The source IP addresses, in CIDR notation. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withSources(String... sources) { if (this.sources == null) { setSources(new com.amazonaws.internal.SdkInternalList* The source IP addresses, in CIDR notation. *
* * @param sources * The source IP addresses, in CIDR notation. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withSources(java.util.Collection* The destination IP addresses, in CIDR notation. *
* * @return The destination IP addresses, in CIDR notation. */ public java.util.List* The destination IP addresses, in CIDR notation. *
* * @param destinations * The destination IP addresses, in CIDR notation. */ public void setDestinations(java.util.Collection* The destination IP addresses, in CIDR notation. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setDestinations(java.util.Collection)} or {@link #withDestinations(java.util.Collection)} if you want to * override the existing values. *
* * @param destinations * The destination IP addresses, in CIDR notation. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withDestinations(String... destinations) { if (this.destinations == null) { setDestinations(new com.amazonaws.internal.SdkInternalList* The destination IP addresses, in CIDR notation. *
* * @param destinations * The destination IP addresses, in CIDR notation. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withDestinations(java.util.Collection* The source ports. *
* * @return The source ports. */ public java.util.List* The source ports. *
* * @param sourcePorts * The source ports. */ public void setSourcePorts(java.util.Collection* The source ports. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setSourcePorts(java.util.Collection)} or {@link #withSourcePorts(java.util.Collection)} if you want to * override the existing values. *
* * @param sourcePorts * The source ports. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withSourcePorts(PortRange... sourcePorts) { if (this.sourcePorts == null) { setSourcePorts(new com.amazonaws.internal.SdkInternalList* The source ports. *
* * @param sourcePorts * The source ports. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withSourcePorts(java.util.Collection* The destination ports. *
* * @return The destination ports. */ public java.util.List* The destination ports. *
* * @param destinationPorts * The destination ports. */ public void setDestinationPorts(java.util.Collection* The destination ports. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setDestinationPorts(java.util.Collection)} or {@link #withDestinationPorts(java.util.Collection)} if you * want to override the existing values. *
* * @param destinationPorts * The destination ports. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withDestinationPorts(PortRange... destinationPorts) { if (this.destinationPorts == null) { setDestinationPorts(new com.amazonaws.internal.SdkInternalList* The destination ports. *
* * @param destinationPorts * The destination ports. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withDestinationPorts(java.util.Collection* The protocols. *
* * @return The protocols. */ public java.util.List* The protocols. *
* * @param protocols * The protocols. */ public void setProtocols(java.util.Collection* The protocols. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setProtocols(java.util.Collection)} or {@link #withProtocols(java.util.Collection)} if you want to * override the existing values. *
* * @param protocols * The protocols. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withProtocols(Integer... protocols) { if (this.protocols == null) { setProtocols(new com.amazonaws.internal.SdkInternalList* The protocols. *
* * @param protocols * The protocols. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withProtocols(java.util.Collection
* The rule action. The possible values are pass
, drop
, and forward_to_site
.
*
pass
, drop
, and
* forward_to_site
.
*/
public void setRuleAction(String ruleAction) {
this.ruleAction = ruleAction;
}
/**
*
* The rule action. The possible values are pass
, drop
, and forward_to_site
.
*
pass
, drop
, and
* forward_to_site
.
*/
public String getRuleAction() {
return this.ruleAction;
}
/**
*
* The rule action. The possible values are pass
, drop
, and forward_to_site
.
*
pass
, drop
, and
* forward_to_site
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FirewallStatelessRule withRuleAction(String ruleAction) {
setRuleAction(ruleAction);
return this;
}
/**
* * The rule priority. *
* * @param priority * The rule priority. */ public void setPriority(Integer priority) { this.priority = priority; } /** ** The rule priority. *
* * @return The rule priority. */ public Integer getPriority() { return this.priority; } /** ** The rule priority. *
* * @param priority * The rule priority. * @return Returns a reference to this object so that method calls can be chained together. */ public FirewallStatelessRule withPriority(Integer priority) { setPriority(priority); 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 (getRuleGroupArn() != null) sb.append("RuleGroupArn: ").append(getRuleGroupArn()).append(","); if (getSources() != null) sb.append("Sources: ").append(getSources()).append(","); if (getDestinations() != null) sb.append("Destinations: ").append(getDestinations()).append(","); if (getSourcePorts() != null) sb.append("SourcePorts: ").append(getSourcePorts()).append(","); if (getDestinationPorts() != null) sb.append("DestinationPorts: ").append(getDestinationPorts()).append(","); if (getProtocols() != null) sb.append("Protocols: ").append(getProtocols()).append(","); if (getRuleAction() != null) sb.append("RuleAction: ").append(getRuleAction()).append(","); if (getPriority() != null) sb.append("Priority: ").append(getPriority()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof FirewallStatelessRule == false) return false; FirewallStatelessRule other = (FirewallStatelessRule) obj; if (other.getRuleGroupArn() == null ^ this.getRuleGroupArn() == null) return false; if (other.getRuleGroupArn() != null && other.getRuleGroupArn().equals(this.getRuleGroupArn()) == false) return false; if (other.getSources() == null ^ this.getSources() == null) return false; if (other.getSources() != null && other.getSources().equals(this.getSources()) == false) return false; if (other.getDestinations() == null ^ this.getDestinations() == null) return false; if (other.getDestinations() != null && other.getDestinations().equals(this.getDestinations()) == false) return false; if (other.getSourcePorts() == null ^ this.getSourcePorts() == null) return false; if (other.getSourcePorts() != null && other.getSourcePorts().equals(this.getSourcePorts()) == false) return false; if (other.getDestinationPorts() == null ^ this.getDestinationPorts() == null) return false; if (other.getDestinationPorts() != null && other.getDestinationPorts().equals(this.getDestinationPorts()) == false) return false; if (other.getProtocols() == null ^ this.getProtocols() == null) return false; if (other.getProtocols() != null && other.getProtocols().equals(this.getProtocols()) == false) return false; if (other.getRuleAction() == null ^ this.getRuleAction() == null) return false; if (other.getRuleAction() != null && other.getRuleAction().equals(this.getRuleAction()) == false) return false; if (other.getPriority() == null ^ this.getPriority() == null) return false; if (other.getPriority() != null && other.getPriority().equals(this.getPriority()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRuleGroupArn() == null) ? 0 : getRuleGroupArn().hashCode()); hashCode = prime * hashCode + ((getSources() == null) ? 0 : getSources().hashCode()); hashCode = prime * hashCode + ((getDestinations() == null) ? 0 : getDestinations().hashCode()); hashCode = prime * hashCode + ((getSourcePorts() == null) ? 0 : getSourcePorts().hashCode()); hashCode = prime * hashCode + ((getDestinationPorts() == null) ? 0 : getDestinationPorts().hashCode()); hashCode = prime * hashCode + ((getProtocols() == null) ? 0 : getProtocols().hashCode()); hashCode = prime * hashCode + ((getRuleAction() == null) ? 0 : getRuleAction().hashCode()); hashCode = prime * hashCode + ((getPriority() == null) ? 0 : getPriority().hashCode()); return hashCode; } @Override public FirewallStatelessRule clone() { try { return (FirewallStatelessRule) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }