当前位置: 首页>>代码示例>>Java>>正文


Java AmazonCloudFront.updateDistribution方法代码示例

本文整理汇总了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()));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:27,代码来源:CloudFrontDistributionConfiguration.java

示例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()));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:32,代码来源:CloudFrontDistributionConfiguration.java


注:本文中的com.amazonaws.services.cloudfront.AmazonCloudFront.updateDistribution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。