Search in sources :

Example 1 with ListDistributionsResponse

use of software.amazon.awssdk.services.cloudfront.model.ListDistributionsResponse in project aws-doc-sdk-examples by awsdocs.

the class GetDistrubutions method getCFDistrubutions.

// snippet-start:[cloudfront.java2.dis.main]
public static void getCFDistrubutions(CloudFrontClient cloudFrontClient) {
    try {
        ListDistributionsResponse response = cloudFrontClient.listDistributions();
        DistributionList list = response.distributionList();
        List<DistributionSummary> dists = list.items();
        for (DistributionSummary dist : dists) {
            System.out.println("The Distribution ARN is " + dist.arn());
        }
    } catch (CloudFrontException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : DistributionSummary(software.amazon.awssdk.services.cloudfront.model.DistributionSummary) CloudFrontException(software.amazon.awssdk.services.cloudfront.model.CloudFrontException) ListDistributionsResponse(software.amazon.awssdk.services.cloudfront.model.ListDistributionsResponse) DistributionList(software.amazon.awssdk.services.cloudfront.model.DistributionList)

Aggregations

CloudFrontException (software.amazon.awssdk.services.cloudfront.model.CloudFrontException)1 DistributionList (software.amazon.awssdk.services.cloudfront.model.DistributionList)1 DistributionSummary (software.amazon.awssdk.services.cloudfront.model.DistributionSummary)1 ListDistributionsResponse (software.amazon.awssdk.services.cloudfront.model.ListDistributionsResponse)1