Example usage for com.amazonaws.services.cloudfront.model StreamingDistributionSummary setTrustedSigners

List of usage examples for com.amazonaws.services.cloudfront.model StreamingDistributionSummary setTrustedSigners

Introduction

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

Prototype


public void setTrustedSigners(TrustedSigners trustedSigners) 

Source Link

Document

A complex type that specifies the AWS accounts, if any, that you want to allow to create signed URLs for private content.

Usage

From source file:org.duracloud.s3task.streaming.StreamingTaskRunnerTestBase.java

License:Apache License

/**
 * Used when expecting a valid distribution as a result of the
 * listStreamingDistributions call./*from  w  ww .  j  ava 2s  .  co m*/
 *
 * @param secure            defines if the returned distribution is secure or open
 * @param listCallsExpected the number of times the call to list distributions will
 *                          be called in order to retrieve the entire list
 */
protected void cfClientExpectValidDistribution(AmazonCloudFrontClient cfClient, boolean secure,
        int listCallsExpected) {
    S3Origin origin = new S3Origin().withDomainName(bucketName + DeleteStreamingTaskRunner.S3_ORIGIN_SUFFIX);
    StreamingDistributionSummary distSummary = new StreamingDistributionSummary().withId("id")
            .withStatus("status").withDomainName(domainName).withEnabled(true).withS3Origin(origin);
    TrustedSigners trustedSigners = new TrustedSigners().withQuantity(0);
    if (secure) {
        trustedSigners = new TrustedSigners().withQuantity(1).withItems("trusted-signer-item");
    }
    distSummary.setTrustedSigners(trustedSigners);

    for (int i = 0; i < listCallsExpected; i++) {
        boolean truncated = false;
        if ((listCallsExpected - i) > 1) {
            truncated = true;
        }

        List<StreamingDistributionSummary> distSummaries = new ArrayList();
        distSummaries.add(distSummary);
        ListStreamingDistributionsResult distSummaryResult = new ListStreamingDistributionsResult()
                .withStreamingDistributionList(new StreamingDistributionList().withItems(distSummaries)
                        .withIsTruncated(truncated).withNextMarker("marker"));
        EasyMock.expect(
                cfClient.listStreamingDistributions(EasyMock.isA(ListStreamingDistributionsRequest.class)))
                .andReturn(distSummaryResult);
    }
}