All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ec2.model.Volume Maven / Gradle / Ivy

Go to download

The AWS SDK for Java with support for OSGi. The AWS SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).

There is a newer version: 1.11.60
Show newest version
/*
 * Copyright 2011-2016 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;

import java.io.Serializable;

/**
 * 

* Describes a volume. *

*/ public class Volume implements Serializable, Cloneable { /** *

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

*/ private String state; /** *

* The time stamp when volume creation was initiated. *

*/ private java.util.Date createTime; /** *

* Information about the volume attachments. *

*/ private com.amazonaws.internal.SdkInternalList attachments; /** *

* Any tags assigned to the volume. *

*/ private com.amazonaws.internal.SdkInternalList tags; /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

*/ 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. *

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS * for gp2 volumes. *

*

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

*/ private Integer iops; /** *

* Indicates whether the volume will be encrypted. *

*/ private Boolean encrypted; /** *

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

*/ private String kmsKeyId; /** *

* The ID of the volume. *

* * @param volumeId * The ID of the volume. */ public void setVolumeId(String volumeId) { this.volumeId = volumeId; } /** *

* The ID of the volume. *

* * @return The ID of the volume. */ public String getVolumeId() { return this.volumeId; } /** *

* The ID of the volume. *

* * @param volumeId * The ID of the volume. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withVolumeId(String volumeId) { setVolumeId(volumeId); return this; } /** *

* The size of the volume, in GiBs. *

* * @param size * The size of the volume, in GiBs. */ public void setSize(Integer size) { this.size = size; } /** *

* The size of the volume, in GiBs. *

* * @return The size of the volume, in GiBs. */ public Integer getSize() { return this.size; } /** *

* The size of the volume, in GiBs. *

* * @param size * The size of the volume, in GiBs. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withSize(Integer size) { setSize(size); return this; } /** *

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

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

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

* * @return The snapshot from which the volume was created, if applicable. */ public String getSnapshotId() { return this.snapshotId; } /** *

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

* * @param snapshotId * The snapshot from which the volume was created, if applicable. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withSnapshotId(String snapshotId) { setSnapshotId(snapshotId); return this; } /** *

* The Availability Zone for the volume. *

* * @param availabilityZone * The Availability Zone for the volume. */ public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; } /** *

* The Availability Zone for the volume. *

* * @return The Availability Zone for the volume. */ public String getAvailabilityZone() { return this.availabilityZone; } /** *

* The Availability Zone for the volume. *

* * @param availabilityZone * The Availability Zone for the volume. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withAvailabilityZone(String availabilityZone) { setAvailabilityZone(availabilityZone); return this; } /** *

* The volume state. *

* * @param state * The volume state. * @see VolumeState */ public void setState(String state) { this.state = state; } /** *

* The volume state. *

* * @return The volume state. * @see VolumeState */ public String getState() { return this.state; } /** *

* The volume state. *

* * @param state * The volume state. * @return Returns a reference to this object so that method calls can be * chained together. * @see VolumeState */ public Volume withState(String state) { setState(state); return this; } /** *

* The volume state. *

* * @param state * The volume state. * @see VolumeState */ public void setState(VolumeState state) { this.state = state.toString(); } /** *

* The volume state. *

* * @param state * The volume state. * @return Returns a reference to this object so that method calls can be * chained together. * @see VolumeState */ public Volume withState(VolumeState state) { setState(state); return this; } /** *

* The time stamp when volume creation was initiated. *

* * @param createTime * The time stamp when volume creation was initiated. */ public void setCreateTime(java.util.Date createTime) { this.createTime = createTime; } /** *

* The time stamp when volume creation was initiated. *

* * @return The time stamp when volume creation was initiated. */ public java.util.Date getCreateTime() { return this.createTime; } /** *

* The time stamp when volume creation was initiated. *

* * @param createTime * The time stamp when volume creation was initiated. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withCreateTime(java.util.Date createTime) { setCreateTime(createTime); return this; } /** *

* Information about the volume attachments. *

* * @return Information about the volume attachments. */ public java.util.List getAttachments() { if (attachments == null) { attachments = new com.amazonaws.internal.SdkInternalList(); } return attachments; } /** *

* Information about the volume attachments. *

* * @param attachments * Information about the volume attachments. */ public void setAttachments( java.util.Collection attachments) { if (attachments == null) { this.attachments = null; return; } this.attachments = new com.amazonaws.internal.SdkInternalList( attachments); } /** *

* Information about the volume attachments. *

*

* NOTE: This method appends the values to the existing list (if * any). Use {@link #setAttachments(java.util.Collection)} or * {@link #withAttachments(java.util.Collection)} if you want to override * the existing values. *

* * @param attachments * Information about the volume attachments. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withAttachments(VolumeAttachment... attachments) { if (this.attachments == null) { setAttachments(new com.amazonaws.internal.SdkInternalList( attachments.length)); } for (VolumeAttachment ele : attachments) { this.attachments.add(ele); } return this; } /** *

* Information about the volume attachments. *

* * @param attachments * Information about the volume attachments. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withAttachments( java.util.Collection attachments) { setAttachments(attachments); return this; } /** *

* Any tags assigned to the volume. *

* * @return Any tags assigned to the volume. */ public java.util.List getTags() { if (tags == null) { tags = new com.amazonaws.internal.SdkInternalList(); } return tags; } /** *

* Any tags assigned to the volume. *

* * @param tags * Any tags assigned to the volume. */ public void setTags(java.util.Collection tags) { if (tags == null) { this.tags = null; return; } this.tags = new com.amazonaws.internal.SdkInternalList(tags); } /** *

* Any tags assigned to the volume. *

*

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

* * @param tags * Any tags assigned to the volume. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withTags(Tag... tags) { if (this.tags == null) { setTags(new com.amazonaws.internal.SdkInternalList(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; } /** *

* Any tags assigned to the volume. *

* * @param tags * Any tags assigned to the volume. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withTags(java.util.Collection tags) { setTags(tags); return this; } /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

* * @param volumeType * The volume type. This can be gp2 for General Purpose * SSD, io1 for Provisioned IOPS SSD, st1 * for Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. * @see VolumeType */ public void setVolumeType(String volumeType) { this.volumeType = volumeType; } /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

* * @return The volume type. This can be gp2 for General Purpose * SSD, io1 for Provisioned IOPS SSD, st1 * for Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. * @see VolumeType */ public String getVolumeType() { return this.volumeType; } /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

* * @param volumeType * The volume type. This can be gp2 for General Purpose * SSD, io1 for Provisioned IOPS SSD, st1 * for Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. * @return Returns a reference to this object so that method calls can be * chained together. * @see VolumeType */ public Volume withVolumeType(String volumeType) { setVolumeType(volumeType); return this; } /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

* * @param volumeType * The volume type. This can be gp2 for General Purpose * SSD, io1 for Provisioned IOPS SSD, st1 * for Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. * @see VolumeType */ public void setVolumeType(VolumeType volumeType) { this.volumeType = volumeType.toString(); } /** *

* The volume type. This can be gp2 for General Purpose SSD, * io1 for Provisioned IOPS SSD, st1 for * Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. *

* * @param volumeType * The volume type. This can be gp2 for General Purpose * SSD, io1 for Provisioned IOPS SSD, st1 * for Throughput Optimized HDD, sc1 for Cold HDD, or * standard for Magnetic volumes. * @return Returns a reference to this object so that method calls can be * chained together. * @see VolumeType */ public Volume withVolumeType(VolumeType volumeType) { setVolumeType(volumeType); 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. *

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS * for gp2 volumes. *

*

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

* * @param 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.

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 * IOPS for gp2 volumes. *

*

* Condition: This parameter is required for requests to create * io1 volumes; it is not used in requests to create * gp2, st1, sc1, or * standard volumes. */ public void setIops(Integer iops) { this.iops = 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. *

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS * for gp2 volumes. *

*

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

* * @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.

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 * IOPS for gp2 volumes. *

*

* Condition: This parameter is required for requests to create * io1 volumes; it is not used in requests to create * gp2, st1, sc1, or * standard volumes. */ public Integer getIops() { return 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. *

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS * for gp2 volumes. *

*

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

* * @param 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.

*

* Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 * IOPS for gp2 volumes. *

*

* Condition: This parameter is required for requests to create * io1 volumes; it is not used in requests to create * gp2, st1, sc1, or * standard volumes. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withIops(Integer iops) { setIops(iops); return this; } /** *

* Indicates whether the volume will be encrypted. *

* * @param encrypted * Indicates whether the volume will be encrypted. */ public void setEncrypted(Boolean encrypted) { this.encrypted = encrypted; } /** *

* Indicates whether the volume will be encrypted. *

* * @return Indicates whether the volume will be encrypted. */ public Boolean getEncrypted() { return this.encrypted; } /** *

* Indicates whether the volume will be encrypted. *

* * @param encrypted * Indicates whether the volume will be encrypted. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withEncrypted(Boolean encrypted) { setEncrypted(encrypted); return this; } /** *

* Indicates whether the volume will be encrypted. *

* * @return Indicates whether the volume will be encrypted. */ public Boolean isEncrypted() { return this.encrypted; } /** *

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

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

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

* * @return The full ARN of the AWS Key Management Service (AWS KMS) customer * master key (CMK) that was used to protect the volume encryption * key for the volume. */ public String getKmsKeyId() { return this.kmsKeyId; } /** *

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

* * @param kmsKeyId * The full ARN of the AWS Key Management Service (AWS KMS) customer * master key (CMK) that was used to protect the volume encryption * key for the volume. * @return Returns a reference to this object so that method calls can be * chained together. */ public Volume withKmsKeyId(String kmsKeyId) { setKmsKeyId(kmsKeyId); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getVolumeId() != null) sb.append("VolumeId: " + getVolumeId() + ","); if (getSize() != null) sb.append("Size: " + getSize() + ","); if (getSnapshotId() != null) sb.append("SnapshotId: " + getSnapshotId() + ","); if (getAvailabilityZone() != null) sb.append("AvailabilityZone: " + getAvailabilityZone() + ","); if (getState() != null) sb.append("State: " + getState() + ","); if (getCreateTime() != null) sb.append("CreateTime: " + getCreateTime() + ","); if (getAttachments() != null) sb.append("Attachments: " + getAttachments() + ","); if (getTags() != null) sb.append("Tags: " + getTags() + ","); if (getVolumeType() != null) sb.append("VolumeType: " + getVolumeType() + ","); if (getIops() != null) sb.append("Iops: " + getIops() + ","); if (getEncrypted() != null) sb.append("Encrypted: " + getEncrypted() + ","); if (getKmsKeyId() != null) sb.append("KmsKeyId: " + getKmsKeyId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Volume == false) return false; Volume other = (Volume) obj; if (other.getVolumeId() == null ^ this.getVolumeId() == null) return false; if (other.getVolumeId() != null && other.getVolumeId().equals(this.getVolumeId()) == false) return false; if (other.getSize() == null ^ this.getSize() == null) return false; if (other.getSize() != null && other.getSize().equals(this.getSize()) == false) return false; if (other.getSnapshotId() == null ^ this.getSnapshotId() == null) return false; if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == false) return false; if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null) return false; if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals( this.getAvailabilityZone()) == false) return false; if (other.getState() == null ^ this.getState() == null) return false; if (other.getState() != null && other.getState().equals(this.getState()) == false) return false; if (other.getCreateTime() == null ^ this.getCreateTime() == null) return false; if (other.getCreateTime() != null && other.getCreateTime().equals(this.getCreateTime()) == false) return false; if (other.getAttachments() == null ^ this.getAttachments() == null) return false; if (other.getAttachments() != null && other.getAttachments().equals(this.getAttachments()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getVolumeType() == null ^ this.getVolumeType() == null) return false; if (other.getVolumeType() != null && other.getVolumeType().equals(this.getVolumeType()) == false) return false; if (other.getIops() == null ^ this.getIops() == null) return false; if (other.getIops() != null && other.getIops().equals(this.getIops()) == false) return false; if (other.getEncrypted() == null ^ this.getEncrypted() == null) return false; if (other.getEncrypted() != null && other.getEncrypted().equals(this.getEncrypted()) == false) return false; if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null) return false; if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false) return false; return true; } @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 + ((getEncrypted() == null) ? 0 : getEncrypted().hashCode()); hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode()); return hashCode; } @Override public Volume clone() { try { return (Volume) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy