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 an Internet gateway.

 
 public class InternetGateway implements SerializableCloneable {

    
The ID of the Internet gateway.
 
     private String internetGatewayId;

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

Returns:
The ID of the Internet gateway.
 
     public String getInternetGatewayId() {
         return ;
     }
    
    
The ID of the Internet gateway.

Parameters:
internetGatewayId The ID of the Internet gateway.
 
     public void setInternetGatewayId(String internetGatewayId) {
         this. = internetGatewayId;
     }
    
    
The ID of the Internet gateway.

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

Parameters:
internetGatewayId The ID of the Internet gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public InternetGateway withInternetGatewayId(String internetGatewayId) {
         this. = internetGatewayId;
         return this;
     }

    
Any VPCs attached to the Internet gateway.

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

Parameters:
attachments Any VPCs attached to the Internet gateway.
 
     public void setAttachments(java.util.Collection<InternetGatewayAttachmentattachments) {
         if (attachments == null) {
             this. = null;
             return;
         }
         attachmentsCopy.addAll(attachments);
         this. = attachmentsCopy;
    }
    
    
Any VPCs attached to the Internet gateway.

NOTE: This method appends the values to the existing list (if any). Use setAttachments(java.util.Collection) or withAttachments(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:
attachments Any VPCs attached to the Internet gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InternetGateway withAttachments(InternetGatewayAttachment... attachments) {
        if (getAttachments() == nullsetAttachments(new java.util.ArrayList<InternetGatewayAttachment>(attachments.length));
        for (InternetGatewayAttachment value : attachments) {
            getAttachments().add(value);
        }
        return this;
    }
    
    
Any VPCs attached to the Internet gateway.

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

Parameters:
attachments Any VPCs attached to the Internet gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (attachments == null) {
            this. = null;
        } else {
            attachmentsCopy.addAll(attachments);
            this. = attachmentsCopy;
        }
        return this;
    }

    
Any tags assigned to the Internet gateway.

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

Parameters:
tags Any tags assigned to the Internet gateway.
    public void setTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
            return;
        }
        tagsCopy.addAll(tags);
        this. = tagsCopy;
    }
    
    
Any tags assigned to the Internet 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 Internet gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InternetGateway 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 Internet gateway.

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

Parameters:
tags Any tags assigned to the Internet gateway.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InternetGateway 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 (getInternetGatewayId() != nullsb.append("InternetGatewayId: " + getInternetGatewayId() + ",");
        if (getAttachments() != nullsb.append("Attachments: " + getAttachments() + ",");
        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 + ((getInternetGatewayId() == null) ? 0 : getInternetGatewayId().hashCode()); 
        hashCode = prime * hashCode + ((getAttachments() == null) ? 0 : getAttachments().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 InternetGateway == falsereturn false;
        InternetGateway other = (InternetGateway)obj;
        
        if (other.getInternetGatewayId() == null ^ this.getInternetGatewayId() == nullreturn false;
        if (other.getInternetGatewayId() != null && other.getInternetGatewayId().equals(this.getInternetGatewayId()) == falsereturn false
        if (other.getAttachments() == null ^ this.getAttachments() == nullreturn false;
        if (other.getAttachments() != null && other.getAttachments().equals(this.getAttachments()) == 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 InternetGateway clone() {
        try {
            return (InternetGatewaysuper.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