@Override
    public void restore(final Path file, final LoginCallback prompt) throws BackgroundException {
        final Path container = session.getFeature(PathContainerService.class).getContainer(file);
        try {
            try {
                final AmazonS3 client = client(container);
                // Standard - S3 Standard retrievals allow you to access any of your archived objects within several hours.
                // This is the default option for the GLACIER and DEEP_ARCHIVE retrieval requests that do not specify
                // the retrieval option. S3 Standard retrievals typically complete within 3-5 hours from the GLACIER
                // storage class and typically complete within 12 hours from the DEEP_ARCHIVE storage class.
                client.restoreObjectV2(new RestoreObjectRequest(container.getName(), session.getFeature(PathContainerService.class).getKey(file))
                    // To restore a specific object version, you can provide a version ID. If you don't provide a version ID, Amazon S3 restores the current version.
                    .withVersionId(file.attributes().getVersionId())
                    .withExpirationInDays(new HostPreferences(session.getHost()).getInteger("s3.glacier.restore.expiration.days"))
                    .withGlacierJobParameters(new GlacierJobParameters().withTier(new HostPreferences(session.getHost()).getProperty("s3.glacier.restore.tier")))
                );
                // 200 Reply if already restored
            }
            catch(AmazonClientException e) {
                throw new AmazonServiceExceptionMappingService().map("Failure to write attributes of {0}", e, file);
            }
        }
        catch(ConflictException e) {
            // 409 when restore is in progress
            log.warn(String.format("Restore for %s already in progress %s", file, e));
        }
    }
@Test
    public void testRestore() throws Exception {
        final Path bucket = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
        final Path test = new Path(bucket, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        final byte[] content = RandomUtils.nextBytes(512);
        final TransferStatus status = new TransferStatus();
        status.setStorageClass("GLACIER");
        status.setLength(content.length);
        status.setChecksum(new SHA256ChecksumCompute().compute(new ByteArrayInputStream(content), status));
        final HttpResponseOutputStream<StorageObject> out = new S3WriteFeature(session, new S3AccessControlListFeature(session)).write(test, status, new DisabledConnectionCallback());
        new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
        out.close();
        assertEquals("GLACIER", new S3AttributesFinderFeature(session, new S3AccessControlListFeature(session)).find(test).getStorageClass());
        final Glacier feature = new Glacier(session, new S3LocationFeature(session), new DisabledX509TrustManager(), new DefaultX509KeyManager());
        feature.restore(test, new DisabledLoginCallback());
        new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledPasswordCallback(), new Delete.DisabledCallback());
    }