@Test public void testReadNoWebsiteConfiguration() throws Exception { final WebsiteCloudFrontDistributionConfiguration configuration = new WebsiteCloudFrontDistributionConfiguration(session, new DisabledX509TrustManager(), new DefaultX509KeyManager(), Collections.emptyMap() ); final Path container = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Distribution distribution = configuration.read(container, Distribution.WEBSITE, new DisabledLoginCallback()); assertEquals("The specified bucket does not have a website configuration", distribution.getStatus()); }
@Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setUrl(URI.create(String.format("%s: distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s: return distribution; } } else { return super.read(container, method, prompt); } }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setUrl(URI.create(String.format("%s: distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s: return distribution; } } else { return super.read(container, method, prompt); } } }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setUrl(URI.create(String.format("%s: distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s: return distribution; } } else { return super.read(container, method, prompt); } } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setUrl(URI.create(String.format("%s: distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s: return distribution; } } else { return super.read(container, method, prompt); } } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setUrl(URI.create(String.format("%s: distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s: return distribution; } } else { return super.read(container, method, prompt); } } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method);  }