Java 类com.amazonaws.services.glacier.model.JobParameters 实例源码

项目:omakase    文件:GlacierClient.java   
public void restore(AWSCredentials awsCredentials, String region, String vault, String archiveId, String snsTopic, String correlationId) {
    try {
        runtimeCredentialsProvider.setAwsCredentials(awsCredentials);
        amazonGlacier.setRegion(Region.getRegion(Regions.fromName(region)));

        JobParameters jobParameters = new JobParameters();
        jobParameters.setType(ARCHIVE_RETRIEVAL);
        jobParameters.setArchiveId(archiveId);
        jobParameters.setSNSTopic(snsTopic);
        jobParameters.setDescription(correlationId);
        InitiateJobResult result = amazonGlacier.initiateJob(new InitiateJobRequest(vault, jobParameters));

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Created restore job " + result.getJobId() + " for archive " + archiveId + " in region/vault" + region + "/" + vault);
        }
    } catch (AmazonClientException e) {
        throw new OmakaseRuntimeException(e);
    }
}
项目:meta-glacier    文件:Vault.java   
/**
 * Start a job to get the inventory of a vault.
 *
 * @param sns_topic_string region appropriate SNS topic string
 * @return job id string if successful; null on error
 */
public String makeVaultInventoryJob(final String sns_topic_string){
    final JobParameters jp = new JobParameters()
            .withType("inventory-retrieval")
            .withSNSTopic(sns_topic_string);
    final InitiateJobRequest initJobRequest = new InitiateJobRequest()
        .withVaultName(name)
        .withJobParameters(jp);
    InitiateJobResult JobResult = null;

    try{
        JobResult = GlacierFrame
                 .getClient(region).initiateJob(initJobRequest);
    } catch(Exception e){
        LGR.log(Level.SEVERE, null, e);           
        return null;
    }
    return JobResult.getJobId();
}
项目:simple-glacier-client    文件:ArchiveInventory.java   
private String sendInventoryRetrievalJobRequest(String format, String description, int interval) {

    log.info("Description: " + description);
    log.info("Interval: " + interval);

    // craete an inventory retrival request
    JobParameters params = new JobParameters().withType("inventory-retrieval").withFormat(format).withDescription(description);
    InitiateJobRequest request = new InitiateJobRequest(account, vault, params);

    // Initiate job and start polling for its completion
    InitiateJobResult initiateJobResult = this.awsClient.initiateJob(request);

    String jobId = initiateJobResult.getJobId();
    this.log.info("Initiated job 'inventory-retrieval'. jobId=" + jobId);

    // wait for the job to complete
    GlacierJobDescription jobDescription = retreiveJobResultByJobId(jobId);
    while (jobDescription == null || ! jobDescription.isCompleted()) {

        // log
        this.log.info("Job not completed! Will try again in " + interval + " minutes");

        // wait before accessing again (remember: AWS are counting API calls!!)
        try {
            TimeUnit.MINUTES.sleep(interval);
        } catch (InterruptedException ie) {}

        // re-check job status
        jobDescription = retreiveJobResultByJobId(jobId);
    }

    return jobId;
}
项目:olfs    文件:ArchiveDownload.java   
@Override
public boolean startJob() throws IOException {

    JobParameters jobParameters = new JobParameters()
        .withArchiveId(_glacierRecord.getArchiveId())
        .withDescription("Retrieving " + _glacierRecord.getResourceId())
        .withType(GLACIER_ARCHIVE_RETRIEVAL);

    return startJob(jobParameters);

}
项目:olfs    文件:InventoryDownload.java   
@Override
public boolean startJob() throws IOException {

    JobParameters jobParameters = new JobParameters()
        .withType(GLACIER_INVENTORY_RETRIEVAL)
            .withDescription(GLACIER_INVENTORY_RETRIEVAL);

    return startJob(jobParameters);

}