Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 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  com.amazonaws.services.ec2.model.transform.CreateVolumeRequestMarshaller;

Container for the parameters to the CreateVolume operation.

Creates an Amazon EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the specified region.

You can create a new empty volume or restore a volume from an Amazon EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.

You can create encrypted volumes with the Encrypted parameter. Encrypted volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .

For more information, see Creating or Restoring an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .

See also:
com.amazonaws.services.ec2.AmazonEC2.createVolume(CreateVolumeRequest)
 
 public class CreateVolumeRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequest<CreateVolumeRequest> {

    
The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

 
     private Integer size;

    
The snapshot from which to create the volume.
 
     private String snapshotId;

    
The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
 
     private String availabilityZone;

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

Default: standard

Constraints:
Allowed Values: standard, io1

 
     private String volumeType;

    
The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.
 
     private Integer iops;

    
Specifies whether the volume should be encrypted.
 
     private Boolean encrypted;

    
Default constructor for a new CreateVolumeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public CreateVolumeRequest() {}
    
    
Constructs a new CreateVolumeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
size The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

availabilityZone The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
    public CreateVolumeRequest(Integer sizeString availabilityZone) {
        setSize(size);
        setAvailabilityZone(availabilityZone);
    }

    
Constructs a new CreateVolumeRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
snapshotId The snapshot from which to create the volume.
availabilityZone The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
    public CreateVolumeRequest(String snapshotIdString availabilityZone) {
        setSnapshotId(snapshotId);
        setAvailabilityZone(availabilityZone);
    }

    
The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

Returns:
The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

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

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

Parameters:
size The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

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

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

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

Parameters:
size The size of the volume, in GiBs.

Constraints: If the volume type is io1, the minimum size of the volume is 10 GiB.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

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

    
The snapshot from which to create the volume.

Returns:
The snapshot from which to create the volume.
    public String getSnapshotId() {
        return ;
    }
    
    
The snapshot from which to create the volume.

Parameters:
snapshotId The snapshot from which to create the volume.
    public void setSnapshotId(String snapshotId) {
        this. = snapshotId;
    }
    
    
The snapshot from which to create the volume.

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

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

    
The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.

Returns:
The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
    public String getAvailabilityZone() {
        return ;
    }
    
    
The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.

Parameters:
availabilityZone The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
    public void setAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
    }
    
    
The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.

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

Parameters:
availabilityZone The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateVolumeRequest withAvailabilityZone(String availabilityZone) {
        this. = availabilityZone;
        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.

Default: standard

Constraints:
Allowed Values: standard, io1

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

Default: standard

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.

Default: standard

Constraints:
Allowed Values: standard, io1

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.

Default: standard

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.

Default: standard

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

Constraints:
Allowed Values: standard, io1

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.

Default: standard

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

Default: standard

Constraints:
Allowed Values: standard, io1

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.

Default: standard

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.

Default: standard

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

Constraints:
Allowed Values: standard, io1

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.

Default: standard

Returns:
A reference to this updated object so that method calls can be chained together.
See also:
VolumeType
    public CreateVolumeRequest withVolumeType(VolumeType volumeType) {
        this. = volumeType.toString();
        return this;
    }

    
The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.

Returns:
The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.
    public Integer getIops() {
        return ;
    }
    
    
The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.

Parameters:
iops The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.
    public void setIops(Integer iops) {
        this. = iops;
    }
    
    
The number of I/O operations per second (IOPS) that the volume supports. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.

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. This parameter is not used with Magnetic or General Purpose (SSD) volumes, but is required when the volume type is io1.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateVolumeRequest withIops(Integer iops) {
        this. = iops;
        return this;
    }

    
Specifies whether the volume should be encrypted.

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

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

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

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

    
Specifies whether the volume should be encrypted.

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

    
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
    @Override
        Request<CreateVolumeRequestrequest = new CreateVolumeRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
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 (getSize() != nullsb.append("Size: " + getSize() + ",");
        if (getSnapshotId() != nullsb.append("SnapshotId: " + getSnapshotId() + ",");
        if (getAvailabilityZone() != nullsb.append("AvailabilityZone: " + getAvailabilityZone() + ",");
        if (getVolumeType() != nullsb.append("VolumeType: " + getVolumeType() + ",");
        if (getIops() != nullsb.append("Iops: " + getIops() + ",");
        if (isEncrypted() != nullsb.append("Encrypted: " + isEncrypted() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        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 + ((getVolumeType() == null) ? 0 : getVolumeType().hashCode()); 
        hashCode = prime * hashCode + ((getIops() == null) ? 0 : getIops().hashCode()); 
        hashCode = prime * hashCode + ((isEncrypted() == null) ? 0 : isEncrypted().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateVolumeRequest == falsereturn false;
        CreateVolumeRequest other = (CreateVolumeRequest)obj;
        
        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.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
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X