Example usage for com.amazonaws.services.cloudfront.model DistributionList isTruncated

List of usage examples for com.amazonaws.services.cloudfront.model DistributionList isTruncated

Introduction

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

Prototype

Boolean isTruncated

To view the source code for com.amazonaws.services.cloudfront.model DistributionList isTruncated.

Click Source Link

Document

A flag that indicates whether more distributions remain to be listed.

Usage

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

License:Apache License

/**
 * Determines if a streaming distribution already exists for a given bucket
 */// www . ja v  a 2  s  . c  om
protected List<DistributionSummary> getAllExistingWebDistributions(String bucketName) {

    List<DistributionSummary> distListForBucket = new ArrayList<>();

    DistributionList distList = cfClient.listDistributions(new ListDistributionsRequest())
            .getDistributionList();

    List<DistributionSummary> webDistList = distList.getItems();
    while (distList.isTruncated()) {
        distList = cfClient
                .listDistributions(new ListDistributionsRequest().withMarker(distList.getNextMarker()))
                .getDistributionList();
        webDistList.addAll(distList.getItems());
    }

    for (DistributionSummary distSummary : webDistList) {
        if (isDistFromBucket(bucketName, distSummary)) {
            distListForBucket.add(distSummary);
        }
    }

    return distListForBucket;
}