@Override
    public void write(final Path file, final Distribution distribution, final LoginCallback prompt) throws BackgroundException {
        final Path container = containerService.getContainer(file);
        try {
            String suffix = "index.html";
            if(StringUtils.isNotBlank(distribution.getIndexDocument())) {
                suffix = PathNormalizer.name(distribution.getIndexDocument());
            }
            // Enable website endpoint
            final Storage.Buckets.Patch request = session.getClient().buckets().patch(container.getName(), new Bucket()
                    .setLogging(new Bucket.Logging()
                            .setLogObjectPrefix(distribution.isEnabled() ? new HostPreferences(session.getHost()).getProperty("google.logging.prefix") : null)
                            .setLogBucket(StringUtils.isNotBlank(distribution.getLoggingContainer()) ? distribution.getLoggingContainer() : container.getName()))
                    .setWebsite(
                            distribution.isEnabled() ? new Bucket.Website().setMainPageSuffix(suffix) : null
                    ));
            if(containerService.getContainer(file).attributes().getCustom().containsKey(GoogleStorageAttributesFinderFeature.KEY_REQUESTER_PAYS)) {
                request.setUserProject(session.getHost().getCredentials().getUsername());
            }
            request.execute();
        }
        catch(IOException e) {
            throw new GoogleStorageExceptionMappingService().map("Cannot write website configuration", e);
        }
    }
@Test
    public void testWrite() throws Exception {
        final DistributionConfiguration configuration = new GoogleStorageWebsiteDistributionConfiguration(session);
        final Path bucket = new Path(new AsciiRandomStringService().random().toLowerCase(Locale.ROOT), EnumSet.of(Path.Type.directory, Path.Type.volume));
        new GoogleStorageDirectoryFeature(session).mkdir(bucket, new TransferStatus());
        configuration.write(bucket, new Distribution(Distribution.WEBSITE, null, true), new DisabledLoginCallback());
        final Distribution distribution = configuration.read(bucket, Distribution.WEBSITE, new DisabledLoginCallback());
        assertTrue(distribution.isEnabled());
        assertEquals(configuration.getName(), distribution.getName());
        new GoogleStorageDeleteFeature(session).delete(Collections.<Path>singletonList(bucket), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }