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;
 
 
Container for the parameters to the CreateNetworkAclEntry operation.

Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.

We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.

After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.

For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .

 
The ID of the network ACL.
 
     private String networkAclId;

    
The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

Constraints: Positive integer from 1 to 32766

 
     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 this is an egress rule (rule is applied to traffic leaving the subnet).
 
     private Boolean egress;

    
The network range to allow or deny, in CIDR notation (for example 172.16.0.0/24).
 
     private String cidrBlock;

    
ICMP protocol: The ICMP type and code. Required if specifying ICMP for the protocol.
 
     private IcmpTypeCode icmpTypeCode;

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

    
The ID of the network ACL.

Returns:
The ID of the network ACL.
    public String getNetworkAclId() {
        return ;
    }
    
    
The ID of the network ACL.

Parameters:
networkAclId The ID of the network ACL.
    public void setNetworkAclId(String networkAclId) {
        this. = networkAclId;
    }
    
    
The ID of the network ACL.

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

Parameters:
networkAclId The ID of the network ACL.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateNetworkAclEntryRequest withNetworkAclId(String networkAclId) {
        this. = networkAclId;
        return this;
    }

    
The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

Constraints: Positive integer from 1 to 32766

Returns:
The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

Constraints: Positive integer from 1 to 32766

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

Constraints: Positive integer from 1 to 32766

Parameters:
ruleNumber The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

Constraints: Positive integer from 1 to 32766

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

Constraints: Positive integer from 1 to 32766

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

Parameters:
ruleNumber The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

Constraints: Positive integer from 1 to 32766

Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateNetworkAclEntryRequest 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 CreateNetworkAclEntryRequest 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 CreateNetworkAclEntryRequest 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
        this. = ruleAction.toString();
        return this;
    }

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

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

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

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

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

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

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

    
The network range to allow or deny, in CIDR notation (for example 172.16.0.0/24).

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

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

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 (for example 172.16.0.0/24).
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateNetworkAclEntryRequest withCidrBlock(String cidrBlock) {
        this. = cidrBlock;
        return this;
    }

    
ICMP protocol: The ICMP type and code. Required if specifying ICMP for the protocol.

Returns:
ICMP protocol: The ICMP type and code. Required if specifying ICMP for the protocol.
    public IcmpTypeCode getIcmpTypeCode() {
        return ;
    }
    
    
ICMP protocol: The ICMP type and code. Required if specifying ICMP for the protocol.

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

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

Parameters:
icmpTypeCode ICMP protocol: The ICMP type and code. Required if specifying ICMP for the protocol.
Returns:
A reference to this updated object so that method calls can be chained together.
        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.
        this. = portRange;
        return this;
    }

    
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
    @Override
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
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 (getNetworkAclId() != nullsb.append("NetworkAclId: " + getNetworkAclId() + ",");
        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 + ((getNetworkAclId() == null) ? 0 : getNetworkAclId().hashCode()); 
        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 CreateNetworkAclEntryRequest == falsereturn false;
        
        if (other.getNetworkAclId() == null ^ this.getNetworkAclId() == nullreturn false;
        if (other.getNetworkAclId() != null && other.getNetworkAclId().equals(this.getNetworkAclId()) == falsereturn false
        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
        
            return (CreateNetworkAclEntryRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X