Example usage for com.amazonaws.services.ec2.model DetachVolumeRequest getVolumeId

List of usage examples for com.amazonaws.services.ec2.model DetachVolumeRequest getVolumeId

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model DetachVolumeRequest getVolumeId.

Prototype


public String getVolumeId() 

Source Link

Document

The ID of the volume.

Usage

From source file:jp.primecloud.auto.aws.typica.EucaEc2Client.java

License:Open Source License

@Override
public DetachVolumeResult detachVolume(DetachVolumeRequest detachVolumeRequest) {
    // Device?? /dev/ ?
    String device = detachVolumeRequest.getDevice();
    if (device != null && device.startsWith("/dev/")) {
        device = device.substring("/dev/".length());
    }/*from   ww w . ja v a  2 s  .  co m*/

    boolean force = detachVolumeRequest.isForce() != null ? detachVolumeRequest.isForce().booleanValue()
            : false;

    try {
        AttachmentInfo info = jec2.detachVolume(detachVolumeRequest.getVolumeId(),
                detachVolumeRequest.getInstanceId(), device, force);
        VolumeAttachment attachment = new VolumeAttachmentConverter().convert(info);
        return new DetachVolumeResult().withAttachment(attachment);
    } catch (EC2Exception e) {
        throw new AmazonClientException(e);
    }
}