Example usage for com.amazonaws.services.ec2.model VolumeState Deleted

List of usage examples for com.amazonaws.services.ec2.model VolumeState Deleted

Introduction

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

Prototype

VolumeState Deleted

To view the source code for com.amazonaws.services.ec2.model VolumeState Deleted.

Click Source Link

Usage

From source file:jp.primecloud.auto.process.aws.AwsCommonProcess.java

License:Open Source License

public Volume waitVolume(AwsProcessClient awsProcessClient, String volumeId) {
    // ???//  ww  w .j  av  a2 s.c  om
    Volume volume;
    while (true) {
        try {
            Thread.sleep(1000L * awsProcessClient.getDescribeInterval());
        } catch (InterruptedException ignore) {
        }

        volume = describeVolume(awsProcessClient, volumeId);
        VolumeState state;
        try {
            state = VolumeState.fromValue(volume.getState());
        } catch (IllegalArgumentException e) {
            // ???
            AutoException exception = new AutoException("EPROCESS-000112", volume, volume.getState());
            exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume));
            throw exception;
        }

        // ?????
        if (state == VolumeState.Available || state == VolumeState.InUse || state == VolumeState.Deleted
                || state == VolumeState.Error) {
            break;
        }
    }

    return volume;
}