com.amazonaws.services.ec2.model.Vpc 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 VPC.
 * 
 */
public class Vpc implements Serializable, Cloneable {
    /**
     * 
     * The ID of the VPC.
     * 
     */
    private String vpcId;
    /**
     * 
     * The current state of the VPC.
     * 
     */
    private String state;
    /**
     * 
     * The CIDR block for the VPC.
     * 
     */
    private String cidrBlock;
    /**
     * 
     * The ID of the set of DHCP options you've associated with the VPC (or
     * default if the default options are associated with the VPC).
     * 
     */
    private String dhcpOptionsId;
    /**
     * 
     * Any tags assigned to the VPC.
     * 
     */
    private com.amazonaws.internal.SdkInternalList tags;
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     */
    private String instanceTenancy;
    /**
     * 
     * Indicates whether the VPC is the default VPC.
     * 
     */
    private Boolean isDefault;
    /**
     * 
     * The ID of the VPC.
     * 
     * 
     * @param vpcId
     *        The ID of the VPC.
     */
    public void setVpcId(String vpcId) {
        this.vpcId = vpcId;
    }
    /**
     * 
     * The ID of the VPC.
     * 
     * 
     * @return The ID of the VPC.
     */
    public String getVpcId() {
        return this.vpcId;
    }
    /**
     * 
     * The ID of the VPC.
     * 
     * 
     * @param vpcId
     *        The ID of the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc withVpcId(String vpcId) {
        setVpcId(vpcId);
        return this;
    }
    /**
     * 
     * The current state of the VPC.
     * 
     * 
     * @param state
     *        The current state of the VPC.
     * @see VpcState
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * 
     * The current state of the VPC.
     * 
     * 
     * @return The current state of the VPC.
     * @see VpcState
     */
    public String getState() {
        return this.state;
    }
    /**
     * 
     * The current state of the VPC.
     * 
     * 
     * @param state
     *        The current state of the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see VpcState
     */
    public Vpc withState(String state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The current state of the VPC.
     * 
     * 
     * @param state
     *        The current state of the VPC.
     * @see VpcState
     */
    public void setState(VpcState state) {
        this.state = state.toString();
    }
    /**
     * 
     * The current state of the VPC.
     * 
     * 
     * @param state
     *        The current state of the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see VpcState
     */
    public Vpc withState(VpcState state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The CIDR block for the VPC.
     * 
     * 
     * @param cidrBlock
     *        The CIDR block for the VPC.
     */
    public void setCidrBlock(String cidrBlock) {
        this.cidrBlock = cidrBlock;
    }
    /**
     * 
     * The CIDR block for the VPC.
     * 
     * 
     * @return The CIDR block for the VPC.
     */
    public String getCidrBlock() {
        return this.cidrBlock;
    }
    /**
     * 
     * The CIDR block for the VPC.
     * 
     * 
     * @param cidrBlock
     *        The CIDR block for the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc withCidrBlock(String cidrBlock) {
        setCidrBlock(cidrBlock);
        return this;
    }
    /**
     * 
     * The ID of the set of DHCP options you've associated with the VPC (or
     * default if the default options are associated with the VPC).
     * 
     * 
     * @param dhcpOptionsId
     *        The ID of the set of DHCP options you've associated with the VPC
     *        (or default if the default options are associated
     *        with the VPC).
     */
    public void setDhcpOptionsId(String dhcpOptionsId) {
        this.dhcpOptionsId = dhcpOptionsId;
    }
    /**
     * 
     * The ID of the set of DHCP options you've associated with the VPC (or
     * default if the default options are associated with the VPC).
     * 
     * 
     * @return The ID of the set of DHCP options you've associated with the VPC
     *         (or default if the default options are associated
     *         with the VPC).
     */
    public String getDhcpOptionsId() {
        return this.dhcpOptionsId;
    }
    /**
     * 
     * The ID of the set of DHCP options you've associated with the VPC (or
     * default if the default options are associated with the VPC).
     * 
     * 
     * @param dhcpOptionsId
     *        The ID of the set of DHCP options you've associated with the VPC
     *        (or default if the default options are associated
     *        with the VPC).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc withDhcpOptionsId(String dhcpOptionsId) {
        setDhcpOptionsId(dhcpOptionsId);
        return this;
    }
    /**
     * 
     * Any tags assigned to the VPC.
     * 
     * 
     * @return Any tags assigned to the VPC.
     */
    public java.util.List getTags() {
        if (tags == null) {
            tags = new com.amazonaws.internal.SdkInternalList();
        }
        return tags;
    }
    /**
     * 
     * Any tags assigned to the VPC.
     * 
     * 
     * @param tags
     *        Any tags assigned to the VPC.
     */
    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 VPC.
     * 
     * 
     * 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 VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc 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 VPC.
     * 
     * 
     * @param tags
     *        Any tags assigned to the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc withTags(java.util.Collection tags) {
        setTags(tags);
        return this;
    }
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     * 
     * @param instanceTenancy
     *        The allowed tenancy of instances launched into the VPC.
     * @see Tenancy
     */
    public void setInstanceTenancy(String instanceTenancy) {
        this.instanceTenancy = instanceTenancy;
    }
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     * 
     * @return The allowed tenancy of instances launched into the VPC.
     * @see Tenancy
     */
    public String getInstanceTenancy() {
        return this.instanceTenancy;
    }
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     * 
     * @param instanceTenancy
     *        The allowed tenancy of instances launched into the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see Tenancy
     */
    public Vpc withInstanceTenancy(String instanceTenancy) {
        setInstanceTenancy(instanceTenancy);
        return this;
    }
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     * 
     * @param instanceTenancy
     *        The allowed tenancy of instances launched into the VPC.
     * @see Tenancy
     */
    public void setInstanceTenancy(Tenancy instanceTenancy) {
        this.instanceTenancy = instanceTenancy.toString();
    }
    /**
     * 
     * The allowed tenancy of instances launched into the VPC.
     * 
     * 
     * @param instanceTenancy
     *        The allowed tenancy of instances launched into the VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see Tenancy
     */
    public Vpc withInstanceTenancy(Tenancy instanceTenancy) {
        setInstanceTenancy(instanceTenancy);
        return this;
    }
    /**
     * 
     * Indicates whether the VPC is the default VPC.
     * 
     * 
     * @param isDefault
     *        Indicates whether the VPC is the default VPC.
     */
    public void setIsDefault(Boolean isDefault) {
        this.isDefault = isDefault;
    }
    /**
     * 
     * Indicates whether the VPC is the default VPC.
     * 
     * 
     * @return Indicates whether the VPC is the default VPC.
     */
    public Boolean getIsDefault() {
        return this.isDefault;
    }
    /**
     * 
     * Indicates whether the VPC is the default VPC.
     * 
     * 
     * @param isDefault
     *        Indicates whether the VPC is the default VPC.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Vpc withIsDefault(Boolean isDefault) {
        setIsDefault(isDefault);
        return this;
    }
    /**
     * 
     * Indicates whether the VPC is the default VPC.
     * 
     * 
     * @return Indicates whether the VPC is the default VPC.
     */
    public Boolean isDefault() {
        return this.isDefault;
    }
    /**
     * 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 (getVpcId() != null)
            sb.append("VpcId: " + getVpcId() + ",");
        if (getState() != null)
            sb.append("State: " + getState() + ",");
        if (getCidrBlock() != null)
            sb.append("CidrBlock: " + getCidrBlock() + ",");
        if (getDhcpOptionsId() != null)
            sb.append("DhcpOptionsId: " + getDhcpOptionsId() + ",");
        if (getTags() != null)
            sb.append("Tags: " + getTags() + ",");
        if (getInstanceTenancy() != null)
            sb.append("InstanceTenancy: " + getInstanceTenancy() + ",");
        if (getIsDefault() != null)
            sb.append("IsDefault: " + getIsDefault());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof Vpc == false)
            return false;
        Vpc other = (Vpc) obj;
        if (other.getVpcId() == null ^ this.getVpcId() == null)
            return false;
        if (other.getVpcId() != null
                && other.getVpcId().equals(this.getVpcId()) == false)
            return false;
        if (other.getState() == null ^ this.getState() == null)
            return false;
        if (other.getState() != null
                && other.getState().equals(this.getState()) == false)
            return false;
        if (other.getCidrBlock() == null ^ this.getCidrBlock() == null)
            return false;
        if (other.getCidrBlock() != null
                && other.getCidrBlock().equals(this.getCidrBlock()) == false)
            return false;
        if (other.getDhcpOptionsId() == null ^ this.getDhcpOptionsId() == null)
            return false;
        if (other.getDhcpOptionsId() != null
                && other.getDhcpOptionsId().equals(this.getDhcpOptionsId()) == false)
            return false;
        if (other.getTags() == null ^ this.getTags() == null)
            return false;
        if (other.getTags() != null
                && other.getTags().equals(this.getTags()) == false)
            return false;
        if (other.getInstanceTenancy() == null
                ^ this.getInstanceTenancy() == null)
            return false;
        if (other.getInstanceTenancy() != null
                && other.getInstanceTenancy().equals(this.getInstanceTenancy()) == false)
            return false;
        if (other.getIsDefault() == null ^ this.getIsDefault() == null)
            return false;
        if (other.getIsDefault() != null
                && other.getIsDefault().equals(this.getIsDefault()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getVpcId() == null) ? 0 : getVpcId().hashCode());
        hashCode = prime * hashCode
                + ((getState() == null) ? 0 : getState().hashCode());
        hashCode = prime * hashCode
                + ((getCidrBlock() == null) ? 0 : getCidrBlock().hashCode());
        hashCode = prime
                * hashCode
                + ((getDhcpOptionsId() == null) ? 0 : getDhcpOptionsId()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getTags() == null) ? 0 : getTags().hashCode());
        hashCode = prime
                * hashCode
                + ((getInstanceTenancy() == null) ? 0 : getInstanceTenancy()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getIsDefault() == null) ? 0 : getIsDefault().hashCode());
        return hashCode;
    }
    @Override
    public Vpc clone() {
        try {
            return (Vpc) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}