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 virtual private gateway.

 
 public class VpnGateway implements SerializableCloneable {

    
The ID of the virtual private gateway.
 
     private String vpnGatewayId;

    
The current state of the virtual private gateway.

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

 
     private String state;

    
The type of VPN connection the virtual private gateway supports.

Constraints:
Allowed Values: ipsec.1

 
     private String type;

    
The Availability Zone where the virtual private gateway was created.
 
     private String availabilityZone;

    
Any VPCs attached to the virtual private gateway.
 
Any tags assigned to the virtual private gateway.
 
The ID of the virtual private gateway.

Returns:
The ID of the virtual private gateway.
 
     public String getVpnGatewayId() {
         return ;
     }
    
    
The ID of the virtual private gateway.

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

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

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

    
The current state of the virtual private gateway.

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

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

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

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

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 virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VpnState
    public VpnGateway withState(String state) {
        this. = state;
        return this;
    }

    
The current state of the virtual private gateway.

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

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

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 virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VpnState
    public VpnGateway withState(VpnState state) {
        this. = state.toString();
        return this;
    }

    
The type of VPN connection the virtual private gateway supports.

Constraints:
Allowed Values: ipsec.1

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

Constraints:
Allowed Values: ipsec.1

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

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 the virtual private gateway supports.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
GatewayType
    public VpnGateway withType(String type) {
        this. = type;
        return this;
    }

    
The type of VPN connection the virtual private gateway supports.

Constraints:
Allowed Values: ipsec.1

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

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 the virtual private gateway supports.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
GatewayType
    public VpnGateway withType(GatewayType type) {
        this. = type.toString();
        return this;
    }

    
The Availability Zone where the virtual private gateway was created.

Returns:
The Availability Zone where the virtual private gateway was created.
    public String getAvailabilityZone() {
        return ;
    }
    
    
The Availability Zone where the virtual private gateway was created.

Parameters:
availabilityZone The Availability Zone where the virtual private gateway was created.
    public void setAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
    }
    
    
The Availability Zone where the virtual private gateway was created.

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

Parameters:
availabilityZone The Availability Zone where the virtual private gateway was created.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnGateway withAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
        return this;
    }

    
Any VPCs attached to the virtual private gateway.

Returns:
Any VPCs attached to the virtual private gateway.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Any VPCs attached to the virtual private gateway.

Parameters:
vpcAttachments Any VPCs attached to the virtual private gateway.
    public void setVpcAttachments(java.util.Collection<VpcAttachmentvpcAttachments) {
        if (vpcAttachments == null) {
            this. = null;
            return;
        }
        vpcAttachmentsCopy.addAll(vpcAttachments);
        this. = vpcAttachmentsCopy;
    }
    
    
Any VPCs attached to the virtual private gateway.

NOTE: This method appends the values to the existing list (if any). Use setVpcAttachments(java.util.Collection) or withVpcAttachments(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:
vpcAttachments Any VPCs attached to the virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnGateway withVpcAttachments(VpcAttachment... vpcAttachments) {
        if (getVpcAttachments() == nullsetVpcAttachments(new java.util.ArrayList<VpcAttachment>(vpcAttachments.length));
        for (VpcAttachment value : vpcAttachments) {
            getVpcAttachments().add(value);
        }
        return this;
    }
    
    
Any VPCs attached to the virtual private gateway.

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

Parameters:
vpcAttachments Any VPCs attached to the virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnGateway withVpcAttachments(java.util.Collection<VpcAttachmentvpcAttachments) {
        if (vpcAttachments == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<VpcAttachmentvpcAttachmentsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<VpcAttachment>(vpcAttachments.size());
            vpcAttachmentsCopy.addAll(vpcAttachments);
            this. = vpcAttachmentsCopy;
        }
        return this;
    }

    
Any tags assigned to the virtual private gateway.

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

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

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 virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnGateway 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 virtual private gateway.

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

Parameters:
tags Any tags assigned to the virtual private gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VpnGateway withTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
        } else {
            tagsCopy.addAll(tags);
            this. = tagsCopy;
        }
        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 (getVpnGatewayId() != nullsb.append("VpnGatewayId: " + getVpnGatewayId() + ",");
        if (getState() != nullsb.append("State: " + getState() + ",");
        if (getType() != nullsb.append("Type: " + getType() + ",");
        if (getAvailabilityZone() != nullsb.append("AvailabilityZone: " + getAvailabilityZone() + ",");
        if (getVpcAttachments() != nullsb.append("VpcAttachments: " + getVpcAttachments() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getVpnGatewayId() == null) ? 0 : getVpnGatewayId().hashCode()); 
        hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); 
        hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); 
        hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode()); 
        hashCode = prime * hashCode + ((getVpcAttachments() == null) ? 0 : getVpcAttachments().hashCode()); 
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof VpnGateway == falsereturn false;
        VpnGateway other = (VpnGateway)obj;
        
        if (other.getVpnGatewayId() == null ^ this.getVpnGatewayId() == nullreturn false;
        if (other.getVpnGatewayId() != null && other.getVpnGatewayId().equals(this.getVpnGatewayId()) == falsereturn false
        if (other.getState() == null ^ this.getState() == nullreturn false;
        if (other.getState() != null && other.getState().equals(this.getState()) == falsereturn false
        if (other.getType() == null ^ this.getType() == nullreturn false;
        if (other.getType() != null && other.getType().equals(this.getType()) == falsereturn false
        if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == nullreturn false;
        if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == falsereturn false
        if (other.getVpcAttachments() == null ^ this.getVpcAttachments() == nullreturn false;
        if (other.getVpcAttachments() != null && other.getVpcAttachments().equals(this.getVpcAttachments()) == falsereturn false
        if (other.getTags() == null ^ this.getTags() == nullreturn false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == falsereturn false
        return true;
    }
    
    @Override
    public VpnGateway clone() {
        try {
            return (VpnGatewaysuper.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