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 a VPN connection.

 
 public class VpnConnection implements SerializableCloneable {

    
The ID of the VPN connection.
 
     private String vpnConnectionId;

    
The current state of the VPN connection.

Constraints:
Allowed Values: pending, available, deleting, deleted

 
     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.

Constraints:
Allowed Values: ipsec.1

 
     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.
 
Information about the VPN tunnel.
 
The VPN connection options.
 
     private VpnConnectionOptions options;

    
The static routes associated with the VPN connection.
 
The ID of the VPN connection.

Returns:
The ID of the VPN connection.
 
     public String getVpnConnectionId() {
         return ;
     }
    
    
The ID of the VPN connection.

Parameters:
vpnConnectionId The ID of the VPN connection.
    public void setVpnConnectionId(String vpnConnectionId) {
        this. = vpnConnectionId;
    }
    
    
The ID of the VPN connection.

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

Parameters:
vpnConnectionId The ID of the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withVpnConnectionId(String vpnConnectionId) {
        this. = vpnConnectionId;
        return this;
    }

    
The current state of the VPN connection.

Constraints:
Allowed Values: pending, available, deleting, deleted

Returns:
The current state of the VPN connection.
See also:
VpnState
    public String getState() {
        return ;
    }
    
    
The current state of the VPN connection.

Constraints:
Allowed Values: pending, available, deleting, deleted

Parameters:
state The current state of the VPN connection.
See also:
VpnState
    public void setState(String state) {
        this. = state;
    }
    
    
The current state of the VPN connection.

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

Constraints:
Allowed Values: pending, available, deleting, deleted

Parameters:
state The current state of the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VpnState
    public VpnConnection withState(String state) {
        this. = state;
        return this;
    }

    
The current state of the VPN connection.

Constraints:
Allowed Values: pending, available, deleting, deleted

Parameters:
state The current state of the VPN connection.
See also:
VpnState
    public void setState(VpnState state) {
        this. = state.toString();
    }
    
    
The current state of the VPN connection.

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

Constraints:
Allowed Values: pending, available, deleting, deleted

Parameters:
state The current state of the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VpnState
    public VpnConnection withState(VpnState state) {
        this. = state.toString();
        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.

Returns:
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.

Parameters:
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;
    }
    
    
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.

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

Parameters:
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.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withCustomerGatewayConfiguration(String customerGatewayConfiguration) {
        this. = customerGatewayConfiguration;
        return this;
    }

    
The type of VPN connection.

Constraints:
Allowed Values: ipsec.1

Returns:
The type of VPN connection.
See also:
GatewayType
    public String getType() {
        return ;
    }
    
    
The type of VPN connection.

Constraints:
Allowed Values: ipsec.1

Parameters:
type The type of VPN connection.
See also:
GatewayType
    public void setType(String type) {
        this. = type;
    }
    
    
The type of VPN connection.

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

Constraints:
Allowed Values: ipsec.1

Parameters:
type The type of VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
GatewayType
    public VpnConnection withType(String type) {
        this. = type;
        return this;
    }

    
The type of VPN connection.

Constraints:
Allowed Values: ipsec.1

Parameters:
type The type of VPN connection.
See also:
GatewayType
    public void setType(GatewayType type) {
        this. = type.toString();
    }
    
    
The type of VPN connection.

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

Constraints:
Allowed Values: ipsec.1

Parameters:
type The type of VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
GatewayType
    public VpnConnection withType(GatewayType type) {
        this. = type.toString();
        return this;
    }

    
The ID of the customer gateway at your end of the VPN connection.

Returns:
The ID of the customer gateway at your end of the VPN connection.
    public String getCustomerGatewayId() {
        return ;
    }
    
    
The ID of the customer gateway at your end of the VPN connection.

Parameters:
customerGatewayId The ID of the customer gateway at your end of the VPN connection.
    public void setCustomerGatewayId(String customerGatewayId) {
        this. = customerGatewayId;
    }
    
    
The ID of the customer gateway at your end of the VPN connection.

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

Parameters:
customerGatewayId The ID of the customer gateway at your end of the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withCustomerGatewayId(String customerGatewayId) {
        this. = customerGatewayId;
        return this;
    }

    
The ID of the virtual private gateway at the AWS side of the VPN connection.

Returns:
The ID of the virtual private gateway at the AWS side of the VPN connection.
    public String getVpnGatewayId() {
        return ;
    }
    
    
The ID of the virtual private gateway at the AWS side of the VPN connection.

Parameters:
vpnGatewayId The ID of the virtual private gateway at the AWS side of the VPN connection.
    public void setVpnGatewayId(String vpnGatewayId) {
        this. = vpnGatewayId;
    }
    
    
The ID of the virtual private gateway at the AWS side of the VPN connection.

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

Parameters:
vpnGatewayId The ID of the virtual private gateway at the AWS side of the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withVpnGatewayId(String vpnGatewayId) {
        this. = vpnGatewayId;
        return this;
    }

    
Any tags assigned to the VPN connection.

Returns:
Any tags assigned to the VPN connection.
    public java.util.List<TaggetTags() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Tag>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Any tags assigned to the VPN connection.

Parameters:
tags Any tags assigned to the VPN connection.
    public void setTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
            return;
        }
        tagsCopy.addAll(tags);
        this. = tagsCopy;
    }
    
    
Any tags assigned to the VPN connection.

NOTE: This method appends the values to the existing list (if any). Use setTags(java.util.Collection) or withTags(java.util.Collection) if you want to override the existing values.

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

Parameters:
tags Any tags assigned to the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withTags(Tag... tags) {
        if (getTags() == nullsetTags(new java.util.ArrayList<Tag>(tags.length));
        for (Tag value : tags) {
            getTags().add(value);
        }
        return this;
    }
    
    
Any tags assigned to the VPN connection.

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

Parameters:
tags Any tags assigned to the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
        } else {
            tagsCopy.addAll(tags);
            this. = tagsCopy;
        }
        return this;
    }

    
Information about the VPN tunnel.

Returns:
Information about the VPN tunnel.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Information about the VPN tunnel.

Parameters:
vgwTelemetry Information about the VPN tunnel.
    public void setVgwTelemetry(java.util.Collection<VgwTelemetryvgwTelemetry) {
        if (vgwTelemetry == null) {
            this. = null;
            return;
        }
        vgwTelemetryCopy.addAll(vgwTelemetry);
        this. = vgwTelemetryCopy;
    }
    
    
Information about the VPN tunnel.

NOTE: This method appends the values to the existing list (if any). Use setVgwTelemetry(java.util.Collection) or withVgwTelemetry(java.util.Collection) if you want to override the existing values.

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

Parameters:
vgwTelemetry Information about the VPN tunnel.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withVgwTelemetry(VgwTelemetry... vgwTelemetry) {
        if (getVgwTelemetry() == nullsetVgwTelemetry(new java.util.ArrayList<VgwTelemetry>(vgwTelemetry.length));
        for (VgwTelemetry value : vgwTelemetry) {
            getVgwTelemetry().add(value);
        }
        return this;
    }
    
    
Information about the VPN tunnel.

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

Parameters:
vgwTelemetry Information about the VPN tunnel.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (vgwTelemetry == null) {
            this. = null;
        } else {
            vgwTelemetryCopy.addAll(vgwTelemetry);
            this. = vgwTelemetryCopy;
        }
        return this;
    }

    
The VPN connection options.

Returns:
The VPN connection options.
    public VpnConnectionOptions getOptions() {
        return ;
    }
    
    
The VPN connection options.

Parameters:
options The VPN connection options.
    public void setOptions(VpnConnectionOptions options) {
        this. = options;
    }
    
    
The VPN connection options.

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

Parameters:
options The VPN connection options.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withOptions(VpnConnectionOptions options) {
        this. = options;
        return this;
    }

    
The static routes associated with the VPN connection.

Returns:
The static routes associated with the VPN connection.
    public java.util.List<VpnStaticRoutegetRoutes() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<VpnStaticRoute>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The static routes associated with the VPN connection.

Parameters:
routes The static routes associated with the VPN connection.
    public void setRoutes(java.util.Collection<VpnStaticRouteroutes) {
        if (routes == null) {
            this. = null;
            return;
        }
        routesCopy.addAll(routes);
        this. = routesCopy;
    }
    
    
The static routes associated with the VPN connection.

NOTE: This method appends the values to the existing list (if any). Use setRoutes(java.util.Collection) or withRoutes(java.util.Collection) if you want to override the existing values.

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

Parameters:
routes The static routes associated with the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnConnection withRoutes(VpnStaticRoute... routes) {
        if (getRoutes() == nullsetRoutes(new java.util.ArrayList<VpnStaticRoute>(routes.length));
        for (VpnStaticRoute value : routes) {
            getRoutes().add(value);
        }
        return this;
    }
    
    
The static routes associated with the VPN connection.

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

Parameters:
routes The static routes associated with the VPN connection.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (routes == null) {
            this. = null;
        } else {
            routesCopy.addAll(routes);
            this. = routesCopy;
        }
        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 (getVpnConnectionId() != nullsb.append("VpnConnectionId: " + getVpnConnectionId() + ",");
        if (getState() != nullsb.append("State: " + getState() + ",");
        if (getCustomerGatewayConfiguration() != nullsb.append("CustomerGatewayConfiguration: " + getCustomerGatewayConfiguration() + ",");
        if (getType() != nullsb.append("Type: " + getType() + ",");
        if (getCustomerGatewayId() != nullsb.append("CustomerGatewayId: " + getCustomerGatewayId() + ",");
        if (getVpnGatewayId() != nullsb.append("VpnGatewayId: " + getVpnGatewayId() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() + ",");
        if (getVgwTelemetry() != nullsb.append("VgwTelemetry: " + getVgwTelemetry() + ",");
        if (getOptions() != nullsb.append("Options: " + getOptions() + ",");
        if (getRoutes() != nullsb.append("Routes: " + getRoutes() );
        sb.append("}");
        return sb.toString();
    }
    
    @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 boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof VpnConnection == falsereturn false;
        VpnConnection other = (VpnConnection)obj;
        
        if (other.getVpnConnectionId() == null ^ this.getVpnConnectionId() == nullreturn false;
        if (other.getVpnConnectionId() != null && other.getVpnConnectionId().equals(this.getVpnConnectionId()) == falsereturn false
        if (other.getState() == null ^ this.getState() == nullreturn false;
        if (other.getState() != null && other.getState().equals(this.getState()) == falsereturn false
        if (other.getCustomerGatewayConfiguration() == null ^ this.getCustomerGatewayConfiguration() == nullreturn false;
        if (other.getCustomerGatewayConfiguration() != null && other.getCustomerGatewayConfiguration().equals(this.getCustomerGatewayConfiguration()) == falsereturn false
        if (other.getType() == null ^ this.getType() == nullreturn false;
        if (other.getType() != null && other.getType().equals(this.getType()) == falsereturn false
        if (other.getCustomerGatewayId() == null ^ this.getCustomerGatewayId() == nullreturn false;
        if (other.getCustomerGatewayId() != null && other.getCustomerGatewayId().equals(this.getCustomerGatewayId()) == falsereturn false
        if (other.getVpnGatewayId() == null ^ this.getVpnGatewayId() == nullreturn false;
        if (other.getVpnGatewayId() != null && other.getVpnGatewayId().equals(this.getVpnGatewayId()) == falsereturn false
        if (other.getTags() == null ^ this.getTags() == nullreturn false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == falsereturn false
        if (other.getVgwTelemetry() == null ^ this.getVgwTelemetry() == nullreturn false;
        if (other.getVgwTelemetry() != null && other.getVgwTelemetry().equals(this.getVgwTelemetry()) == falsereturn false
        if (other.getOptions() == null ^ this.getOptions() == nullreturn false;
        if (other.getOptions() != null && other.getOptions().equals(this.getOptions()) == falsereturn false
        if (other.getRoutes() == null ^ this.getRoutes() == nullreturn false;
        if (other.getRoutes() != null && other.getRoutes().equals(this.getRoutes()) == falsereturn false
        return true;
    }
    
    @Override
    public VpnConnection clone() {
        try {
            return (VpnConnectionsuper.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