Java 类com.amazonaws.services.ec2.model.DetachVolumeRequest 实例源码

项目:photon-model    文件:AWSComputeDiskDay2Service.java   
@Override
protected void handleSuccess(DetachVolumeRequest request, DetachVolumeResult result) {

    //consumer to be invoked once a volume is deleted
    Consumer<Object> consumer = volume -> {
        this.service.logInfo(
                () -> String.format("[AWSComputeDiskDay2Service] Successfully detached "
                                + "the volume %s from instance %s for task reference :%s",
                        this.context.diskState.id, this.context.computeState.id,
                        this.context.request.taskLink()));
        if (this.performNextInstanceOp) {
            //Instance will be started only if the disk is succesfully detached from the instance
            startInstance(this.context.amazonEC2Client, this.context, this.dr);
        }
    };

    String volumeId = this.context.diskState.id;
    startStatusChecker(this.context, volumeId, AWSTaskStatusChecker.AWS_AVAILABLE_NAME,
            consumer);
}
项目:photon-model    文件:TestAWSEnumerationTask.java   
@After
public void tearDown() throws Throwable {
    if (this.testEbsId != null) {
        DetachVolumeRequest detachVolumeRequest = new DetachVolumeRequest().withVolumeId(this.testEbsId);
        this.client.detachVolume(detachVolumeRequest);
    }
    if (this.host == null) {
        return;
    }
    if (this.bucketToBeDeleted != null) {
        this.s3Client.deleteBucket(this.bucketToBeDeleted);
    }
    tearDownAwsVMs();
    tearDownTestVpc(this.client, this.host, this.awsTestContext, this.isMock);
    this.client.shutdown();
    this.s3Client.shutdown();
    if (ENABLE_LOAD_BALANCER_ENUMERATION) {
        tearDownAwsLoadBalancer();
        this.lbClient.shutdown();
    }
    setAwsClientMockInfo(false, null);
    if (this.testEbsId != null) {
        DeleteVolumeRequest deleteVolumeRequest = new DeleteVolumeRequest().withVolumeId(this.testEbsId);
        this.client.deleteVolume(deleteVolumeRequest);
    }
}
项目:primecloud-controller    文件:AwsVolumeProcess.java   
public void detachVolume(AwsProcessClient awsProcessClient, Long instanceNo, Long volumeNo) {
    AwsVolume awsVolume = awsVolumeDao.read(volumeNo);
    String volumeId = awsVolume.getVolumeId();

    //イベントログ出力
    Component component = null;
    if (awsVolume.getComponentNo() != null) {
        component = componentDao.read(awsVolume.getComponentNo());
    }
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(component, instance, "AwsEbsDetach",
            new Object[] { instance.getInstanceName(), awsVolume.getVolumeId(), awsVolume.getDevice() });

    // ボリュームのデタッチ
    DetachVolumeRequest request = new DetachVolumeRequest();
    request.withVolumeId(volumeId);
    request.withInstanceId(awsVolume.getInstanceId());
    request.withDevice(awsVolume.getDevice());
    DetachVolumeResult result = awsProcessClient.getEc2Client().detachVolume(request);
    VolumeAttachment attachment = result.getAttachment();

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100125", volumeId, attachment.getInstanceId()));
    }
}
项目:photon-model    文件:AWSComputeDiskDay2Service.java   
/**
 * Send detach request to aws using amazon ec2 client.
 */
private void detachVolume(DiskContext context, DeferredResult<DiskContext> dr,
        String instanceId, String diskId, boolean startInstance) {
    DetachVolumeRequest detachVolumeRequest = new DetachVolumeRequest()
            .withInstanceId(instanceId)
            .withVolumeId(diskId);

    AWSAsyncHandler<DetachVolumeRequest, DetachVolumeResult> detachDiskHandler =
            new AWSDetachDiskHandler(this, dr, context, startInstance);

    context.amazonEC2Client.detachVolumeAsync(detachVolumeRequest, detachDiskHandler);
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public DetachVolumeResult detachFromInstance(DetachVolumeRequest request,
        ResultCapture<DetachVolumeResult> extractor) {

    ActionResult result = resource.performAction("DetachFromInstance",
            request, extractor);

    if (result == null) return null;
    return (DetachVolumeResult) result.getData();
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public DetachVolumeResult detachFromInstance(
        ResultCapture<DetachVolumeResult> extractor) {

    DetachVolumeRequest request = new DetachVolumeRequest();
    return detachFromInstance(request, extractor);
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public DetachVolumeResult detachVolume(DetachVolumeRequest request,
        ResultCapture<DetachVolumeResult> extractor) {

    ActionResult result = resource.performAction("DetachVolume", request,
            extractor);

    if (result == null) return null;
    return (DetachVolumeResult) result.getData();
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public DetachVolumeResult detachVolume(DetachVolumeRequest detachVolumeRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public DetachVolumeResult detachFromInstance(DetachVolumeRequest request) {
    return detachFromInstance(request, null);
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public DetachVolumeResult detachVolume(DetachVolumeRequest request) {
    return detachVolume(request, null);
}
项目:aws-sdk-java-resources    文件:Instance.java   
/**
 * Performs the <code>DetachVolume</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Instance</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>InstanceId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The response of the low-level client operation associated with
 *         this resource action.
 * @see DetachVolumeRequest
 */
DetachVolumeResult detachVolume(DetachVolumeRequest request);
项目:aws-sdk-java-resources    文件:Instance.java   
/**
 * Performs the <code>DetachVolume</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Instance</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>InstanceId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The response of the low-level client operation associated with
 *         this resource action.
 * @see DetachVolumeRequest
 */
DetachVolumeResult detachVolume(DetachVolumeRequest request,
        ResultCapture<DetachVolumeResult> extractor);
项目:aws-sdk-java-resources    文件:Volume.java   
/**
 * Performs the <code>DetachFromInstance</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Volume</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>VolumeId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The response of the low-level client operation associated with
 *         this resource action.
 * @see DetachVolumeRequest
 */
DetachVolumeResult detachFromInstance(DetachVolumeRequest request);
项目:aws-sdk-java-resources    文件:Volume.java   
/**
 * Performs the <code>DetachFromInstance</code> action and use a
 * ResultCapture to retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Volume</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>VolumeId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The response of the low-level client operation associated with
 *         this resource action.
 * @see DetachVolumeRequest
 */
DetachVolumeResult detachFromInstance(DetachVolumeRequest request,
        ResultCapture<DetachVolumeResult> extractor);