Skip to content

Commit 2ac0f41

Browse files
add missing cache behavior required parameters
1 parent ad72d85 commit 2ac0f41

File tree

6 files changed

+339
-10
lines changed

6 files changed

+339
-10
lines changed

__tests__/__snapshots__/custom-url-origin.test.js.snap

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,26 @@ Object {
6161
"Origins": Object {
6262
"Items": Array [
6363
Object {
64+
"CustomHeaders": Object {
65+
"Items": Array [],
66+
"Quantity": 0,
67+
},
6468
"CustomOriginConfig": Object {
6569
"HTTPPort": 80,
6670
"HTTPSPort": 443,
71+
"OriginKeepaliveTimeout": 5,
6772
"OriginProtocolPolicy": "https-only",
73+
"OriginReadTimeout": 30,
74+
"OriginSslProtocols": Object {
75+
"Items": Array [
76+
"TLSv1.2",
77+
],
78+
"Quantity": 1,
79+
},
6880
},
6981
"DomainName": "mycustomorigin.com",
7082
"Id": "mycustomorigin.com",
83+
"OriginPath": "",
7184
},
7285
],
7386
"Quantity": 1,
@@ -80,17 +93,77 @@ Object {
8093
exports[`Input origin as a custom url updates distribution 1`] = `
8194
Object {
8295
"DistributionConfig": Object {
96+
"DefaultCacheBehavior": Object {
97+
"AllowedMethods": Object {
98+
"CachedMethods": Object {
99+
"Items": Array [
100+
"HEAD",
101+
"GET",
102+
],
103+
"Quantity": 2,
104+
},
105+
"Items": Array [
106+
"HEAD",
107+
"GET",
108+
],
109+
"Quantity": 2,
110+
},
111+
"Compress": false,
112+
"DefaultTTL": 86400,
113+
"FieldLevelEncryptionId": "",
114+
"ForwardedValues": Object {
115+
"Cookies": Object {
116+
"Forward": "none",
117+
},
118+
"Headers": Object {
119+
"Items": Array [],
120+
"Quantity": 0,
121+
},
122+
"QueryString": false,
123+
"QueryStringCacheKeys": Object {
124+
"Items": Array [],
125+
"Quantity": 0,
126+
},
127+
},
128+
"LambdaFunctionAssociations": Object {
129+
"Items": Array [],
130+
"Quantity": 0,
131+
},
132+
"MaxTTL": 31536000,
133+
"MinTTL": 0,
134+
"SmoothStreaming": false,
135+
"TargetOriginId": "mycustomoriginupdated.com",
136+
"TrustedSigners": Object {
137+
"Enabled": false,
138+
"Items": Array [],
139+
"Quantity": 0,
140+
},
141+
"ViewerProtocolPolicy": "redirect-to-https",
142+
},
83143
"Enabled": true,
84144
"Origins": Object {
85145
"Items": Array [
86146
Object {
147+
"CustomHeaders": Object {
148+
"Items": Array [],
149+
"Quantity": 0,
150+
},
87151
"CustomOriginConfig": Object {
88152
"HTTPPort": 80,
89153
"HTTPSPort": 443,
154+
"OriginKeepaliveTimeout": 5,
90155
"OriginProtocolPolicy": "https-only",
156+
"OriginReadTimeout": 30,
157+
"OriginSslProtocols": Object {
158+
"Items": Array [
159+
"TLSv1.2",
160+
],
161+
"Quantity": 1,
162+
},
91163
},
92164
"DomainName": "mycustomoriginupdated.com",
93165
"Id": "mycustomoriginupdated.com",
166+
"OriginPath": "",
94167
},
95168
],
96169
"Quantity": 1,

__tests__/__snapshots__/origin-with-path-pattern.test.js.snap

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,49 @@ Object {
1010
"CacheBehaviors": Object {
1111
"Items": Array [
1212
Object {
13+
"AllowedMethods": Object {
14+
"CachedMethods": Object {
15+
"Items": Array [
16+
"GET",
17+
"HEAD",
18+
],
19+
"Quantity": 2,
20+
},
21+
"Items": Array [
22+
"GET",
23+
"HEAD",
24+
],
25+
"Quantity": 2,
26+
},
1327
"Compress": true,
28+
"DefaultTTL": 0,
29+
"FieldLevelEncryptionId": "",
1430
"ForwardedValues": Object {
1531
"Cookies": Object {
1632
"Forward": "all",
1733
},
34+
"Headers": Object {
35+
"Items": Array [],
36+
"Quantity": 0,
37+
},
1838
"QueryString": true,
39+
"QueryStringCacheKeys": Object {
40+
"Items": Array [],
41+
"Quantity": 0,
42+
},
1943
},
44+
"LambdaFunctionAssociations": Object {
45+
"Items": Array [],
46+
"Quantity": 0,
47+
},
48+
"MaxTTL": 0,
2049
"MinTTL": 10,
2150
"PathPattern": "/some/path",
51+
"SmoothStreaming": false,
2252
"TargetOriginId": "exampleorigin.com",
2353
"TrustedSigners": Object {
2454
"Enabled": false,
55+
"Quantity": 0,
2556
},
2657
"ViewerProtocolPolicy": "https-only",
2758
},
@@ -82,13 +113,26 @@ Object {
82113
"Origins": Object {
83114
"Items": Array [
84115
Object {
116+
"CustomHeaders": Object {
117+
"Items": Array [],
118+
"Quantity": 0,
119+
},
85120
"CustomOriginConfig": Object {
86121
"HTTPPort": 80,
87122
"HTTPSPort": 443,
123+
"OriginKeepaliveTimeout": 5,
88124
"OriginProtocolPolicy": "https-only",
125+
"OriginReadTimeout": 30,
126+
"OriginSslProtocols": Object {
127+
"Items": Array [
128+
"TLSv1.2",
129+
],
130+
"Quantity": 1,
131+
},
89132
},
90133
"DomainName": "exampleorigin.com",
91134
"Id": "exampleorigin.com",
135+
"OriginPath": "",
92136
},
93137
],
94138
"Quantity": 1,
@@ -104,35 +148,126 @@ Object {
104148
"CacheBehaviors": Object {
105149
"Items": Array [
106150
Object {
151+
"AllowedMethods": Object {
152+
"CachedMethods": Object {
153+
"Items": Array [
154+
"GET",
155+
"HEAD",
156+
],
157+
"Quantity": 2,
158+
},
159+
"Items": Array [
160+
"GET",
161+
"HEAD",
162+
],
163+
"Quantity": 2,
164+
},
107165
"Compress": true,
166+
"DefaultTTL": 0,
167+
"FieldLevelEncryptionId": "",
108168
"ForwardedValues": Object {
109169
"Cookies": Object {
110170
"Forward": "all",
111171
},
172+
"Headers": Object {
173+
"Items": Array [],
174+
"Quantity": 0,
175+
},
112176
"QueryString": true,
177+
"QueryStringCacheKeys": Object {
178+
"Items": Array [],
179+
"Quantity": 0,
180+
},
181+
},
182+
"LambdaFunctionAssociations": Object {
183+
"Items": Array [],
184+
"Quantity": 0,
113185
},
186+
"MaxTTL": 0,
114187
"MinTTL": 10,
115188
"PathPattern": "/some/other/path",
189+
"SmoothStreaming": false,
116190
"TargetOriginId": "exampleorigin.com",
117191
"TrustedSigners": Object {
118192
"Enabled": false,
193+
"Quantity": 0,
119194
},
120195
"ViewerProtocolPolicy": "https-only",
121196
},
122197
],
123198
"Quantity": 1,
124199
},
200+
"DefaultCacheBehavior": Object {
201+
"AllowedMethods": Object {
202+
"CachedMethods": Object {
203+
"Items": Array [
204+
"HEAD",
205+
"GET",
206+
],
207+
"Quantity": 2,
208+
},
209+
"Items": Array [
210+
"HEAD",
211+
"GET",
212+
],
213+
"Quantity": 2,
214+
},
215+
"Compress": false,
216+
"DefaultTTL": 86400,
217+
"FieldLevelEncryptionId": "",
218+
"ForwardedValues": Object {
219+
"Cookies": Object {
220+
"Forward": "none",
221+
},
222+
"Headers": Object {
223+
"Items": Array [],
224+
"Quantity": 0,
225+
},
226+
"QueryString": false,
227+
"QueryStringCacheKeys": Object {
228+
"Items": Array [],
229+
"Quantity": 0,
230+
},
231+
},
232+
"LambdaFunctionAssociations": Object {
233+
"Items": Array [],
234+
"Quantity": 0,
235+
},
236+
"MaxTTL": 31536000,
237+
"MinTTL": 0,
238+
"SmoothStreaming": false,
239+
"TargetOriginId": "exampleorigin.com",
240+
"TrustedSigners": Object {
241+
"Enabled": false,
242+
"Items": Array [],
243+
"Quantity": 0,
244+
},
245+
"ViewerProtocolPolicy": "redirect-to-https",
246+
},
125247
"Enabled": true,
126248
"Origins": Object {
127249
"Items": Array [
128250
Object {
251+
"CustomHeaders": Object {
252+
"Items": Array [],
253+
"Quantity": 0,
254+
},
129255
"CustomOriginConfig": Object {
130256
"HTTPPort": 80,
131257
"HTTPSPort": 443,
258+
"OriginKeepaliveTimeout": 5,
132259
"OriginProtocolPolicy": "https-only",
260+
"OriginReadTimeout": 30,
261+
"OriginSslProtocols": Object {
262+
"Items": Array [
263+
"TLSv1.2",
264+
],
265+
"Quantity": 1,
266+
},
133267
},
134268
"DomainName": "exampleorigin.com",
135269
"Id": "exampleorigin.com",
270+
"OriginPath": "",
136271
},
137272
],
138273
"Quantity": 1,

__tests__/__snapshots__/s3-origin.test.js.snap

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,13 @@ Object {
6161
"Origins": Object {
6262
"Items": Array [
6363
Object {
64+
"CustomHeaders": Object {
65+
"Items": Array [],
66+
"Quantity": 0,
67+
},
6468
"DomainName": "mybucket.s3.amazonaws.com",
6569
"Id": "mybucket",
70+
"OriginPath": "",
6671
"S3OriginConfig": Object {
6772
"OriginAccessIdentity": "",
6873
},
@@ -78,12 +83,64 @@ Object {
7883
exports[`Input origin as an S3 bucket url updates distribution 1`] = `
7984
Object {
8085
"DistributionConfig": Object {
86+
"DefaultCacheBehavior": Object {
87+
"AllowedMethods": Object {
88+
"CachedMethods": Object {
89+
"Items": Array [
90+
"HEAD",
91+
"GET",
92+
],
93+
"Quantity": 2,
94+
},
95+
"Items": Array [
96+
"HEAD",
97+
"GET",
98+
],
99+
"Quantity": 2,
100+
},
101+
"Compress": false,
102+
"DefaultTTL": 86400,
103+
"FieldLevelEncryptionId": "",
104+
"ForwardedValues": Object {
105+
"Cookies": Object {
106+
"Forward": "none",
107+
},
108+
"Headers": Object {
109+
"Items": Array [],
110+
"Quantity": 0,
111+
},
112+
"QueryString": false,
113+
"QueryStringCacheKeys": Object {
114+
"Items": Array [],
115+
"Quantity": 0,
116+
},
117+
},
118+
"LambdaFunctionAssociations": Object {
119+
"Items": Array [],
120+
"Quantity": 0,
121+
},
122+
"MaxTTL": 31536000,
123+
"MinTTL": 0,
124+
"SmoothStreaming": false,
125+
"TargetOriginId": "anotherbucket",
126+
"TrustedSigners": Object {
127+
"Enabled": false,
128+
"Items": Array [],
129+
"Quantity": 0,
130+
},
131+
"ViewerProtocolPolicy": "redirect-to-https",
132+
},
81133
"Enabled": true,
82134
"Origins": Object {
83135
"Items": Array [
84136
Object {
137+
"CustomHeaders": Object {
138+
"Items": Array [],
139+
"Quantity": 0,
140+
},
85141
"DomainName": "anotherbucket.s3.amazonaws.com",
86142
"Id": "anotherbucket",
143+
"OriginPath": "",
87144
"S3OriginConfig": Object {
88145
"OriginAccessIdentity": "",
89146
},

0 commit comments

Comments
 (0)