How to use create_transit_gateway_route_table method in localstack

Best Python code snippet using localstack_python

test_transit_gateway.py

Source:test_transit_gateway.py Github

copy

Full Screen

...218 ec2 = boto3.client("ec2", region_name="us-west-1")219 response = ec2.describe_transit_gateway_route_tables()220 response.should.have.key("TransitGatewayRouteTables").equal([])221@mock_ec2222def test_create_transit_gateway_route_table():223 ec2 = boto3.client("ec2", region_name="us-west-1")224 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][225 "TransitGatewayId"226 ]227 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[228 "TransitGatewayRouteTable"229 ]230 table.should.have.key("TransitGatewayRouteTableId").match("tgw-rtb-[0-9a-z]+")231 table.should.have.key("TransitGatewayId").equals(gateway_id)232 table.should.have.key("State").equals("available")233 table.should.have.key("DefaultAssociationRouteTable").equals(False)234 table.should.have.key("DefaultPropagationRouteTable").equals(False)235 table.should.have.key("CreationTime")236 table.should.have.key("Tags").equals([])237 tables = ec2.describe_transit_gateway_route_tables(238 TransitGatewayRouteTableIds=[table["TransitGatewayRouteTableId"]]239 )["TransitGatewayRouteTables"]240 tables.should.have.length_of(1)241@mock_ec2242def test_create_transit_gateway_route_table_with_tags():243 ec2 = boto3.client("ec2", region_name="us-west-1")244 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][245 "TransitGatewayId"246 ]247 response = ec2.create_transit_gateway_route_table(248 TransitGatewayId=gateway_id,249 TagSpecifications=[250 {251 "ResourceType": "transit-gateway-route-table",252 "Tags": [253 {"Key": "tag1", "Value": "val1"},254 {"Key": "tag2", "Value": "val2"},255 ],256 }257 ],258 )259 table = response["TransitGatewayRouteTable"]260 table["Tags"].should.have.length_of(2)261 table["Tags"].should.contain({"Key": "tag1", "Value": "val1"})262 table["Tags"].should.contain({"Key": "tag2", "Value": "val2"})263@mock_ec2264def test_delete_transit_gateway_route_table():265 ec2 = boto3.client("ec2", region_name="us-west-1")266 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][267 "TransitGatewayId"268 ]269 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[270 "TransitGatewayRouteTable"271 ]272 table_id = table["TransitGatewayRouteTableId"]273 tables = ec2.describe_transit_gateway_route_tables(274 TransitGatewayRouteTableIds=[table_id]275 )["TransitGatewayRouteTables"]276 tables.should.have.length_of(1)277 tables[0]["State"].should.equal("available")278 table = ec2.delete_transit_gateway_route_table(TransitGatewayRouteTableId=table_id)279 table["TransitGatewayRouteTable"].should.have.key("State").equals("deleted")280 tables = ec2.describe_transit_gateway_route_tables(281 TransitGatewayRouteTableIds=[table_id]282 )["TransitGatewayRouteTables"]283 tables.should.have.length_of(1)284 tables[0]["State"].should.equal("deleted")285@mock_ec2286def test_search_transit_gateway_routes_empty():287 ec2 = boto3.client("ec2", region_name="us-west-1")288 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][289 "TransitGatewayId"290 ]291 table_id = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[292 "TransitGatewayRouteTable"293 ]["TransitGatewayRouteTableId"]294 response = ec2.search_transit_gateway_routes(295 TransitGatewayRouteTableId=table_id,296 Filters=[{"Name": "state", "Values": ["active"]}],297 )298 response.should.have.key("Routes").equal([])299 response.should.have.key("AdditionalRoutesAvailable").equal(False)300@mock_ec2301def test_create_transit_gateway_route():302 ec2 = boto3.client("ec2", region_name="us-west-1")303 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][304 "TransitGatewayId"305 ]306 table_id = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[307 "TransitGatewayRouteTable"308 ]["TransitGatewayRouteTableId"]309 route = ec2.create_transit_gateway_route(310 DestinationCidrBlock="0.0.0.0", TransitGatewayRouteTableId=table_id311 )["Route"]312 route.should.have.key("DestinationCidrBlock").equal("0.0.0.0")313 route.should.have.key("Type").equal("static")314 route.should.have.key("State").equal("active")315@mock_ec2316def test_create_transit_gateway_route_as_blackhole():317 ec2 = boto3.client("ec2", region_name="us-west-1")318 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][319 "TransitGatewayId"320 ]321 table_id = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[322 "TransitGatewayRouteTable"323 ]["TransitGatewayRouteTableId"]324 route = ec2.create_transit_gateway_route(325 DestinationCidrBlock="192.168.0.1",326 TransitGatewayRouteTableId=table_id,327 Blackhole=True,328 )["Route"]329 route.should.have.key("DestinationCidrBlock").equal("192.168.0.1")330 route.should.have.key("Type").equal("static")331 route.should.have.key("State").equal("blackhole")332@mock_ec2333def test_search_transit_gateway_routes_by_state():334 ec2 = boto3.client("ec2", region_name="us-west-1")335 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][336 "TransitGatewayId"337 ]338 table_id = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[339 "TransitGatewayRouteTable"340 ]["TransitGatewayRouteTableId"]341 ec2.create_transit_gateway_route(342 DestinationCidrBlock="192.168.0.0", TransitGatewayRouteTableId=table_id343 )344 ec2.create_transit_gateway_route(345 DestinationCidrBlock="192.168.0.1",346 TransitGatewayRouteTableId=table_id,347 Blackhole=True,348 )349 routes = ec2.search_transit_gateway_routes(350 TransitGatewayRouteTableId=table_id,351 Filters=[{"Name": "state", "Values": ["active"]}],352 )["Routes"]353 routes.should.equal(354 [{"DestinationCidrBlock": "192.168.0.0", "Type": "static", "State": "active"}]355 )356 routes = ec2.search_transit_gateway_routes(357 TransitGatewayRouteTableId=table_id,358 Filters=[{"Name": "state", "Values": ["blackhole"]}],359 )["Routes"]360 routes.should.equal(361 [362 {363 "DestinationCidrBlock": "192.168.0.1",364 "Type": "static",365 "State": "blackhole",366 }367 ]368 )369 routes = ec2.search_transit_gateway_routes(370 TransitGatewayRouteTableId=table_id,371 Filters=[{"Name": "state", "Values": ["unknown"]}],372 )["Routes"]373 routes.should.equal([])374@mock_ec2375def test_search_transit_gateway_routes_by_routesearch():376 client = boto3.client("ec2", region_name="us-west-2")377 vpc = client.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"]378 subnet = client.create_subnet(VpcId=vpc["VpcId"], CidrBlock="10.0.1.0/24")["Subnet"]379 tgw = client.create_transit_gateway(Description="description")380 tgw_id = tgw["TransitGateway"]["TransitGatewayId"]381 route_table = client.create_transit_gateway_route_table(TransitGatewayId=tgw_id)382 transit_gateway_route_id = route_table["TransitGatewayRouteTable"][383 "TransitGatewayRouteTableId"384 ]385 attachment = client.create_transit_gateway_vpc_attachment(386 TransitGatewayId=tgw_id, VpcId=vpc["VpcId"], SubnetIds=[subnet["SubnetId"]]387 )388 transit_gateway_attachment_id = attachment["TransitGatewayVpcAttachment"][389 "TransitGatewayAttachmentId"390 ]391 exported_cidr_ranges = ["172.17.0.0/24", "192.160.0.0/24"]392 for route in exported_cidr_ranges:393 client.create_transit_gateway_route(394 DestinationCidrBlock=route,395 TransitGatewayRouteTableId=transit_gateway_route_id,396 TransitGatewayAttachmentId=transit_gateway_attachment_id,397 )398 for route in exported_cidr_ranges:399 expected_route = client.search_transit_gateway_routes(400 TransitGatewayRouteTableId=transit_gateway_route_id,401 Filters=[{"Name": "route-search.exact-match", "Values": [route]}],402 )403 expected_route["Routes"][0]["DestinationCidrBlock"].should.equal(route)404@mock_ec2405def test_delete_transit_gateway_route():406 ec2 = boto3.client("ec2", region_name="us-west-1")407 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][408 "TransitGatewayId"409 ]410 table_id = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[411 "TransitGatewayRouteTable"412 ]["TransitGatewayRouteTableId"]413 ec2.create_transit_gateway_route(414 DestinationCidrBlock="192.168.0.0", TransitGatewayRouteTableId=table_id415 )416 ec2.create_transit_gateway_route(417 DestinationCidrBlock="192.168.0.1", TransitGatewayRouteTableId=table_id418 )419 response = ec2.delete_transit_gateway_route(420 DestinationCidrBlock="192.168.0.0", TransitGatewayRouteTableId=table_id421 )422 response["Route"].should.equal(423 {"DestinationCidrBlock": "192.168.0.0", "Type": "static", "State": "deleted"}424 )425 routes = ec2.search_transit_gateway_routes(426 TransitGatewayRouteTableId=table_id,427 Filters=[{"Name": "state", "Values": ["active"]}],428 )["Routes"]429 routes.should.equal(430 [{"DestinationCidrBlock": "192.168.0.1", "Type": "static", "State": "active"}]431 )432@mock_ec2433def test_create_transit_gateway_vpc_attachment():434 ec2 = boto3.client("ec2", region_name="us-west-1")435 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][436 "TransitGatewayId"437 ]438 response = ec2.create_transit_gateway_vpc_attachment(439 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]440 )441 response.should.have.key("TransitGatewayVpcAttachment")442 attachment = response["TransitGatewayVpcAttachment"]443 attachment.should.have.key("TransitGatewayAttachmentId").match(444 "tgw-attach-[0-9a-z]+"445 )446 attachment.should.have.key("TransitGatewayId").equal(gateway_id)447 attachment.should.have.key("VpcId").equal("vpc-id")448 attachment.should.have.key("VpcOwnerId").equal(ACCOUNT_ID)449 attachment.should.have.key("SubnetIds").equal(["sub1"])450 attachment.should.have.key("State").equal("available")451 attachment.should.have.key("Tags").equal([])452@mock_ec2453def test_modify_transit_gateway_vpc_attachment_add_subnets():454 ec2 = boto3.client("ec2", region_name="us-west-1")455 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][456 "TransitGatewayId"457 ]458 response = ec2.create_transit_gateway_vpc_attachment(459 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1", "sub3"]460 )461 attchmnt_id = response["TransitGatewayVpcAttachment"]["TransitGatewayAttachmentId"]462 ec2.modify_transit_gateway_vpc_attachment(463 TransitGatewayAttachmentId=attchmnt_id, AddSubnetIds=["sub2"]464 )465 attachment = ec2.describe_transit_gateway_vpc_attachments(466 TransitGatewayAttachmentIds=[attchmnt_id]467 )["TransitGatewayVpcAttachments"][0]468 sorted(attachment["SubnetIds"]).should.equal(["sub1", "sub2", "sub3"])469@mock_ec2470def test_modify_transit_gateway_vpc_attachment_remove_subnets():471 ec2 = boto3.client("ec2", region_name="us-west-1")472 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][473 "TransitGatewayId"474 ]475 response = ec2.create_transit_gateway_vpc_attachment(476 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1", "sub2", "sub3"]477 )478 attchmnt_id = response["TransitGatewayVpcAttachment"]["TransitGatewayAttachmentId"]479 ec2.modify_transit_gateway_vpc_attachment(480 TransitGatewayAttachmentId=attchmnt_id, RemoveSubnetIds=["sub2"]481 )482 attachment = ec2.describe_transit_gateway_vpc_attachments(483 TransitGatewayAttachmentIds=[attchmnt_id]484 )["TransitGatewayVpcAttachments"][0]485 attachment["SubnetIds"].should.equal(["sub1", "sub3"])486@mock_ec2487def test_modify_transit_gateway_vpc_attachment_change_options():488 ec2 = boto3.client("ec2", region_name="us-west-1")489 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][490 "TransitGatewayId"491 ]492 response = ec2.create_transit_gateway_vpc_attachment(493 TransitGatewayId=gateway_id,494 VpcId="vpc-id",495 SubnetIds=["sub1"],496 Options={497 "DnsSupport": "enable",498 "Ipv6Support": "enable",499 "ApplianceModeSupport": "enable",500 },501 )502 attchmnt_id = response["TransitGatewayVpcAttachment"]["TransitGatewayAttachmentId"]503 ec2.modify_transit_gateway_vpc_attachment(504 TransitGatewayAttachmentId=attchmnt_id,505 Options={"ApplianceModeSupport": "disabled"},506 )507 attachment = ec2.describe_transit_gateway_vpc_attachments(508 TransitGatewayAttachmentIds=[attchmnt_id]509 )["TransitGatewayVpcAttachments"][0]510 attachment["Options"]["ApplianceModeSupport"].should.equal("disabled")511 attachment["Options"]["DnsSupport"].should.equal("enable")512 attachment["Options"]["Ipv6Support"].should.equal("enable")513@mock_ec2514def test_delete_transit_gateway_vpc_attachment():515 ec2 = boto3.client("ec2", region_name="us-west-1")516 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][517 "TransitGatewayId"518 ]519 a1 = ec2.create_transit_gateway_vpc_attachment(520 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]521 )["TransitGatewayVpcAttachment"]["TransitGatewayAttachmentId"]522 a2 = ec2.create_transit_gateway_vpc_attachment(523 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]524 )["TransitGatewayVpcAttachment"]["TransitGatewayAttachmentId"]525 available = ec2.describe_transit_gateway_vpc_attachments(526 TransitGatewayAttachmentIds=[a1, a2],527 Filters=[{"Name": "state", "Values": ["available"]}],528 )["TransitGatewayVpcAttachments"]529 available.should.have.length_of(2)530 a1_removed = ec2.delete_transit_gateway_vpc_attachment(531 TransitGatewayAttachmentId=a1532 )["TransitGatewayVpcAttachment"]533 a1_removed.should.have.key("TransitGatewayAttachmentId").equal(a1)534 a1_removed.should.have.key("State").equal("deleted")535 all_attchmnts = ec2.describe_transit_gateway_vpc_attachments(536 TransitGatewayAttachmentIds=[a1, a2]537 )["TransitGatewayVpcAttachments"]538 all_attchmnts.should.have.length_of(1)539 [a["TransitGatewayAttachmentId"] for a in all_attchmnts].should.equal([a2])540@mock_ec2541def test_associate_transit_gateway_route_table():542 ec2 = boto3.client("ec2", region_name="us-west-1")543 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][544 "TransitGatewayId"545 ]546 attchmnt = ec2.create_transit_gateway_vpc_attachment(547 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]548 )["TransitGatewayVpcAttachment"]549 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[550 "TransitGatewayRouteTable"551 ]552 initial = ec2.get_transit_gateway_route_table_associations(553 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]554 )555 initial["Associations"].should.equal(556 [557 {558 "TransitGatewayAttachmentId": "",559 "ResourceId": "",560 "ResourceType": "",561 "State": "",562 }563 ]564 )565 ec2.associate_transit_gateway_route_table(566 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],567 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],568 )569 updated = ec2.get_transit_gateway_route_table_associations(570 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]571 )572 updated["Associations"].should.equal(573 [574 {575 "TransitGatewayAttachmentId": attchmnt["TransitGatewayAttachmentId"],576 "ResourceId": "vpc-id",577 "ResourceType": "vpc",578 "State": "associated",579 }580 ]581 )582@mock_ec2583def test_disassociate_transit_gateway_route_table():584 ec2 = boto3.client("ec2", region_name="us-west-1")585 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][586 "TransitGatewayId"587 ]588 attchmnt = ec2.create_transit_gateway_vpc_attachment(589 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]590 )["TransitGatewayVpcAttachment"]591 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[592 "TransitGatewayRouteTable"593 ]594 initial = ec2.get_transit_gateway_route_table_associations(595 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]596 )["Associations"][0]597 initial["TransitGatewayAttachmentId"].should.equal("")598 ec2.associate_transit_gateway_route_table(599 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],600 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],601 )602 updated = ec2.get_transit_gateway_route_table_associations(603 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]604 )["Associations"][0]605 updated["TransitGatewayAttachmentId"].should.equal(606 attchmnt["TransitGatewayAttachmentId"]607 )608 updated["State"].should.equal("associated")609 dis = ec2.disassociate_transit_gateway_route_table(610 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],611 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],612 )["Association"]613 dis["State"].should.equal("disassociated")614 updated = ec2.get_transit_gateway_route_table_associations(615 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]616 )["Associations"][0]617 updated["TransitGatewayAttachmentId"].should.equal("")618 updated["State"].should.equal("")619@mock_ec2620def test_enable_transit_gateway_route_table_propagation():621 ec2 = boto3.client("ec2", region_name="us-west-1")622 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][623 "TransitGatewayId"624 ]625 attchmnt = ec2.create_transit_gateway_vpc_attachment(626 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]627 )["TransitGatewayVpcAttachment"]628 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[629 "TransitGatewayRouteTable"630 ]631 initial = ec2.get_transit_gateway_route_table_propagations(632 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]633 )634 initial["TransitGatewayRouteTablePropagations"].should.equal(635 [636 {637 "TransitGatewayAttachmentId": "",638 "ResourceId": "",639 "ResourceType": "",640 "State": "",641 }642 ]643 )644 ec2.associate_transit_gateway_route_table(645 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],646 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],647 )648 ec2.enable_transit_gateway_route_table_propagation(649 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],650 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],651 )652 enabled = ec2.get_transit_gateway_route_table_propagations(653 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]654 )655 enabled["TransitGatewayRouteTablePropagations"].should.equal(656 [657 {658 "TransitGatewayAttachmentId": attchmnt["TransitGatewayAttachmentId"],659 "ResourceId": "vpc-id",660 "ResourceType": "vpc",661 "State": "enabled",662 }663 ]664 )665@mock_ec2666def test_disable_transit_gateway_route_table_propagation_without_enabling_first():667 ec2 = boto3.client("ec2", region_name="us-west-1")668 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][669 "TransitGatewayId"670 ]671 attchmnt = ec2.create_transit_gateway_vpc_attachment(672 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]673 )["TransitGatewayVpcAttachment"]674 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[675 "TransitGatewayRouteTable"676 ]677 initial = ec2.get_transit_gateway_route_table_propagations(678 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]679 )680 initial["TransitGatewayRouteTablePropagations"].should.equal(681 [682 {683 "TransitGatewayAttachmentId": "",684 "ResourceId": "",685 "ResourceType": "",686 "State": "",687 }688 ]689 )690 ec2.associate_transit_gateway_route_table(691 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],692 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],693 )694 try:695 ec2.disable_transit_gateway_route_table_propagation(696 TransitGatewayAttachmentId=attchmnt["TransitGatewayAttachmentId"],697 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"],698 )699 assert False, "Should not be able to disable before enabling it"700 except Exception:701 pass702@mock_ec2703def test_disable_transit_gateway_route_table_propagation():704 ec2 = boto3.client("ec2", region_name="us-west-1")705 gateway_id = ec2.create_transit_gateway(Description="g")["TransitGateway"][706 "TransitGatewayId"707 ]708 attchmnt = ec2.create_transit_gateway_vpc_attachment(709 TransitGatewayId=gateway_id, VpcId="vpc-id", SubnetIds=["sub1"]710 )["TransitGatewayVpcAttachment"]711 table = ec2.create_transit_gateway_route_table(TransitGatewayId=gateway_id)[712 "TransitGatewayRouteTable"713 ]714 initial = ec2.get_transit_gateway_route_table_propagations(715 TransitGatewayRouteTableId=table["TransitGatewayRouteTableId"]716 )717 initial["TransitGatewayRouteTablePropagations"].should.equal(718 [719 {720 "TransitGatewayAttachmentId": "",721 "ResourceId": "",722 "ResourceType": "",723 "State": "",724 }725 ]...

Full Screen

Full Screen

transit_gateway_route_tables.py

Source:transit_gateway_route_tables.py Github

copy

Full Screen

1from moto.core.responses import BaseResponse2from moto.ec2.utils import filters_from_querystring3from moto.utilities.utils import str2bool4class TransitGatewayRouteTable(BaseResponse):5 def create_transit_gateway_route_table(self):6 transit_gateway_id = self._get_param("TransitGatewayId")7 tags = self._get_multi_param("TagSpecifications")8 tags = tags[0] if isinstance(tags, list) and len(tags) == 1 else tags9 tags = (tags or {}).get("Tag", [])10 tags = {t["Key"]: t["Value"] for t in tags}11 transit_gateway_route_table = self.ec2_backend.create_transit_gateway_route_table(12 transit_gateway_id=transit_gateway_id, tags=tags13 )14 template = self.response_template(CREATE_TRANSIT_GATEWAY_ROUTE_TABLE_RESPONSE)15 return template.render(transit_gateway_route_table=transit_gateway_route_table)16 def describe_transit_gateway_route_tables(self):17 filters = filters_from_querystring(self.querystring)18 transit_gateway_route_table_ids = (19 self._get_multi_param("TransitGatewayRouteTableIds") or None20 )21 transit_gateway_route_tables = self.ec2_backend.get_all_transit_gateway_route_tables(22 transit_gateway_route_table_ids, filters23 )24 template = self.response_template(DESCRIBE_TRANSIT_GATEWAY_ROUTE_TABLE_RESPONSE)25 return template.render(...

Full Screen

Full Screen

transit-gateway.py

Source:transit-gateway.py Github

copy

Full Screen

...36 return response37#Create transit gateway route-table38def create_transit_gateway_rt(transit_gateway_id):39 client = boto3.client('ec2', region_name='us-east-1')40 response = client.create_transit_gateway_route_table(41 TransitGatewayId=transit_gateway_id,42 DryRun=False43 )44 return response45#Create transit gateway route46def create_transit_gateway_route(transit_gateway_rt_id, destination_ip_block, transit_gateway_attachment_id):47 client = boto3.client('ec2', region_name='us-east-1')48 response = client.create_transit_gateway_route(49 DestinationCidrBlock=destination_ip_block,50 TransitGatewayRouteTableId=transit_gateway_rt_id,51 TransitGatewayAttachmentId=transit_gateway_attachment_id,52 Blackhole=False,53 DryRun=False54 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful