@terra-graph/conventions-aws 1.0.0-rc.1

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 (91) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +25 -0
  3. package/dist/cjs/conventions/dataflow/profiles/base.js +89 -0
  4. package/dist/cjs/conventions/dataflow/profiles/dot.js +44 -0
  5. package/dist/cjs/conventions/dataflow/profiles/dot.test.js +147 -0
  6. package/dist/cjs/conventions/dataflow/rules.js +4 -0
  7. package/dist/cjs/conventions/dataflow/rules.test.js +11 -0
  8. package/dist/cjs/conventions/dataflow/rulesets.js +751 -0
  9. package/dist/cjs/conventions/dataflow/rulesets.test.js +27 -0
  10. package/dist/cjs/conventions/index.js +7 -0
  11. package/dist/cjs/conventions/index.test.js +8 -0
  12. package/dist/cjs/index.js +70 -0
  13. package/dist/cjs/index.test.js +58 -0
  14. package/dist/cjs/namespaces.js +14 -0
  15. package/dist/cjs/namespaces.test.js +17 -0
  16. package/dist/cjs/package.json +1 -0
  17. package/dist/cjs/plugins/AwsApiGateway.js +218 -0
  18. package/dist/cjs/plugins/AwsApiGateway.test.js +427 -0
  19. package/dist/cjs/plugins/AwsIam.js +432 -0
  20. package/dist/cjs/plugins/AwsIam.test.js +468 -0
  21. package/dist/cjs/plugins/AwsS3.js +107 -0
  22. package/dist/cjs/plugins/AwsS3.test.js +102 -0
  23. package/dist/cjs/plugins/AwsSns.js +52 -0
  24. package/dist/cjs/plugins/AwsSns.test.js +55 -0
  25. package/dist/cjs/plugins/AwsTransferFamily.js +105 -0
  26. package/dist/cjs/plugins/AwsTransferFamily.test.js +279 -0
  27. package/dist/cjs/rules/dot.js +36 -0
  28. package/dist/cjs/rules/dot.test.js +42 -0
  29. package/dist/cjs/rules/general.js +69 -0
  30. package/dist/cjs/rules/general.test.js +47 -0
  31. package/dist/cjs/rulesets/dot.js +25 -0
  32. package/dist/cjs/rulesets/dot.test.js +48 -0
  33. package/dist/esm/conventions/dataflow/profiles/base.d.ts +4 -0
  34. package/dist/esm/conventions/dataflow/profiles/base.js +86 -0
  35. package/dist/esm/conventions/dataflow/profiles/dot.d.ts +4 -0
  36. package/dist/esm/conventions/dataflow/profiles/dot.js +38 -0
  37. package/dist/esm/conventions/dataflow/profiles/dot.test.d.ts +1 -0
  38. package/dist/esm/conventions/dataflow/profiles/dot.test.js +109 -0
  39. package/dist/esm/conventions/dataflow/rules.d.ts +3 -0
  40. package/dist/esm/conventions/dataflow/rules.js +2 -0
  41. package/dist/esm/conventions/dataflow/rules.test.d.ts +1 -0
  42. package/dist/esm/conventions/dataflow/rules.test.js +6 -0
  43. package/dist/esm/conventions/dataflow/rulesets.d.ts +3 -0
  44. package/dist/esm/conventions/dataflow/rulesets.js +749 -0
  45. package/dist/esm/conventions/dataflow/rulesets.test.d.ts +1 -0
  46. package/dist/esm/conventions/dataflow/rulesets.test.js +22 -0
  47. package/dist/esm/conventions/index.d.ts +3 -0
  48. package/dist/esm/conventions/index.js +4 -0
  49. package/dist/esm/conventions/index.test.d.ts +1 -0
  50. package/dist/esm/conventions/index.test.js +6 -0
  51. package/dist/esm/index.d.ts +3 -0
  52. package/dist/esm/index.js +32 -0
  53. package/dist/esm/index.test.d.ts +1 -0
  54. package/dist/esm/index.test.js +53 -0
  55. package/dist/esm/namespaces.d.ts +7 -0
  56. package/dist/esm/namespaces.js +6 -0
  57. package/dist/esm/namespaces.test.d.ts +1 -0
  58. package/dist/esm/namespaces.test.js +15 -0
  59. package/dist/esm/plugins/AwsApiGateway.d.ts +6 -0
  60. package/dist/esm/plugins/AwsApiGateway.js +214 -0
  61. package/dist/esm/plugins/AwsApiGateway.test.d.ts +1 -0
  62. package/dist/esm/plugins/AwsApiGateway.test.js +425 -0
  63. package/dist/esm/plugins/AwsIam.d.ts +32 -0
  64. package/dist/esm/plugins/AwsIam.js +428 -0
  65. package/dist/esm/plugins/AwsIam.test.d.ts +1 -0
  66. package/dist/esm/plugins/AwsIam.test.js +466 -0
  67. package/dist/esm/plugins/AwsS3.d.ts +12 -0
  68. package/dist/esm/plugins/AwsS3.js +103 -0
  69. package/dist/esm/plugins/AwsS3.test.d.ts +1 -0
  70. package/dist/esm/plugins/AwsS3.test.js +100 -0
  71. package/dist/esm/plugins/AwsSns.d.ts +6 -0
  72. package/dist/esm/plugins/AwsSns.js +48 -0
  73. package/dist/esm/plugins/AwsSns.test.d.ts +1 -0
  74. package/dist/esm/plugins/AwsSns.test.js +53 -0
  75. package/dist/esm/plugins/AwsTransferFamily.d.ts +6 -0
  76. package/dist/esm/plugins/AwsTransferFamily.js +101 -0
  77. package/dist/esm/plugins/AwsTransferFamily.test.d.ts +1 -0
  78. package/dist/esm/plugins/AwsTransferFamily.test.js +277 -0
  79. package/dist/esm/rules/dot.d.ts +3 -0
  80. package/dist/esm/rules/dot.js +34 -0
  81. package/dist/esm/rules/dot.test.d.ts +1 -0
  82. package/dist/esm/rules/dot.test.js +37 -0
  83. package/dist/esm/rules/general.d.ts +3 -0
  84. package/dist/esm/rules/general.js +67 -0
  85. package/dist/esm/rules/general.test.d.ts +1 -0
  86. package/dist/esm/rules/general.test.js +42 -0
  87. package/dist/esm/rulesets/dot.d.ts +3 -0
  88. package/dist/esm/rulesets/dot.js +23 -0
  89. package/dist/esm/rulesets/dot.test.d.ts +1 -0
  90. package/dist/esm/rulesets/dot.test.js +43 -0
  91. package/package.json +45 -0
@@ -0,0 +1,749 @@
1
+ import { EdgeDirectionSemantic, EdgeSemanticLegend, NamedRuleSetRegistry, RemoveNode, RuleSet, TgEdgeDirectionSemantics, } from '@terra-graph/core';
2
+ import { conventionName, ruleSetName } from '../../namespaces.js';
3
+ import { Convention } from '../index.js';
4
+ export default new NamedRuleSetRegistry({
5
+ [conventionName(Convention.DataFlow, ruleSetName('cleanup'))]: new RuleSet({
6
+ rules: [
7
+ new RemoveNode({
8
+ node: {
9
+ and: [
10
+ { attr: { key: 'terraform.resource', eq: 'aws_lambda_event_source_mapping' } },
11
+ { not: { edge: { in: { any: true } } } },
12
+ ],
13
+ },
14
+ }),
15
+ ],
16
+ }),
17
+ [conventionName(Convention.DataFlow, ruleSetName('semantics'))]: new RuleSet({
18
+ rules: [
19
+ new EdgeDirectionSemantic({
20
+ edge: {
21
+ from: {
22
+ attr: {
23
+ key: 'terraform.resource',
24
+ startsWith: 'aws_iam_',
25
+ },
26
+ },
27
+ to: {
28
+ any: true,
29
+ },
30
+ },
31
+ options: {
32
+ semantic: TgEdgeDirectionSemantics.Authorizes,
33
+ },
34
+ }),
35
+ new EdgeDirectionSemantic({
36
+ edge: {
37
+ from: {
38
+ and: [
39
+ {
40
+ attr: {
41
+ key: 'terraform.resource',
42
+ endsWith: '_policy',
43
+ },
44
+ },
45
+ {
46
+ not: {
47
+ attr: {
48
+ key: 'terraform.resource',
49
+ startsWith: 'aws_iam_',
50
+ },
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ to: {
56
+ any: true,
57
+ },
58
+ },
59
+ options: {
60
+ semantic: TgEdgeDirectionSemantics.Authorizes,
61
+ enforceDirection: true,
62
+ },
63
+ }),
64
+ new EdgeDirectionSemantic({
65
+ edge: {
66
+ from: {
67
+ attr: {
68
+ key: 'terraform.resource',
69
+ eq: 'aws_lambda_permission',
70
+ },
71
+ },
72
+ to: {
73
+ any: true,
74
+ },
75
+ },
76
+ options: {
77
+ semantic: TgEdgeDirectionSemantics.Authorizes,
78
+ enforceDirection: true,
79
+ },
80
+ }),
81
+ new EdgeDirectionSemantic({
82
+ edge: {
83
+ from: {
84
+ any: true,
85
+ },
86
+ to: {
87
+ attr: {
88
+ key: 'terraform.resource',
89
+ in: ['aws_cloudwatch_log_group', 'aws_cloudwatch_metric_alarm', 'aws_xray_group'],
90
+ },
91
+ },
92
+ },
93
+ options: {
94
+ semantic: TgEdgeDirectionSemantics.ObservedBy,
95
+ enforceDirection: true,
96
+ },
97
+ }),
98
+ new EdgeDirectionSemantic({
99
+ edge: {
100
+ from: {
101
+ attr: {
102
+ key: 'terraform.resource',
103
+ in: ['aws_cloudwatch_event_target'],
104
+ },
105
+ },
106
+ to: {
107
+ not: {
108
+ attr: {
109
+ key: 'terraform.resource',
110
+ startsWith: ['aws_cloudwatch_event_', 'aws_iam_'],
111
+ },
112
+ },
113
+ },
114
+ },
115
+ options: {
116
+ semantic: TgEdgeDirectionSemantics.Invokes,
117
+ enforceDirection: true,
118
+ },
119
+ }),
120
+ new EdgeDirectionSemantic({
121
+ edge: {
122
+ from: {
123
+ attr: {
124
+ key: 'terraform.resource',
125
+ eq: 'aws_cloudwatch_event_rule',
126
+ },
127
+ },
128
+ to: {
129
+ attr: {
130
+ key: 'terraform.resource',
131
+ in: ['aws_cloudwatch_event_target', 'aws_sqs_queue'],
132
+ },
133
+ },
134
+ },
135
+ options: {
136
+ semantic: TgEdgeDirectionSemantics.Invokes,
137
+ enforceDirection: true,
138
+ },
139
+ }),
140
+ new EdgeDirectionSemantic({
141
+ edge: {
142
+ from: {
143
+ attr: {
144
+ key: 'terraform.resource',
145
+ in: ['aws_sqs_queue', 'aws_kinesis_stream', 'aws_dynamodb_table'],
146
+ },
147
+ },
148
+ to: {
149
+ attr: {
150
+ key: 'terraform.resource',
151
+ in: ['aws_lambda_event_source_mapping'],
152
+ },
153
+ },
154
+ },
155
+ options: {
156
+ semantic: TgEdgeDirectionSemantics.Triggers,
157
+ enforceDirection: true,
158
+ },
159
+ }),
160
+ new EdgeDirectionSemantic({
161
+ edge: {
162
+ from: {
163
+ attr: {
164
+ key: 'terraform.resource',
165
+ in: ['aws_dynamodb_table'],
166
+ },
167
+ },
168
+ to: {
169
+ attr: {
170
+ key: 'terraform.resource',
171
+ in: ['aws_dynamodb_table_item'],
172
+ },
173
+ },
174
+ },
175
+ options: {
176
+ semantic: TgEdgeDirectionSemantics.Accesses,
177
+ enforceDirection: true,
178
+ },
179
+ }),
180
+ new EdgeDirectionSemantic({
181
+ edge: {
182
+ from: {
183
+ attr: {
184
+ key: 'terraform.resource',
185
+ in: [
186
+ 'aws_sns_topic_subscription',
187
+ 'aws_s3_bucket_notification',
188
+ 'aws_lambda_function_url',
189
+ 'aws_cloudwatch_event_target',
190
+ 'aws_scheduler_schedule',
191
+ 'aws_api_gatewayv2_route',
192
+ 'aws_api_gateway_stage',
193
+ 'aws_lambda_event_source_mapping',
194
+ ],
195
+ },
196
+ },
197
+ to: {
198
+ attr: {
199
+ key: 'terraform.resource',
200
+ in: ['aws_lambda_function'],
201
+ },
202
+ },
203
+ },
204
+ options: {
205
+ semantic: TgEdgeDirectionSemantics.Invokes,
206
+ enforceDirection: true,
207
+ },
208
+ }),
209
+ new EdgeDirectionSemantic({
210
+ edge: {
211
+ from: {
212
+ attr: {
213
+ key: 'terraform.resource',
214
+ in: ['aws_scheduler_schedule'],
215
+ },
216
+ },
217
+ to: {
218
+ attr: {
219
+ key: 'terraform.resource',
220
+ in: ['aws_lambda_event_source_mapping'],
221
+ },
222
+ },
223
+ },
224
+ options: {
225
+ semantic: TgEdgeDirectionSemantics.Invokes,
226
+ enforceDirection: true,
227
+ },
228
+ }),
229
+ new EdgeDirectionSemantic({
230
+ edge: {
231
+ from: {
232
+ attr: {
233
+ key: 'terraform.resource',
234
+ in: ['aws_s3_bucket'],
235
+ },
236
+ },
237
+ to: {
238
+ attr: {
239
+ key: 'terraform.resource',
240
+ in: [
241
+ 'aws_s3_bucket_notification',
242
+ 'aws_cloudwatch_event_rule', // when using eventbridge
243
+ ],
244
+ },
245
+ },
246
+ },
247
+ options: {
248
+ semantic: TgEdgeDirectionSemantics.Triggers,
249
+ enforceDirection: true,
250
+ },
251
+ }),
252
+ new EdgeDirectionSemantic({
253
+ edge: {
254
+ from: {
255
+ attr: {
256
+ key: 'terraform.resource',
257
+ in: [
258
+ 'aws_lambda_function',
259
+ 'aws_ecs_service',
260
+ 'aws_ecs_task_definition',
261
+ 'aws_sfn_state_machine',
262
+ 'aws_apigatewayv2_api',
263
+ 'aws_s3_bucket_notification',
264
+ ],
265
+ },
266
+ },
267
+ to: {
268
+ attr: {
269
+ key: 'terraform.resource',
270
+ in: [
271
+ 'aws_sns_topic',
272
+ 'aws_sqs_queue',
273
+ 'aws_cloudwatch_event_bus',
274
+ 'aws_kinesis_stream',
275
+ ],
276
+ },
277
+ },
278
+ },
279
+ options: {
280
+ semantic: TgEdgeDirectionSemantics.Publishes,
281
+ },
282
+ }),
283
+ new EdgeDirectionSemantic({
284
+ edge: {
285
+ from: {
286
+ attr: {
287
+ key: 'terraform.resource',
288
+ in: ['aws_secretsmanager_secret_version'],
289
+ },
290
+ },
291
+ to: {
292
+ attr: {
293
+ key: 'terraform.resource',
294
+ startsWith: ['aws_secretsmanager_secret'],
295
+ },
296
+ },
297
+ },
298
+ options: {
299
+ semantic: TgEdgeDirectionSemantics.Accesses,
300
+ enforceDirection: true,
301
+ },
302
+ }),
303
+ new EdgeDirectionSemantic({
304
+ edge: {
305
+ from: {
306
+ attr: {
307
+ key: 'terraform.resource',
308
+ in: [
309
+ 'aws_lambda_function',
310
+ 'aws_ecs_service',
311
+ 'aws_ecs_task_definition',
312
+ 'aws_glue_job',
313
+ // 'aws_athena_named_query',
314
+ 'aws_glue_catalog_table',
315
+ 'aws_glue_catalog_database',
316
+ 'aws_sfn_state_machine',
317
+ 'aws_cloudwatch_log_delivery_destination',
318
+ ],
319
+ },
320
+ },
321
+ to: {
322
+ attr: {
323
+ key: 'terraform.resource',
324
+ startsWith: [
325
+ 'aws_dynamodb_',
326
+ 'aws_s3_',
327
+ 'aws_rds_',
328
+ 'aws_docdb_',
329
+ 'aws_elasticache_',
330
+ 'aws_opensearch_',
331
+ 'aws_timestream',
332
+ 'aws_redshift_',
333
+ 'aws_secretsmanager_secret_version',
334
+ ],
335
+ },
336
+ },
337
+ },
338
+ options: {
339
+ semantic: TgEdgeDirectionSemantics.Accesses,
340
+ enforceDirection: true,
341
+ },
342
+ }),
343
+ new EdgeDirectionSemantic({
344
+ edge: {
345
+ from: {
346
+ attr: {
347
+ key: 'terraform.resource',
348
+ in: ['aws_cloudwatch_log_delivery_source'],
349
+ },
350
+ },
351
+ to: {
352
+ not: {
353
+ attr: {
354
+ key: 'terraform.resource',
355
+ in: ['aws_cloudwatch_log_delivery'],
356
+ },
357
+ },
358
+ },
359
+ },
360
+ options: {
361
+ semantic: TgEdgeDirectionSemantics.ObservedBy,
362
+ enforceDirection: true,
363
+ },
364
+ }),
365
+ new EdgeDirectionSemantic({
366
+ edge: {
367
+ from: {
368
+ attr: {
369
+ key: 'terraform.resource',
370
+ in: ['aws_cloudwatch_log_delivery_source'],
371
+ },
372
+ },
373
+ to: {
374
+ attr: {
375
+ key: 'terraform.resource',
376
+ in: ['aws_cloudwatch_log_delivery'],
377
+ },
378
+ },
379
+ },
380
+ options: {
381
+ semantic: TgEdgeDirectionSemantics.Invokes,
382
+ enforceDirection: true,
383
+ },
384
+ }),
385
+ new EdgeDirectionSemantic({
386
+ edge: {
387
+ from: {
388
+ attr: {
389
+ key: 'terraform.resource',
390
+ in: ['aws_cloudwatch_log_delivery'],
391
+ },
392
+ },
393
+ to: {
394
+ attr: {
395
+ key: 'terraform.resource',
396
+ in: ['aws_cloudwatch_log_delivery_destination'],
397
+ },
398
+ },
399
+ },
400
+ options: {
401
+ semantic: TgEdgeDirectionSemantics.Invokes,
402
+ enforceDirection: true,
403
+ },
404
+ }),
405
+ new EdgeDirectionSemantic({
406
+ edge: {
407
+ from: {
408
+ attr: {
409
+ key: 'terraform.resource',
410
+ in: ['aws_athena_named_query'],
411
+ },
412
+ },
413
+ to: {
414
+ attr: {
415
+ key: 'terraform.resource',
416
+ startsWith: ['aws_glue_catalog_database'],
417
+ },
418
+ },
419
+ },
420
+ options: {
421
+ semantic: TgEdgeDirectionSemantics.Accesses,
422
+ enforceDirection: true,
423
+ },
424
+ }),
425
+ new EdgeDirectionSemantic({
426
+ edge: {
427
+ from: {
428
+ attr: {
429
+ key: 'terraform.resource',
430
+ in: ['aws_s3_bucket'],
431
+ },
432
+ },
433
+ to: {
434
+ attr: {
435
+ key: 'terraform.resource',
436
+ in: ['aws_s3_bucket_notification'],
437
+ },
438
+ },
439
+ },
440
+ options: {
441
+ semantic: TgEdgeDirectionSemantics.Triggers,
442
+ enforceDirection: true,
443
+ },
444
+ }),
445
+ new EdgeDirectionSemantic({
446
+ edge: {
447
+ from: {
448
+ attr: {
449
+ key: 'terraform.resource',
450
+ eq: 'aws_sqs_queue',
451
+ },
452
+ },
453
+ to: {
454
+ attr: {
455
+ key: 'terraform.resource',
456
+ eq: 'aws_sqs_queue',
457
+ },
458
+ },
459
+ },
460
+ options: {
461
+ semantic: TgEdgeDirectionSemantics.Publishes,
462
+ enforceDirection: true,
463
+ },
464
+ }),
465
+ // this is the generic one
466
+ new EdgeDirectionSemantic({
467
+ edge: {
468
+ from: {
469
+ attr: {
470
+ key: 'terraform.resource',
471
+ in: [
472
+ // 'aws_sqs_queue',
473
+ 'aws_sns_topic',
474
+ // 'aws_kinesis_stream',
475
+ // 'aws_dynamodb_table',
476
+ 'aws_cloudwatch_event_bus',
477
+ // 'aws_cloudwatch_event_target',
478
+ 'aws_scheduler_schedule',
479
+ // 'aws_s3_bucket',
480
+ ],
481
+ },
482
+ },
483
+ to: {
484
+ attr: {
485
+ key: 'terraform.resource',
486
+ in: [
487
+ // 'aws_lambda_event_source_mapping',
488
+ 'aws_sqs_queue',
489
+ 'aws_cloudwatch_event_rule',
490
+ 'aws_cloudwatch_event_archive',
491
+ 'aws_sfn_state_machine',
492
+ 'aws_ecs_service',
493
+ // 'aws_s3_bucket_notification',
494
+ 'aws_sns_topic_subscription',
495
+ ],
496
+ },
497
+ },
498
+ },
499
+ options: {
500
+ semantic: TgEdgeDirectionSemantics.Triggers,
501
+ enforceDirection: true,
502
+ },
503
+ }),
504
+ // another weird generic rule
505
+ new EdgeDirectionSemantic({
506
+ edge: {
507
+ from: {
508
+ attr: {
509
+ key: 'terraform.resource',
510
+ in: [
511
+ 'aws_apigatewayv2_api',
512
+ 'aws_api_gateway_rest_api',
513
+ 'aws_lambda_function',
514
+ 'aws_sfn_state_machine',
515
+ // 'aws_cloudwatch_event_rule',
516
+ ],
517
+ },
518
+ },
519
+ to: {
520
+ attr: {
521
+ key: 'terraform.resource',
522
+ in: ['aws_ecs_service', 'aws_apigatewayv2_api'],
523
+ },
524
+ },
525
+ },
526
+ options: {
527
+ semantic: TgEdgeDirectionSemantics.Invokes,
528
+ enforceDirection: true,
529
+ },
530
+ }),
531
+ new EdgeDirectionSemantic({
532
+ edge: {
533
+ from: {
534
+ attr: {
535
+ key: 'terraform.resource',
536
+ in: [
537
+ 'aws_apigatewayv2_api',
538
+ 'aws_api_gateway_rest_api',
539
+ 'aws_lb',
540
+ 'aws_lb_listener',
541
+ 'aws_cloudfront_distribution',
542
+ 'aws_route53_record',
543
+ ],
544
+ },
545
+ },
546
+ to: {
547
+ not: {
548
+ attr: {
549
+ key: 'terraform.resource',
550
+ startsWith: [
551
+ 'aws_waf',
552
+ 'aws_acm_certificate_',
553
+ 'aws_cloudfront_origin_access_control',
554
+ 'aws_cloudwatch_log_delivery_source',
555
+ ],
556
+ },
557
+ },
558
+ },
559
+ },
560
+ options: {
561
+ semantic: TgEdgeDirectionSemantics.Routes,
562
+ enforceDirection: true,
563
+ },
564
+ }),
565
+ new EdgeDirectionSemantic({
566
+ edge: {
567
+ from: {
568
+ attr: {
569
+ key: 'terraform.resource',
570
+ in: ['aws_glue_catalog_database', 'aws_timestreamwrite_database'],
571
+ },
572
+ },
573
+ to: {
574
+ attr: {
575
+ key: 'terraform.resource',
576
+ in: ['aws_glue_catalog_table', 'aws_timestreamwrite_table'],
577
+ },
578
+ },
579
+ },
580
+ options: {
581
+ semantic: TgEdgeDirectionSemantics.Routes,
582
+ enforceDirection: true,
583
+ },
584
+ }),
585
+ new EdgeDirectionSemantic({
586
+ edge: {
587
+ from: {
588
+ attr: {
589
+ key: 'terraform.resource',
590
+ in: ['aws_wafv2_ip_set'],
591
+ },
592
+ },
593
+ to: {
594
+ attr: {
595
+ key: 'terraform.resource',
596
+ in: ['aws_wafv2_web_acl'],
597
+ },
598
+ },
599
+ },
600
+ options: {
601
+ semantic: TgEdgeDirectionSemantics.Authorizes,
602
+ enforceDirection: true,
603
+ },
604
+ }),
605
+ new EdgeDirectionSemantic({
606
+ edge: {
607
+ from: {
608
+ attr: {
609
+ key: 'terraform.resource',
610
+ in: [
611
+ 'aws_wafv2_web_acl',
612
+ 'aws_acm_certificate_validation',
613
+ 'aws_cloudfront_origin_access_control',
614
+ ],
615
+ },
616
+ },
617
+ to: {
618
+ attr: {
619
+ key: 'terraform.resource',
620
+ in: ['aws_cloudfront_distribution'],
621
+ },
622
+ },
623
+ },
624
+ options: {
625
+ semantic: TgEdgeDirectionSemantics.Authorizes,
626
+ enforceDirection: true,
627
+ },
628
+ }),
629
+ new EdgeDirectionSemantic({
630
+ edge: {
631
+ from: {
632
+ attr: {
633
+ key: 'terraform.resource',
634
+ in: ['aws_wafv2_web_acl'],
635
+ },
636
+ },
637
+ to: {
638
+ attr: {
639
+ key: 'terraform.resource',
640
+ in: ['aws_wafv2_web_acl_logging_configuration'],
641
+ },
642
+ },
643
+ },
644
+ options: {
645
+ semantic: TgEdgeDirectionSemantics.ObservedBy,
646
+ enforceDirection: true,
647
+ },
648
+ }),
649
+ new EdgeDirectionSemantic({
650
+ edge: {
651
+ from: {
652
+ attr: {
653
+ key: 'terraform.resource',
654
+ in: ['aws_cloudfront_distribution'],
655
+ },
656
+ },
657
+ to: {
658
+ attr: {
659
+ key: 'terraform.resource',
660
+ in: ['aws_s3_bucket'],
661
+ },
662
+ },
663
+ },
664
+ options: {
665
+ semantic: TgEdgeDirectionSemantics.Accesses,
666
+ enforceDirection: true,
667
+ },
668
+ }),
669
+ new EdgeDirectionSemantic({
670
+ edge: {
671
+ from: {
672
+ attr: {
673
+ key: 'terraform.resource',
674
+ in: ['aws_wafv2_web_acl_logging_configuration'],
675
+ },
676
+ },
677
+ to: {
678
+ attr: {
679
+ key: 'terraform.resource',
680
+ in: ['aws_kinesis_firehose_delivery_stream'],
681
+ },
682
+ },
683
+ },
684
+ options: {
685
+ semantic: TgEdgeDirectionSemantics.Invokes,
686
+ enforceDirection: true,
687
+ },
688
+ }),
689
+ new EdgeDirectionSemantic({
690
+ edge: {
691
+ from: {
692
+ attr: {
693
+ key: 'terraform.resource',
694
+ in: ['aws_kinesis_firehose_delivery_stream'],
695
+ },
696
+ },
697
+ to: {
698
+ attr: {
699
+ key: 'terraform.resource',
700
+ in: ['aws_cloudwatch_log_stream'],
701
+ },
702
+ },
703
+ },
704
+ options: {
705
+ semantic: TgEdgeDirectionSemantics.Invokes,
706
+ enforceDirection: true,
707
+ },
708
+ }),
709
+ new EdgeSemanticLegend({
710
+ edge: {
711
+ from: { any: true },
712
+ to: { any: true },
713
+ },
714
+ options: {
715
+ legendBySemantic: {
716
+ [TgEdgeDirectionSemantics.Invokes]: {
717
+ title: 'Invokes',
718
+ colour: '#0d6efd',
719
+ },
720
+ [TgEdgeDirectionSemantics.Accesses]: {
721
+ title: 'Accesses data',
722
+ colour: '#198754',
723
+ },
724
+ [TgEdgeDirectionSemantics.Publishes]: {
725
+ title: 'Publishes event',
726
+ colour: '#fd7e14',
727
+ },
728
+ [TgEdgeDirectionSemantics.Triggers]: {
729
+ title: 'Triggers async consumer',
730
+ colour: '#dc3545',
731
+ },
732
+ [TgEdgeDirectionSemantics.Routes]: {
733
+ title: 'Routes request',
734
+ colour: '#6f42c1',
735
+ },
736
+ [TgEdgeDirectionSemantics.Authorizes]: {
737
+ title: 'Authorizes',
738
+ colour: '#8dd7c5',
739
+ },
740
+ [TgEdgeDirectionSemantics.ObservedBy]: {
741
+ title: 'Observed by telemetry',
742
+ colour: '#20c997',
743
+ },
744
+ },
745
+ },
746
+ }),
747
+ ],
748
+ }),
749
+ });