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

项目:photon-model    文件:TestAWSSetupUtils.java   
/**
 * Creates a snapshot and return the snapshot id.
 */
public static String createSnapshot(VerificationHost host, AmazonEC2Client client, String volumeId) {
    CreateSnapshotRequest req = new CreateSnapshotRequest()
            .withVolumeId(volumeId);
    CreateSnapshotResult res = client.createSnapshot(req);
    String snapshotId = res.getSnapshot().getSnapshotId();
    Filter filter = new Filter().withName(SNAPSHOT_ID_ATTRIBUTE).withValues(snapshotId);

    DescribeSnapshotsRequest snapshotsRequest = new DescribeSnapshotsRequest()
            .withSnapshotIds(snapshotId)
            .withFilters(filter);
    host.waitFor("Timeout waiting for creating snapshot", () -> {
        DescribeSnapshotsResult snapshotsResult = client.describeSnapshots(snapshotsRequest);
        String state = snapshotsResult.getSnapshots().get(0).getState();
        if (state.equalsIgnoreCase(SNAPSHOT_STATUS_COMPLETE)) {
            return true;
        }
        return false;
    });
    return snapshotId;
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public Snapshot createSnapshot(CreateSnapshotRequest request,
        ResultCapture<CreateSnapshotResult> extractor) {

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

    if (result == null) return null;
    return new SnapshotImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public Snapshot createSnapshot(String description,
        ResultCapture<CreateSnapshotResult> extractor) {

    CreateSnapshotRequest request = new CreateSnapshotRequest()
        .withDescription(description);
    return createSnapshot(request, extractor);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Snapshot createSnapshot(CreateSnapshotRequest request,
        ResultCapture<CreateSnapshotResult> extractor) {

    ActionResult result = service.performAction("CreateSnapshot", request,
            extractor);

    if (result == null) return null;
    return new SnapshotImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Snapshot createSnapshot(String description, String volumeId,
        ResultCapture<CreateSnapshotResult> extractor) {

    CreateSnapshotRequest request = new CreateSnapshotRequest()
        .withDescription(description)
        .withVolumeId(volumeId);
    return createSnapshot(request, extractor);
}
项目:cloudbreak    文件:EncryptedSnapshotPreparator.java   
private Optional<String> prepareSnapshotForEncryptionBecauseThatDoesNotExist(AuthenticatedContext ac, Group group,
        AwsInstanceView instanceView, AmazonEC2Client client) {
    CreateVolumeResult volumeResult = client.createVolume(prepareCreateVolumeRequest(ac, instanceView, client));

    checkEbsVolumeStatus(ac, group, client, volumeResult);
    CreateSnapshotResult snapshotResult = client.createSnapshot(prepareCreateSnapshotRequest(volumeResult));

    checkSnapshotReadiness(ac, client, snapshotResult);
    client.createTags(prepareCreateTagsRequest(instanceView, snapshotResult));
    return Optional.of(snapshotResult.getSnapshot().getSnapshotId());
}
项目:cloudbreak    文件:EncryptedSnapshotPreparator.java   
private void checkSnapshotReadiness(AuthenticatedContext ac, AmazonEC2Client client, CreateSnapshotResult snapshotResult) {
    PollTask<Boolean> snapshotReadyChecker = awsPollTaskFactory
            .newCreateSnapshotReadyStatusCheckerTask(ac, snapshotResult.getSnapshot().getSnapshotId(), client);
    try {
        Boolean statePollerResult = snapshotReadyChecker.call();
        if (!snapshotReadyChecker.completed(statePollerResult)) {
            syncPollingScheduler.schedule(snapshotReadyChecker);
        }
    } catch (Exception e) {
        throw new CloudConnectorException(e.getMessage(), e);
    }
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public CreateSnapshotResult createSnapshot(CreateSnapshotRequest createSnapshotRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:VolumeImpl.java   
@Override
public Snapshot createSnapshot(String description) {
    return createSnapshot(description,
            (ResultCapture<CreateSnapshotResult>)null);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Snapshot createSnapshot(String description, String volumeId) {
    return createSnapshot(description, volumeId,
            (ResultCapture<CreateSnapshotResult>)null);
}
项目:cloudbreak    文件:EncryptedSnapshotPreparator.java   
private CreateTagsRequest prepareCreateTagsRequest(AwsInstanceView awsInstanceView, CreateSnapshotResult snapshotResult) {
    return new CreateTagsRequest().withTags(prepareTagList(awsInstanceView)).withResources(snapshotResult.getSnapshot().getSnapshotId());
}
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * Performs the <code>CreateSnapshot</code> action and use a ResultCapture
 * to retrieve the low-level client response.
 *
 * <p>
 *
 * @return The <code>Snapshot</code> resource object associated with the
 *         result of this action.
 * @see CreateSnapshotRequest
 */
com.amazonaws.resources.ec2.Snapshot createSnapshot(CreateSnapshotRequest
        request, ResultCapture<CreateSnapshotResult> extractor);
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * The convenient method form for the <code>CreateSnapshot</code> action.
 *
 * @see #createSnapshot(CreateSnapshotRequest, ResultCapture)
 */
com.amazonaws.resources.ec2.Snapshot createSnapshot(String description,
        String volumeId, ResultCapture<CreateSnapshotResult> extractor);
项目:aws-sdk-java-resources    文件:Volume.java   
/**
 * Performs the <code>CreateSnapshot</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 <code>Snapshot</code> resource object associated with the
 *         result of this action.
 * @see CreateSnapshotRequest
 */
Snapshot createSnapshot(CreateSnapshotRequest request,
        ResultCapture<CreateSnapshotResult> extractor);
项目:aws-sdk-java-resources    文件:Volume.java   
/**
 * The convenient method form for the <code>CreateSnapshot</code> action.
 *
 * @see #createSnapshot(CreateSnapshotRequest, ResultCapture)
 */
Snapshot createSnapshot(String description,
        ResultCapture<CreateSnapshotResult> extractor);