@quadnix/octo-aws-cdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/factories/aws-client.factory.d.ts +28 -0
  2. package/dist/factories/aws-client.factory.js +36 -0
  3. package/dist/factories/aws-client.factory.js.map +1 -1
  4. package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.d.ts +6 -0
  5. package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.js +11 -1
  6. package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.js.map +1 -1
  7. package/dist/modules/service/aws-s3-static-website-service/index.schema.d.ts +58 -0
  8. package/dist/modules/service/aws-s3-static-website-service/index.schema.js +96 -0
  9. package/dist/modules/service/aws-s3-static-website-service/index.schema.js.map +1 -1
  10. package/dist/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.js +89 -4
  11. package/dist/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.js.map +1 -1
  12. package/dist/modules/service/aws-s3-static-website-service/models/service/actions/update-aws-s3-static-website-service-source-paths.model.action.js +17 -1
  13. package/dist/modules/service/aws-s3-static-website-service/models/service/actions/update-aws-s3-static-website-service-source-paths.model.action.js.map +1 -1
  14. package/dist/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.js +6 -3
  15. package/dist/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.js.map +1 -1
  16. package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.d.ts +97 -0
  17. package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.js +613 -0
  18. package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.js.map +1 -0
  19. package/dist/resources/cloudfront-distribution/index.d.ts +1 -0
  20. package/dist/resources/cloudfront-distribution/index.js +2 -0
  21. package/dist/resources/cloudfront-distribution/index.js.map +1 -0
  22. package/dist/resources/cloudfront-distribution/index.schema.d.ts +522 -0
  23. package/dist/resources/cloudfront-distribution/index.schema.js +754 -0
  24. package/dist/resources/cloudfront-distribution/index.schema.js.map +1 -0
  25. package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.d.ts +36 -0
  26. package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.js +90 -0
  27. package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.js.map +1 -0
  28. package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.d.ts +39 -0
  29. package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.js +69 -0
  30. package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.js.map +1 -0
  31. package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.d.ts +37 -0
  32. package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.js +91 -0
  33. package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.js.map +1 -0
  34. package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.d.ts +62 -0
  35. package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.js +89 -0
  36. package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.js.map +1 -0
  37. package/dist/resources/cloudfront-invalidation/index.d.ts +5 -0
  38. package/dist/resources/cloudfront-invalidation/index.js +6 -0
  39. package/dist/resources/cloudfront-invalidation/index.js.map +1 -0
  40. package/dist/resources/cloudfront-invalidation/index.schema.d.ts +61 -0
  41. package/dist/resources/cloudfront-invalidation/index.schema.js +110 -0
  42. package/dist/resources/cloudfront-invalidation/index.schema.js.map +1 -0
  43. package/dist/resources/s3-website/index.schema.d.ts +20 -0
  44. package/dist/resources/s3-website/index.schema.js +38 -0
  45. package/dist/resources/s3-website/index.schema.js.map +1 -1
  46. package/dist/resources/s3-website/s3-website.resource.d.ts +20 -3
  47. package/dist/resources/s3-website/s3-website.resource.js +82 -26
  48. package/dist/resources/s3-website/s3-website.resource.js.map +1 -1
  49. package/package.json +4 -1
@@ -0,0 +1,754 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { BaseResourceSchema, Schema, Validate } from '@quadnix/octo';
11
+ /**
12
+ * One origin the distribution can serve from.
13
+ *
14
+ * @group Resources/CloudFrontDistribution
15
+ *
16
+ * @hideconstructor
17
+ */
18
+ export class CloudFrontOriginSchema {
19
+ constructor() {
20
+ /**
21
+ * How many times CloudFront retries the origin before giving up. Between 1 and 3.
22
+ */
23
+ this.connectionAttempts = Schema(3);
24
+ /**
25
+ * How long CloudFront waits to establish a connection to the origin, in seconds. Between 1 and 10.
26
+ */
27
+ this.connectionTimeout = Schema(10);
28
+ /**
29
+ * Headers CloudFront adds to every request it sends to this origin.
30
+ * This is how a load balancer rejects anything that did not arrive through the distribution.
31
+ */
32
+ this.customHeaders = Schema({});
33
+ /**
34
+ * What kind of origin this is, and the settings that only apply to that kind.
35
+ *
36
+ * * `s3` is a bucket reached privately. The distribution emits an origin access control for it,
37
+ * and builds the hostname from `bucketName` and `bucketRegion` rather than referencing the bucket,
38
+ * because the bucket's own policy already references this distribution. Granting the distribution
39
+ * read on the bucket is the bucket's job, driven by an overlay.
40
+ * * `custom` is anything that speaks HTTP - a load balancer, an EC2 instance, an API, a third
41
+ * party, or an S3 website endpoint.
42
+ */
43
+ this.kind = Schema();
44
+ /**
45
+ * How this origin is named by behaviors and origin groups. Unique across origins and origin groups.
46
+ */
47
+ this.originId = Schema();
48
+ /**
49
+ * A prefix CloudFront prepends to the path before asking the origin for it.
50
+ * Empty asks the origin for the path the viewer requested.
51
+ */
52
+ this.originPath = Schema('');
53
+ }
54
+ }
55
+ __decorate([
56
+ Validate({ options: { maxLength: 3, minLength: 1 } }),
57
+ __metadata("design:type", Object)
58
+ ], CloudFrontOriginSchema.prototype, "connectionAttempts", void 0);
59
+ __decorate([
60
+ Validate({ options: { maxLength: 10, minLength: 1 } }),
61
+ __metadata("design:type", Object)
62
+ ], CloudFrontOriginSchema.prototype, "connectionTimeout", void 0);
63
+ __decorate([
64
+ Validate({
65
+ destruct: (value) => Object.keys(value),
66
+ options: { minLength: 1 },
67
+ }),
68
+ __metadata("design:type", Object)
69
+ ], CloudFrontOriginSchema.prototype, "customHeaders", void 0);
70
+ __decorate([
71
+ Validate({
72
+ destruct: (value) => value.kind === 's3'
73
+ ? [value.bucketName, value.bucketRegion]
74
+ : [value.originProtocolPolicy, ...value.sslProtocols],
75
+ options: { minLength: 1 },
76
+ }),
77
+ __metadata("design:type", Object)
78
+ ], CloudFrontOriginSchema.prototype, "kind", void 0);
79
+ __decorate([
80
+ Validate({ options: { minLength: 1 } }),
81
+ __metadata("design:type", Object)
82
+ ], CloudFrontOriginSchema.prototype, "originId", void 0);
83
+ /**
84
+ * A primary origin and the origin CloudFront falls back to when the primary answers with one of
85
+ * `failoverStatusCodes`.
86
+ *
87
+ * @group Resources/CloudFrontDistribution
88
+ *
89
+ * @hideconstructor
90
+ */
91
+ export class CloudFrontOriginGroupSchema {
92
+ constructor() {
93
+ /**
94
+ * The origin id CloudFront falls back to.
95
+ */
96
+ this.failoverOriginId = Schema();
97
+ /**
98
+ * The status codes from the primary origin that trigger the failover.
99
+ */
100
+ this.failoverStatusCodes = Schema();
101
+ /**
102
+ * How this group is named by behaviors. Unique across origins and origin groups.
103
+ */
104
+ this.originGroupId = Schema();
105
+ /**
106
+ * The origin id CloudFront tries first.
107
+ */
108
+ this.primaryOriginId = Schema();
109
+ }
110
+ }
111
+ __decorate([
112
+ Validate({ options: { minLength: 1 } }),
113
+ __metadata("design:type", Object)
114
+ ], CloudFrontOriginGroupSchema.prototype, "failoverOriginId", void 0);
115
+ __decorate([
116
+ Validate({
117
+ destruct: (value) => value,
118
+ options: { maxLength: 599, minLength: 100 },
119
+ }),
120
+ __metadata("design:type", Object)
121
+ ], CloudFrontOriginGroupSchema.prototype, "failoverStatusCodes", void 0);
122
+ __decorate([
123
+ Validate({ options: { minLength: 1 } }),
124
+ __metadata("design:type", Object)
125
+ ], CloudFrontOriginGroupSchema.prototype, "originGroupId", void 0);
126
+ __decorate([
127
+ Validate({ options: { minLength: 1 } }),
128
+ __metadata("design:type", Object)
129
+ ], CloudFrontOriginGroupSchema.prototype, "primaryOriginId", void 0);
130
+ /**
131
+ * An edge function CloudFront runs for a behavior. The function itself is not created here - pass
132
+ * the ARN of one that already exists.
133
+ *
134
+ * @group Resources/CloudFrontDistribution
135
+ *
136
+ * @hideconstructor
137
+ */
138
+ export class CloudFrontFunctionAssociationSchema {
139
+ constructor() {
140
+ /**
141
+ * The ARN of the CloudFront Function or the Lambda@Edge function version.
142
+ */
143
+ this.arn = Schema();
144
+ /**
145
+ * Which lifecycle event the function runs on. See {@link ICloudFrontFunctionEventType}.
146
+ */
147
+ this.eventType = Schema();
148
+ /**
149
+ * Which engine runs it. A `cloudfront-function` is JavaScript at the edge and may only bind to a
150
+ * viewer event; `lambda-edge` may bind to any of the four.
151
+ */
152
+ this.kind = Schema();
153
+ }
154
+ }
155
+ __decorate([
156
+ Validate({ options: { minLength: 1 } }),
157
+ __metadata("design:type", Object)
158
+ ], CloudFrontFunctionAssociationSchema.prototype, "arn", void 0);
159
+ __decorate([
160
+ Validate({ options: { minLength: 1 } }),
161
+ __metadata("design:type", Object)
162
+ ], CloudFrontFunctionAssociationSchema.prototype, "eventType", void 0);
163
+ __decorate([
164
+ Validate({ options: { minLength: 1 } }),
165
+ __metadata("design:type", Object)
166
+ ], CloudFrontFunctionAssociationSchema.prototype, "kind", void 0);
167
+ /**
168
+ * One rule binding a set of paths to an origin, and deciding everything about how those paths are
169
+ * served.
170
+ *
171
+ * @group Resources/CloudFrontDistribution
172
+ *
173
+ * @hideconstructor
174
+ */
175
+ export class CloudFrontBehaviorSchema {
176
+ constructor() {
177
+ /**
178
+ * The HTTP methods CloudFront forwards to the origin.
179
+ * `['GET', 'HEAD']` is a CDN; the full set makes the distribution a reverse proxy.
180
+ */
181
+ this.allowedMethods = Schema(['GET', 'HEAD']);
182
+ /**
183
+ * The subset of `allowedMethods` whose responses CloudFront caches.
184
+ */
185
+ this.cachedMethods = Schema(['GET', 'HEAD']);
186
+ /**
187
+ * Which policy decides the cache key and the TTLs. See {@link ICloudFrontPolicyReference}.
188
+ */
189
+ this.cachePolicy = Schema();
190
+ /**
191
+ * Whether CloudFront compresses the response for viewers that accept it.
192
+ */
193
+ this.compress = Schema(true);
194
+ /**
195
+ * Edge functions to run for this behavior. See {@link CloudFrontFunctionAssociationSchema}.
196
+ */
197
+ this.functionAssociations = Schema([]);
198
+ /**
199
+ * Which policy decides what reaches the origin, independently of the cache key.
200
+ * `null` forwards only what the cache policy already selected.
201
+ */
202
+ this.originRequestPolicy = Schema(null);
203
+ /**
204
+ * The paths this behavior claims, e.g. `/api/*`. Absent on the default behavior, which claims
205
+ * everything no other behavior did.
206
+ */
207
+ this.pathPattern = Schema(null);
208
+ /**
209
+ * Which policy decides the headers CloudFront adds on the way out - CORS, HSTS, and the app's own
210
+ * content security policy. `null` adds nothing.
211
+ */
212
+ this.responseHeadersPolicy = Schema(null);
213
+ /**
214
+ * The origin or origin group serving these paths.
215
+ */
216
+ this.targetOriginId = Schema();
217
+ /**
218
+ * What CloudFront does with a plain HTTP request.
219
+ */
220
+ this.viewerProtocolPolicy = Schema('redirect-to-https');
221
+ }
222
+ }
223
+ __decorate([
224
+ Validate({
225
+ destruct: (value) => value,
226
+ options: { minLength: 1 },
227
+ }),
228
+ __metadata("design:type", Object)
229
+ ], CloudFrontBehaviorSchema.prototype, "allowedMethods", void 0);
230
+ __decorate([
231
+ Validate({
232
+ destruct: (value) => value,
233
+ options: { minLength: 1 },
234
+ }),
235
+ __metadata("design:type", Object)
236
+ ], CloudFrontBehaviorSchema.prototype, "cachedMethods", void 0);
237
+ __decorate([
238
+ Validate({
239
+ destruct: (value) => [value.kind, value.name],
240
+ options: { minLength: 1 },
241
+ }),
242
+ __metadata("design:type", Object)
243
+ ], CloudFrontBehaviorSchema.prototype, "cachePolicy", void 0);
244
+ __decorate([
245
+ Validate({
246
+ destruct: (value) => value,
247
+ options: { isSchema: { schema: CloudFrontFunctionAssociationSchema } },
248
+ }),
249
+ __metadata("design:type", Object)
250
+ ], CloudFrontBehaviorSchema.prototype, "functionAssociations", void 0);
251
+ __decorate([
252
+ Validate({
253
+ destruct: (value) => value ? [value.kind, value.name] : [],
254
+ options: { minLength: 1 },
255
+ }),
256
+ __metadata("design:type", Object)
257
+ ], CloudFrontBehaviorSchema.prototype, "originRequestPolicy", void 0);
258
+ __decorate([
259
+ Validate({
260
+ destruct: (value) => (value ? [value] : []),
261
+ options: { minLength: 1 },
262
+ }),
263
+ __metadata("design:type", Object)
264
+ ], CloudFrontBehaviorSchema.prototype, "pathPattern", void 0);
265
+ __decorate([
266
+ Validate({
267
+ destruct: (value) => value ? [value.kind, value.name] : [],
268
+ options: { minLength: 1 },
269
+ }),
270
+ __metadata("design:type", Object)
271
+ ], CloudFrontBehaviorSchema.prototype, "responseHeadersPolicy", void 0);
272
+ __decorate([
273
+ Validate({ options: { minLength: 1 } }),
274
+ __metadata("design:type", Object)
275
+ ], CloudFrontBehaviorSchema.prototype, "targetOriginId", void 0);
276
+ __decorate([
277
+ Validate({ options: { minLength: 1 } }),
278
+ __metadata("design:type", Object)
279
+ ], CloudFrontBehaviorSchema.prototype, "viewerProtocolPolicy", void 0);
280
+ /**
281
+ * What the viewer gets when the origin answers with a status code CloudFront was told to handle.
282
+ *
283
+ * The same field set expresses opposite intents. A single-page app maps `403` and `404` to a `200`
284
+ * carrying `/index.html` with a short TTL, so the client-side router can take over; a content site
285
+ * maps them to a real `404` carrying an error page.
286
+ *
287
+ * @group Resources/CloudFrontDistribution
288
+ *
289
+ * @hideconstructor
290
+ */
291
+ export class CloudFrontCustomErrorResponseSchema {
292
+ constructor() {
293
+ /**
294
+ * How long CloudFront caches this error before asking the origin again, in seconds.
295
+ */
296
+ this.errorCachingMinTtl = Schema(10);
297
+ /**
298
+ * The status code the origin answered with.
299
+ */
300
+ this.errorCode = Schema();
301
+ /**
302
+ * The status code the viewer sees.
303
+ */
304
+ this.responseCode = Schema();
305
+ /**
306
+ * The object served in place of the error, e.g. `/index.html`.
307
+ */
308
+ this.responsePagePath = Schema();
309
+ }
310
+ }
311
+ __decorate([
312
+ Validate({ options: { minLength: 0 } }),
313
+ __metadata("design:type", Object)
314
+ ], CloudFrontCustomErrorResponseSchema.prototype, "errorCachingMinTtl", void 0);
315
+ __decorate([
316
+ Validate({ options: { maxLength: 599, minLength: 100 } }),
317
+ __metadata("design:type", Object)
318
+ ], CloudFrontCustomErrorResponseSchema.prototype, "errorCode", void 0);
319
+ __decorate([
320
+ Validate({ options: { maxLength: 599, minLength: 100 } }),
321
+ __metadata("design:type", Object)
322
+ ], CloudFrontCustomErrorResponseSchema.prototype, "responseCode", void 0);
323
+ __decorate([
324
+ Validate({ options: { minLength: 1 } }),
325
+ __metadata("design:type", Object)
326
+ ], CloudFrontCustomErrorResponseSchema.prototype, "responsePagePath", void 0);
327
+ /**
328
+ * A cache policy this distribution declares, referenced by a behavior under
329
+ * `{ kind: 'custom', name }`.
330
+ *
331
+ * @group Resources/CloudFrontDistribution
332
+ *
333
+ * @hideconstructor
334
+ */
335
+ export class CloudFrontCachePolicySchema {
336
+ constructor() {
337
+ /**
338
+ * Which cookies are part of the cache key.
339
+ */
340
+ this.cookies = Schema({ kind: 'none' });
341
+ /**
342
+ * How long CloudFront serves an object without asking the origin, when the origin sent no
343
+ * caching headers of its own. In seconds.
344
+ */
345
+ this.defaultTtl = Schema(86400);
346
+ /**
347
+ * Whether CloudFront may store and serve a brotli-compressed copy.
348
+ */
349
+ this.enableBrotli = Schema(true);
350
+ /**
351
+ * Whether CloudFront may store and serve a gzip-compressed copy.
352
+ */
353
+ this.enableGzip = Schema(true);
354
+ /**
355
+ * Which request headers are part of the cache key.
356
+ */
357
+ this.headers = Schema({ kind: 'none' });
358
+ /**
359
+ * The longest CloudFront will serve an object without asking the origin, whatever the origin's
360
+ * own caching headers said. In seconds.
361
+ */
362
+ this.maxTtl = Schema(31536000);
363
+ /**
364
+ * The shortest CloudFront will serve an object without asking the origin. In seconds.
365
+ */
366
+ this.minTtl = Schema(1);
367
+ /**
368
+ * How a behavior names this policy.
369
+ */
370
+ this.name = Schema();
371
+ /**
372
+ * Which query strings are part of the cache key.
373
+ */
374
+ this.queryStrings = Schema({ kind: 'none' });
375
+ }
376
+ }
377
+ __decorate([
378
+ Validate({
379
+ destruct: (value) => [value.kind],
380
+ options: { minLength: 1 },
381
+ }),
382
+ __metadata("design:type", Object)
383
+ ], CloudFrontCachePolicySchema.prototype, "cookies", void 0);
384
+ __decorate([
385
+ Validate({ options: { minLength: 0 } }),
386
+ __metadata("design:type", Object)
387
+ ], CloudFrontCachePolicySchema.prototype, "defaultTtl", void 0);
388
+ __decorate([
389
+ Validate({
390
+ destruct: (value) => [value.kind],
391
+ options: { minLength: 1 },
392
+ }),
393
+ __metadata("design:type", Object)
394
+ ], CloudFrontCachePolicySchema.prototype, "headers", void 0);
395
+ __decorate([
396
+ Validate({ options: { minLength: 0 } }),
397
+ __metadata("design:type", Object)
398
+ ], CloudFrontCachePolicySchema.prototype, "maxTtl", void 0);
399
+ __decorate([
400
+ Validate({ options: { minLength: 0 } }),
401
+ __metadata("design:type", Object)
402
+ ], CloudFrontCachePolicySchema.prototype, "minTtl", void 0);
403
+ __decorate([
404
+ Validate({ options: { minLength: 1 } }),
405
+ __metadata("design:type", Object)
406
+ ], CloudFrontCachePolicySchema.prototype, "name", void 0);
407
+ __decorate([
408
+ Validate({
409
+ destruct: (value) => [value.kind],
410
+ options: { minLength: 1 },
411
+ }),
412
+ __metadata("design:type", Object)
413
+ ], CloudFrontCachePolicySchema.prototype, "queryStrings", void 0);
414
+ /**
415
+ * An origin request policy this distribution declares, referenced by a behavior under
416
+ * `{ kind: 'custom', name }`.
417
+ *
418
+ * This is what reaches the origin, and it is separate from the cache key on purpose: an origin can
419
+ * be told the viewer's `Authorization` header without every distinct token becoming its own cache
420
+ * entry.
421
+ *
422
+ * @group Resources/CloudFrontDistribution
423
+ *
424
+ * @hideconstructor
425
+ */
426
+ export class CloudFrontOriginRequestPolicySchema {
427
+ constructor() {
428
+ /**
429
+ * Which cookies reach the origin.
430
+ */
431
+ this.cookies = Schema({ kind: 'none' });
432
+ /**
433
+ * Which request headers reach the origin.
434
+ */
435
+ this.headers = Schema({ kind: 'none' });
436
+ /**
437
+ * How a behavior names this policy.
438
+ */
439
+ this.name = Schema();
440
+ /**
441
+ * Which query strings reach the origin.
442
+ */
443
+ this.queryStrings = Schema({ kind: 'none' });
444
+ }
445
+ }
446
+ __decorate([
447
+ Validate({
448
+ destruct: (value) => [value.kind],
449
+ options: { minLength: 1 },
450
+ }),
451
+ __metadata("design:type", Object)
452
+ ], CloudFrontOriginRequestPolicySchema.prototype, "cookies", void 0);
453
+ __decorate([
454
+ Validate({
455
+ destruct: (value) => [value.kind],
456
+ options: { minLength: 1 },
457
+ }),
458
+ __metadata("design:type", Object)
459
+ ], CloudFrontOriginRequestPolicySchema.prototype, "headers", void 0);
460
+ __decorate([
461
+ Validate({ options: { minLength: 1 } }),
462
+ __metadata("design:type", Object)
463
+ ], CloudFrontOriginRequestPolicySchema.prototype, "name", void 0);
464
+ __decorate([
465
+ Validate({
466
+ destruct: (value) => [value.kind],
467
+ options: { minLength: 1 },
468
+ }),
469
+ __metadata("design:type", Object)
470
+ ], CloudFrontOriginRequestPolicySchema.prototype, "queryStrings", void 0);
471
+ /**
472
+ * The security headers a response headers policy adds. Every field is optional; a `null` field adds
473
+ * nothing for that header.
474
+ *
475
+ * @group Resources/CloudFrontDistribution
476
+ *
477
+ * @hideconstructor
478
+ */
479
+ export class CloudFrontSecurityHeadersSchema {
480
+ constructor() {
481
+ /**
482
+ * The app's own content security policy, verbatim.
483
+ */
484
+ this.contentSecurityPolicy = Schema(null);
485
+ /**
486
+ * Whether to send `X-Content-Type-Options`, which tells a browser to trust the declared content
487
+ * type rather than guessing one from the bytes.
488
+ */
489
+ this.contentTypeOptions = Schema(true);
490
+ /**
491
+ * The value of `X-Frame-Options`, or `null` to send none.
492
+ */
493
+ this.frameOptions = Schema('SAMEORIGIN');
494
+ /**
495
+ * The value of `Referrer-Policy`, or `null` to send none.
496
+ */
497
+ this.referrerPolicy = Schema(null);
498
+ /**
499
+ * How long a viewer should keep using HTTPS for this host, in seconds. `null` sends no
500
+ * `Strict-Transport-Security` header at all.
501
+ */
502
+ this.strictTransportSecurityMaxAge = Schema(31536000);
503
+ }
504
+ }
505
+ __decorate([
506
+ Validate({
507
+ destruct: (value) => (value ? [value] : []),
508
+ options: { minLength: 1 },
509
+ }),
510
+ __metadata("design:type", Object)
511
+ ], CloudFrontSecurityHeadersSchema.prototype, "contentSecurityPolicy", void 0);
512
+ __decorate([
513
+ Validate({
514
+ destruct: (value) => (value ? [value] : []),
515
+ options: { minLength: 1 },
516
+ }),
517
+ __metadata("design:type", Object)
518
+ ], CloudFrontSecurityHeadersSchema.prototype, "frameOptions", void 0);
519
+ __decorate([
520
+ Validate({
521
+ destruct: (value) => (value ? [value] : []),
522
+ options: { minLength: 1 },
523
+ }),
524
+ __metadata("design:type", Object)
525
+ ], CloudFrontSecurityHeadersSchema.prototype, "referrerPolicy", void 0);
526
+ __decorate([
527
+ Validate({
528
+ destruct: (value) => value === null || value === undefined ? [] : [value],
529
+ options: { minLength: 0 },
530
+ }),
531
+ __metadata("design:type", Object)
532
+ ], CloudFrontSecurityHeadersSchema.prototype, "strictTransportSecurityMaxAge", void 0);
533
+ /**
534
+ * A response headers policy this distribution declares, referenced by a behavior under
535
+ * `{ kind: 'custom', name }`.
536
+ *
537
+ * @group Resources/CloudFrontDistribution
538
+ *
539
+ * @hideconstructor
540
+ */
541
+ export class CloudFrontResponseHeadersPolicySchema {
542
+ constructor() {
543
+ /**
544
+ * A cross-origin resource sharing configuration, or `null` for none.
545
+ */
546
+ this.cors = Schema(null);
547
+ /**
548
+ * Headers CloudFront adds verbatim. `override` decides what happens when the origin already sent
549
+ * one of the same name.
550
+ */
551
+ this.customHeaders = Schema([]);
552
+ /**
553
+ * How a behavior names this policy.
554
+ */
555
+ this.name = Schema();
556
+ /**
557
+ * Headers CloudFront strips from the origin's response before the viewer sees it.
558
+ */
559
+ this.removeHeaders = Schema([]);
560
+ /**
561
+ * The security headers to add, or `null` to add none.
562
+ * See {@link CloudFrontSecurityHeadersSchema}.
563
+ */
564
+ this.securityHeaders = Schema(null);
565
+ }
566
+ }
567
+ __decorate([
568
+ Validate({
569
+ destruct: (value) => value ? [...value.allowHeaders, ...value.allowMethods, ...value.allowOrigins] : [],
570
+ options: { minLength: 1 },
571
+ }),
572
+ __metadata("design:type", Object)
573
+ ], CloudFrontResponseHeadersPolicySchema.prototype, "cors", void 0);
574
+ __decorate([
575
+ Validate({
576
+ destruct: (value) => value.flatMap((v) => [v.header, v.value]),
577
+ options: { minLength: 1 },
578
+ }),
579
+ __metadata("design:type", Object)
580
+ ], CloudFrontResponseHeadersPolicySchema.prototype, "customHeaders", void 0);
581
+ __decorate([
582
+ Validate({ options: { minLength: 1 } }),
583
+ __metadata("design:type", Object)
584
+ ], CloudFrontResponseHeadersPolicySchema.prototype, "name", void 0);
585
+ __decorate([
586
+ Validate({
587
+ destruct: (value) => value,
588
+ options: { minLength: 1 },
589
+ }),
590
+ __metadata("design:type", Object)
591
+ ], CloudFrontResponseHeadersPolicySchema.prototype, "removeHeaders", void 0);
592
+ __decorate([
593
+ Validate({
594
+ destruct: (value) => value ? [value] : [],
595
+ options: { isSchema: { schema: CloudFrontSecurityHeadersSchema } },
596
+ }),
597
+ __metadata("design:type", Object)
598
+ ], CloudFrontResponseHeadersPolicySchema.prototype, "securityHeaders", void 0);
599
+ /**
600
+ * The `CloudFrontDistributionSchema` class is the schema for the `CloudFrontDistribution` resource,
601
+ * which represents an AWS CloudFront distribution. Terraform provisions it as
602
+ * [`aws_cloudfront_distribution`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution),
603
+ * alongside an
604
+ * [`aws_cloudfront_origin_access_control`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_origin_access_control)
605
+ * per S3 origin and one terraform resource per policy the distribution declares.
606
+ *
607
+ * The distribution is deliberately open. It carries several origins of mixed kinds, a routing table
608
+ * of behaviors over them, and the security layer around both, so that one module can serve a
609
+ * single-page app out of a bucket while another puts the same resource in front of a load balancer.
610
+ * The opinion about which of those a caller gets belongs to the module, not here.
611
+ *
612
+ * @group Resources/CloudFrontDistribution
613
+ *
614
+ * @hideconstructor
615
+ *
616
+ * @overrideProperty parents - Every managed origin that is not an S3 bucket. The distribution reads
617
+ * such an origin's hostname out of its response, so it is a child of it. An S3 origin runs the other
618
+ * way - the bucket's policy has to name this distribution's ARN, which AWS assigns, so the bucket is
619
+ * the child and this distribution writes the bucket's hostname literally.
620
+ * ```mermaid
621
+ * graph TD;
622
+ * origin((Origin<br>Resource)) --> cloudfront_distribution((CloudFront<br>Distribution))
623
+ * cloudfront_distribution --> s3_bucket((S3<br>Bucket))
624
+ * ```
625
+ * @overrideProperty resourceId - The resource id is of format `cloudfront-<distribution-name>`.
626
+ * There is no region in it: CloudFront is global, and the provider is found on the account alone.
627
+ */
628
+ export class CloudFrontDistributionSchema extends BaseResourceSchema {
629
+ constructor() {
630
+ super(...arguments);
631
+ /**
632
+ * Input properties.
633
+ * * `properties.aliases` - The custom domain names the distribution answers on. Each one needs a
634
+ * DNS record pointing at the distribution, which this resource does not create. Empty serves only
635
+ * the `*.cloudfront.net` domain CloudFront assigns.
636
+ * * `properties.awsAccountId` - The AWS account id.
637
+ * * `properties.behaviors` - The routing table. Exactly one entry has no `pathPattern` and is the
638
+ * default behavior; the rest are matched in order before it.
639
+ * See {@link CloudFrontBehaviorSchema}.
640
+ * * `properties.cachePolicies` - Cache policies this distribution declares.
641
+ * See {@link CloudFrontCachePolicySchema}.
642
+ * * `properties.comment` - A human-readable label. It is the only name a distribution carries in
643
+ * the console.
644
+ * * `properties.customErrorResponses` - What the viewer gets for an origin error.
645
+ * See {@link CloudFrontCustomErrorResponseSchema}.
646
+ * * `properties.defaultRootObject` - The object served for a request to the site root.
647
+ * * `properties.distributionName` - What names this distribution. Part of its identity.
648
+ * * `properties.enabled` - Whether the distribution serves traffic. Disabling is also the first
649
+ * half of deleting one, which AWS makes a slow operation.
650
+ * * `properties.geoRestriction` - Which countries may reach the distribution.
651
+ * * `properties.httpVersion` - The newest HTTP version viewers may negotiate.
652
+ * * `properties.isIpv6Enabled` - Whether the distribution answers over IP version 6.
653
+ * * `properties.logging` - Where CloudFront writes its access logs, or `null` for none. The bucket
654
+ * is not created here.
655
+ * * `properties.originGroups` - Fail-over pairs over the origins.
656
+ * See {@link CloudFrontOriginGroupSchema}.
657
+ * * `properties.originRequestPolicies` - Origin request policies this distribution declares.
658
+ * See {@link CloudFrontOriginRequestPolicySchema}.
659
+ * * `properties.origins` - Where content comes from. See {@link CloudFrontOriginSchema}.
660
+ * * `properties.priceClass` - Which edge locations serve the traffic, which is what the
661
+ * distribution costs. `PriceClass_100` is North America and Europe alone.
662
+ * * `properties.responseHeadersPolicies` - Response headers policies this distribution declares.
663
+ * See {@link CloudFrontResponseHeadersPolicySchema}.
664
+ * * `properties.viewerCertificate` - The certificate viewers see. `default` serves CloudFront's
665
+ * own, which is valid only for the assigned `*.cloudfront.net` domain; `acm` serves a certificate
666
+ * of yours, which CloudFront reads from `us-east-1` alone.
667
+ * * `properties.webAclArn` - The web ACL guarding the distribution, or `null` for none. The
668
+ * ACL is not created here, and CloudFront reads it from `us-east-1` alone.
669
+ */
670
+ this.properties = Schema();
671
+ /**
672
+ * Saved response.
673
+ * * `response.Arn` - The ARN of the distribution. A bucket admitting this distribution names it.
674
+ * * `response.DistributionId` - The distribution id, which is what an invalidation is issued against.
675
+ * * `response.DomainName` - The `*.cloudfront.net` domain CloudFront assigned. Point a DNS record
676
+ * at this.
677
+ * * `response.HostedZoneId` - The zone a Route 53 alias record pointing at this distribution needs.
678
+ * It is the same constant for every CloudFront distribution, and it is published here so that a
679
+ * DNS module never has to know that.
680
+ */
681
+ this.response = Schema({
682
+ Arn: 'arn:aws:cloudfront::000000000000:distribution/E000000000000',
683
+ DistributionId: 'E000000000000',
684
+ DomainName: 'd000000000000.cloudfront.net',
685
+ HostedZoneId: 'Z2FDTNDATAQYW2',
686
+ });
687
+ }
688
+ }
689
+ __decorate([
690
+ Validate([
691
+ {
692
+ destruct: (value) => [
693
+ ...value.aliases,
694
+ value.awsAccountId,
695
+ value.distributionName,
696
+ value.httpVersion,
697
+ value.priceClass,
698
+ ],
699
+ options: { minLength: 1 },
700
+ },
701
+ {
702
+ destruct: (value) => value.origins,
703
+ options: { isSchema: { schema: CloudFrontOriginSchema } },
704
+ },
705
+ {
706
+ destruct: (value) => value.originGroups,
707
+ options: { isSchema: { schema: CloudFrontOriginGroupSchema } },
708
+ },
709
+ {
710
+ destruct: (value) => value.behaviors,
711
+ options: { isSchema: { schema: CloudFrontBehaviorSchema } },
712
+ },
713
+ {
714
+ destruct: (value) => value.customErrorResponses,
715
+ options: { isSchema: { schema: CloudFrontCustomErrorResponseSchema } },
716
+ },
717
+ {
718
+ destruct: (value) => value.cachePolicies,
719
+ options: { isSchema: { schema: CloudFrontCachePolicySchema } },
720
+ },
721
+ {
722
+ destruct: (value) => value.originRequestPolicies,
723
+ options: { isSchema: { schema: CloudFrontOriginRequestPolicySchema } },
724
+ },
725
+ {
726
+ destruct: (value) => value.responseHeadersPolicies,
727
+ options: { isSchema: { schema: CloudFrontResponseHeadersPolicySchema } },
728
+ },
729
+ ]),
730
+ __metadata("design:type", Object)
731
+ ], CloudFrontDistributionSchema.prototype, "properties", void 0);
732
+ __decorate([
733
+ Validate({
734
+ destruct: (value) => {
735
+ const subjects = [];
736
+ if (value.Arn) {
737
+ subjects.push(value.Arn);
738
+ }
739
+ if (value.DistributionId) {
740
+ subjects.push(value.DistributionId);
741
+ }
742
+ if (value.DomainName) {
743
+ subjects.push(value.DomainName);
744
+ }
745
+ if (value.HostedZoneId) {
746
+ subjects.push(value.HostedZoneId);
747
+ }
748
+ return subjects;
749
+ },
750
+ options: { minLength: 1 },
751
+ }),
752
+ __metadata("design:type", Object)
753
+ ], CloudFrontDistributionSchema.prototype, "response", void 0);
754
+ //# sourceMappingURL=index.schema.js.map