File: data.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (687 lines) | stat: -rw-r--r-- 22,216 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
grpc_route_spec = {
    "priority": 1,
    "grpcRoute": {
        "action": {
            "weightedTargets": [
                {"port": 8080, "virtualNode": "my-virtual-node", "weight": 50}
            ]
        },
        "match": {
            "metadata": [
                {
                    "invert": False,
                    "match": {"exact": "example-value"},
                    "name": "my-metadata-key",
                }
            ],
            "methodName": "myMethod",
            "port": 8080,
            "serviceName": "myService",
        },
        "retryPolicy": {
            "grpcRetryEvents": ["unavailable", "resource-exhausted"],
            "httpRetryEvents": ["gateway-error"],
            "maxRetries": 3,
            "perRetryTimeout": {"unit": "ms", "value": 200},
            "tcpRetryEvents": ["connection-error"],
        },
        "timeout": {
            "idle": {"unit": "s", "value": 60},
            "perRequest": {"unit": "s", "value": 5},
        },
    },
}

http_route_spec = {
    "priority": 2,
    "httpRoute": {
        "action": {
            "weightedTargets": [
                {"port": 80, "virtualNode": "web-server-node", "weight": 100}
            ]
        },
        "match": {
            "headers": [
                {
                    "invert": True,
                    "match": {"prefix": "Bearer "},
                    "name": "Authorization",
                }
            ],
            "method": "POST",
            "path": {"exact": "/login"},
            "port": 80,
            "queryParameters": [
                {"match": {"exact": "example-match"}, "name": "http-query-param"}
            ],
            "scheme": "http",
        },
        "retryPolicy": {
            "httpRetryEvents": ["gateway-error", "client-error"],
            "maxRetries": 0,
            "perRetryTimeout": {"unit": "ms", "value": 0},
            "tcpRetryEvents": ["connection-error"],
        },
        "timeout": {
            "idle": {"unit": "s", "value": 15},
            "perRequest": {"unit": "s", "value": 1},
        },
    },
}

http2_route_spec = {
    "priority": 3,
    "http2Route": {
        "action": {
            "weightedTargets": [
                {"port": 80, "virtualNode": "web-server-node", "weight": 75}
            ]
        },
        "match": {
            "headers": [
                {
                    "invert": False,
                    "match": {"exact": "application/json"},
                    "name": "Content-Type",
                }
            ],
            "method": "GET",
            "path": {"exact": "/api/products"},
            "port": 80,
            "prefix": "/api",
            "queryParameters": [
                {"match": {"exact": "electronics"}, "name": "category"}
            ],
            "scheme": "https",
        },
        "retryPolicy": {
            "httpRetryEvents": ["server-error"],
            "maxRetries": 2,
            "perRetryTimeout": {"unit": "ms", "value": 500},
            "tcpRetryEvents": ["connection-error"],
        },
        "timeout": {
            "idle": {"unit": "s", "value": 30},
            "perRequest": {"unit": "s", "value": 2},
        },
    },
}

tcp_route_spec = {
    "priority": 4,
    "tcpRoute": {
        "action": {
            "weightedTargets": [
                {"port": 22, "virtualNode": "ssh-server-node", "weight": 100}
            ]
        },
        "match": {"port": 22},
        "timeout": {"idle": {"unit": "s", "value": 600}},
    },
}

modified_http_route_spec = {
    "priority": 5,
    "httpRoute": {
        "action": {
            "weightedTargets": [
                {"port": 8080, "virtualNode": "api-server-node", "weight": 50}
            ]
        },
        "match": {
            "headers": [
                {
                    "invert": False,
                    "match": {"prefix": "Token "},
                    "name": "X-Auth-Token",
                }
            ],
            "method": "GET",
            "path": {"exact": "/profile"},
            "port": 443,
            "queryParameters": [
                {"match": {"exact": "modified-match"}, "name": "filter-param"}
            ],
            "scheme": "https",
        },
        "retryPolicy": {
            "httpRetryEvents": ["server-error"],
            "maxRetries": 3,
            "perRetryTimeout": {"unit": "s", "value": 2},
            "tcpRetryEvents": ["connection-reset"],
        },
        "timeout": {
            "idle": {"unit": "m", "value": 5},
            "perRequest": {"unit": "ms", "value": 500},
        },
    },
}

http_virtual_node_spec = {
    "backendDefaults": {
        "clientPolicy": {
            "tls": {
                "certificate": {
                    "file": {
                        "certificateChain": "/path/to/cert_chain.pem",
                        "privateKey": "/path/to/private_key.pem",
                    }
                },
                "enforce": True,
                "ports": [443],
                "validation": {
                    "subjectAlternativeNames": {
                        "match": {"exact": ["www.example.com", "api.example.com"]}
                    },
                    "trust": {"file": {"certificateChain": "/path/to/ca_bundle.pem"}},
                },
            }
        }
    },
    "backends": [
        {
            "virtualService": {
                "clientPolicy": {
                    "tls": {
                        "enforce": False,
                        "validation": {
                            "subjectAlternativeNames": {
                                "match": {
                                    "exact": [
                                        "example-alternative-name",
                                    ]
                                }
                            },
                            "trust": {
                                "file": {
                                    "certificateChain": "example-certificate-chain"
                                },
                            },
                        },
                    }
                },
                "virtualServiceName": "my-service.default.svc.cluster.local",
            }
        }
    ],
    "listeners": [
        {
            "connectionPool": {
                "http": {"maxConnections": 1000, "maxPendingRequests": 5000}
            },
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 5000,
                "path": "/health",
                "port": 80,
                "protocol": "http",
                "timeoutMillis": 2000,
                "unhealthyThreshold": 3,
            },
            "outlierDetection": {
                "baseEjectionDuration": {"unit": "s", "value": 30},
                "interval": {"unit": "s", "value": 10},
                "maxEjectionPercent": 10,
                "maxServerErrors": 5,
            },
            "portMapping": {"port": 80, "protocol": "http"},
            "timeout": {
                "http": {
                    "idle": {"unit": "s", "value": 60},
                    "perRequest": {"unit": "s", "value": 5},
                }
            },
            "tls": {
                "certificate": {
                    "acm": {
                        "certificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/abcdefg-1234-5678-90ab-cdef01234567"
                    }
                },
                "mode": "STRICT",
                "validation": {"trust": {"sds": {"secretName": "my-ca-bundle-secret"}}},
            },
        }
    ],
    "logging": {
        "accessLog": {
            "file": {
                "format": {
                    "json": [
                        {"key": "start_time", "value": "%START_TIME%"},
                        {"key": "method", "value": "%REQ(:METHOD)%"},
                    ]
                },
                "path": "/var/log/appmesh/access.log",
            }
        }
    },
    "serviceDiscovery": {
        "awsCloudMap": {
            "attributes": [{"key": "env", "value": "prod"}],
            "ipPreference": "IPv4_PREFERRED",
            "namespaceName": "my-namespace",
            "serviceName": "my-service",
        }
    },
}

http2_virtual_node_spec = {
    "backendDefaults": {
        "clientPolicy": {
            "tls": {
                "certificate": {
                    "file": {
                        "certificateChain": "/path/to/cert_chain.pem",
                        "privateKey": "/path/to/private_key.pem",
                    }
                },
                "enforce": True,
                "ports": [443],
                "validation": {
                    "subjectAlternativeNames": {
                        "match": {"exact": ["http2.example.com"]}
                    },
                    "trust": {"file": {"certificateChain": "/path/to/ca_bundle.pem"}},
                },
            }
        }
    },
    "backends": [
        {
            "virtualService": {
                "clientPolicy": {
                    "tls": {
                        "enforce": True,
                        "ports": [443],
                        "validation": {
                            "subjectAlternativeNames": {
                                "match": {
                                    "exact": [
                                        "match-me",
                                    ]
                                }
                            },
                            "trust": {"sds": {"secretName": "example-secret-name"}},
                        },
                    }
                },
                "virtualServiceName": "my-http2-service.default.svc.cluster.local",
            }
        }
    ],
    "listeners": [
        {
            "connectionPool": {"http2": {"maxRequests": 1000}},
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 5000,
                "path": "/",
                "port": 443,
                "protocol": "http2",
                "timeoutMillis": 2000,
                "unhealthyThreshold": 3,
            },
            "portMapping": {
                "port": 443,
                "protocol": "http2",
            },
            "timeout": {
                "http2": {
                    "idle": {
                        "unit": "s",
                        "value": 120,
                    },
                    "perRequest": {"unit": "s", "value": 10},
                }
            },
            "tls": {
                "certificate": {
                    "acm": {
                        "certificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/abcdefg-1234-5678-90ab-cdef01234567"
                    }
                },
                "mode": "STRICT",
                "validation": {"trust": {"sds": {"secretName": "my-ca-bundle-secret"}}},
            },
        }
    ],
    "logging": {
        "accessLog": {
            "file": {
                "format": {
                    "json": [
                        {"key": "end_time", "value": "%END_TIME%"},
                        {"key": "status_code", "value": "%RESPONSE_CODE%"},
                    ]
                },
                "path": "/var/log/appmesh/new_access.log",
            }
        }
    },
    "serviceDiscovery": {
        "awsCloudMap": {
            "attributes": [{"key": "region", "value": "us-east-1"}],
            "ipPreference": "IPv6_PREFERRED",
            "namespaceName": "new-namespace",
            "serviceName": "new-service",
        }
    },
}

grpc_virtual_node_spec = {
    "backendDefaults": {
        "clientPolicy": {
            "tls": {
                "certificate": {
                    "file": {
                        "certificateChain": "/path/to/cert_chain.pem",
                        "privateKey": "/path/to/private_key.pem",
                    }
                },
                "enforce": True,
                "ports": [443],
                "validation": {
                    "subjectAlternativeNames": {
                        "match": {"exact": ["grpc.example.com"]}
                    },
                    "trust": {"file": {"certificateChain": "/path/to/ca_bundle.pem"}},
                },
            }
        }
    },
    "backends": [
        {
            "virtualService": {
                "clientPolicy": {
                    "tls": {
                        "enforce": True,
                        "ports": [443],
                        "certificate": {
                            "file": {
                                "certificateChain": "grpc-backend-certificate-chain",
                                "privateKey": "grpc-backend-certificate-private-key",
                            },
                        },
                        "validation": {
                            "subjectAlternativeNames": {
                                "match": {
                                    "exact": [
                                        "validation-alternate-name",
                                    ]
                                }
                            },
                            "trust": {
                                "acm": {
                                    "certificateAuthorityArns": [
                                        "example-acm-arn",
                                    ]
                                },
                            },
                        },
                    }
                },
                "virtualServiceName": "my-grpc-service.default.svc.cluster.local",
            }
        }
    ],
    "listeners": [
        {
            "connectionPool": {"grpc": {"maxRequests": 500}},
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 5000,
                "port": 50051,
                "protocol": "grpc",
                "timeoutMillis": 2000,
                "unhealthyThreshold": 3,
            },
            "portMapping": {
                "port": 50051,
                "protocol": "grpc",
            },
            "timeout": {
                "grpc": {
                    "idle": {
                        "unit": "s",
                        "value": 600,
                    },
                    "perRequest": {"unit": "s", "value": 30},
                }
            },
            "tls": {
                "certificate": {
                    "acm": {
                        "certificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/abcdefg-1234-5678-90ab-cdef01234567"
                    }
                },
                "mode": "STRICT",
                "validation": {"trust": {"sds": {"secretName": "my-ca-bundle-secret"}}},
            },
        }
    ],
    "logging": {
        "accessLog": {
            "file": {
                "format": {
                    "json": [
                        {"key": "end_time", "value": "%END_TIME%"},
                        {"key": "status_code", "value": "%RESPONSE_CODE%"},
                    ]
                },
                "path": "/var/log/appmesh/new_access.log",
            }
        }
    },
    "serviceDiscovery": {
        "awsCloudMap": {
            "attributes": [{"key": "region", "value": "us-east-1"}],
            "ipPreference": "IPv6_PREFERRED",
            "namespaceName": "new-namespace",
            "serviceName": "new-service",
        }
    },
}

tcp_virtual_node_spec = {
    "backendDefaults": {
        "clientPolicy": {
            "tls": {
                "certificate": {
                    "file": {
                        "certificateChain": "/path/to/cert_chain.pem",
                        "privateKey": "/path/to/private_key.pem",
                    }
                },
                "enforce": True,
                "ports": [443],
                "validation": {
                    "subjectAlternativeNames": {
                        "match": {"exact": ["tcp.example.com"]}
                    },
                    "trust": {"file": {"certificateChain": "/path/to/ca_bundle.pem"}},
                },
            }
        }
    },
    "backends": [
        {
            "virtualService": {
                "clientPolicy": {
                    "tls": {
                        "enforce": False,
                        "validation": {
                            "subjectAlternativeNames": {
                                "match": {
                                    "exact": [
                                        "exact-match-example",
                                    ]
                                }
                            },
                            "trust": {
                                "file": {"certificateChain": "test-certificate-chain"},
                            },
                        },
                    }
                },
                "virtualServiceName": "my-tcp-service.default.svc.cluster.local",
            }
        }
    ],
    "listeners": [
        {
            "connectionPool": {"tcp": {"maxConnections": 2000}},
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 10000,
                "port": 8080,
                "protocol": "tcp",
                "timeoutMillis": 5000,
                "unhealthyThreshold": 3,
            },
            "portMapping": {
                "port": 8080,
                "protocol": "tcp",
            },
            "timeout": {
                "tcp": {
                    "idle": {
                        "unit": "m",
                        "value": 30,
                    }
                }
            },
        }
    ],
    "logging": {
        "accessLog": {
            "file": {
                "format": {
                    "json": [
                        {"key": "end_time", "value": "%END_TIME%"},
                        {"key": "status_code", "value": "%RESPONSE_CODE%"},
                    ]
                },
                "path": "/var/log/appmesh/new_access.log",
            }
        }
    },
    "serviceDiscovery": {
        "awsCloudMap": {
            "attributes": [{"key": "region", "value": "us-east-1"}],
            "ipPreference": "IPv6_PREFERRED",
            "namespaceName": "new-namespace",
            "serviceName": "new-service",
        }
    },
}

modified_http2_virtual_node_spec = {
    "backendDefaults": {
        "clientPolicy": {
            "tls": {
                "certificate": {
                    "file": {
                        "certificateChain": "/updated/path/to/cert_chain.pem",
                        "privateKey": "/updated/path/to/private_key.pem",
                    }
                },
                "enforce": False,
                "ports": [8443],
                "validation": {
                    "subjectAlternativeNames": {
                        "match": {"exact": ["updated.example.com"]}
                    },
                    "trust": {
                        "file": {"certificateChain": "/updated/path/to/ca_bundle.pem"}
                    },
                },
            }
        }
    },
    "backends": [
        {
            "virtualService": {
                "clientPolicy": {
                    "tls": {
                        "enforce": False,
                        "ports": [8443],
                        "validation": {
                            "subjectAlternativeNames": {
                                "match": {
                                    "exact": [
                                        "another-exact-match-example",
                                    ]
                                }
                            },
                            "trust": {
                                "file": {
                                    "certificateChain": "different-test-certificate-chain"
                                },
                            },
                        },
                    }
                },
                "virtualServiceName": "updated-http2-service.default.svc.cluster.local",
            }
        }
    ],
    "listeners": [
        {
            "connectionPool": {"http2": {"maxRequests": 500}},
            "healthCheck": {
                "healthyThreshold": 3,
                "intervalMillis": 5100,
                "path": "/health",
                "port": 8443,
                "protocol": "http2",
                "timeoutMillis": 2200,
                "unhealthyThreshold": 2,
            },
            "portMapping": {
                "port": 8443,
                "protocol": "http2",
            },
            "timeout": {
                "http2": {
                    "idle": {
                        "unit": "m",
                        "value": 5,
                    },
                    "perRequest": {"unit": "m", "value": 1},
                }
            },
            "tls": {
                "certificate": {
                    "acm": {
                        "certificateArn": "arn:aws:acm:us-west-2:987654321098:certificate/hgfedcba-4321-8765-ba09-fedc09876543"
                    }
                },
                "mode": "PERMISSIVE",
                "validation": {
                    "trust": {"sds": {"secretName": "updated-ca-bundle-secret"}}
                },
            },
        }
    ],
    "logging": {
        "accessLog": {
            "file": {
                "format": {
                    "json": [
                        {"key": "start_time", "value": "%START_TIME%"},
                        {"key": "method", "value": "%REQUEST_METHOD%"},
                    ]
                },
                "path": "/var/log/appmesh/updated_access.log",
            }
        }
    },
    "serviceDiscovery": {
        "awsCloudMap": {
            "attributes": [{"key": "environment", "value": "production"}],
            "ipPreference": "IPv4_PREFERRED",
            "namespaceName": "updated-namespace",
            "serviceName": "updated-service",
        }
    },
}