Example usage for com.amazonaws.services.cloudfront.model DistributionConfig setEnabled

List of usage examples for com.amazonaws.services.cloudfront.model DistributionConfig setEnabled

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudfront.model DistributionConfig setEnabled.

Prototype


public void setEnabled(Boolean enabled) 

Source Link

Document

From this field, you can enable or disable the selected distribution.

Usage

From source file:org.duracloud.s3task.streaminghls.BaseHlsTaskRunner.java

License:Apache License

/**
 * Enables or disables an existing distribution
 *
 * @param distId  the ID of the distribution
 * @param enabled true to enable, false to disable
 *//*from   ww w. j  av a 2 s. com*/
protected void setDistributionState(String distId, boolean enabled) {
    GetDistributionConfigResult result = cfClient
            .getDistributionConfig(new GetDistributionConfigRequest(distId));

    DistributionConfig distConfig = result.getDistributionConfig();
    distConfig.setEnabled(enabled);

    cfClient.updateDistribution(new UpdateDistributionRequest().withDistributionConfig(distConfig)
            .withIfMatch(result.getETag()).withId(distId));
}