List of usage examples for com.amazonaws.services.cloudfront AmazonCloudFront updateStreamingDistribution
UpdateStreamingDistributionResult updateStreamingDistribution( UpdateStreamingDistributionRequest updateStreamingDistributionRequest);
Update a streaming distribution.
From source file:ch.cyberduck.core.cloudfront.CloudFrontDistributionConfiguration.java
License:Open Source License
protected UpdateStreamingDistributionResult updateStreamingDistribution(final Path container, final Distribution distribution) throws IOException, BackgroundException { final URI origin = this.getOrigin(container, distribution.getMethod()); if (log.isDebugEnabled()) { log.debug(String.format("Update %s distribution with origin %s", distribution.getMethod().toString(), origin));//from www. j a v a2 s .c om } final AmazonCloudFront client = client(container); final GetStreamingDistributionConfigResult response = client .getStreamingDistributionConfig(new GetStreamingDistributionConfigRequest(distribution.getId())); final StreamingDistributionConfig config = response.getStreamingDistributionConfig() .withEnabled(distribution.isEnabled()) .withS3Origin(new S3Origin(origin.getHost(), StringUtils.EMPTY)).withAliases(new Aliases() .withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length)); if (distribution.isLogging()) { // Make bucket name fully qualified final String loggingTarget = ServiceUtils.generateS3HostnameForBucket( distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if (log.isDebugEnabled()) { log.debug(String.format("Set logging target for %s to %s", distribution, loggingTarget)); } config.setLogging(new StreamingLoggingConfig().withEnabled(distribution.isLogging()) .withBucket(loggingTarget).withPrefix(preferences.getProperty("cloudfront.logging.prefix"))); } return client.updateStreamingDistribution( new UpdateStreamingDistributionRequest(config, distribution.getId(), response.getETag())); }