@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); }
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())); } }
/** * 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); }
@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(); }
@Override public DetachVolumeResult detachFromInstance( ResultCapture<DetachVolumeResult> extractor) { DetachVolumeRequest request = new DetachVolumeRequest(); return detachFromInstance(request, extractor); }
@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(); }
@Override public DetachVolumeResult detachVolume(DetachVolumeRequest detachVolumeRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
@Override public DetachVolumeResult detachFromInstance(DetachVolumeRequest request) { return detachFromInstance(request, null); }
@Override public DetachVolumeResult detachFromInstance() { return detachFromInstance((ResultCapture<DetachVolumeResult>)null); }
@Override public DetachVolumeResult detachVolume(DetachVolumeRequest request) { return detachVolume(request, null); }
/** * 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);
/** * 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);
/** * 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);
/** * 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);
/** * The convenient method form for the <code>DetachFromInstance</code> * action. * * @see #detachFromInstance(DetachVolumeRequest) */ DetachVolumeResult detachFromInstance();
/** * The convenient method form for the <code>DetachFromInstance</code> * action. * * @see #detachFromInstance(DetachVolumeRequest, ResultCapture) */ DetachVolumeResult detachFromInstance(ResultCapture<DetachVolumeResult> extractor);