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 volume attachment details.

 
 public class VolumeAttachment implements SerializableCloneable {

    
The ID of the volume.
 
     private String volumeId;

    
The ID of the instance.
 
     private String instanceId;

    
The device name.
 
     private String device;

    
The attachment state of the volume.

Constraints:
Allowed Values: attaching, attached, detaching, detached

 
     private String state;

    
The time stamp when the attachment initiated.
 
     private java.util.Date attachTime;

    
Indicates whether the Amazon EBS volume is deleted on instance termination.
 
     private Boolean deleteOnTermination;

    
The ID of the volume.

Returns:
The ID of the volume.
 
     public String getVolumeId() {
         return ;
     }
    
    
The ID of the volume.

Parameters:
volumeId The ID of the volume.
 
     public void setVolumeId(String volumeId) {
         this. = volumeId;
     }
    
    
The ID of the volume.

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

Parameters:
volumeId The ID of the volume.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public VolumeAttachment withVolumeId(String volumeId) {
         this. = volumeId;
         return this;
     }

    
The ID of the instance.

Returns:
The ID of the instance.
 
     public String getInstanceId() {
         return ;
    }
    
    
The ID of the instance.

Parameters:
instanceId The ID of the instance.
    public void setInstanceId(String instanceId) {
        this. = instanceId;
    }
    
    
The ID of the instance.

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

Parameters:
instanceId The ID of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VolumeAttachment withInstanceId(String instanceId) {
        this. = instanceId;
        return this;
    }

    
The device name.

Returns:
The device name.
    public String getDevice() {
        return ;
    }
    
    
The device name.

Parameters:
device The device name.
    public void setDevice(String device) {
        this. = device;
    }
    
    
The device name.

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

Parameters:
device The device name.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VolumeAttachment withDevice(String device) {
        this. = device;
        return this;
    }

    
The attachment state of the volume.

Constraints:
Allowed Values: attaching, attached, detaching, detached

Returns:
The attachment state of the volume.
See also:
VolumeAttachmentState
    public String getState() {
        return ;
    }
    
    
The attachment state of the volume.

Constraints:
Allowed Values: attaching, attached, detaching, detached

Parameters:
state The attachment state of the volume.
See also:
VolumeAttachmentState
    public void setState(String state) {
        this. = state;
    }
    
    
The attachment state of the volume.

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

Constraints:
Allowed Values: attaching, attached, detaching, detached

Parameters:
state The attachment state of the volume.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeAttachmentState
    public VolumeAttachment withState(String state) {
        this. = state;
        return this;
    }

    
The attachment state of the volume.

Constraints:
Allowed Values: attaching, attached, detaching, detached

Parameters:
state The attachment state of the volume.
See also:
VolumeAttachmentState
    public void setState(VolumeAttachmentState state) {
        this. = state.toString();
    }
    
    
The attachment state of the volume.

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

Constraints:
Allowed Values: attaching, attached, detaching, detached

Parameters:
state The attachment state of the volume.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeAttachmentState
        this. = state.toString();
        return this;
    }

    
The time stamp when the attachment initiated.

Returns:
The time stamp when the attachment initiated.
    public java.util.Date getAttachTime() {
        return ;
    }
    
    
The time stamp when the attachment initiated.

Parameters:
attachTime The time stamp when the attachment initiated.
    public void setAttachTime(java.util.Date attachTime) {
        this. = attachTime;
    }
    
    
The time stamp when the attachment initiated.

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

Parameters:
attachTime The time stamp when the attachment initiated.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VolumeAttachment withAttachTime(java.util.Date attachTime) {
        this. = attachTime;
        return this;
    }

    
Indicates whether the Amazon EBS volume is deleted on instance termination.

Returns:
Indicates whether the Amazon EBS volume is deleted on instance termination.
    public Boolean isDeleteOnTermination() {
        return ;
    }
    
    
Indicates whether the Amazon EBS volume is deleted on instance termination.

Parameters:
deleteOnTermination Indicates whether the Amazon EBS volume is deleted on instance termination.
    public void setDeleteOnTermination(Boolean deleteOnTermination) {
        this. = deleteOnTermination;
    }
    
    
Indicates whether the Amazon EBS volume is deleted on instance termination.

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

Parameters:
deleteOnTermination Indicates whether the Amazon EBS volume is deleted on instance termination.
Returns:
A reference to this updated object so that method calls can be chained together.
    public VolumeAttachment withDeleteOnTermination(Boolean deleteOnTermination) {
        this. = deleteOnTermination;
        return this;
    }

    
Indicates whether the Amazon EBS volume is deleted on instance termination.

Returns:
Indicates whether the Amazon EBS volume is deleted on instance termination.
    public Boolean getDeleteOnTermination() {
        return ;
    }

    
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 (getVolumeId() != nullsb.append("VolumeId: " + getVolumeId() + ",");
        if (getInstanceId() != nullsb.append("InstanceId: " + getInstanceId() + ",");
        if (getDevice() != nullsb.append("Device: " + getDevice() + ",");
        if (getState() != nullsb.append("State: " + getState() + ",");
        if (getAttachTime() != nullsb.append("AttachTime: " + getAttachTime() + ",");
        if (isDeleteOnTermination() != nullsb.append("DeleteOnTermination: " + isDeleteOnTermination() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getVolumeId() == null) ? 0 : getVolumeId().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getDevice() == null) ? 0 : getDevice().hashCode()); 
        hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); 
        hashCode = prime * hashCode + ((getAttachTime() == null) ? 0 : getAttachTime().hashCode()); 
        hashCode = prime * hashCode + ((isDeleteOnTermination() == null) ? 0 : isDeleteOnTermination().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof VolumeAttachment == falsereturn false;
        VolumeAttachment other = (VolumeAttachment)obj;
        
        if (other.getVolumeId() == null ^ this.getVolumeId() == nullreturn false;
        if (other.getVolumeId() != null && other.getVolumeId().equals(this.getVolumeId()) == falsereturn false
        if (other.getInstanceId() == null ^ this.getInstanceId() == nullreturn false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == falsereturn false
        if (other.getDevice() == null ^ this.getDevice() == nullreturn false;
        if (other.getDevice() != null && other.getDevice().equals(this.getDevice()) == falsereturn false
        if (other.getState() == null ^ this.getState() == nullreturn false;
        if (other.getState() != null && other.getState().equals(this.getState()) == falsereturn false
        if (other.getAttachTime() == null ^ this.getAttachTime() == nullreturn false;
        if (other.getAttachTime() != null && other.getAttachTime().equals(this.getAttachTime()) == falsereturn false
        if (other.isDeleteOnTermination() == null ^ this.isDeleteOnTermination() == nullreturn false;
        if (other.isDeleteOnTermination() != null && other.isDeleteOnTermination().equals(this.isDeleteOnTermination()) == falsereturn false
        return true;
    }
    
    @Override
    public VolumeAttachment clone() {
        try {
            return (VolumeAttachmentsuper.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