AwsCloudfront

Service-level AWS CloudFront component.

Remarks

Naming:

  • Root: type ${namespace}:aws:AwsCloudfront; capability cloudfront; identity is the raw selected capability name field; target ${env}-${projectHash}-cloudfront-${sanitiseNamePart(identity)}. The target rejects a punctuation-only identity such as ___; consumers must select an alphanumeric identity.
  • Primary children have parent AwsCloudfront and tuple containing their selected raw capability name: aws:cloudfront/distribution:Distribution and its optional aws:cloudfront/monitoringSubscription:MonitoringSubscription use [args.distribution.name]; aws:cloudfront/function:Function uses [args.function.name]; aws:cloudfront/originAccessControl:OriginAccessControl uses [args.originAccessControl.name]; and aws:cloudfront/cachePolicy:CachePolicy, aws:cloudfront/originRequestPolicy:OriginRequestPolicy, and aws:cloudfront/responseHeadersPolicy:ResponseHeadersPolicy use their corresponding args.<capability>.name. Each target is ${env}-${projectHash}-${sanitiseNamePart(name)}; distinct qualified provider resource types permit identical tuples.
  • AWS provider names: Function name (source args.function.name), OriginAccessControl name (source args.originAccessControl.name), and all policy name fields (source their matching args.<capability>.name) use stackAndPurpose ${env}-${projectHash}-${purpose} through buildAwsNameFromLiteralCamelCasePurpose(...), retaining their length limits. Distribution has no controlled provider name: args.distribution.name is forwarded unchanged only as its default semantic comment; CloudFront owns provider validation for that comment. MonitoringSubscription has no provider name.

Example

CODE
`const distribution = new AwsCloudfront({ distribution: { name: 'website', origins: [{ domainName: 'origin.example.com', originId: 'application', customOriginConfig: { httpPort: 80, httpsPort: 443 } }], defaultCacheBehavior: { targetOriginId: 'application' }, viewerCertificate: { acmCertificateArn: 'arn:aws:acm:us-east-1:000000000000:certificate/12345678-1234-1234-1234-123456789abc' } } });`

Constructors

new AwsCloudfront( args: AwsCloudfrontArgs, options?: ComponentResourceOptions, ): AwsCloudfront

Parameters

  • args (AwsCloudfrontArgs)
  • options (ComponentResourceOptions, optional)

Returns

AwsCloudfront

Hierarchy

  • ComponentResource
  • AwsCloudfront

Properties

cachePolicy: CachePolicy

readonly

Cache policy created by the cache-policy capability.

cachePolicyReference: Output<AwsCloudfrontCachePolicyReference>

readonly

Typed cache-policy identifier for cache behaviours.

distribution: Distribution

readonly

Distribution created by the distribution capability.

distributionArn: Output<string>

readonly

Distribution ARN for dependent resources.

distributionDomainName: Output<string>

readonly

CloudFront-managed distribution domain name.

distributionId: Output<string>

readonly

Distribution ID for dependent resources.

distributionReference: Output<AwsCloudfrontDistributionReference>

readonly

Typed distribution identifiers for dependent infrastructure.

function: Function

readonly

Function created by the function capability.

functionArn: Output<string>

readonly

ARN of the published CloudFront Function.

monitoringSubscription: MonitoringSubscription

readonly

Optional enhanced real-time metrics subscription for the distribution.

originAccessControl: OriginAccessControl

readonly

Origin Access Control created by the OAC capability.

originAccessControlReference: Output<AwsCloudfrontOriginAccessControlReference>

readonly

Typed OAC identifier for private S3 origins.

originRequestPolicy: OriginRequestPolicy

readonly

Origin request policy created by the origin-request-policy capability.

originRequestPolicyReference: Output<AwsCloudfrontOriginRequestPolicyReference>

readonly

Typed origin-request-policy identifier for cache behaviours.

responseHeadersPolicy: ResponseHeadersPolicy

readonly

Response headers policy created by the response-headers-policy capability.

responseHeadersPolicyReference: Output<AwsCloudfrontResponseHeadersPolicyReference>

readonly

Typed response-headers-policy identifier for cache behaviours.

urn: Output<string>

readonly

Inherited from urn

The stable logical URN used to distinctly address a resource, both before and after deployments.

Methods

getData(): Promise<any>

protectedasync

Inherited from getData

Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.

Returns

  • Promise<any>

getProvider(moduleMember: string): ProviderResource | undefined

Inherited from getProvider

Returns the provider for the given module member, if one exists.

Parameters

  • moduleMember (string)

Returns

  • ProviderResource | undefined

initialize( args: Inputs, opts?: ComponentResourceOptions, name?: string, type?: string, ): Promise<any>

protectedasync

Inherited from initialize

Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.

Parameters

  • args (Inputs)
  • opts (ComponentResourceOptions, optional)
  • name (string, optional)
  • type (string, optional)

Returns

  • Promise<any>

registerOutputs( outputs?: Inputs | Promise<Inputs> | Output<Inputs>, ): void

protected

Inherited from registerOutputs

Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

Parameters

  • outputs (Inputs | Promise<Inputs> | Output<Inputs>, optional)

Returns

  • void

Static Methods

isInstance(obj: any): obj is ComponentResource<any>

static

Inherited from isInstance

Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

Parameters

  • obj (any)

Returns

  • obj is ComponentResource<any>