class GoogleStorageWebsiteDistributionConfiguration implements DistributionConfiguration, Index {

    @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
            session.getClient().buckets().patch(container.getName(), new Bucket()
                .setLogging(new Bucket.Logging()
                    .setLogObjectPrefix(distribution.isEnabled() ? PreferencesFactory.get().getProperty("google.logging.prefix") : null)
                    .setLogBucket(StringUtils.isNotBlank(distribution.getLoggingContainer()) ? distribution.getLoggingContainer() : container.getName()))
                .setWebsite(
                    distribution.isEnabled() ? new Bucket.Website().setMainPageSuffix(suffix) : null
                )).execute();
        }
        catch(IOException e) {
            throw new GoogleStorageExceptionMappingService().map("Cannot write website configuration", e);
        }
    }

    public  GoogleStorageWebsiteDistributionConfiguration(final GoogleStorageSession session);

}