com.amazonaws.services.ec2.model.AttachVolumeResult Java Examples

The following examples show how to use com.amazonaws.services.ec2.model.AttachVolumeResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstanceImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public AttachVolumeResult attachVolume(String device, String volumeId,
        ResultCapture<AttachVolumeResult> extractor) {

    AttachVolumeRequest request = new AttachVolumeRequest()
        .withDevice(device)
        .withVolumeId(volumeId);
    return attachVolume(request, extractor);
}
 
Example #2
Source File: InstanceImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public AttachVolumeResult attachVolume(AttachVolumeRequest request,
        ResultCapture<AttachVolumeResult> extractor) {

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

    if (result == null) return null;
    return (AttachVolumeResult) result.getData();
}
 
Example #3
Source File: AwsVolumeProcess.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void attachVolume(AwsProcessClient awsProcessClient, Long instanceNo, Long volumeNo) {
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
    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, "AwsEbsAttach",
            new Object[] { instance.getInstanceName(), awsVolume.getVolumeId(), awsVolume.getDevice() });

    // ボリュームのアタッチ
    AttachVolumeRequest request = new AttachVolumeRequest();
    request.withVolumeId(volumeId);
    request.withInstanceId(awsInstance.getInstanceId());
    request.withDevice(awsVolume.getDevice());
    AttachVolumeResult result = awsProcessClient.getEc2Client().attachVolume(request);
    VolumeAttachment attachment = result.getAttachment();

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100123", volumeId, attachment.getInstanceId()));
    }

    // データベースの更新
    awsVolume.setInstanceId(attachment.getInstanceId());
    awsVolumeDao.update(awsVolume);
}
 
Example #4
Source File: VolumeImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public AttachVolumeResult attachToInstance(AttachVolumeRequest request,
        ResultCapture<AttachVolumeResult> extractor) {

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

    if (result == null) return null;
    return (AttachVolumeResult) result.getData();
}
 
Example #5
Source File: VolumeImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public AttachVolumeResult attachToInstance(String device, String instanceId)
        {

    return attachToInstance(device, instanceId,
            (ResultCapture<AttachVolumeResult>)null);
}
 
Example #6
Source File: VolumeImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public AttachVolumeResult attachToInstance(String device, String instanceId,
        ResultCapture<AttachVolumeResult> extractor) {

    AttachVolumeRequest request = new AttachVolumeRequest()
        .withDevice(device)
        .withInstanceId(instanceId);
    return attachToInstance(request, extractor);
}
 
Example #7
Source File: InstanceImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public AttachVolumeResult attachVolume(AttachVolumeRequest request) {
    return attachVolume(request, null);
}
 
Example #8
Source File: AmazonEc2RetryClient.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
public AttachVolumeResult attachVolume(AttachVolumeRequest request) {
    return retry.testWith2SecDelayMax15Times(() -> mapThrottlingError(() -> client.attachVolume(request)));
}
 
Example #9
Source File: InstanceImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public AttachVolumeResult attachVolume(String device, String volumeId) {
    return attachVolume(device, volumeId,
            (ResultCapture<AttachVolumeResult>)null);
}
 
Example #10
Source File: VolumeImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public AttachVolumeResult attachToInstance(AttachVolumeRequest request) {
    return attachToInstance(request, null);
}
 
Example #11
Source File: Instance.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * The convenient method form for the <code>AttachVolume</code> action.
 *
 * @see #attachVolume(AttachVolumeRequest, ResultCapture)
 */
AttachVolumeResult attachVolume(String device, String volumeId,
        ResultCapture<AttachVolumeResult> extractor);
 
Example #12
Source File: Instance.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * The convenient method form for the <code>AttachVolume</code> action.
 *
 * @see #attachVolume(AttachVolumeRequest)
 */
AttachVolumeResult attachVolume(String device, String volumeId);
 
Example #13
Source File: Instance.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>AttachVolume</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 AttachVolumeRequest
 */
AttachVolumeResult attachVolume(AttachVolumeRequest request,
        ResultCapture<AttachVolumeResult> extractor);
 
Example #14
Source File: Volume.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>AttachToInstance</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 AttachVolumeRequest
 */
AttachVolumeResult attachToInstance(AttachVolumeRequest request);
 
Example #15
Source File: Volume.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>AttachToInstance</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 AttachVolumeRequest
 */
AttachVolumeResult attachToInstance(AttachVolumeRequest request,
        ResultCapture<AttachVolumeResult> extractor);
 
Example #16
Source File: Volume.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * The convenient method form for the <code>AttachToInstance</code> action.
 *
 * @see #attachToInstance(AttachVolumeRequest)
 */
AttachVolumeResult attachToInstance(String device, String instanceId);
 
Example #17
Source File: Volume.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * The convenient method form for the <code>AttachToInstance</code> action.
 *
 * @see #attachToInstance(AttachVolumeRequest, ResultCapture)
 */
AttachVolumeResult attachToInstance(String device, String instanceId,
        ResultCapture<AttachVolumeResult> extractor);
 
Example #18
Source File: Instance.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>AttachVolume</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 AttachVolumeRequest
 */
AttachVolumeResult attachVolume(AttachVolumeRequest request);