@Override
    public LifecycleConfiguration getConfiguration(final Path file) throws BackgroundException {
        final Path bucket = containerService.getContainer(file);
        if(file.getType().contains(Path.Type.upload)) {
            return LifecycleConfiguration.empty();
        }
        try {
            final LifecycleConfig status = session.getClient().getLifecycleConfig(bucket.isRoot() ? StringUtils.EMPTY : bucket.getName());
            if(null == status) {
                log.warn(String.format("Failure parsing lifecycle config for %s", bucket));
                return LifecycleConfiguration.empty();
            }
            Integer transition = null;
            Integer expiration = null;
            String storageClass = null;
            for(LifecycleConfig.Rule rule : status.getRules()) {
                if(StringUtils.isBlank(rule.getPrefix())) {
                    if(rule.getTransition() != null) {
                        transition = rule.getTransition().getDays();
                    }
                    if(rule.getExpiration() != null) {
                        expiration = rule.getExpiration().getDays();
                    }
                }
            }
            return new LifecycleConfiguration(transition, expiration);
        }
        catch(ServiceException e) {
            try {
                throw new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, bucket);
            }
            catch(AccessDeniedException | InteroperabilityException l) {
                log.warn(String.format("Missing permission to read lifecycle configuration for %s %s", bucket, e.getMessage()));
                return LifecycleConfiguration.empty();
            }
        }
    }
@Test
    public void testGetConfiguration() throws Exception {
        final LifecycleConfiguration configuration = new S3LifecycleConfiguration(session).getConfiguration(
            new Path("test-lifecycle-us-east-1-cyberduck", EnumSet.of(Path.Type.directory))
        );
        assertEquals(30, configuration.getExpiration(), 0L);
        assertEquals(1, configuration.getTransition(), 0L);
    }