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

com.amazonaws.services.ec2.model.FirewallStatelessRule Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * 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.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 sources; /** *

* The destination IP addresses, in CIDR notation. *

*/ private com.amazonaws.internal.SdkInternalList destinations; /** *

* The source ports. *

*/ private com.amazonaws.internal.SdkInternalList sourcePorts; /** *

* The destination ports. *

*/ private com.amazonaws.internal.SdkInternalList destinationPorts; /** *

* The protocols. *

*/ private com.amazonaws.internal.SdkInternalList protocols; /** *

* The rule action. The possible values are pass, drop, and forward_to_site. *

*/ private String ruleAction; /** *

* 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 getSources() { if (sources == null) { sources = new com.amazonaws.internal.SdkInternalList(); } return sources; } /** *

* The source IP addresses, in CIDR notation. *

* * @param sources * The source IP addresses, in CIDR notation. */ public void setSources(java.util.Collection sources) { if (sources == null) { this.sources = null; return; } this.sources = new com.amazonaws.internal.SdkInternalList(sources); } /** *

* 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(sources.length)); } for (String ele : sources) { this.sources.add(ele); } return this; } /** *

* 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 sources) { setSources(sources); return this; } /** *

* The destination IP addresses, in CIDR notation. *

* * @return The destination IP addresses, in CIDR notation. */ public java.util.List getDestinations() { if (destinations == null) { destinations = new com.amazonaws.internal.SdkInternalList(); } return destinations; } /** *

* The destination IP addresses, in CIDR notation. *

* * @param destinations * The destination IP addresses, in CIDR notation. */ public void setDestinations(java.util.Collection destinations) { if (destinations == null) { this.destinations = null; return; } this.destinations = new com.amazonaws.internal.SdkInternalList(destinations); } /** *

* 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(destinations.length)); } for (String ele : destinations) { this.destinations.add(ele); } return this; } /** *

* 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 destinations) { setDestinations(destinations); return this; } /** *

* The source ports. *

* * @return The source ports. */ public java.util.List getSourcePorts() { if (sourcePorts == null) { sourcePorts = new com.amazonaws.internal.SdkInternalList(); } return sourcePorts; } /** *

* The source ports. *

* * @param sourcePorts * The source ports. */ public void setSourcePorts(java.util.Collection sourcePorts) { if (sourcePorts == null) { this.sourcePorts = null; return; } this.sourcePorts = new com.amazonaws.internal.SdkInternalList(sourcePorts); } /** *

* 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(sourcePorts.length)); } for (PortRange ele : sourcePorts) { this.sourcePorts.add(ele); } return this; } /** *

* 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 sourcePorts) { setSourcePorts(sourcePorts); return this; } /** *

* The destination ports. *

* * @return The destination ports. */ public java.util.List getDestinationPorts() { if (destinationPorts == null) { destinationPorts = new com.amazonaws.internal.SdkInternalList(); } return destinationPorts; } /** *

* The destination ports. *

* * @param destinationPorts * The destination ports. */ public void setDestinationPorts(java.util.Collection destinationPorts) { if (destinationPorts == null) { this.destinationPorts = null; return; } this.destinationPorts = new com.amazonaws.internal.SdkInternalList(destinationPorts); } /** *

* 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(destinationPorts.length)); } for (PortRange ele : destinationPorts) { this.destinationPorts.add(ele); } return this; } /** *

* 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 destinationPorts) { setDestinationPorts(destinationPorts); return this; } /** *

* The protocols. *

* * @return The protocols. */ public java.util.List getProtocols() { if (protocols == null) { protocols = new com.amazonaws.internal.SdkInternalList(); } return protocols; } /** *

* The protocols. *

* * @param protocols * The protocols. */ public void setProtocols(java.util.Collection protocols) { if (protocols == null) { this.protocols = null; return; } this.protocols = new com.amazonaws.internal.SdkInternalList(protocols); } /** *

* 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(protocols.length)); } for (Integer ele : protocols) { this.protocols.add(ele); } return this; } /** *

* 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 protocols) { setProtocols(protocols); return this; } /** *

* The rule action. The possible values are pass, drop, and forward_to_site. *

* * @param ruleAction * The rule action. The possible values are 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. *

* * @return The rule action. The possible values are 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. *

* * @param ruleAction * The rule action. The possible values are 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); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy