com.amazonaws.services.ec2.model.VpnConnection 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 VPN connection.
 * 
 */
public class VpnConnection implements Serializable, Cloneable {
    /**
     * 
     * The ID of the VPN connection.
     * 
     */
    private String vpnConnectionId;
    /**
     * 
     * The current state of the VPN connection.
     * 
     */
    private String state;
    /**
     * 
     * The configuration information for the VPN connection's customer gateway
     * (in the native XML format). This element is always present in the
     * CreateVpnConnection response; however, it's present in the
     * DescribeVpnConnections response only if the VPN connection is in
     * the pending or available state.
     * 
     */
    private String customerGatewayConfiguration;
    /**
     * 
     * The type of VPN connection.
     * 
     */
    private String type;
    /**
     * 
     * The ID of the customer gateway at your end of the VPN connection.
     * 
     */
    private String customerGatewayId;
    /**
     * 
     * The ID of the virtual private gateway at the AWS side of the VPN
     * connection.
     * 
     */
    private String vpnGatewayId;
    /**
     * 
     * Any tags assigned to the VPN connection.
     * 
     */
    private com.amazonaws.internal.SdkInternalList tags;
    /**
     * 
     * Information about the VPN tunnel.
     * 
     */
    private com.amazonaws.internal.SdkInternalList vgwTelemetry;
    /**
     * 
     * The VPN connection options.
     * 
     */
    private VpnConnectionOptions options;
    /**
     * 
     * The static routes associated with the VPN connection.
     * 
     */
    private com.amazonaws.internal.SdkInternalList routes;
    /**
     * 
     * The ID of the VPN connection.
     * 
     * 
     * @param vpnConnectionId
     *        The ID of the VPN connection.
     */
    public void setVpnConnectionId(String vpnConnectionId) {
        this.vpnConnectionId = vpnConnectionId;
    }
    /**
     * 
     * The ID of the VPN connection.
     * 
     * 
     * @return The ID of the VPN connection.
     */
    public String getVpnConnectionId() {
        return this.vpnConnectionId;
    }
    /**
     * 
     * The ID of the VPN connection.
     * 
     * 
     * @param vpnConnectionId
     *        The ID of the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withVpnConnectionId(String vpnConnectionId) {
        setVpnConnectionId(vpnConnectionId);
        return this;
    }
    /**
     * 
     * The current state of the VPN connection.
     * 
     * 
     * @param state
     *        The current state of the VPN connection.
     * @see VpnState
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * 
     * The current state of the VPN connection.
     * 
     * 
     * @return The current state of the VPN connection.
     * @see VpnState
     */
    public String getState() {
        return this.state;
    }
    /**
     * 
     * The current state of the VPN connection.
     * 
     * 
     * @param state
     *        The current state of the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see VpnState
     */
    public VpnConnection withState(String state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The current state of the VPN connection.
     * 
     * 
     * @param state
     *        The current state of the VPN connection.
     * @see VpnState
     */
    public void setState(VpnState state) {
        this.state = state.toString();
    }
    /**
     * 
     * The current state of the VPN connection.
     * 
     * 
     * @param state
     *        The current state of the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see VpnState
     */
    public VpnConnection withState(VpnState state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The configuration information for the VPN connection's customer gateway
     * (in the native XML format). This element is always present in the
     * CreateVpnConnection response; however, it's present in the
     * DescribeVpnConnections response only if the VPN connection is in
     * the pending or available state.
     * 
     * 
     * @param customerGatewayConfiguration
     *        The configuration information for the VPN connection's customer
     *        gateway (in the native XML format). This element is always present
     *        in the CreateVpnConnection response; however, it's present
     *        in the DescribeVpnConnections response only if the VPN
     *        connection is in the pending or
     *        available state.
     */
    public void setCustomerGatewayConfiguration(
            String customerGatewayConfiguration) {
        this.customerGatewayConfiguration = customerGatewayConfiguration;
    }
    /**
     * 
     * The configuration information for the VPN connection's customer gateway
     * (in the native XML format). This element is always present in the
     * CreateVpnConnection response; however, it's present in the
     * DescribeVpnConnections response only if the VPN connection is in
     * the pending or available state.
     * 
     * 
     * @return The configuration information for the VPN connection's customer
     *         gateway (in the native XML format). This element is always
     *         present in the CreateVpnConnection response; however, it's
     *         present in the DescribeVpnConnections response only if the
     *         VPN connection is in the pending or
     *         available state.
     */
    public String getCustomerGatewayConfiguration() {
        return this.customerGatewayConfiguration;
    }
    /**
     * 
     * The configuration information for the VPN connection's customer gateway
     * (in the native XML format). This element is always present in the
     * CreateVpnConnection response; however, it's present in the
     * DescribeVpnConnections response only if the VPN connection is in
     * the pending or available state.
     * 
     * 
     * @param customerGatewayConfiguration
     *        The configuration information for the VPN connection's customer
     *        gateway (in the native XML format). This element is always present
     *        in the CreateVpnConnection response; however, it's present
     *        in the DescribeVpnConnections response only if the VPN
     *        connection is in the pending or
     *        available state.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withCustomerGatewayConfiguration(
            String customerGatewayConfiguration) {
        setCustomerGatewayConfiguration(customerGatewayConfiguration);
        return this;
    }
    /**
     * 
     * The type of VPN connection.
     * 
     * 
     * @param type
     *        The type of VPN connection.
     * @see GatewayType
     */
    public void setType(String type) {
        this.type = type;
    }
    /**
     * 
     * The type of VPN connection.
     * 
     * 
     * @return The type of VPN connection.
     * @see GatewayType
     */
    public String getType() {
        return this.type;
    }
    /**
     * 
     * The type of VPN connection.
     * 
     * 
     * @param type
     *        The type of VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see GatewayType
     */
    public VpnConnection withType(String type) {
        setType(type);
        return this;
    }
    /**
     * 
     * The type of VPN connection.
     * 
     * 
     * @param type
     *        The type of VPN connection.
     * @see GatewayType
     */
    public void setType(GatewayType type) {
        this.type = type.toString();
    }
    /**
     * 
     * The type of VPN connection.
     * 
     * 
     * @param type
     *        The type of VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see GatewayType
     */
    public VpnConnection withType(GatewayType type) {
        setType(type);
        return this;
    }
    /**
     * 
     * The ID of the customer gateway at your end of the VPN connection.
     * 
     * 
     * @param customerGatewayId
     *        The ID of the customer gateway at your end of the VPN connection.
     */
    public void setCustomerGatewayId(String customerGatewayId) {
        this.customerGatewayId = customerGatewayId;
    }
    /**
     * 
     * The ID of the customer gateway at your end of the VPN connection.
     * 
     * 
     * @return The ID of the customer gateway at your end of the VPN connection.
     */
    public String getCustomerGatewayId() {
        return this.customerGatewayId;
    }
    /**
     * 
     * The ID of the customer gateway at your end of the VPN connection.
     * 
     * 
     * @param customerGatewayId
     *        The ID of the customer gateway at your end of the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withCustomerGatewayId(String customerGatewayId) {
        setCustomerGatewayId(customerGatewayId);
        return this;
    }
    /**
     * 
     * The ID of the virtual private gateway at the AWS side of the VPN
     * connection.
     * 
     * 
     * @param vpnGatewayId
     *        The ID of the virtual private gateway at the AWS side of the VPN
     *        connection.
     */
    public void setVpnGatewayId(String vpnGatewayId) {
        this.vpnGatewayId = vpnGatewayId;
    }
    /**
     * 
     * The ID of the virtual private gateway at the AWS side of the VPN
     * connection.
     * 
     * 
     * @return The ID of the virtual private gateway at the AWS side of the VPN
     *         connection.
     */
    public String getVpnGatewayId() {
        return this.vpnGatewayId;
    }
    /**
     * 
     * The ID of the virtual private gateway at the AWS side of the VPN
     * connection.
     * 
     * 
     * @param vpnGatewayId
     *        The ID of the virtual private gateway at the AWS side of the VPN
     *        connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withVpnGatewayId(String vpnGatewayId) {
        setVpnGatewayId(vpnGatewayId);
        return this;
    }
    /**
     * 
     * Any tags assigned to the VPN connection.
     * 
     * 
     * @return Any tags assigned to the VPN connection.
     */
    public java.util.List getTags() {
        if (tags == null) {
            tags = new com.amazonaws.internal.SdkInternalList();
        }
        return tags;
    }
    /**
     * 
     * Any tags assigned to the VPN connection.
     * 
     * 
     * @param tags
     *        Any tags assigned to the VPN connection.
     */
    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 VPN connection.
     * 
     * 
     * 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 VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection 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 VPN connection.
     * 
     * 
     * @param tags
     *        Any tags assigned to the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withTags(java.util.Collection tags) {
        setTags(tags);
        return this;
    }
    /**
     * 
     * Information about the VPN tunnel.
     * 
     * 
     * @return Information about the VPN tunnel.
     */
    public java.util.List getVgwTelemetry() {
        if (vgwTelemetry == null) {
            vgwTelemetry = new com.amazonaws.internal.SdkInternalList();
        }
        return vgwTelemetry;
    }
    /**
     * 
     * Information about the VPN tunnel.
     * 
     * 
     * @param vgwTelemetry
     *        Information about the VPN tunnel.
     */
    public void setVgwTelemetry(java.util.Collection vgwTelemetry) {
        if (vgwTelemetry == null) {
            this.vgwTelemetry = null;
            return;
        }
        this.vgwTelemetry = new com.amazonaws.internal.SdkInternalList(
                vgwTelemetry);
    }
    /**
     * 
     * Information about the VPN tunnel.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setVgwTelemetry(java.util.Collection)} or
     * {@link #withVgwTelemetry(java.util.Collection)} if you want to override
     * the existing values.
     * 
     * 
     * @param vgwTelemetry
     *        Information about the VPN tunnel.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withVgwTelemetry(VgwTelemetry... vgwTelemetry) {
        if (this.vgwTelemetry == null) {
            setVgwTelemetry(new com.amazonaws.internal.SdkInternalList(
                    vgwTelemetry.length));
        }
        for (VgwTelemetry ele : vgwTelemetry) {
            this.vgwTelemetry.add(ele);
        }
        return this;
    }
    /**
     * 
     * Information about the VPN tunnel.
     * 
     * 
     * @param vgwTelemetry
     *        Information about the VPN tunnel.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withVgwTelemetry(
            java.util.Collection vgwTelemetry) {
        setVgwTelemetry(vgwTelemetry);
        return this;
    }
    /**
     * 
     * The VPN connection options.
     * 
     * 
     * @param options
     *        The VPN connection options.
     */
    public void setOptions(VpnConnectionOptions options) {
        this.options = options;
    }
    /**
     * 
     * The VPN connection options.
     * 
     * 
     * @return The VPN connection options.
     */
    public VpnConnectionOptions getOptions() {
        return this.options;
    }
    /**
     * 
     * The VPN connection options.
     * 
     * 
     * @param options
     *        The VPN connection options.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withOptions(VpnConnectionOptions options) {
        setOptions(options);
        return this;
    }
    /**
     * 
     * The static routes associated with the VPN connection.
     * 
     * 
     * @return The static routes associated with the VPN connection.
     */
    public java.util.List getRoutes() {
        if (routes == null) {
            routes = new com.amazonaws.internal.SdkInternalList();
        }
        return routes;
    }
    /**
     * 
     * The static routes associated with the VPN connection.
     * 
     * 
     * @param routes
     *        The static routes associated with the VPN connection.
     */
    public void setRoutes(java.util.Collection routes) {
        if (routes == null) {
            this.routes = null;
            return;
        }
        this.routes = new com.amazonaws.internal.SdkInternalList(
                routes);
    }
    /**
     * 
     * The static routes associated with the VPN connection.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setRoutes(java.util.Collection)} or
     * {@link #withRoutes(java.util.Collection)} if you want to override the
     * existing values.
     * 
     * 
     * @param routes
     *        The static routes associated with the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withRoutes(VpnStaticRoute... routes) {
        if (this.routes == null) {
            setRoutes(new com.amazonaws.internal.SdkInternalList(
                    routes.length));
        }
        for (VpnStaticRoute ele : routes) {
            this.routes.add(ele);
        }
        return this;
    }
    /**
     * 
     * The static routes associated with the VPN connection.
     * 
     * 
     * @param routes
     *        The static routes associated with the VPN connection.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public VpnConnection withRoutes(java.util.Collection routes) {
        setRoutes(routes);
        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 (getVpnConnectionId() != null)
            sb.append("VpnConnectionId: " + getVpnConnectionId() + ",");
        if (getState() != null)
            sb.append("State: " + getState() + ",");
        if (getCustomerGatewayConfiguration() != null)
            sb.append("CustomerGatewayConfiguration: "
                    + getCustomerGatewayConfiguration() + ",");
        if (getType() != null)
            sb.append("Type: " + getType() + ",");
        if (getCustomerGatewayId() != null)
            sb.append("CustomerGatewayId: " + getCustomerGatewayId() + ",");
        if (getVpnGatewayId() != null)
            sb.append("VpnGatewayId: " + getVpnGatewayId() + ",");
        if (getTags() != null)
            sb.append("Tags: " + getTags() + ",");
        if (getVgwTelemetry() != null)
            sb.append("VgwTelemetry: " + getVgwTelemetry() + ",");
        if (getOptions() != null)
            sb.append("Options: " + getOptions() + ",");
        if (getRoutes() != null)
            sb.append("Routes: " + getRoutes());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof VpnConnection == false)
            return false;
        VpnConnection other = (VpnConnection) obj;
        if (other.getVpnConnectionId() == null
                ^ this.getVpnConnectionId() == null)
            return false;
        if (other.getVpnConnectionId() != null
                && other.getVpnConnectionId().equals(this.getVpnConnectionId()) == 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.getCustomerGatewayConfiguration() == null
                ^ this.getCustomerGatewayConfiguration() == null)
            return false;
        if (other.getCustomerGatewayConfiguration() != null
                && other.getCustomerGatewayConfiguration().equals(
                        this.getCustomerGatewayConfiguration()) == false)
            return false;
        if (other.getType() == null ^ this.getType() == null)
            return false;
        if (other.getType() != null
                && other.getType().equals(this.getType()) == false)
            return false;
        if (other.getCustomerGatewayId() == null
                ^ this.getCustomerGatewayId() == null)
            return false;
        if (other.getCustomerGatewayId() != null
                && other.getCustomerGatewayId().equals(
                        this.getCustomerGatewayId()) == false)
            return false;
        if (other.getVpnGatewayId() == null ^ this.getVpnGatewayId() == null)
            return false;
        if (other.getVpnGatewayId() != null
                && other.getVpnGatewayId().equals(this.getVpnGatewayId()) == 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.getVgwTelemetry() == null ^ this.getVgwTelemetry() == null)
            return false;
        if (other.getVgwTelemetry() != null
                && other.getVgwTelemetry().equals(this.getVgwTelemetry()) == false)
            return false;
        if (other.getOptions() == null ^ this.getOptions() == null)
            return false;
        if (other.getOptions() != null
                && other.getOptions().equals(this.getOptions()) == false)
            return false;
        if (other.getRoutes() == null ^ this.getRoutes() == null)
            return false;
        if (other.getRoutes() != null
                && other.getRoutes().equals(this.getRoutes()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime
                * hashCode
                + ((getVpnConnectionId() == null) ? 0 : getVpnConnectionId()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getState() == null) ? 0 : getState().hashCode());
        hashCode = prime
                * hashCode
                + ((getCustomerGatewayConfiguration() == null) ? 0
                        : getCustomerGatewayConfiguration().hashCode());
        hashCode = prime * hashCode
                + ((getType() == null) ? 0 : getType().hashCode());
        hashCode = prime
                * hashCode
                + ((getCustomerGatewayId() == null) ? 0
                        : getCustomerGatewayId().hashCode());
        hashCode = prime
                * hashCode
                + ((getVpnGatewayId() == null) ? 0 : getVpnGatewayId()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getTags() == null) ? 0 : getTags().hashCode());
        hashCode = prime
                * hashCode
                + ((getVgwTelemetry() == null) ? 0 : getVgwTelemetry()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getOptions() == null) ? 0 : getOptions().hashCode());
        hashCode = prime * hashCode
                + ((getRoutes() == null) ? 0 : getRoutes().hashCode());
        return hashCode;
    }
    @Override
    public VpnConnection clone() {
        try {
            return (VpnConnection) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}