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

项目:omakase    文件:GlacierClient.java   
public InputStream getArchiveRetrievalJobOutput(AWSCredentials credentials, String region, String vault, String jobId) {
    try {
        runtimeCredentialsProvider.setAwsCredentials(credentials);
        amazonGlacier.setRegion(Region.getRegion(Regions.fromName(region)));

        GetJobOutputRequest request = new GetJobOutputRequest();
        request.setVaultName(vault);
        request.setJobId(jobId);
        GetJobOutputResult result = amazonGlacier.getJobOutput(request);
        return result.getBody();
    } catch (AmazonClientException e) {
        throw new OmakaseRuntimeException(e);
    }
}
项目:aws-sdk-java-resources    文件:JobImpl.java   
@Override
public GetJobOutputResult getOutput(GetJobOutputRequest request,
        ResultCapture<GetJobOutputResult> extractor) {

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

    if (result == null) return null;
    return (GetJobOutputResult) result.getData();
}
项目:aws-sdk-java-resources    文件:JobImpl.java   
@Override
public GetJobOutputResult getOutput(String range,
        ResultCapture<GetJobOutputResult> extractor) {

    GetJobOutputRequest request = new GetJobOutputRequest()
        .withRange(range);
    return getOutput(request, extractor);
}
项目:meta-glacier    文件:Vault.java   
/**
 * Gets job output result from AWS.
 *
 * @param jid job id string
 * @return
 */
public GetJobOutputResult getJobOutput(final String jid){
    GetJobOutputRequest jor = new GetJobOutputRequest()
                    .withVaultName(name)
                    .withJobId(jid);
    return GlacierFrame.getClient(region).getJobOutput(jor);
}
项目:simple-glacier-client    文件:ArchiveInventory.java   
/**
 * retrieve the list of archives in this objects vault
 */
public void list(String format, int interval, String description, String jobId, String fileName) throws IOException {

    log.debug("Listing archives in " + format + " format");

    if (jobId == null) {

        // try to find the latest job of the given format and who's results are still available (AWS keeps results for 24 hours)
        GlacierJobDescription potentialJob = retreiveLatestJobResults(format);
        if (potentialJob != null) {
            jobId = potentialJob.getJobId();
            log.info("Found job with Id "+ jobId + " which was successfuly completed on " + potentialJob.getCompletionDate());
        } else {
            // no job id given and no recent job results are available -> submit a new retrival job and wait for it to complete
            jobId = sendInventoryRetrievalJobRequest(format, description, interval);
            log.info("A new job request with Id "+ jobId + " is now completed");
        } 
    } else {
            // provide some information in the log..
            log.info("Looking specifically for the output of job with Id " + jobId);
    }

    // job is completed - request output and log it line by line
    GetJobOutputResult jobOutput = this.awsClient.getJobOutput(new GetJobOutputRequest().withAccountId(this.account).withVaultName(this.vault).withJobId(jobId));

    // determine target file name using the given name or use default name if needed
    String path = fileName;
    if (path == null) {

        // caclulate file name suffix out of the JOB content type (either CSV or JSON)
        String suffix = jobOutput.getContentType();
        if (suffix.equalsIgnoreCase("text/csv")) {
            suffix = "csv";
        } else if (suffix.equalsIgnoreCase("application/json")) {
            suffix = "json";
        } else {
            suffix = format; // not supposed to get here...
        }

        // default - informative - file output file name
        path = "aws.glacier." + this.region + "." + this.vault + "." + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "." + suffix;
    }

    // write to file
    log.info("Writing job output in a file named " + path);
    Files.copy(jobOutput.getBody(), Paths.get(path), StandardCopyOption.REPLACE_EXISTING);

    this.awsClient.shutdown();

    this.log.info("Done");
}
项目:aws-sdk-java-resources    文件:JobImpl.java   
@Override
public GetJobOutputResult getOutput(GetJobOutputRequest request) {
    return getOutput(request, null);
}
项目:aws-sdk-java-resources    文件:Job.java   
/**
 * Performs the <code>GetOutput</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Job</code> resource, and any conflicting parameter value set in the
 * request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>AccountId</code></b>
 *         - mapped from the <code>AccountId</code> identifier.
 *   </li>
 *   <li>
 *     <b><code>VaultName</code></b>
 *         - mapped from the <code>VaultName</code> identifier.
 *   </li>
 *   <li>
 *     <b><code>JobId</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 GetJobOutputRequest
 */
GetJobOutputResult getOutput(GetJobOutputRequest request);
项目:aws-sdk-java-resources    文件:Job.java   
/**
 * Performs the <code>GetOutput</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>Job</code> resource, and any conflicting parameter value set in the
 * request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>AccountId</code></b>
 *         - mapped from the <code>AccountId</code> identifier.
 *   </li>
 *   <li>
 *     <b><code>VaultName</code></b>
 *         - mapped from the <code>VaultName</code> identifier.
 *   </li>
 *   <li>
 *     <b><code>JobId</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 GetJobOutputRequest
 */
GetJobOutputResult getOutput(GetJobOutputRequest request,
        ResultCapture<GetJobOutputResult> extractor);