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

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

Introduction

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

Prototype


public String getDevice() 

Source Link

Document

The device name.

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  .j a v  a2s.  c om*/

    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);
    }
}