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

 
 public class Volume implements SerializableCloneable {

    
The ID of the volume.
 
     private String volumeId;

    
The size of the volume, in GiBs.
 
     private Integer size;

    
The snapshot from which the volume was created, if applicable.
 
     private String snapshotId;

    
The Availability Zone for the volume.
 
     private String availabilityZone;

    
The volume state.

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

 
     private String state;

    
The time stamp when volume creation was initiated.
 
     private java.util.Date createTime;

    
Information about the volume attachments.
 
Any tags assigned to the volume.
 
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

Constraints:
Allowed Values: standard, io1, gp2

 
     private String volumeType;

    
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

 
     private Integer iops;

    
Indicates whether the volume will be encrypted.
 
    private Boolean encrypted;

    
The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.
    private String kmsKeyId;

    
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 Volume withVolumeId(String volumeId) {
        this. = volumeId;
        return this;
    }

    
The size of the volume, in GiBs.

Returns:
The size of the volume, in GiBs.
    public Integer getSize() {
        return ;
    }
    
    
The size of the volume, in GiBs.

Parameters:
size The size of the volume, in GiBs.
    public void setSize(Integer size) {
        this. = size;
    }
    
    
The size of the volume, in GiBs.

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

Parameters:
size The size of the volume, in GiBs.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withSize(Integer size) {
        this. = size;
        return this;
    }

    
The snapshot from which the volume was created, if applicable.

Returns:
The snapshot from which the volume was created, if applicable.
    public String getSnapshotId() {
        return ;
    }
    
    
The snapshot from which the volume was created, if applicable.

Parameters:
snapshotId The snapshot from which the volume was created, if applicable.
    public void setSnapshotId(String snapshotId) {
        this. = snapshotId;
    }
    
    
The snapshot from which the volume was created, if applicable.

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

Parameters:
snapshotId The snapshot from which the volume was created, if applicable.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withSnapshotId(String snapshotId) {
        this. = snapshotId;
        return this;
    }

    
The Availability Zone for the volume.

Returns:
The Availability Zone for the volume.
    public String getAvailabilityZone() {
        return ;
    }
    
    
The Availability Zone for the volume.

Parameters:
availabilityZone The Availability Zone for the volume.
    public void setAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
    }
    
    
The Availability Zone for the volume.

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

Parameters:
availabilityZone The Availability Zone for the volume.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
        return this;
    }

    
The volume state.

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

Returns:
The volume state.
See also:
VolumeState
    public String getState() {
        return ;
    }
    
    
The volume state.

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

Parameters:
state The volume state.
See also:
VolumeState
    public void setState(String state) {
        this. = state;
    }
    
    
The volume state.

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

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

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

    
The volume state.

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

Parameters:
state The volume state.
See also:
VolumeState
    public void setState(VolumeState state) {
        this. = state.toString();
    }
    
    
The volume state.

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

Constraints:
Allowed Values: creating, available, in-use, deleting, deleted, error

Parameters:
state The volume state.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeState
    public Volume withState(VolumeState state) {
        this. = state.toString();
        return this;
    }

    
The time stamp when volume creation was initiated.

Returns:
The time stamp when volume creation was initiated.
    public java.util.Date getCreateTime() {
        return ;
    }
    
    
The time stamp when volume creation was initiated.

Parameters:
createTime The time stamp when volume creation was initiated.
    public void setCreateTime(java.util.Date createTime) {
        this. = createTime;
    }
    
    
The time stamp when volume creation was initiated.

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

Parameters:
createTime The time stamp when volume creation was initiated.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withCreateTime(java.util.Date createTime) {
        this. = createTime;
        return this;
    }

    
Information about the volume attachments.

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

Parameters:
attachments Information about the volume attachments.
    public void setAttachments(java.util.Collection<VolumeAttachmentattachments) {
        if (attachments == null) {
            this. = null;
            return;
        }
        attachmentsCopy.addAll(attachments);
        this. = attachmentsCopy;
    }
    
    
Information about the volume attachments.

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 Information about the volume attachments.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withAttachments(VolumeAttachment... attachments) {
        if (getAttachments() == nullsetAttachments(new java.util.ArrayList<VolumeAttachment>(attachments.length));
        for (VolumeAttachment value : attachments) {
            getAttachments().add(value);
        }
        return this;
    }
    
    
Information about the volume attachments.

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

Parameters:
attachments Information about the volume attachments.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withAttachments(java.util.Collection<VolumeAttachmentattachments) {
        if (attachments == null) {
            this. = null;
        } else {
            attachmentsCopy.addAll(attachments);
            this. = attachmentsCopy;
        }
        return this;
    }

    
Any tags assigned to the volume.

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

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

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

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

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

    
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

Constraints:
Allowed Values: standard, io1, gp2

Returns:
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.
See also:
VolumeType
    public String getVolumeType() {
        return ;
    }
    
    
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

Constraints:
Allowed Values: standard, io1, gp2

Parameters:
volumeType The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.
See also:
VolumeType
    public void setVolumeType(String volumeType) {
        this. = volumeType;
    }
    
    
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

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

Constraints:
Allowed Values: standard, io1, gp2

Parameters:
volumeType The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeType
    public Volume withVolumeType(String volumeType) {
        this. = volumeType;
        return this;
    }

    
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

Constraints:
Allowed Values: standard, io1, gp2

Parameters:
volumeType The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.
See also:
VolumeType
    public void setVolumeType(VolumeType volumeType) {
        this. = volumeType.toString();
    }
    
    
The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.

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

Constraints:
Allowed Values: standard, io1, gp2

Parameters:
volumeType The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeType
    public Volume withVolumeType(VolumeType volumeType) {
        this. = volumeType.toString();
        return this;
    }

    
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

Returns:
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

    public Integer getIops() {
        return ;
    }
    
    
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

Parameters:
iops The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

    public void setIops(Integer iops) {
        this. = iops;
    }
    
    
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

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

Parameters:
iops The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide for Linux.

Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.

Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withIops(Integer iops) {
        this. = iops;
        return this;
    }

    
Indicates whether the volume will be encrypted.

Returns:
Indicates whether the volume will be encrypted.
    public Boolean isEncrypted() {
        return ;
    }
    
    
Indicates whether the volume will be encrypted.

Parameters:
encrypted Indicates whether the volume will be encrypted.
    public void setEncrypted(Boolean encrypted) {
        this. = encrypted;
    }
    
    
Indicates whether the volume will be encrypted.

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

Parameters:
encrypted Indicates whether the volume will be encrypted.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withEncrypted(Boolean encrypted) {
        this. = encrypted;
        return this;
    }

    
Indicates whether the volume will be encrypted.

Returns:
Indicates whether the volume will be encrypted.
    public Boolean getEncrypted() {
        return ;
    }

    
The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.

Returns:
The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.
    public String getKmsKeyId() {
        return ;
    }
    
    
The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.

Parameters:
kmsKeyId The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.
    public void setKmsKeyId(String kmsKeyId) {
        this. = kmsKeyId;
    }
    
    
The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.

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

Parameters:
kmsKeyId The full ARN of the AWS Key Management Service (KMS) master key that was used to protect the volume encryption key for the volume.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Volume withKmsKeyId(String kmsKeyId) {
        this. = kmsKeyId;
        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 (getVolumeId() != nullsb.append("VolumeId: " + getVolumeId() + ",");
        if (getSize() != nullsb.append("Size: " + getSize() + ",");
        if (getSnapshotId() != nullsb.append("SnapshotId: " + getSnapshotId() + ",");
        if (getAvailabilityZone() != nullsb.append("AvailabilityZone: " + getAvailabilityZone() + ",");
        if (getState() != nullsb.append("State: " + getState() + ",");
        if (getCreateTime() != nullsb.append("CreateTime: " + getCreateTime() + ",");
        if (getAttachments() != nullsb.append("Attachments: " + getAttachments() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() + ",");
        if (getVolumeType() != nullsb.append("VolumeType: " + getVolumeType() + ",");
        if (getIops() != nullsb.append("Iops: " + getIops() + ",");
        if (isEncrypted() != nullsb.append("Encrypted: " + isEncrypted() + ",");
        if (getKmsKeyId() != nullsb.append("KmsKeyId: " + getKmsKeyId() );
        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 + ((getSize() == null) ? 0 : getSize().hashCode()); 
        hashCode = prime * hashCode + ((getSnapshotId() == null) ? 0 : getSnapshotId().hashCode()); 
        hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode()); 
        hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); 
        hashCode = prime * hashCode + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); 
        hashCode = prime * hashCode + ((getAttachments() == null) ? 0 : getAttachments().hashCode()); 
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); 
        hashCode = prime * hashCode + ((getVolumeType() == null) ? 0 : getVolumeType().hashCode()); 
        hashCode = prime * hashCode + ((getIops() == null) ? 0 : getIops().hashCode()); 
        hashCode = prime * hashCode + ((isEncrypted() == null) ? 0 : isEncrypted().hashCode()); 
        hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Volume == falsereturn false;
        Volume other = (Volume)obj;
        
        if (other.getVolumeId() == null ^ this.getVolumeId() == nullreturn false;
        if (other.getVolumeId() != null && other.getVolumeId().equals(this.getVolumeId()) == falsereturn false
        if (other.getSize() == null ^ this.getSize() == nullreturn false;
        if (other.getSize() != null && other.getSize().equals(this.getSize()) == falsereturn false
        if (other.getSnapshotId() == null ^ this.getSnapshotId() == nullreturn false;
        if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == falsereturn false
        if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == nullreturn false;
        if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == falsereturn false
        if (other.getState() == null ^ this.getState() == nullreturn false;
        if (other.getState() != null && other.getState().equals(this.getState()) == falsereturn false
        if (other.getCreateTime() == null ^ this.getCreateTime() == nullreturn false;
        if (other.getCreateTime() != null && other.getCreateTime().equals(this.getCreateTime()) == 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
        if (other.getVolumeType() == null ^ this.getVolumeType() == nullreturn false;
        if (other.getVolumeType() != null && other.getVolumeType().equals(this.getVolumeType()) == falsereturn false
        if (other.getIops() == null ^ this.getIops() == nullreturn false;
        if (other.getIops() != null && other.getIops().equals(this.getIops()) == falsereturn false
        if (other.isEncrypted() == null ^ this.isEncrypted() == nullreturn false;
        if (other.isEncrypted() != null && other.isEncrypted().equals(this.isEncrypted()) == falsereturn false
        if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == nullreturn false;
        if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == falsereturn false
        return true;
    }
    
    @Override
    public Volume clone() {
        try {
            return (Volumesuper.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