本文整理汇总了Java中com.amazonaws.services.cloudfront.AmazonCloudFront.updateDistribution方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonCloudFront.updateDistribution方法的具体用法?Java AmazonCloudFront.updateDistribution怎么用?Java AmazonCloudFront.updateDistribution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.cloudfront.AmazonCloudFront
的用法示例。
在下文中一共展示了AmazonCloudFront.updateDistribution方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCustomDistribution
import com.amazonaws.services.cloudfront.AmazonCloudFront; //导入方法依赖的package包/类
protected UpdateDistributionResult updateCustomDistribution(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));
}
final AmazonCloudFront client = client(container);
final GetDistributionConfigResult response = client.getDistributionConfig(new GetDistributionConfigRequest(distribution.getId()));
final DistributionConfig config = response.getDistributionConfig()
.withEnabled(distribution.isEnabled())
.withDefaultRootObject(distribution.getIndexDocument() != null ? distribution.getIndexDocument() : StringUtils.EMPTY)
.withAliases(new Aliases().withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length));
// 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 LoggingConfig()
.withEnabled(distribution.isLogging())
.withIncludeCookies(true)
.withBucket(loggingTarget)
.withPrefix(preferences.getProperty("cloudfront.logging.prefix"))
);
return client.updateDistribution(new UpdateDistributionRequest(config, distribution.getId(), response.getETag()));
}
示例2: updateDownloadDistribution
import com.amazonaws.services.cloudfront.AmazonCloudFront; //导入方法依赖的package包/类
/**
* Amazon CloudFront Extension used to enable or disable a distribution configuration and its CNAMESs
*/
protected UpdateDistributionResult updateDownloadDistribution(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));
}
final AmazonCloudFront client = client(container);
final GetDistributionConfigResult response = client.getDistributionConfig(new GetDistributionConfigRequest(distribution.getId()));
final DistributionConfig config = response.getDistributionConfig()
.withEnabled(distribution.isEnabled())
.withDefaultRootObject(distribution.getIndexDocument())
.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 LoggingConfig()
.withEnabled(distribution.isLogging())
.withIncludeCookies(true)
.withBucket(loggingTarget)
.withPrefix(preferences.getProperty("cloudfront.logging.prefix"))
);
}
return client.updateDistribution(new UpdateDistributionRequest(config, distribution.getId(), response.getETag()));
}