mercredi 25 février 2015

Amazon Glacier Retrieve Job

I have function I'm trying to write to retreive the contents of my Amazon Glacier, but it keeps saying the job isn't found "ResourceNotFoundException". I setup an SNS topic and subscribed an email address to it.


Got the notification by email that it was ready:



{"Action":"InventoryRetrieval","ArchiveId":null,"ArchiveSHA256TreeHash":null,"ArchiveSizeInBytes":null,"Completed":true,"CompletionDate":"2015-02-25T22:55:20.395Z","CreationDate":"2015-02-25T19:11:16.080Z","InventoryRetrievalParameters":{"EndDate":null,"Format":"JSON","Limit":null,"Marker":null,"StartDate":null},"InventorySizeInBytes":5346845,"JobDescription":null,"JobId":"long job id","RetrievalByteRange":null,"SHA256TreeHash":null,"SNSTopic":"arn archive job","StatusCode":"Succeeded","StatusMessage":"Succeeded","VaultARN":"arnmessage"}


This is the code I'm using to retrieve it with the JobId above.



private static void downloadJobOutput(String jobId) throws IOException {
String fileName = "/Users/me/Desktop/archives.txt";
GetJobOutputRequest getJobOutputRequest = new GetJobOutputRequest()
.withVaultName(vaultName)
.withJobId(jobId);
GetJobOutputResult getJobOutputResult = client.getJobOutput(getJobOutputRequest);

FileWriter fstream = new FileWriter(fileName);
BufferedWriter out = new BufferedWriter(fstream);
BufferedReader in = new BufferedReader(new InputStreamReader(getJobOutputResult.getBody()));
String inputLine;
try {
while ((inputLine = in.readLine()) != null) {
out.write(inputLine);
}
}catch(IOException e) {
throw new AmazonClientException("Unable to save archive", e);
}finally{
try {in.close();} catch (Exception e) {}
try {out.close();} catch (Exception e) {}
}
System.out.println("Retrieved inventory to " + fileName);
}


Error message: Exception in thread "main" com.amazonaws.services.glacier.model.ResourceNotFoundException: The job ID was not found:





Aucun commentaire:

Enregistrer un commentaire