UNPKG

1.45 kBTypeScriptView Raw
1import { CfnDistribution } from '../cloudfront.generated';
2import { AddBehaviorOptions } from '../distribution';
3/**
4 * Properties for specifying custom behaviors for origins.
5 */
6export interface CacheBehaviorProps extends AddBehaviorOptions {
7 /**
8 * The pattern (e.g., `images/*.jpg`) that specifies which requests to apply the behavior to.
9 * There must be exactly one behavior associated with each `Distribution` that has a path pattern
10 * of '*', which acts as the catch-all default behavior.
11 */
12 readonly pathPattern: string;
13}
14/**
15 * Allows configuring a variety of CloudFront functionality for a given URL path pattern.
16 *
17 * Note: This really should simply by called 'Behavior', but this name is already taken by the legacy
18 * CloudFrontWebDistribution implementation.
19 */
20export declare class CacheBehavior {
21 private readonly props;
22 private readonly originId;
23 constructor(originId: string, props: CacheBehaviorProps);
24 /**
25 * Creates and returns the CloudFormation representation of this behavior.
26 * This renders as a "CacheBehaviorProperty" regardless of if this is a default
27 * cache behavior or not, as the two are identical except that the pathPattern
28 * is omitted for the default cache behavior.
29 *
30 * @internal
31 */
32 _renderBehavior(): CfnDistribution.CacheBehaviorProperty;
33 private validateEdgeLambdas;
34 private grantEdgeLambdaFunctionExecutionRole;
35}