com.amazonaws.services.ec2.model.NetworkAcl Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
 * Copyright 2011-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.ec2.model;
import java.io.Serializable;
/**
 * 
 * Describes a network ACL.
 * 
 */
public class NetworkAcl implements Serializable, Cloneable {
    /**
     * 
     * The ID of the network ACL.
     * 
     */
    private String networkAclId;
    /**
     * 
     * The ID of the VPC for the network ACL.
     * 
     */
    private String vpcId;
    /**
     * 
     * Indicates whether this is the default network ACL for the VPC.
     * 
     */
    private Boolean isDefault;
    /**
     * 
     * One or more entries (rules) in the network ACL.
     * 
     */
    private com.amazonaws.internal.SdkInternalList entries;
    /**
     * 
     * Any associations between the network ACL and one or more subnets
     * 
     */
    private com.amazonaws.internal.SdkInternalList associations;
    /**
     * 
     * Any tags assigned to the network ACL.
     * 
     */
    private com.amazonaws.internal.SdkInternalList tags;
    /**
     * 
     * The ID of the network ACL.
     * 
     * 
     * @param networkAclId
     *        The ID of the network ACL.
     */
    public void setNetworkAclId(String networkAclId) {
        this.networkAclId = networkAclId;
    }
    /**
     * 
     * The ID of the network ACL.
     * 
     * 
     * @return The ID of the network ACL.
     */
    public String getNetworkAclId() {
        return this.networkAclId;
    }
    /**
     * 
     * The ID of the network ACL.
     * 
     * 
     * @param networkAclId
     *        The ID of the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withNetworkAclId(String networkAclId) {
        setNetworkAclId(networkAclId);
        return this;
    }
    /**
     * 
     * The ID of the VPC for the network ACL.
     * 
     * 
     * @param vpcId
     *        The ID of the VPC for the network ACL.
     */
    public void setVpcId(String vpcId) {
        this.vpcId = vpcId;
    }
    /**
     * 
     * The ID of the VPC for the network ACL.
     * 
     * 
     * @return The ID of the VPC for the network ACL.
     */
    public String getVpcId() {
        return this.vpcId;
    }
    /**
     * 
     * The ID of the VPC for the network ACL.
     * 
     * 
     * @param vpcId
     *        The ID of the VPC for the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withVpcId(String vpcId) {
        setVpcId(vpcId);
        return this;
    }
    /**
     * 
     * Indicates whether this is the default network ACL for the VPC.
     * 
     * 
     * @param isDefault
     *        Indicates whether this is the default network ACL for the VPC.
     */
    public void setIsDefault(Boolean isDefault) {
        this.isDefault = isDefault;
    }
    /**
     * 
     * Indicates whether this is the default network ACL for the VPC.
     * 
     * 
     * @return Indicates whether this is the default network ACL for the VPC.
     */
    public Boolean getIsDefault() {
        return this.isDefault;
    }
    /**
     * 
     * Indicates whether this is the default network ACL for the VPC.
     * 
     * 
     * @param isDefault
     *        Indicates whether this is the default network ACL for the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withIsDefault(Boolean isDefault) {
        setIsDefault(isDefault);
        return this;
    }
    /**
     * 
     * Indicates whether this is the default network ACL for the VPC.
     * 
     * 
     * @return Indicates whether this is the default network ACL for the VPC.
     */
    public Boolean isDefault() {
        return this.isDefault;
    }
    /**
     * 
     * One or more entries (rules) in the network ACL.
     * 
     * 
     * @return One or more entries (rules) in the network ACL.
     */
    public java.util.List getEntries() {
        if (entries == null) {
            entries = new com.amazonaws.internal.SdkInternalList();
        }
        return entries;
    }
    /**
     * 
     * One or more entries (rules) in the network ACL.
     * 
     * 
     * @param entries
     *        One or more entries (rules) in the network ACL.
     */
    public void setEntries(java.util.Collection entries) {
        if (entries == null) {
            this.entries = null;
            return;
        }
        this.entries = new com.amazonaws.internal.SdkInternalList(
                entries);
    }
    /**
     * 
     * One or more entries (rules) in the network ACL.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setEntries(java.util.Collection)} or
     * {@link #withEntries(java.util.Collection)} if you want to override the
     * existing values.
     * 
     * 
     * @param entries
     *        One or more entries (rules) in the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withEntries(NetworkAclEntry... entries) {
        if (this.entries == null) {
            setEntries(new com.amazonaws.internal.SdkInternalList(
                    entries.length));
        }
        for (NetworkAclEntry ele : entries) {
            this.entries.add(ele);
        }
        return this;
    }
    /**
     * 
     * One or more entries (rules) in the network ACL.
     * 
     * 
     * @param entries
     *        One or more entries (rules) in the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withEntries(java.util.Collection entries) {
        setEntries(entries);
        return this;
    }
    /**
     * 
     * Any associations between the network ACL and one or more subnets
     * 
     * 
     * @return Any associations between the network ACL and one or more subnets
     */
    public java.util.List getAssociations() {
        if (associations == null) {
            associations = new com.amazonaws.internal.SdkInternalList();
        }
        return associations;
    }
    /**
     * 
     * Any associations between the network ACL and one or more subnets
     * 
     * 
     * @param associations
     *        Any associations between the network ACL and one or more subnets
     */
    public void setAssociations(
            java.util.Collection associations) {
        if (associations == null) {
            this.associations = null;
            return;
        }
        this.associations = new com.amazonaws.internal.SdkInternalList(
                associations);
    }
    /**
     * 
     * Any associations between the network ACL and one or more subnets
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setAssociations(java.util.Collection)} or
     * {@link #withAssociations(java.util.Collection)} if you want to override
     * the existing values.
     * 
     * 
     * @param associations
     *        Any associations between the network ACL and one or more subnets
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withAssociations(NetworkAclAssociation... associations) {
        if (this.associations == null) {
            setAssociations(new com.amazonaws.internal.SdkInternalList(
                    associations.length));
        }
        for (NetworkAclAssociation ele : associations) {
            this.associations.add(ele);
        }
        return this;
    }
    /**
     * 
     * Any associations between the network ACL and one or more subnets
     * 
     * 
     * @param associations
     *        Any associations between the network ACL and one or more subnets
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withAssociations(
            java.util.Collection associations) {
        setAssociations(associations);
        return this;
    }
    /**
     * 
     * Any tags assigned to the network ACL.
     * 
     * 
     * @return Any tags assigned to the network ACL.
     */
    public java.util.List getTags() {
        if (tags == null) {
            tags = new com.amazonaws.internal.SdkInternalList();
        }
        return tags;
    }
    /**
     * 
     * Any tags assigned to the network ACL.
     * 
     * 
     * @param tags
     *        Any tags assigned to the network ACL.
     */
    public void setTags(java.util.Collection tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }
        this.tags = new com.amazonaws.internal.SdkInternalList(tags);
    }
    /**
     * 
     * Any tags assigned to the network ACL.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setTags(java.util.Collection)} or
     * {@link #withTags(java.util.Collection)} if you want to override the
     * existing values.
     * 
     * 
     * @param tags
     *        Any tags assigned to the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withTags(Tag... tags) {
        if (this.tags == null) {
            setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
        }
        for (Tag ele : tags) {
            this.tags.add(ele);
        }
        return this;
    }
    /**
     * 
     * Any tags assigned to the network ACL.
     * 
     * 
     * @param tags
     *        Any tags assigned to the network ACL.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public NetworkAcl withTags(java.util.Collection tags) {
        setTags(tags);
        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 (getNetworkAclId() != null)
            sb.append("NetworkAclId: " + getNetworkAclId() + ",");
        if (getVpcId() != null)
            sb.append("VpcId: " + getVpcId() + ",");
        if (getIsDefault() != null)
            sb.append("IsDefault: " + getIsDefault() + ",");
        if (getEntries() != null)
            sb.append("Entries: " + getEntries() + ",");
        if (getAssociations() != null)
            sb.append("Associations: " + getAssociations() + ",");
        if (getTags() != null)
            sb.append("Tags: " + getTags());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof NetworkAcl == false)
            return false;
        NetworkAcl other = (NetworkAcl) obj;
        if (other.getNetworkAclId() == null ^ this.getNetworkAclId() == null)
            return false;
        if (other.getNetworkAclId() != null
                && other.getNetworkAclId().equals(this.getNetworkAclId()) == false)
            return false;
        if (other.getVpcId() == null ^ this.getVpcId() == null)
            return false;
        if (other.getVpcId() != null
                && other.getVpcId().equals(this.getVpcId()) == false)
            return false;
        if (other.getIsDefault() == null ^ this.getIsDefault() == null)
            return false;
        if (other.getIsDefault() != null
                && other.getIsDefault().equals(this.getIsDefault()) == false)
            return false;
        if (other.getEntries() == null ^ this.getEntries() == null)
            return false;
        if (other.getEntries() != null
                && other.getEntries().equals(this.getEntries()) == false)
            return false;
        if (other.getAssociations() == null ^ this.getAssociations() == null)
            return false;
        if (other.getAssociations() != null
                && other.getAssociations().equals(this.getAssociations()) == false)
            return false;
        if (other.getTags() == null ^ this.getTags() == null)
            return false;
        if (other.getTags() != null
                && other.getTags().equals(this.getTags()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime
                * hashCode
                + ((getNetworkAclId() == null) ? 0 : getNetworkAclId()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getVpcId() == null) ? 0 : getVpcId().hashCode());
        hashCode = prime * hashCode
                + ((getIsDefault() == null) ? 0 : getIsDefault().hashCode());
        hashCode = prime * hashCode
                + ((getEntries() == null) ? 0 : getEntries().hashCode());
        hashCode = prime
                * hashCode
                + ((getAssociations() == null) ? 0 : getAssociations()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getTags() == null) ? 0 : getTags().hashCode());
        return hashCode;
    }
    @Override
    public NetworkAcl clone() {
        try {
            return (NetworkAcl) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}