AWS.CloudFront (2016-11-25) — AWS SDK for JavaScript (original) (raw)

We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

This is the Amazon CloudFront API Reference. This guide is for developers who need detailed information about the CloudFront API actions, data types, and errors. For detailed information about CloudFront features and their associated API calls, see the Amazon CloudFront Developer Guide.

Sending a Request Using CloudFront

var cloudfront = new AWS.CloudFront();
cloudfront.createCloudFrontOriginAccessIdentity(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CloudFront object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var cloudfront = new AWS.CloudFront({apiVersion: '2016-11-25'});

You can also set the API version globally in AWS.config.apiVersions using the cloudfront service identifier:

AWS.config.apiVersions = {
  cloudfront: '2016-11-25',
  // other service API versions
};

var cloudfront = new AWS.CloudFront();

Waiter Resource States

This service supports a list of resource states that can be polled using the waitFor() method. The resource states are:

distributionDeployed, invalidationCompleted, streamingDistributionDeployed

Constructor Summarycollapse

Property Summarycollapse

Properties inherited from AWS.Service

apiVersions

Method Summarycollapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, setupRequestListeners, defineService

Constructor Details

new AWS.CloudFront(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Property Details

endpointAWS.Endpoint

Returns an Endpoint object representing the endpoint URL for service requests.

Method Details

createCloudFrontOriginAccessIdentity(params = {}, callback) ⇒ AWS.Request

Creates a new origin access identity. If you're using Amazon S3 for your origin, you can use an origin access identity to require users to access your content using a CloudFront URL instead of the Amazon S3 URL. For more information about how to use origin access identities, see Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide.

createDistribution(params = {}, callback) ⇒ AWS.Request

Creates a new web distribution. Send a GET request to the /_CloudFront API version_/distribution/distribution ID resource.

createDistributionWithTags(params = {}, callback) ⇒ AWS.Request

Create a new distribution with tags.

createInvalidation(params = {}, callback) ⇒ AWS.Request

Create a new invalidation.

createStreamingDistribution(params = {}, callback) ⇒ AWS.Request

Creates a new RMTP distribution. An RTMP distribution is similar to a web distribution, but an RTMP distribution streams media files using the Adobe Real-Time Messaging Protocol (RTMP) instead of serving files using HTTP.

To create a new web distribution, submit a POST request to the CloudFront API version/distribution resource. The request body must include a document with a StreamingDistributionConfig element. The response echoes the StreamingDistributionConfig element and returns other information about the RTMP distribution.

To get the status of your request, use the GET StreamingDistribution API action. When the value of Enabled is true and the value of Status is Deployed, your distribution is ready. A distribution usually deploys in less than 15 minutes.

For more information about web distributions, see Working with RTMP Distributions in the Amazon CloudFront Developer Guide.

Beginning with the 2012-05-05 version of the CloudFront API, we made substantial changes to the format of the XML document that you include in the request body when you create or update a web distribution or an RTMP distribution, and when you invalidate objects. With previous versions of the API, we discovered that it was too easy to accidentally delete one or more values for an element that accepts multiple values, for example, CNAMEs and trusted signers. Our changes for the 2012-05-05 release are intended to prevent these accidental deletions and to notify you when there's a mismatch between the number of values you say you're specifying in the Quantity element and the number of values specified.

createStreamingDistributionWithTags(params = {}, callback) ⇒ AWS.Request

Create a new streaming distribution with tags.

deleteCloudFrontOriginAccessIdentity(params = {}, callback) ⇒ AWS.Request

Delete an origin access identity.

deleteDistribution(params = {}, callback) ⇒ AWS.Request

deleteStreamingDistribution(params = {}, callback) ⇒ AWS.Request

Delete a streaming distribution. To delete an RTMP distribution using the CloudFront API, perform the following steps.

To delete an RTMP distribution using the CloudFront API:

  1. Disable the RTMP distribution.
  2. Submit a GET Streaming Distribution Config request to get the current configuration and the Etag header for the distribution.
  3. Update the XML document that was returned in the response to your GET Streaming Distribution Config request to change the value of Enabled to false.
  4. Submit a PUT Streaming Distribution Config request to update the configuration for your distribution. In the request body, include the XML document that you updated in Step 3. Then set the value of the HTTP If-Match header to the value of the ETag header that CloudFront returned when you submitted the GET Streaming Distribution Config request in Step 2.
  5. Review the response to the PUT Streaming Distribution Config request to confirm that the distribution was successfully disabled.
  6. Submit a GET Streaming Distribution Config request to confirm that your changes have propagated. When propagation is complete, the value of Status is Deployed.
  7. Submit a DELETE Streaming Distribution request. Set the value of the HTTP If-Match header to the value of the ETag header that CloudFront returned when you submitted the GET Streaming Distribution Config request in Step 2.
  8. Review the response to your DELETE Streaming Distribution request to confirm that the distribution was successfully deleted.

For information about deleting a distribution using the CloudFront console, see Deleting a Distribution in the Amazon CloudFront Developer Guide.

getCloudFrontOriginAccessIdentity(params = {}, callback) ⇒ AWS.Request

Get the information about an origin access identity.

getCloudFrontOriginAccessIdentityConfig(params = {}, callback) ⇒ AWS.Request

Get the configuration information about an origin access identity.

getDistribution(params = {}, callback) ⇒ AWS.Request

Get the information about a distribution.

getDistributionConfig(params = {}, callback) ⇒ AWS.Request

Get the configuration information about a distribution.

getInvalidation(params = {}, callback) ⇒ AWS.Request

Get the information about an invalidation.

getStreamingDistribution(params = {}, callback) ⇒ AWS.Request

Gets information about a specified RTMP distribution, including the distribution configuration.

getStreamingDistributionConfig(params = {}, callback) ⇒ AWS.Request

Get the configuration information about a streaming distribution.

listCloudFrontOriginAccessIdentities(params = {}, callback) ⇒ AWS.Request

Lists origin access identities.

listDistributions(params = {}, callback) ⇒ AWS.Request

listDistributionsByWebACLId(params = {}, callback) ⇒ AWS.Request

List the distributions that are associated with a specified AWS WAF web ACL.

listInvalidations(params = {}, callback) ⇒ AWS.Request

Lists invalidation batches.

listStreamingDistributions(params = {}, callback) ⇒ AWS.Request

List streaming distributions.

listTagsForResource(params = {}, callback) ⇒ AWS.Request

List tags for a CloudFront resource.

tagResource(params = {}, callback) ⇒ AWS.Request

Add tags to a CloudFront resource.

untagResource(params = {}, callback) ⇒ AWS.Request

Remove tags from a CloudFront resource.

updateCloudFrontOriginAccessIdentity(params = {}, callback) ⇒ AWS.Request

Update an origin access identity.

updateDistribution(params = {}, callback) ⇒ AWS.Request

updateStreamingDistribution(params = {}, callback) ⇒ AWS.Request

Update a streaming distribution.

waitFor(state, params = {}, callback) ⇒ AWS.Request

Waits for a given CloudFront_20161125 resource. The final callback or'complete' event will be fired only when the resource is either in its final state or the waiter has timed out and stopped polling for the final state.

Waiter Resource Details

cloudfront.waitFor('distributionDeployed', params = {}, [callback]) ⇒ AWS.Request

Waits for the distributionDeployed state by periodically calling the underlyingCloudFront_20161125.getDistribution() operation every 60 seconds (at most 25 times).

cloudfront.waitFor('invalidationCompleted', params = {}, [callback]) ⇒ AWS.Request

Waits for the invalidationCompleted state by periodically calling the underlyingCloudFront_20161125.getInvalidation() operation every 20 seconds (at most 30 times).

cloudfront.waitFor('streamingDistributionDeployed', params = {}, [callback]) ⇒ AWS.Request

Waits for the streamingDistributionDeployed state by periodically calling the underlyingCloudFront_20161125.getStreamingDistribution() operation every 60 seconds (at most 25 times).