1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export interface CloudFrontHeaders {
|
9 | [name: string]: Array<{
|
10 | key?: string;
|
11 | value: string;
|
12 | }>;
|
13 | }
|
14 |
|
15 | export type CloudFrontOrigin =
|
16 | | { s3: CloudFrontS3Origin; custom?: never }
|
17 | | { custom: CloudFrontCustomOrigin; s3?: never };
|
18 |
|
19 | export interface CloudFrontCustomOrigin {
|
20 | customHeaders: CloudFrontHeaders;
|
21 | domainName: string;
|
22 | keepaliveTimeout: number;
|
23 | path: string;
|
24 | port: number;
|
25 | protocol: 'http' | 'https';
|
26 | readTimeout: number;
|
27 | sslProtocols: string[];
|
28 | }
|
29 |
|
30 | export interface CloudFrontS3Origin {
|
31 | authMethod: 'origin-access-identity' | 'none';
|
32 | customHeaders: CloudFrontHeaders;
|
33 | domainName: string;
|
34 | path: string;
|
35 | region: string;
|
36 | }
|
37 |
|
38 | export interface CloudFrontResponse {
|
39 | status: string;
|
40 | statusDescription: string;
|
41 | headers: CloudFrontHeaders;
|
42 | }
|
43 |
|
44 | export interface CloudFrontRequest {
|
45 | body?: {
|
46 | action: 'read-only' | 'replace';
|
47 | data: string;
|
48 | encoding: 'base64' | 'text';
|
49 | readonly inputTruncated: boolean;
|
50 | };
|
51 | readonly clientIp: string;
|
52 | readonly method: string;
|
53 | uri: string;
|
54 | querystring: string;
|
55 | headers: CloudFrontHeaders;
|
56 | origin?: CloudFrontOrigin;
|
57 | }
|
58 |
|
59 | export interface CloudFrontEvent {
|
60 | config: {
|
61 | readonly distributionDomainName: string;
|
62 | readonly distributionId: string;
|
63 | readonly eventType: 'origin-request' | 'origin-response' | 'viewer-request' | 'viewer-response';
|
64 | readonly requestId: string;
|
65 | };
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export interface CloudFrontResultResponse {
|
74 | status: string;
|
75 | statusDescription?: string;
|
76 | headers?: CloudFrontHeaders;
|
77 | bodyEncoding?: 'text' | 'base64';
|
78 | body?: string;
|
79 | }
|