@aws-sdk/client-cloudfront
Description
AWS SDK for JavaScript CloudFront Client for Node.js, Browser and React Native.
Amazon CloudFront
This is the Amazon CloudFront API Reference. This guide is for developers who need detailed information about CloudFront API actions, data types, and errors. For detailed information about CloudFront features, see the Amazon CloudFront Developer Guide.
Installing
To install this package, use the CLI of your favorite package manager:
npm install @aws-sdk/client-cloudfront
yarn add @aws-sdk/client-cloudfront
pnpm add @aws-sdk/client-cloudfront
Getting Started
Import
The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the CloudFrontClient and
the commands you need, for example ListCachePoliciesCommand:
const { CloudFrontClient, ListCachePoliciesCommand } = require("@aws-sdk/client-cloudfront");
import { CloudFrontClient, ListCachePoliciesCommand } from "@aws-sdk/client-cloudfront";
Usage
To send a request:
- Instantiate a client with configuration (e.g. credentials, region).
- Instantiate a command with input parameters.
- Call the
send operation on the client, providing the command object as input.
const client = new CloudFrontClient({ region: "REGION" });
const params = { };
const command = new ListCachePoliciesCommand(params);
Async/await
We recommend using the await
operator to wait for the promise returned by send operation as follows:
try {
const data = await client.send(command);
} catch (error) {
} finally {
}
Promises
You can also use Promise chaining.
client
.send(command)
.then((data) => {
})
.catch((error) => {
})
.finally(() => {
});
Aggregated client
The aggregated client class is exported from the same package, but without the "Client" suffix.
CloudFront extends CloudFrontClient and additionally supports all operations, waiters, and paginators as methods.
This style may be familiar to you from the AWS SDK for JavaScript v2.
If you are bundling the AWS SDK, we recommend using only the bare-bones client (CloudFrontClient).
More details are in the blog post on
modular packages in AWS SDK for JavaScript.
import { CloudFront } from "@aws-sdk/client-cloudfront";
const client = new CloudFront({ region: "REGION" });
try {
const data = await client.listCachePolicies(params);
} catch (error) {
}
client
.listCachePolicies(params)
.then((data) => {
})
.catch((error) => {
});
client.listCachePolicies(params, (err, data) => {
});
Troubleshooting
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
try {
const data = await client.send(command);
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
}
See also docs/ERROR_HANDLING.
Getting Help
Please use these community resources for getting help.
We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
To test your universal JavaScript code in Node.js, browser and react-native environments,
visit our code samples repo.
Contributing
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-cloudfront package is updated.
To contribute to client you can check our generate clients scripts.
License
This SDK is distributed under the
Apache License, Version 2.0,
see LICENSE for more information.
Client Commands (Operations List)
AssociateAlias
Command API Reference / Input / Output
AssociateDistributionTenantWebACL
Command API Reference / Input / Output
AssociateDistributionWebACL
Command API Reference / Input / Output
CopyDistribution
Command API Reference / Input / Output
CreateAnycastIpList
Command API Reference / Input / Output
CreateCachePolicy
Command API Reference / Input / Output
CreateCloudFrontOriginAccessIdentity
Command API Reference / Input / Output
CreateConnectionFunction
Command API Reference / Input / Output
CreateConnectionGroup
Command API Reference / Input / Output
CreateContinuousDeploymentPolicy
Command API Reference / Input / Output
CreateDistribution
Command API Reference / Input / Output
CreateDistributionTenant
Command API Reference / Input / Output
CreateDistributionWithTags
Command API Reference / Input / Output
CreateFieldLevelEncryptionConfig
Command API Reference / Input / Output
CreateFieldLevelEncryptionProfile
Command API Reference / Input / Output
CreateFunction
Command API Reference / Input / Output
CreateInvalidation
Command API Reference / Input / Output
CreateInvalidationForDistributionTenant
Command API Reference / Input / Output
CreateKeyGroup
Command API Reference / Input / Output
CreateKeyValueStore
Command API Reference / Input / Output
CreateMonitoringSubscription
Command API Reference / Input / Output
CreateOriginAccessControl
Command API Reference / Input / Output
CreateOriginRequestPolicy
Command API Reference / Input / Output
CreatePublicKey
Command API Reference / Input / Output
CreateRealtimeLogConfig
Command API Reference / Input / Output
CreateResponseHeadersPolicy
Command API Reference / Input / Output
CreateStreamingDistribution
Command API Reference / Input / Output
CreateStreamingDistributionWithTags
Command API Reference / Input / Output
CreateTrustStore
Command API Reference / Input / Output
CreateVpcOrigin
Command API Reference / Input / Output
DeleteAnycastIpList
Command API Reference / Input / Output
DeleteCachePolicy
Command API Reference / Input / Output
DeleteCloudFrontOriginAccessIdentity
Command API Reference / Input / Output
DeleteConnectionFunction
Command API Reference / Input / Output
DeleteConnectionGroup
Command API Reference / Input / Output
DeleteContinuousDeploymentPolicy
Command API Reference / Input / Output
DeleteDistribution
Command API Reference / Input / Output
DeleteDistributionTenant
Command API Reference / Input / Output
DeleteFieldLevelEncryptionConfig
Command API Reference / Input / Output
DeleteFieldLevelEncryptionProfile
Command API Reference / Input / Output
DeleteFunction
Command API Reference / Input / Output
DeleteKeyGroup
Command API Reference / Input / Output
DeleteKeyValueStore
Command API Reference / Input / Output
DeleteMonitoringSubscription
Command API Reference / Input / Output
DeleteOriginAccessControl
Command API Reference / Input / Output
DeleteOriginRequestPolicy
Command API Reference / Input / Output
DeletePublicKey
Command API Reference / Input / Output
DeleteRealtimeLogConfig
Command API Reference / Input / Output
DeleteResourcePolicy
Command API Reference / Input / Output
DeleteResponseHeadersPolicy
Command API Reference / Input / Output
DeleteStreamingDistribution
Command API Reference / Input / Output
DeleteTrustStore
Command API Reference / Input / Output
DeleteVpcOrigin
Command API Reference / Input / Output
DescribeConnectionFunction
Command API Reference / Input / Output
DescribeFunction
Command API Reference / Input / Output
DescribeKeyValueStore
Command API Reference / Input / Output
DisassociateDistributionTenantWebACL
Command API Reference / Input / Output
DisassociateDistributionWebACL
Command API Reference / Input / Output
GetAnycastIpList
Command API Reference / Input / Output
GetCachePolicy
Command API Reference / Input / Output
GetCachePolicyConfig
Command API Reference / Input / Output
GetCloudFrontOriginAccessIdentity
Command API Reference / Input / Output
GetCloudFrontOriginAccessIdentityConfig
Command API Reference / Input / Output
GetConnectionFunction
Command API Reference / Input / Output
GetConnectionGroup
Command API Reference / Input / Output
GetConnectionGroupByRoutingEndpoint
Command API Reference / Input / Output
GetContinuousDeploymentPolicy
Command API Reference / Input / Output
GetContinuousDeploymentPolicyConfig
Command API Reference / Input / Output
GetDistribution
Command API Reference / Input / Output
GetDistributionConfig
Command API Reference / Input / Output
GetDistributionTenant
Command API Reference / Input / Output
GetDistributionTenantByDomain
Command API Reference / Input / Output
GetFieldLevelEncryption
Command API Reference / Input / Output
GetFieldLevelEncryptionConfig
Command API Reference / Input / Output
GetFieldLevelEncryptionProfile
Command API Reference / Input / Output
GetFieldLevelEncryptionProfileConfig
Command API Reference / Input / Output
GetFunction
Command API Reference / Input / Output
GetInvalidation
Command API Reference / Input / Output
GetInvalidationForDistributionTenant
Command API Reference / Input / Output
GetKeyGroup
Command API Reference / Input / Output
GetKeyGroupConfig
Command API Reference / Input / Output
GetManagedCertificateDetails
Command API Reference / Input / Output
GetMonitoringSubscription
Command API Reference / Input / Output
GetOriginAccessControl
Command API Reference / Input / Output
GetOriginAccessControlConfig
Command API Reference / Input / Output
GetOriginRequestPolicy
Command API Reference / Input / Output
GetOriginRequestPolicyConfig
Command API Reference / Input / Output
GetPublicKey
Command API Reference / Input / Output
GetPublicKeyConfig
Command API Reference / Input / Output
GetRealtimeLogConfig
Command API Reference / Input / Output
GetResourcePolicy
Command API Reference / Input / Output
GetResponseHeadersPolicy
Command API Reference / Input / Output
GetResponseHeadersPolicyConfig
Command API Reference / Input / Output
GetStreamingDistribution
Command API Reference / Input / Output
GetStreamingDistributionConfig
Command API Reference / Input / Output
GetTrustStore
Command API Reference / Input / Output
GetVpcOrigin
Command API Reference / Input / Output
ListAnycastIpLists
Command API Reference / Input / Output
ListCachePolicies
Command API Reference / Input / Output
ListCloudFrontOriginAccessIdentities
Command API Reference / Input / Output
ListConflictingAliases
Command API Reference / Input / Output
ListConnectionFunctions
Command API Reference / Input / Output
ListConnectionGroups
Command API Reference / Input / Output
ListContinuousDeploymentPolicies
Command API Reference / Input / Output
ListDistributions
Command API Reference / Input / Output
ListDistributionsByAnycastIpListId
Command API Reference / Input / Output
ListDistributionsByCachePolicyId
Command API Reference / Input / Output
ListDistributionsByConnectionFunction
Command API Reference / Input / Output
ListDistributionsByConnectionMode
Command API Reference / Input / Output
ListDistributionsByKeyGroup
Command API Reference / Input / Output
ListDistributionsByOriginRequestPolicyId
Command API Reference / Input / Output
ListDistributionsByOwnedResource
Command API Reference / Input / Output
ListDistributionsByRealtimeLogConfig
Command API Reference / Input / Output
ListDistributionsByResponseHeadersPolicyId
Command API Reference / Input / Output
ListDistributionsByTrustStore
Command API Reference / Input / Output
ListDistributionsByVpcOriginId
Command API Reference / Input / Output
ListDistributionsByWebACLId
Command API Reference / Input / Output
ListDistributionTenants
Command API Reference / Input / Output
ListDistributionTenantsByCustomization
Command API Reference / Input / Output
ListDomainConflicts
Command API Reference / Input / Output
ListFieldLevelEncryptionConfigs
Command API Reference / Input / Output
ListFieldLevelEncryptionProfiles
Command API Reference / Input / Output
ListFunctions
Command API Reference / Input / Output
ListInvalidations
Command API Reference / Input / Output
ListInvalidationsForDistributionTenant
Command API Reference / Input / Output
ListKeyGroups
Command API Reference / Input / Output
ListKeyValueStores
Command API Reference / Input / Output
ListOriginAccessControls
Command API Reference / Input / Output
ListOriginRequestPolicies
Command API Reference / Input / Output
ListPublicKeys
Command API Reference / Input / Output
ListRealtimeLogConfigs
Command API Reference / Input / Output
ListResponseHeadersPolicies
Command API Reference / Input / Output
ListStreamingDistributions
Command API Reference / Input / Output
ListTagsForResource
Command API Reference / Input / Output
ListTrustStores
Command API Reference / Input / Output
ListVpcOrigins
Command API Reference / Input / Output
PublishConnectionFunction
Command API Reference / Input / Output
PublishFunction
Command API Reference / Input / Output
PutResourcePolicy
Command API Reference / Input / Output
TagResource
Command API Reference / Input / Output
TestConnectionFunction
Command API Reference / Input / Output
TestFunction
Command API Reference / Input / Output
UntagResource
Command API Reference / Input / Output
UpdateAnycastIpList
Command API Reference / Input / Output
UpdateCachePolicy
Command API Reference / Input / Output
UpdateCloudFrontOriginAccessIdentity
Command API Reference / Input / Output
UpdateConnectionFunction
Command API Reference / Input / Output
UpdateConnectionGroup
Command API Reference / Input / Output
UpdateContinuousDeploymentPolicy
Command API Reference / Input / Output
UpdateDistribution
Command API Reference / Input / Output
UpdateDistributionTenant
Command API Reference / Input / Output
UpdateDistributionWithStagingConfig
Command API Reference / Input / Output
UpdateDomainAssociation
Command API Reference / Input / Output
UpdateFieldLevelEncryptionConfig
Command API Reference / Input / Output
UpdateFieldLevelEncryptionProfile
Command API Reference / Input / Output
UpdateFunction
Command API Reference / Input / Output
UpdateKeyGroup
Command API Reference / Input / Output
UpdateKeyValueStore
Command API Reference / Input / Output
UpdateOriginAccessControl
Command API Reference / Input / Output
UpdateOriginRequestPolicy
Command API Reference / Input / Output
UpdatePublicKey
Command API Reference / Input / Output
UpdateRealtimeLogConfig
Command API Reference / Input / Output
UpdateResponseHeadersPolicy
Command API Reference / Input / Output
UpdateStreamingDistribution
Command API Reference / Input / Output
UpdateTrustStore
Command API Reference / Input / Output
UpdateVpcOrigin
Command API Reference / Input / Output
VerifyDnsConfiguration
Command API Reference / Input / Output