UNPKG

6.38 kBTypeScriptView Raw
1import { Resource } from '@aws-cdk/core';
2import { Construct } from 'constructs';
3/**
4 * Represents a Origin Request Policy
5 */
6export interface IOriginRequestPolicy {
7 /**
8 * The ID of the origin request policy
9 * @attribute
10 */
11 readonly originRequestPolicyId: string;
12}
13/**
14 * Properties for creating a Origin Request Policy
15 */
16export interface OriginRequestPolicyProps {
17 /**
18 * A unique name to identify the origin request policy.
19 * The name must only include '-', '_', or alphanumeric characters.
20 * @default - generated from the `id`
21 */
22 readonly originRequestPolicyName?: string;
23 /**
24 * A comment to describe the origin request policy.
25 * @default - no comment
26 */
27 readonly comment?: string;
28 /**
29 * The cookies from viewer requests to include in origin requests.
30 * @default OriginRequestCookieBehavior.none()
31 */
32 readonly cookieBehavior?: OriginRequestCookieBehavior;
33 /**
34 * The HTTP headers to include in origin requests. These can include headers from viewer requests and additional headers added by CloudFront.
35 * @default OriginRequestHeaderBehavior.none()
36 */
37 readonly headerBehavior?: OriginRequestHeaderBehavior;
38 /**
39 * The URL query strings from viewer requests to include in origin requests.
40 * @default OriginRequestQueryStringBehavior.none()
41 */
42 readonly queryStringBehavior?: OriginRequestQueryStringBehavior;
43}
44/**
45 * A Origin Request Policy configuration.
46 *
47 * @resource AWS::CloudFront::OriginRequestPolicy
48 */
49export declare class OriginRequestPolicy extends Resource implements IOriginRequestPolicy {
50 /** This policy includes only the User-Agent and Referer headers. It doesn’t include any query strings or cookies. */
51 static readonly USER_AGENT_REFERER_HEADERS: IOriginRequestPolicy;
52 /** This policy includes the header that enables cross-origin resource sharing (CORS) requests when the origin is a custom origin. */
53 static readonly CORS_CUSTOM_ORIGIN: IOriginRequestPolicy;
54 /** This policy includes the headers that enable cross-origin resource sharing (CORS) requests when the origin is an Amazon S3 bucket. */
55 static readonly CORS_S3_ORIGIN: IOriginRequestPolicy;
56 /** This policy includes all values (query strings, headers, and cookies) in the viewer request. */
57 static readonly ALL_VIEWER: IOriginRequestPolicy;
58 /** This policy is designed for use with an origin that is an AWS Elemental MediaTailor endpoint. */
59 static readonly ELEMENTAL_MEDIA_TAILOR: IOriginRequestPolicy;
60 /** Imports a Origin Request Policy from its id. */
61 static fromOriginRequestPolicyId(scope: Construct, id: string, originRequestPolicyId: string): IOriginRequestPolicy;
62 /** Use an existing managed origin request policy. */
63 private static fromManagedOriginRequestPolicy;
64 readonly originRequestPolicyId: string;
65 constructor(scope: Construct, id: string, props?: OriginRequestPolicyProps);
66}
67/**
68 * Determines whether any cookies in viewer requests (and if so, which cookies)
69 * are included in requests that CloudFront sends to the origin.
70 */
71export declare class OriginRequestCookieBehavior {
72 /**
73 * Cookies in viewer requests are not included in requests that CloudFront sends to the origin.
74 * Any cookies that are listed in a CachePolicy are still included in origin requests.
75 */
76 static none(): OriginRequestCookieBehavior;
77 /** All cookies in viewer requests are included in requests that CloudFront sends to the origin. */
78 static all(): OriginRequestCookieBehavior;
79 /** Only the provided `cookies` are included in requests that CloudFront sends to the origin. */
80 static allowList(...cookies: string[]): OriginRequestCookieBehavior;
81 /** The behavior of cookies: allow all, none or an allow list. */
82 readonly behavior: string;
83 /** The cookies to allow, if the behavior is an allow list. */
84 readonly cookies?: string[];
85 private constructor();
86}
87/**
88 * Determines whether any HTTP headers (and if so, which headers) are included in requests that CloudFront sends to the origin.
89 */
90export declare class OriginRequestHeaderBehavior {
91 /**
92 * HTTP headers are not included in requests that CloudFront sends to the origin.
93 * Any headers that are listed in a CachePolicy are still included in origin requests.
94 */
95 static none(): OriginRequestHeaderBehavior;
96 /**
97 * All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.
98 * Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.
99 * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-cloudfront-headers.html
100 */
101 static all(...cloudfrontHeaders: string[]): OriginRequestHeaderBehavior;
102 /** Listed headers are included in requests that CloudFront sends to the origin. */
103 static allowList(...headers: string[]): OriginRequestHeaderBehavior;
104 /** The behavior of headers: allow all, none or an allow list. */
105 readonly behavior: string;
106 /** The headers for the allow list or the included CloudFront headers, if applicable. */
107 readonly headers?: string[];
108 private constructor();
109}
110/**
111 * Determines whether any URL query strings in viewer requests (and if so, which query strings)
112 * are included in requests that CloudFront sends to the origin.
113 */
114export declare class OriginRequestQueryStringBehavior {
115 /**
116 * Query strings in viewer requests are not included in requests that CloudFront sends to the origin.
117 * Any query strings that are listed in a CachePolicy are still included in origin requests.
118 */
119 static none(): OriginRequestQueryStringBehavior;
120 /** All query strings in viewer requests are included in requests that CloudFront sends to the origin. */
121 static all(): OriginRequestQueryStringBehavior;
122 /** Only the provided `queryStrings` are included in requests that CloudFront sends to the origin. */
123 static allowList(...queryStrings: string[]): OriginRequestQueryStringBehavior;
124 /** The behavior of query strings -- allow all, none, or only an allow list. */
125 readonly behavior: string;
126 /** The query strings to allow, if the behavior is an allow list. */
127 readonly queryStrings?: string[];
128 private constructor();
129}