cyberduck
cyberduck copied to clipboard
Indicate Glacier restore in progress
d8d6957 created the issue
It would be nice to have some indication where in the restore process a particular file is at. Thus when getting information on a S3 object, has a restore request been placed, has it now been restored and is ready for download? Even just a history of restore requests would be nice. As it is, when I place a restore request via CyberDuck I never know when it is ready for download other than to try to download it. With a few objects, this is ok but with dozens it's quite tedious. Thx!
I agree, this is quite confusing right now, as a first step it would be great to change the error message when you try to download an object for which a restore request has already been made, something along the lines of
try {
// Attempt to get the object
s3Client.getObject(BUCKET_NAME, OBJECT_KEY);
} catch (AmazonServiceException e) {
// Check if it's a 403 error and the operation is not valid for the object's storage class
if (e.getStatusCode() == 403 && e.getErrorCode().equals("InvalidObjectState")) {
LocalDateTime restoreInitiationTime = restoreInitiationTimes.get(OBJECT_KEY);
if (restoreInitiationTime == null) {
// Initiate a restore request if one has not been initiated before
RestoreObjectRequest restoreObjectRequest = new RestoreObjectRequest(BUCKET_NAME, OBJECT_KEY)
.withExpirationInDays(7) // Keep the restored data for 7 days
.withGlacierJobParameters(new RestoreObjectRequest.GlacierJobParameters()
.withTier(RestoreObjectRequest.Tier.Bulk)); // Initiate a bulk retrieval job
s3Client.restoreObject(restoreObjectRequest);
// Store the current time as the initiation time for the restore
restoreInitiationTimes.put(OBJECT_KEY, LocalDateTime.now());
System.out.println("A restore request has been triggered. Please come back in 3-10 hours when the data will be accessible.");
} else {
// Calculate the time passed since the initiation
long hoursPassed = java.time.Duration.between(restoreInitiationTime, LocalDateTime.now()).toHours();
long hoursRemaining = Math.max(3, 12 - hoursPassed); // Assume max time is 12 hours
// Format the initiation time
String formattedTime = restoreInitiationTime.format(DateTimeFormatter.ofPattern("dd MMM yyyy 'at' HH:mm"));
System.out.println("A restore request was already triggered on " + formattedTime +
". You may have to wait another " + hoursRemaining + " hours until the object is available for download.");
}
} else {
// Other exceptions can be handled here
e.printStackTrace();
}
}
Also when requesting it is not clear what type of request was made. This should default to "Bulk" -> the cheapest.