Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Describes an entry in a network ACL.

 
 public class NetworkAclEntry implements SerializableCloneable {

    
The rule number for the entry. ACL entries are processed in ascending order by rule number.
 
     private Integer ruleNumber;

    
The protocol. A value of -1 means all protocols.
 
     private String protocol;

    
Indicates whether to allow or deny the traffic that matches the rule.

Constraints:
Allowed Values: allow, deny

 
     private String ruleAction;

    
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).
 
     private Boolean egress;

    
The network range to allow or deny, in CIDR notation.
 
     private String cidrBlock;

    
ICMP protocol: The ICMP type and code.
 
     private IcmpTypeCode icmpTypeCode;

    
TCP or UDP protocols: The range of ports the rule applies to.
 
     private PortRange portRange;

    
The rule number for the entry. ACL entries are processed in ascending order by rule number.

Returns:
The rule number for the entry. ACL entries are processed in ascending order by rule number.
 
     public Integer getRuleNumber() {
         return ;
     }
    
    
The rule number for the entry. ACL entries are processed in ascending order by rule number.

Parameters:
ruleNumber The rule number for the entry. ACL entries are processed in ascending order by rule number.
 
     public void setRuleNumber(Integer ruleNumber) {
         this. = ruleNumber;
     }
    
    
The rule number for the entry. ACL entries are processed in ascending order by rule number.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ruleNumber The rule number for the entry. ACL entries are processed in ascending order by rule number.
Returns:
A reference to this updated object so that method calls can be chained together.
 
    public NetworkAclEntry withRuleNumber(Integer ruleNumber) {
        this. = ruleNumber;
        return this;
    }

    
The protocol. A value of -1 means all protocols.

Returns:
The protocol. A value of -1 means all protocols.
    public String getProtocol() {
        return ;
    }
    
    
The protocol. A value of -1 means all protocols.

Parameters:
protocol The protocol. A value of -1 means all protocols.
    public void setProtocol(String protocol) {
        this. = protocol;
    }
    
    
The protocol. A value of -1 means all protocols.

Returns a reference to this object so that method calls can be chained together.

Parameters:
protocol The protocol. A value of -1 means all protocols.
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkAclEntry withProtocol(String protocol) {
        this. = protocol;
        return this;
    }

    
Indicates whether to allow or deny the traffic that matches the rule.

Constraints:
Allowed Values: allow, deny

Returns:
Indicates whether to allow or deny the traffic that matches the rule.
See also:
RuleAction
    public String getRuleAction() {
        return ;
    }
    
    
Indicates whether to allow or deny the traffic that matches the rule.

Constraints:
Allowed Values: allow, deny

Parameters:
ruleAction Indicates whether to allow or deny the traffic that matches the rule.
See also:
RuleAction
    public void setRuleAction(String ruleAction) {
        this. = ruleAction;
    }
    
    
Indicates whether to allow or deny the traffic that matches the rule.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: allow, deny

Parameters:
ruleAction Indicates whether to allow or deny the traffic that matches the rule.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
RuleAction
    public NetworkAclEntry withRuleAction(String ruleAction) {
        this. = ruleAction;
        return this;
    }

    
Indicates whether to allow or deny the traffic that matches the rule.

Constraints:
Allowed Values: allow, deny

Parameters:
ruleAction Indicates whether to allow or deny the traffic that matches the rule.
See also:
RuleAction
    public void setRuleAction(RuleAction ruleAction) {
        this. = ruleAction.toString();
    }
    
    
Indicates whether to allow or deny the traffic that matches the rule.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: allow, deny

Parameters:
ruleAction Indicates whether to allow or deny the traffic that matches the rule.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
RuleAction
    public NetworkAclEntry withRuleAction(RuleAction ruleAction) {
        this. = ruleAction.toString();
        return this;
    }

    
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).

Returns:
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).
    public Boolean isEgress() {
        return ;
    }
    
    
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).

Parameters:
egress Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).
    public void setEgress(Boolean egress) {
        this. = egress;
    }
    
    
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).

Returns a reference to this object so that method calls can be chained together.

Parameters:
egress Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkAclEntry withEgress(Boolean egress) {
        this. = egress;
        return this;
    }

    
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).

Returns:
Indicates whether the rule is an egress rule (applied to traffic leaving the subnet).
    public Boolean getEgress() {
        return ;
    }

    
The network range to allow or deny, in CIDR notation.

Returns:
The network range to allow or deny, in CIDR notation.
    public String getCidrBlock() {
        return ;
    }
    
    
The network range to allow or deny, in CIDR notation.

Parameters:
cidrBlock The network range to allow or deny, in CIDR notation.
    public void setCidrBlock(String cidrBlock) {
        this. = cidrBlock;
    }
    
    
The network range to allow or deny, in CIDR notation.

Returns a reference to this object so that method calls can be chained together.

Parameters:
cidrBlock The network range to allow or deny, in CIDR notation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkAclEntry withCidrBlock(String cidrBlock) {
        this. = cidrBlock;
        return this;
    }

    
ICMP protocol: The ICMP type and code.

Returns:
ICMP protocol: The ICMP type and code.
    public IcmpTypeCode getIcmpTypeCode() {
        return ;
    }
    
    
ICMP protocol: The ICMP type and code.

Parameters:
icmpTypeCode ICMP protocol: The ICMP type and code.
    public void setIcmpTypeCode(IcmpTypeCode icmpTypeCode) {
        this. = icmpTypeCode;
    }
    
    
ICMP protocol: The ICMP type and code.

Returns a reference to this object so that method calls can be chained together.

Parameters:
icmpTypeCode ICMP protocol: The ICMP type and code.
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkAclEntry withIcmpTypeCode(IcmpTypeCode icmpTypeCode) {
        this. = icmpTypeCode;
        return this;
    }

    
TCP or UDP protocols: The range of ports the rule applies to.

Returns:
TCP or UDP protocols: The range of ports the rule applies to.
    public PortRange getPortRange() {
        return ;
    }
    
    
TCP or UDP protocols: The range of ports the rule applies to.

Parameters:
portRange TCP or UDP protocols: The range of ports the rule applies to.
    public void setPortRange(PortRange portRange) {
        this. = portRange;
    }
    
    
TCP or UDP protocols: The range of ports the rule applies to.

Returns a reference to this object so that method calls can be chained together.

Parameters:
portRange TCP or UDP protocols: The range of ports the rule applies to.
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkAclEntry withPortRange(PortRange portRange) {
        this. = portRange;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getRuleNumber() != nullsb.append("RuleNumber: " + getRuleNumber() + ",");
        if (getProtocol() != nullsb.append("Protocol: " + getProtocol() + ",");
        if (getRuleAction() != nullsb.append("RuleAction: " + getRuleAction() + ",");
        if (isEgress() != nullsb.append("Egress: " + isEgress() + ",");
        if (getCidrBlock() != nullsb.append("CidrBlock: " + getCidrBlock() + ",");
        if (getIcmpTypeCode() != nullsb.append("IcmpTypeCode: " + getIcmpTypeCode() + ",");
        if (getPortRange() != nullsb.append("PortRange: " + getPortRange() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getRuleNumber() == null) ? 0 : getRuleNumber().hashCode()); 
        hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode()); 
        hashCode = prime * hashCode + ((getRuleAction() == null) ? 0 : getRuleAction().hashCode()); 
        hashCode = prime * hashCode + ((isEgress() == null) ? 0 : isEgress().hashCode()); 
        hashCode = prime * hashCode + ((getCidrBlock() == null) ? 0 : getCidrBlock().hashCode()); 
        hashCode = prime * hashCode + ((getIcmpTypeCode() == null) ? 0 : getIcmpTypeCode().hashCode()); 
        hashCode = prime * hashCode + ((getPortRange() == null) ? 0 : getPortRange().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof NetworkAclEntry == falsereturn false;
        NetworkAclEntry other = (NetworkAclEntry)obj;
        
        if (other.getRuleNumber() == null ^ this.getRuleNumber() == nullreturn false;
        if (other.getRuleNumber() != null && other.getRuleNumber().equals(this.getRuleNumber()) == falsereturn false
        if (other.getProtocol() == null ^ this.getProtocol() == nullreturn false;
        if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == falsereturn false
        if (other.getRuleAction() == null ^ this.getRuleAction() == nullreturn false;
        if (other.getRuleAction() != null && other.getRuleAction().equals(this.getRuleAction()) == falsereturn false
        if (other.isEgress() == null ^ this.isEgress() == nullreturn false;
        if (other.isEgress() != null && other.isEgress().equals(this.isEgress()) == falsereturn false
        if (other.getCidrBlock() == null ^ this.getCidrBlock() == nullreturn false;
        if (other.getCidrBlock() != null && other.getCidrBlock().equals(this.getCidrBlock()) == falsereturn false
        if (other.getIcmpTypeCode() == null ^ this.getIcmpTypeCode() == nullreturn false;
        if (other.getIcmpTypeCode() != null && other.getIcmpTypeCode().equals(this.getIcmpTypeCode()) == falsereturn false
        if (other.getPortRange() == null ^ this.getPortRange() == nullreturn false;
        if (other.getPortRange() != null && other.getPortRange().equals(this.getPortRange()) == falsereturn false
        return true;
    }
    
    @Override
    public NetworkAclEntry clone() {
        try {
            return (NetworkAclEntrysuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X