How to use describe_local_gateway_route_table_vpc_associations method in localstack

Best Python code snippet using localstack_python

__init__.pyi

Source:__init__.pyi Github

copy

Full Screen

1"""2Main interface for ec2 service.3Usage::4 ```python5 import boto36 from mypy_boto3_ec2 import (7 BundleTaskCompleteWaiter,8 Client,9 ConversionTaskCancelledWaiter,10 ConversionTaskCompletedWaiter,11 ConversionTaskDeletedWaiter,12 CustomerGatewayAvailableWaiter,13 DescribeByoipCidrsPaginator,14 DescribeCapacityReservationsPaginator,15 DescribeCarrierGatewaysPaginator,16 DescribeClassicLinkInstancesPaginator,17 DescribeClientVpnAuthorizationRulesPaginator,18 DescribeClientVpnConnectionsPaginator,19 DescribeClientVpnEndpointsPaginator,20 DescribeClientVpnRoutesPaginator,21 DescribeClientVpnTargetNetworksPaginator,22 DescribeCoipPoolsPaginator,23 DescribeDhcpOptionsPaginator,24 DescribeEgressOnlyInternetGatewaysPaginator,25 DescribeExportImageTasksPaginator,26 DescribeFastSnapshotRestoresPaginator,27 DescribeFleetsPaginator,28 DescribeFlowLogsPaginator,29 DescribeFpgaImagesPaginator,30 DescribeHostReservationOfferingsPaginator,31 DescribeHostReservationsPaginator,32 DescribeHostsPaginator,33 DescribeIamInstanceProfileAssociationsPaginator,34 DescribeImportImageTasksPaginator,35 DescribeImportSnapshotTasksPaginator,36 DescribeInstanceCreditSpecificationsPaginator,37 DescribeInstanceStatusPaginator,38 DescribeInstanceTypeOfferingsPaginator,39 DescribeInstanceTypesPaginator,40 DescribeInstancesPaginator,41 DescribeInternetGatewaysPaginator,42 DescribeIpv6PoolsPaginator,43 DescribeLaunchTemplateVersionsPaginator,44 DescribeLaunchTemplatesPaginator,45 DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator,46 DescribeLocalGatewayRouteTableVpcAssociationsPaginator,47 DescribeLocalGatewayRouteTablesPaginator,48 DescribeLocalGatewayVirtualInterfaceGroupsPaginator,49 DescribeLocalGatewayVirtualInterfacesPaginator,50 DescribeLocalGatewaysPaginator,51 DescribeManagedPrefixListsPaginator,52 DescribeMovingAddressesPaginator,53 DescribeNatGatewaysPaginator,54 DescribeNetworkAclsPaginator,55 DescribeNetworkInterfacePermissionsPaginator,56 DescribeNetworkInterfacesPaginator,57 DescribePrefixListsPaginator,58 DescribePrincipalIdFormatPaginator,59 DescribePublicIpv4PoolsPaginator,60 DescribeReservedInstancesModificationsPaginator,61 DescribeReservedInstancesOfferingsPaginator,62 DescribeRouteTablesPaginator,63 DescribeScheduledInstanceAvailabilityPaginator,64 DescribeScheduledInstancesPaginator,65 DescribeSecurityGroupsPaginator,66 DescribeSnapshotsPaginator,67 DescribeSpotFleetInstancesPaginator,68 DescribeSpotFleetRequestsPaginator,69 DescribeSpotInstanceRequestsPaginator,70 DescribeSpotPriceHistoryPaginator,71 DescribeStaleSecurityGroupsPaginator,72 DescribeSubnetsPaginator,73 DescribeTagsPaginator,74 DescribeTrafficMirrorFiltersPaginator,75 DescribeTrafficMirrorSessionsPaginator,76 DescribeTrafficMirrorTargetsPaginator,77 DescribeTransitGatewayAttachmentsPaginator,78 DescribeTransitGatewayMulticastDomainsPaginator,79 DescribeTransitGatewayPeeringAttachmentsPaginator,80 DescribeTransitGatewayRouteTablesPaginator,81 DescribeTransitGatewayVpcAttachmentsPaginator,82 DescribeTransitGatewaysPaginator,83 DescribeVolumeStatusPaginator,84 DescribeVolumesModificationsPaginator,85 DescribeVolumesPaginator,86 DescribeVpcClassicLinkDnsSupportPaginator,87 DescribeVpcEndpointConnectionNotificationsPaginator,88 DescribeVpcEndpointConnectionsPaginator,89 DescribeVpcEndpointServiceConfigurationsPaginator,90 DescribeVpcEndpointServicePermissionsPaginator,91 DescribeVpcEndpointServicesPaginator,92 DescribeVpcEndpointsPaginator,93 DescribeVpcPeeringConnectionsPaginator,94 DescribeVpcsPaginator,95 EC2Client,96 EC2ServiceResource,97 ExportTaskCancelledWaiter,98 ExportTaskCompletedWaiter,99 GetAssociatedIpv6PoolCidrsPaginator,100 GetGroupsForCapacityReservationPaginator,101 GetManagedPrefixListAssociationsPaginator,102 GetManagedPrefixListEntriesPaginator,103 GetTransitGatewayAttachmentPropagationsPaginator,104 GetTransitGatewayMulticastDomainAssociationsPaginator,105 GetTransitGatewayRouteTableAssociationsPaginator,106 GetTransitGatewayRouteTablePropagationsPaginator,107 ImageAvailableWaiter,108 ImageExistsWaiter,109 InstanceExistsWaiter,110 InstanceRunningWaiter,111 InstanceStatusOkWaiter,112 InstanceStoppedWaiter,113 InstanceTerminatedWaiter,114 KeyPairExistsWaiter,115 NatGatewayAvailableWaiter,116 NetworkInterfaceAvailableWaiter,117 PasswordDataAvailableWaiter,118 SearchLocalGatewayRoutesPaginator,119 SearchTransitGatewayMulticastGroupsPaginator,120 SecurityGroupExistsWaiter,121 ServiceResource,122 SnapshotCompletedWaiter,123 SpotInstanceRequestFulfilledWaiter,124 SubnetAvailableWaiter,125 SystemStatusOkWaiter,126 VolumeAvailableWaiter,127 VolumeDeletedWaiter,128 VolumeInUseWaiter,129 VpcAvailableWaiter,130 VpcExistsWaiter,131 VpcPeeringConnectionDeletedWaiter,132 VpcPeeringConnectionExistsWaiter,133 VpnConnectionAvailableWaiter,134 VpnConnectionDeletedWaiter,135 )136 session = boto3.Session()137 client: EC2Client = boto3.client("ec2")138 session_client: EC2Client = session.client("ec2")139 resource: EC2ServiceResource = boto3.resource("ec2")140 session_resource: EC2ServiceResource = session.resource("ec2")141 bundle_task_complete_waiter: BundleTaskCompleteWaiter = client.get_waiter("bundle_task_complete")142 conversion_task_cancelled_waiter: ConversionTaskCancelledWaiter = client.get_waiter("conversion_task_cancelled")143 conversion_task_completed_waiter: ConversionTaskCompletedWaiter = client.get_waiter("conversion_task_completed")144 conversion_task_deleted_waiter: ConversionTaskDeletedWaiter = client.get_waiter("conversion_task_deleted")145 customer_gateway_available_waiter: CustomerGatewayAvailableWaiter = client.get_waiter("customer_gateway_available")146 export_task_cancelled_waiter: ExportTaskCancelledWaiter = client.get_waiter("export_task_cancelled")147 export_task_completed_waiter: ExportTaskCompletedWaiter = client.get_waiter("export_task_completed")148 image_available_waiter: ImageAvailableWaiter = client.get_waiter("image_available")149 image_exists_waiter: ImageExistsWaiter = client.get_waiter("image_exists")150 instance_exists_waiter: InstanceExistsWaiter = client.get_waiter("instance_exists")151 instance_running_waiter: InstanceRunningWaiter = client.get_waiter("instance_running")152 instance_status_ok_waiter: InstanceStatusOkWaiter = client.get_waiter("instance_status_ok")153 instance_stopped_waiter: InstanceStoppedWaiter = client.get_waiter("instance_stopped")154 instance_terminated_waiter: InstanceTerminatedWaiter = client.get_waiter("instance_terminated")155 key_pair_exists_waiter: KeyPairExistsWaiter = client.get_waiter("key_pair_exists")156 nat_gateway_available_waiter: NatGatewayAvailableWaiter = client.get_waiter("nat_gateway_available")157 network_interface_available_waiter: NetworkInterfaceAvailableWaiter = client.get_waiter("network_interface_available")158 password_data_available_waiter: PasswordDataAvailableWaiter = client.get_waiter("password_data_available")159 security_group_exists_waiter: SecurityGroupExistsWaiter = client.get_waiter("security_group_exists")160 snapshot_completed_waiter: SnapshotCompletedWaiter = client.get_waiter("snapshot_completed")161 spot_instance_request_fulfilled_waiter: SpotInstanceRequestFulfilledWaiter = client.get_waiter("spot_instance_request_fulfilled")162 subnet_available_waiter: SubnetAvailableWaiter = client.get_waiter("subnet_available")163 system_status_ok_waiter: SystemStatusOkWaiter = client.get_waiter("system_status_ok")164 volume_available_waiter: VolumeAvailableWaiter = client.get_waiter("volume_available")165 volume_deleted_waiter: VolumeDeletedWaiter = client.get_waiter("volume_deleted")166 volume_in_use_waiter: VolumeInUseWaiter = client.get_waiter("volume_in_use")167 vpc_available_waiter: VpcAvailableWaiter = client.get_waiter("vpc_available")168 vpc_exists_waiter: VpcExistsWaiter = client.get_waiter("vpc_exists")169 vpc_peering_connection_deleted_waiter: VpcPeeringConnectionDeletedWaiter = client.get_waiter("vpc_peering_connection_deleted")170 vpc_peering_connection_exists_waiter: VpcPeeringConnectionExistsWaiter = client.get_waiter("vpc_peering_connection_exists")171 vpn_connection_available_waiter: VpnConnectionAvailableWaiter = client.get_waiter("vpn_connection_available")172 vpn_connection_deleted_waiter: VpnConnectionDeletedWaiter = client.get_waiter("vpn_connection_deleted")173 describe_byoip_cidrs_paginator: DescribeByoipCidrsPaginator = client.get_paginator("describe_byoip_cidrs")174 describe_capacity_reservations_paginator: DescribeCapacityReservationsPaginator = client.get_paginator("describe_capacity_reservations")175 describe_carrier_gateways_paginator: DescribeCarrierGatewaysPaginator = client.get_paginator("describe_carrier_gateways")176 describe_classic_link_instances_paginator: DescribeClassicLinkInstancesPaginator = client.get_paginator("describe_classic_link_instances")177 describe_client_vpn_authorization_rules_paginator: DescribeClientVpnAuthorizationRulesPaginator = client.get_paginator("describe_client_vpn_authorization_rules")178 describe_client_vpn_connections_paginator: DescribeClientVpnConnectionsPaginator = client.get_paginator("describe_client_vpn_connections")179 describe_client_vpn_endpoints_paginator: DescribeClientVpnEndpointsPaginator = client.get_paginator("describe_client_vpn_endpoints")180 describe_client_vpn_routes_paginator: DescribeClientVpnRoutesPaginator = client.get_paginator("describe_client_vpn_routes")181 describe_client_vpn_target_networks_paginator: DescribeClientVpnTargetNetworksPaginator = client.get_paginator("describe_client_vpn_target_networks")182 describe_coip_pools_paginator: DescribeCoipPoolsPaginator = client.get_paginator("describe_coip_pools")183 describe_dhcp_options_paginator: DescribeDhcpOptionsPaginator = client.get_paginator("describe_dhcp_options")184 describe_egress_only_internet_gateways_paginator: DescribeEgressOnlyInternetGatewaysPaginator = client.get_paginator("describe_egress_only_internet_gateways")185 describe_export_image_tasks_paginator: DescribeExportImageTasksPaginator = client.get_paginator("describe_export_image_tasks")186 describe_fast_snapshot_restores_paginator: DescribeFastSnapshotRestoresPaginator = client.get_paginator("describe_fast_snapshot_restores")187 describe_fleets_paginator: DescribeFleetsPaginator = client.get_paginator("describe_fleets")188 describe_flow_logs_paginator: DescribeFlowLogsPaginator = client.get_paginator("describe_flow_logs")189 describe_fpga_images_paginator: DescribeFpgaImagesPaginator = client.get_paginator("describe_fpga_images")190 describe_host_reservation_offerings_paginator: DescribeHostReservationOfferingsPaginator = client.get_paginator("describe_host_reservation_offerings")191 describe_host_reservations_paginator: DescribeHostReservationsPaginator = client.get_paginator("describe_host_reservations")192 describe_hosts_paginator: DescribeHostsPaginator = client.get_paginator("describe_hosts")193 describe_iam_instance_profile_associations_paginator: DescribeIamInstanceProfileAssociationsPaginator = client.get_paginator("describe_iam_instance_profile_associations")194 describe_import_image_tasks_paginator: DescribeImportImageTasksPaginator = client.get_paginator("describe_import_image_tasks")195 describe_import_snapshot_tasks_paginator: DescribeImportSnapshotTasksPaginator = client.get_paginator("describe_import_snapshot_tasks")196 describe_instance_credit_specifications_paginator: DescribeInstanceCreditSpecificationsPaginator = client.get_paginator("describe_instance_credit_specifications")197 describe_instance_status_paginator: DescribeInstanceStatusPaginator = client.get_paginator("describe_instance_status")198 describe_instance_type_offerings_paginator: DescribeInstanceTypeOfferingsPaginator = client.get_paginator("describe_instance_type_offerings")199 describe_instance_types_paginator: DescribeInstanceTypesPaginator = client.get_paginator("describe_instance_types")200 describe_instances_paginator: DescribeInstancesPaginator = client.get_paginator("describe_instances")201 describe_internet_gateways_paginator: DescribeInternetGatewaysPaginator = client.get_paginator("describe_internet_gateways")202 describe_ipv6_pools_paginator: DescribeIpv6PoolsPaginator = client.get_paginator("describe_ipv6_pools")203 describe_launch_template_versions_paginator: DescribeLaunchTemplateVersionsPaginator = client.get_paginator("describe_launch_template_versions")204 describe_launch_templates_paginator: DescribeLaunchTemplatesPaginator = client.get_paginator("describe_launch_templates")205 describe_local_gateway_route_table_virtual_interface_group_associations_paginator: DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator = client.get_paginator("describe_local_gateway_route_table_virtual_interface_group_associations")206 describe_local_gateway_route_table_vpc_associations_paginator: DescribeLocalGatewayRouteTableVpcAssociationsPaginator = client.get_paginator("describe_local_gateway_route_table_vpc_associations")207 describe_local_gateway_route_tables_paginator: DescribeLocalGatewayRouteTablesPaginator = client.get_paginator("describe_local_gateway_route_tables")208 describe_local_gateway_virtual_interface_groups_paginator: DescribeLocalGatewayVirtualInterfaceGroupsPaginator = client.get_paginator("describe_local_gateway_virtual_interface_groups")209 describe_local_gateway_virtual_interfaces_paginator: DescribeLocalGatewayVirtualInterfacesPaginator = client.get_paginator("describe_local_gateway_virtual_interfaces")210 describe_local_gateways_paginator: DescribeLocalGatewaysPaginator = client.get_paginator("describe_local_gateways")211 describe_managed_prefix_lists_paginator: DescribeManagedPrefixListsPaginator = client.get_paginator("describe_managed_prefix_lists")212 describe_moving_addresses_paginator: DescribeMovingAddressesPaginator = client.get_paginator("describe_moving_addresses")213 describe_nat_gateways_paginator: DescribeNatGatewaysPaginator = client.get_paginator("describe_nat_gateways")214 describe_network_acls_paginator: DescribeNetworkAclsPaginator = client.get_paginator("describe_network_acls")215 describe_network_interface_permissions_paginator: DescribeNetworkInterfacePermissionsPaginator = client.get_paginator("describe_network_interface_permissions")216 describe_network_interfaces_paginator: DescribeNetworkInterfacesPaginator = client.get_paginator("describe_network_interfaces")217 describe_prefix_lists_paginator: DescribePrefixListsPaginator = client.get_paginator("describe_prefix_lists")218 describe_principal_id_format_paginator: DescribePrincipalIdFormatPaginator = client.get_paginator("describe_principal_id_format")219 describe_public_ipv4_pools_paginator: DescribePublicIpv4PoolsPaginator = client.get_paginator("describe_public_ipv4_pools")220 describe_reserved_instances_modifications_paginator: DescribeReservedInstancesModificationsPaginator = client.get_paginator("describe_reserved_instances_modifications")221 describe_reserved_instances_offerings_paginator: DescribeReservedInstancesOfferingsPaginator = client.get_paginator("describe_reserved_instances_offerings")222 describe_route_tables_paginator: DescribeRouteTablesPaginator = client.get_paginator("describe_route_tables")223 describe_scheduled_instance_availability_paginator: DescribeScheduledInstanceAvailabilityPaginator = client.get_paginator("describe_scheduled_instance_availability")224 describe_scheduled_instances_paginator: DescribeScheduledInstancesPaginator = client.get_paginator("describe_scheduled_instances")225 describe_security_groups_paginator: DescribeSecurityGroupsPaginator = client.get_paginator("describe_security_groups")226 describe_snapshots_paginator: DescribeSnapshotsPaginator = client.get_paginator("describe_snapshots")227 describe_spot_fleet_instances_paginator: DescribeSpotFleetInstancesPaginator = client.get_paginator("describe_spot_fleet_instances")228 describe_spot_fleet_requests_paginator: DescribeSpotFleetRequestsPaginator = client.get_paginator("describe_spot_fleet_requests")229 describe_spot_instance_requests_paginator: DescribeSpotInstanceRequestsPaginator = client.get_paginator("describe_spot_instance_requests")230 describe_spot_price_history_paginator: DescribeSpotPriceHistoryPaginator = client.get_paginator("describe_spot_price_history")231 describe_stale_security_groups_paginator: DescribeStaleSecurityGroupsPaginator = client.get_paginator("describe_stale_security_groups")232 describe_subnets_paginator: DescribeSubnetsPaginator = client.get_paginator("describe_subnets")233 describe_tags_paginator: DescribeTagsPaginator = client.get_paginator("describe_tags")234 describe_traffic_mirror_filters_paginator: DescribeTrafficMirrorFiltersPaginator = client.get_paginator("describe_traffic_mirror_filters")235 describe_traffic_mirror_sessions_paginator: DescribeTrafficMirrorSessionsPaginator = client.get_paginator("describe_traffic_mirror_sessions")236 describe_traffic_mirror_targets_paginator: DescribeTrafficMirrorTargetsPaginator = client.get_paginator("describe_traffic_mirror_targets")237 describe_transit_gateway_attachments_paginator: DescribeTransitGatewayAttachmentsPaginator = client.get_paginator("describe_transit_gateway_attachments")238 describe_transit_gateway_multicast_domains_paginator: DescribeTransitGatewayMulticastDomainsPaginator = client.get_paginator("describe_transit_gateway_multicast_domains")239 describe_transit_gateway_peering_attachments_paginator: DescribeTransitGatewayPeeringAttachmentsPaginator = client.get_paginator("describe_transit_gateway_peering_attachments")240 describe_transit_gateway_route_tables_paginator: DescribeTransitGatewayRouteTablesPaginator = client.get_paginator("describe_transit_gateway_route_tables")241 describe_transit_gateway_vpc_attachments_paginator: DescribeTransitGatewayVpcAttachmentsPaginator = client.get_paginator("describe_transit_gateway_vpc_attachments")242 describe_transit_gateways_paginator: DescribeTransitGatewaysPaginator = client.get_paginator("describe_transit_gateways")243 describe_volume_status_paginator: DescribeVolumeStatusPaginator = client.get_paginator("describe_volume_status")244 describe_volumes_paginator: DescribeVolumesPaginator = client.get_paginator("describe_volumes")245 describe_volumes_modifications_paginator: DescribeVolumesModificationsPaginator = client.get_paginator("describe_volumes_modifications")246 describe_vpc_classic_link_dns_support_paginator: DescribeVpcClassicLinkDnsSupportPaginator = client.get_paginator("describe_vpc_classic_link_dns_support")247 describe_vpc_endpoint_connection_notifications_paginator: DescribeVpcEndpointConnectionNotificationsPaginator = client.get_paginator("describe_vpc_endpoint_connection_notifications")248 describe_vpc_endpoint_connections_paginator: DescribeVpcEndpointConnectionsPaginator = client.get_paginator("describe_vpc_endpoint_connections")249 describe_vpc_endpoint_service_configurations_paginator: DescribeVpcEndpointServiceConfigurationsPaginator = client.get_paginator("describe_vpc_endpoint_service_configurations")250 describe_vpc_endpoint_service_permissions_paginator: DescribeVpcEndpointServicePermissionsPaginator = client.get_paginator("describe_vpc_endpoint_service_permissions")251 describe_vpc_endpoint_services_paginator: DescribeVpcEndpointServicesPaginator = client.get_paginator("describe_vpc_endpoint_services")252 describe_vpc_endpoints_paginator: DescribeVpcEndpointsPaginator = client.get_paginator("describe_vpc_endpoints")253 describe_vpc_peering_connections_paginator: DescribeVpcPeeringConnectionsPaginator = client.get_paginator("describe_vpc_peering_connections")254 describe_vpcs_paginator: DescribeVpcsPaginator = client.get_paginator("describe_vpcs")255 get_associated_ipv6_pool_cidrs_paginator: GetAssociatedIpv6PoolCidrsPaginator = client.get_paginator("get_associated_ipv6_pool_cidrs")256 get_groups_for_capacity_reservation_paginator: GetGroupsForCapacityReservationPaginator = client.get_paginator("get_groups_for_capacity_reservation")257 get_managed_prefix_list_associations_paginator: GetManagedPrefixListAssociationsPaginator = client.get_paginator("get_managed_prefix_list_associations")258 get_managed_prefix_list_entries_paginator: GetManagedPrefixListEntriesPaginator = client.get_paginator("get_managed_prefix_list_entries")259 get_transit_gateway_attachment_propagations_paginator: GetTransitGatewayAttachmentPropagationsPaginator = client.get_paginator("get_transit_gateway_attachment_propagations")260 get_transit_gateway_multicast_domain_associations_paginator: GetTransitGatewayMulticastDomainAssociationsPaginator = client.get_paginator("get_transit_gateway_multicast_domain_associations")261 get_transit_gateway_route_table_associations_paginator: GetTransitGatewayRouteTableAssociationsPaginator = client.get_paginator("get_transit_gateway_route_table_associations")262 get_transit_gateway_route_table_propagations_paginator: GetTransitGatewayRouteTablePropagationsPaginator = client.get_paginator("get_transit_gateway_route_table_propagations")263 search_local_gateway_routes_paginator: SearchLocalGatewayRoutesPaginator = client.get_paginator("search_local_gateway_routes")264 search_transit_gateway_multicast_groups_paginator: SearchTransitGatewayMulticastGroupsPaginator = client.get_paginator("search_transit_gateway_multicast_groups")265 ```266"""267from mypy_boto3_ec2.client import EC2Client268from mypy_boto3_ec2.paginator import (269 DescribeByoipCidrsPaginator,270 DescribeCapacityReservationsPaginator,271 DescribeCarrierGatewaysPaginator,272 DescribeClassicLinkInstancesPaginator,273 DescribeClientVpnAuthorizationRulesPaginator,274 DescribeClientVpnConnectionsPaginator,275 DescribeClientVpnEndpointsPaginator,276 DescribeClientVpnRoutesPaginator,277 DescribeClientVpnTargetNetworksPaginator,278 DescribeCoipPoolsPaginator,279 DescribeDhcpOptionsPaginator,280 DescribeEgressOnlyInternetGatewaysPaginator,281 DescribeExportImageTasksPaginator,282 DescribeFastSnapshotRestoresPaginator,283 DescribeFleetsPaginator,284 DescribeFlowLogsPaginator,285 DescribeFpgaImagesPaginator,286 DescribeHostReservationOfferingsPaginator,287 DescribeHostReservationsPaginator,288 DescribeHostsPaginator,289 DescribeIamInstanceProfileAssociationsPaginator,290 DescribeImportImageTasksPaginator,291 DescribeImportSnapshotTasksPaginator,292 DescribeInstanceCreditSpecificationsPaginator,293 DescribeInstancesPaginator,294 DescribeInstanceStatusPaginator,295 DescribeInstanceTypeOfferingsPaginator,296 DescribeInstanceTypesPaginator,297 DescribeInternetGatewaysPaginator,298 DescribeIpv6PoolsPaginator,299 DescribeLaunchTemplatesPaginator,300 DescribeLaunchTemplateVersionsPaginator,301 DescribeLocalGatewayRouteTablesPaginator,302 DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator,303 DescribeLocalGatewayRouteTableVpcAssociationsPaginator,304 DescribeLocalGatewaysPaginator,305 DescribeLocalGatewayVirtualInterfaceGroupsPaginator,306 DescribeLocalGatewayVirtualInterfacesPaginator,307 DescribeManagedPrefixListsPaginator,308 DescribeMovingAddressesPaginator,309 DescribeNatGatewaysPaginator,310 DescribeNetworkAclsPaginator,311 DescribeNetworkInterfacePermissionsPaginator,312 DescribeNetworkInterfacesPaginator,313 DescribePrefixListsPaginator,314 DescribePrincipalIdFormatPaginator,315 DescribePublicIpv4PoolsPaginator,316 DescribeReservedInstancesModificationsPaginator,317 DescribeReservedInstancesOfferingsPaginator,318 DescribeRouteTablesPaginator,319 DescribeScheduledInstanceAvailabilityPaginator,320 DescribeScheduledInstancesPaginator,321 DescribeSecurityGroupsPaginator,322 DescribeSnapshotsPaginator,323 DescribeSpotFleetInstancesPaginator,324 DescribeSpotFleetRequestsPaginator,325 DescribeSpotInstanceRequestsPaginator,326 DescribeSpotPriceHistoryPaginator,327 DescribeStaleSecurityGroupsPaginator,328 DescribeSubnetsPaginator,329 DescribeTagsPaginator,330 DescribeTrafficMirrorFiltersPaginator,331 DescribeTrafficMirrorSessionsPaginator,332 DescribeTrafficMirrorTargetsPaginator,333 DescribeTransitGatewayAttachmentsPaginator,334 DescribeTransitGatewayMulticastDomainsPaginator,335 DescribeTransitGatewayPeeringAttachmentsPaginator,336 DescribeTransitGatewayRouteTablesPaginator,337 DescribeTransitGatewaysPaginator,338 DescribeTransitGatewayVpcAttachmentsPaginator,339 DescribeVolumesModificationsPaginator,340 DescribeVolumesPaginator,341 DescribeVolumeStatusPaginator,342 DescribeVpcClassicLinkDnsSupportPaginator,343 DescribeVpcEndpointConnectionNotificationsPaginator,344 DescribeVpcEndpointConnectionsPaginator,345 DescribeVpcEndpointServiceConfigurationsPaginator,346 DescribeVpcEndpointServicePermissionsPaginator,347 DescribeVpcEndpointServicesPaginator,348 DescribeVpcEndpointsPaginator,349 DescribeVpcPeeringConnectionsPaginator,350 DescribeVpcsPaginator,351 GetAssociatedIpv6PoolCidrsPaginator,352 GetGroupsForCapacityReservationPaginator,353 GetManagedPrefixListAssociationsPaginator,354 GetManagedPrefixListEntriesPaginator,355 GetTransitGatewayAttachmentPropagationsPaginator,356 GetTransitGatewayMulticastDomainAssociationsPaginator,357 GetTransitGatewayRouteTableAssociationsPaginator,358 GetTransitGatewayRouteTablePropagationsPaginator,359 SearchLocalGatewayRoutesPaginator,360 SearchTransitGatewayMulticastGroupsPaginator,361)362from mypy_boto3_ec2.service_resource import EC2ServiceResource363from mypy_boto3_ec2.waiter import (364 BundleTaskCompleteWaiter,365 ConversionTaskCancelledWaiter,366 ConversionTaskCompletedWaiter,367 ConversionTaskDeletedWaiter,368 CustomerGatewayAvailableWaiter,369 ExportTaskCancelledWaiter,370 ExportTaskCompletedWaiter,371 ImageAvailableWaiter,372 ImageExistsWaiter,373 InstanceExistsWaiter,374 InstanceRunningWaiter,375 InstanceStatusOkWaiter,376 InstanceStoppedWaiter,377 InstanceTerminatedWaiter,378 KeyPairExistsWaiter,379 NatGatewayAvailableWaiter,380 NetworkInterfaceAvailableWaiter,381 PasswordDataAvailableWaiter,382 SecurityGroupExistsWaiter,383 SnapshotCompletedWaiter,384 SpotInstanceRequestFulfilledWaiter,385 SubnetAvailableWaiter,386 SystemStatusOkWaiter,387 VolumeAvailableWaiter,388 VolumeDeletedWaiter,389 VolumeInUseWaiter,390 VpcAvailableWaiter,391 VpcExistsWaiter,392 VpcPeeringConnectionDeletedWaiter,393 VpcPeeringConnectionExistsWaiter,394 VpnConnectionAvailableWaiter,395 VpnConnectionDeletedWaiter,396)397Client = EC2Client398ServiceResource = EC2ServiceResource399__all__ = (400 "BundleTaskCompleteWaiter",401 "Client",402 "ConversionTaskCancelledWaiter",403 "ConversionTaskCompletedWaiter",404 "ConversionTaskDeletedWaiter",405 "CustomerGatewayAvailableWaiter",406 "DescribeByoipCidrsPaginator",407 "DescribeCapacityReservationsPaginator",408 "DescribeCarrierGatewaysPaginator",409 "DescribeClassicLinkInstancesPaginator",410 "DescribeClientVpnAuthorizationRulesPaginator",411 "DescribeClientVpnConnectionsPaginator",412 "DescribeClientVpnEndpointsPaginator",413 "DescribeClientVpnRoutesPaginator",414 "DescribeClientVpnTargetNetworksPaginator",415 "DescribeCoipPoolsPaginator",416 "DescribeDhcpOptionsPaginator",417 "DescribeEgressOnlyInternetGatewaysPaginator",418 "DescribeExportImageTasksPaginator",419 "DescribeFastSnapshotRestoresPaginator",420 "DescribeFleetsPaginator",421 "DescribeFlowLogsPaginator",422 "DescribeFpgaImagesPaginator",423 "DescribeHostReservationOfferingsPaginator",424 "DescribeHostReservationsPaginator",425 "DescribeHostsPaginator",426 "DescribeIamInstanceProfileAssociationsPaginator",427 "DescribeImportImageTasksPaginator",428 "DescribeImportSnapshotTasksPaginator",429 "DescribeInstanceCreditSpecificationsPaginator",430 "DescribeInstanceStatusPaginator",431 "DescribeInstanceTypeOfferingsPaginator",432 "DescribeInstanceTypesPaginator",433 "DescribeInstancesPaginator",434 "DescribeInternetGatewaysPaginator",435 "DescribeIpv6PoolsPaginator",436 "DescribeLaunchTemplateVersionsPaginator",437 "DescribeLaunchTemplatesPaginator",438 "DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator",439 "DescribeLocalGatewayRouteTableVpcAssociationsPaginator",440 "DescribeLocalGatewayRouteTablesPaginator",441 "DescribeLocalGatewayVirtualInterfaceGroupsPaginator",442 "DescribeLocalGatewayVirtualInterfacesPaginator",443 "DescribeLocalGatewaysPaginator",444 "DescribeManagedPrefixListsPaginator",445 "DescribeMovingAddressesPaginator",446 "DescribeNatGatewaysPaginator",447 "DescribeNetworkAclsPaginator",448 "DescribeNetworkInterfacePermissionsPaginator",449 "DescribeNetworkInterfacesPaginator",450 "DescribePrefixListsPaginator",451 "DescribePrincipalIdFormatPaginator",452 "DescribePublicIpv4PoolsPaginator",453 "DescribeReservedInstancesModificationsPaginator",454 "DescribeReservedInstancesOfferingsPaginator",455 "DescribeRouteTablesPaginator",456 "DescribeScheduledInstanceAvailabilityPaginator",457 "DescribeScheduledInstancesPaginator",458 "DescribeSecurityGroupsPaginator",459 "DescribeSnapshotsPaginator",460 "DescribeSpotFleetInstancesPaginator",461 "DescribeSpotFleetRequestsPaginator",462 "DescribeSpotInstanceRequestsPaginator",463 "DescribeSpotPriceHistoryPaginator",464 "DescribeStaleSecurityGroupsPaginator",465 "DescribeSubnetsPaginator",466 "DescribeTagsPaginator",467 "DescribeTrafficMirrorFiltersPaginator",468 "DescribeTrafficMirrorSessionsPaginator",469 "DescribeTrafficMirrorTargetsPaginator",470 "DescribeTransitGatewayAttachmentsPaginator",471 "DescribeTransitGatewayMulticastDomainsPaginator",472 "DescribeTransitGatewayPeeringAttachmentsPaginator",473 "DescribeTransitGatewayRouteTablesPaginator",474 "DescribeTransitGatewayVpcAttachmentsPaginator",475 "DescribeTransitGatewaysPaginator",476 "DescribeVolumeStatusPaginator",477 "DescribeVolumesModificationsPaginator",478 "DescribeVolumesPaginator",479 "DescribeVpcClassicLinkDnsSupportPaginator",480 "DescribeVpcEndpointConnectionNotificationsPaginator",481 "DescribeVpcEndpointConnectionsPaginator",482 "DescribeVpcEndpointServiceConfigurationsPaginator",483 "DescribeVpcEndpointServicePermissionsPaginator",484 "DescribeVpcEndpointServicesPaginator",485 "DescribeVpcEndpointsPaginator",486 "DescribeVpcPeeringConnectionsPaginator",487 "DescribeVpcsPaginator",488 "EC2Client",489 "EC2ServiceResource",490 "ExportTaskCancelledWaiter",491 "ExportTaskCompletedWaiter",492 "GetAssociatedIpv6PoolCidrsPaginator",493 "GetGroupsForCapacityReservationPaginator",494 "GetManagedPrefixListAssociationsPaginator",495 "GetManagedPrefixListEntriesPaginator",496 "GetTransitGatewayAttachmentPropagationsPaginator",497 "GetTransitGatewayMulticastDomainAssociationsPaginator",498 "GetTransitGatewayRouteTableAssociationsPaginator",499 "GetTransitGatewayRouteTablePropagationsPaginator",500 "ImageAvailableWaiter",501 "ImageExistsWaiter",502 "InstanceExistsWaiter",503 "InstanceRunningWaiter",504 "InstanceStatusOkWaiter",505 "InstanceStoppedWaiter",506 "InstanceTerminatedWaiter",507 "KeyPairExistsWaiter",508 "NatGatewayAvailableWaiter",509 "NetworkInterfaceAvailableWaiter",510 "PasswordDataAvailableWaiter",511 "SearchLocalGatewayRoutesPaginator",512 "SearchTransitGatewayMulticastGroupsPaginator",513 "SecurityGroupExistsWaiter",514 "ServiceResource",515 "SnapshotCompletedWaiter",516 "SpotInstanceRequestFulfilledWaiter",517 "SubnetAvailableWaiter",518 "SystemStatusOkWaiter",519 "VolumeAvailableWaiter",520 "VolumeDeletedWaiter",521 "VolumeInUseWaiter",522 "VpcAvailableWaiter",523 "VpcExistsWaiter",524 "VpcPeeringConnectionDeletedWaiter",525 "VpcPeeringConnectionExistsWaiter",526 "VpnConnectionAvailableWaiter",527 "VpnConnectionDeletedWaiter",...

Full Screen

Full Screen

ec2_fixtures.py

Source:ec2_fixtures.py Github

copy

Full Screen

1import boto32import pytest3from moto import mock_ec24from tests.utils import random_str5@pytest.fixture6def gen_ec2_client(aws_setup):7 with mock_ec2():8 yield boto3.client("ec2")9@pytest.fixture10def gen_ec2_resource(aws_setup):11 with mock_ec2():12 yield boto3.resource("ec2")13# ============================14# WAITER15# ============================16@pytest.fixture17def gen_instance_exists_waiter(gen_ec2_client):18 return gen_ec2_client.get_waiter("instance_exists")19@pytest.fixture20def gen_bundle_task_complete_waiter(gen_ec2_client):21 return gen_ec2_client.get_waiter("bundle_task_complete")22@pytest.fixture23def gen_conversion_task_cancelled_waiter(gen_ec2_client):24 return gen_ec2_client.get_waiter("conversion_task_cancelled")25@pytest.fixture26def gen_conversion_task_completed_waiter(gen_ec2_client):27 return gen_ec2_client.get_waiter("conversion_task_completed")28@pytest.fixture29def gen_conversion_task_deleted_waiter(gen_ec2_client):30 return gen_ec2_client.get_waiter("conversion_task_deleted")31@pytest.fixture32def gen_customer_gateway_available_waiter(gen_ec2_client):33 return gen_ec2_client.get_waiter("customer_gateway_available")34@pytest.fixture35def gen_export_task_cancelled_waiter(gen_ec2_client):36 return gen_ec2_client.get_waiter("export_task_cancelled")37@pytest.fixture38def gen_export_task_completed_waiter(gen_ec2_client):39 return gen_ec2_client.get_waiter("export_task_completed")40@pytest.fixture41def gen_image_exists_waiter(gen_ec2_client):42 return gen_ec2_client.get_waiter("image_exists")43@pytest.fixture44def gen_image_available_waiter(gen_ec2_client):45 return gen_ec2_client.get_waiter("image_available")46@pytest.fixture47def gen_instance_running_waiter(gen_ec2_client):48 return gen_ec2_client.get_waiter("instance_running")49@pytest.fixture50def gen_instance_status_ok_waiter(gen_ec2_client):51 return gen_ec2_client.get_waiter("instance_status_ok")52@pytest.fixture53def gen_instance_stopped_waiter(gen_ec2_client):54 return gen_ec2_client.get_waiter("instance_stopped")55@pytest.fixture56def gen_instance_terminated_waiter(gen_ec2_client):57 return gen_ec2_client.get_waiter("instance_terminated")58@pytest.fixture59def gen_key_pair_exists_waiter(gen_ec2_client):60 return gen_ec2_client.get_waiter("key_pair_exists")61@pytest.fixture62def gen_nat_gateway_available_waiter(gen_ec2_client):63 return gen_ec2_client.get_waiter("nat_gateway_available")64@pytest.fixture65def gen_network_interface_available_waiter(gen_ec2_client):66 return gen_ec2_client.get_waiter("network_interface_available")67@pytest.fixture68def gen_password_data_available_waiter(gen_ec2_client):69 return gen_ec2_client.get_waiter("password_data_available")70@pytest.fixture71def gen_snapshot_completed_waiter(gen_ec2_client):72 return gen_ec2_client.get_waiter("snapshot_completed")73@pytest.fixture74def gen_security_group_exists_waiter(gen_ec2_client):75 return gen_ec2_client.get_waiter("security_group_exists")76@pytest.fixture77def gen_spot_instance_request_fulfilled_waiter(gen_ec2_client):78 return gen_ec2_client.get_waiter("spot_instance_request_fulfilled")79@pytest.fixture80def gen_subnet_available_waiter(gen_ec2_client):81 return gen_ec2_client.get_waiter("subnet_available")82@pytest.fixture83def gen_system_status_ok_waiter(gen_ec2_client):84 return gen_ec2_client.get_waiter("system_status_ok")85@pytest.fixture86def gen_volume_available_waiter(gen_ec2_client):87 return gen_ec2_client.get_waiter("volume_available")88@pytest.fixture89def gen_volume_deleted_waiter(gen_ec2_client):90 return gen_ec2_client.get_waiter("volume_deleted")91@pytest.fixture92def gen_volume_in_use_waiter(gen_ec2_client):93 return gen_ec2_client.get_waiter("volume_in_use")94@pytest.fixture95def gen_vpc_available_waiter(gen_ec2_client):96 return gen_ec2_client.get_waiter("vpc_available")97@pytest.fixture98def gen_vpc_exists_waiter(gen_ec2_client):99 return gen_ec2_client.get_waiter("vpc_exists")100@pytest.fixture101def gen_vpn_connection_available_waiter(gen_ec2_client):102 return gen_ec2_client.get_waiter("vpn_connection_available")103@pytest.fixture104def gen_vpn_connection_deleted_waiter(gen_ec2_client):105 return gen_ec2_client.get_waiter("vpn_connection_deleted")106@pytest.fixture107def gen_vpc_peering_connection_exists_waiter(gen_ec2_client):108 return gen_ec2_client.get_waiter("vpc_peering_connection_exists")109@pytest.fixture110def gen_vpc_peering_connection_deleted_waiter(gen_ec2_client):111 return gen_ec2_client.get_waiter("vpc_peering_connection_deleted")112# ============================113# PAGINATOR114# ============================115@pytest.fixture116def gen_describe_route_tables_paginator(gen_ec2_client):117 return gen_ec2_client.get_paginator("describe_route_tables")118@pytest.fixture119def gen_describe_iam_instance_profile_associations_paginator(gen_ec2_client):120 return gen_ec2_client.get_paginator("describe_iam_instance_profile_associations")121@pytest.fixture122def gen_describe_instance_status_paginator(gen_ec2_client):123 return gen_ec2_client.get_paginator("describe_instance_status")124@pytest.fixture125def gen_describe_instances_paginator(gen_ec2_client):126 return gen_ec2_client.get_paginator("describe_instances")127@pytest.fixture128def gen_describe_reserved_instances_offerings_paginator(gen_ec2_client):129 return gen_ec2_client.get_paginator("describe_reserved_instances_offerings")130@pytest.fixture131def gen_describe_reserved_instances_modifications_paginator(gen_ec2_client):132 return gen_ec2_client.get_paginator("describe_reserved_instances_modifications")133@pytest.fixture134def gen_describe_security_groups_paginator(gen_ec2_client):135 return gen_ec2_client.get_paginator("describe_security_groups")136@pytest.fixture137def gen_describe_snapshots_paginator(gen_ec2_client):138 return gen_ec2_client.get_paginator("describe_snapshots")139@pytest.fixture140def gen_describe_spot_fleet_instances_paginator(gen_ec2_client):141 return gen_ec2_client.get_paginator("describe_spot_fleet_instances")142@pytest.fixture143def gen_describe_spot_fleet_requests_paginator(gen_ec2_client):144 return gen_ec2_client.get_paginator("describe_spot_fleet_requests")145@pytest.fixture146def gen_describe_spot_price_history_paginator(gen_ec2_client):147 return gen_ec2_client.get_paginator("describe_spot_price_history")148@pytest.fixture149def gen_describe_tags_paginator(gen_ec2_client):150 return gen_ec2_client.get_paginator("describe_tags")151@pytest.fixture152def gen_describe_volume_status_paginator(gen_ec2_client):153 return gen_ec2_client.get_paginator("describe_volume_status")154@pytest.fixture155def gen_describe_volumes_paginator(gen_ec2_client):156 return gen_ec2_client.get_paginator("describe_volumes")157@pytest.fixture158def gen_describe_nat_gateways_paginator(gen_ec2_client):159 return gen_ec2_client.get_paginator("describe_nat_gateways")160@pytest.fixture161def gen_describe_network_interfaces_paginator(gen_ec2_client):162 return gen_ec2_client.get_paginator("describe_network_interfaces")163@pytest.fixture164def gen_describe_vpc_endpoints_paginator(gen_ec2_client):165 return gen_ec2_client.get_paginator("describe_vpc_endpoints")166@pytest.fixture167def gen_describe_vpc_endpoint_services_paginator(gen_ec2_client):168 return gen_ec2_client.get_paginator("describe_vpc_endpoint_services")169@pytest.fixture170def gen_describe_vpc_endpoint_connections_paginator(gen_ec2_client):171 return gen_ec2_client.get_paginator("describe_vpc_endpoint_connections")172@pytest.fixture173def gen_describe_byoip_cidrs_paginator(gen_ec2_client):174 return gen_ec2_client.get_paginator("describe_byoip_cidrs")175@pytest.fixture176def gen_describe_capacity_reservations_paginator(gen_ec2_client):177 return gen_ec2_client.get_paginator("describe_capacity_reservations")178@pytest.fixture179def gen_describe_classic_link_instances_paginator(gen_ec2_client):180 return gen_ec2_client.get_paginator("describe_classic_link_instances")181@pytest.fixture182def gen_describe_client_vpn_authorization_rules_paginator(gen_ec2_client):183 return gen_ec2_client.get_paginator("describe_client_vpn_authorization_rules")184@pytest.fixture185def gen_describe_client_vpn_connections_paginator(gen_ec2_client):186 return gen_ec2_client.get_paginator("describe_client_vpn_connections")187@pytest.fixture188def gen_describe_client_vpn_endpoints_paginator(gen_ec2_client):189 return gen_ec2_client.get_paginator("describe_client_vpn_endpoints")190@pytest.fixture191def gen_describe_client_vpn_routes_paginator(gen_ec2_client):192 return gen_ec2_client.get_paginator("describe_client_vpn_routes")193@pytest.fixture194def gen_describe_client_vpn_target_networks_paginator(gen_ec2_client):195 return gen_ec2_client.get_paginator("describe_client_vpn_target_networks")196@pytest.fixture197def gen_describe_egress_only_internet_gateways_paginator(gen_ec2_client):198 return gen_ec2_client.get_paginator("describe_egress_only_internet_gateways")199@pytest.fixture200def gen_describe_fleets_paginator(gen_ec2_client):201 return gen_ec2_client.get_paginator("describe_fleets")202@pytest.fixture203def gen_describe_flow_logs_paginator(gen_ec2_client):204 return gen_ec2_client.get_paginator("describe_flow_logs")205@pytest.fixture206def gen_describe_fpga_images_paginator(gen_ec2_client):207 return gen_ec2_client.get_paginator("describe_fpga_images")208@pytest.fixture209def gen_describe_host_reservation_offerings_paginator(gen_ec2_client):210 return gen_ec2_client.get_paginator("describe_host_reservation_offerings")211@pytest.fixture212def gen_describe_host_reservations_paginator(gen_ec2_client):213 return gen_ec2_client.get_paginator("describe_host_reservations")214@pytest.fixture215def gen_describe_hosts_paginator(gen_ec2_client):216 return gen_ec2_client.get_paginator("describe_hosts")217@pytest.fixture218def gen_describe_import_image_tasks_paginator(gen_ec2_client):219 return gen_ec2_client.get_paginator("describe_import_image_tasks")220@pytest.fixture221def gen_describe_import_snapshot_tasks_paginator(gen_ec2_client):222 return gen_ec2_client.get_paginator("describe_import_snapshot_tasks")223@pytest.fixture224def gen_describe_instance_credit_specifications_paginator(gen_ec2_client):225 return gen_ec2_client.get_paginator("describe_instance_credit_specifications")226@pytest.fixture227def gen_describe_launch_template_versions_paginator(gen_ec2_client):228 return gen_ec2_client.get_paginator("describe_launch_template_versions")229@pytest.fixture230def gen_describe_launch_templates_paginator(gen_ec2_client):231 return gen_ec2_client.get_paginator("describe_launch_templates")232@pytest.fixture233def gen_describe_moving_addresses_paginator(gen_ec2_client):234 return gen_ec2_client.get_paginator("describe_moving_addresses")235@pytest.fixture236def gen_describe_network_interface_permissions_paginator(gen_ec2_client):237 return gen_ec2_client.get_paginator("describe_network_interface_permissions")238@pytest.fixture239def gen_describe_prefix_lists_paginator(gen_ec2_client):240 return gen_ec2_client.get_paginator("describe_prefix_lists")241@pytest.fixture242def gen_describe_principal_id_format_paginator(gen_ec2_client):243 return gen_ec2_client.get_paginator("describe_principal_id_format")244@pytest.fixture245def gen_describe_public_ipv4_pools_paginator(gen_ec2_client):246 return gen_ec2_client.get_paginator("describe_public_ipv4_pools")247@pytest.fixture248def gen_describe_scheduled_instance_availability_paginator(gen_ec2_client):249 return gen_ec2_client.get_paginator("describe_scheduled_instance_availability")250@pytest.fixture251def gen_describe_scheduled_instances_paginator(gen_ec2_client):252 return gen_ec2_client.get_paginator("describe_scheduled_instances")253@pytest.fixture254def gen_describe_stale_security_groups_paginator(gen_ec2_client):255 return gen_ec2_client.get_paginator("describe_stale_security_groups")256@pytest.fixture257def gen_describe_transit_gateway_attachments_paginator(gen_ec2_client):258 return gen_ec2_client.get_paginator("describe_transit_gateway_attachments")259@pytest.fixture260def gen_describe_transit_gateway_route_tables_paginator(gen_ec2_client):261 return gen_ec2_client.get_paginator("describe_transit_gateway_route_tables")262@pytest.fixture263def gen_describe_transit_gateway_vpc_attachments_paginator(gen_ec2_client):264 return gen_ec2_client.get_paginator("describe_transit_gateway_vpc_attachments")265@pytest.fixture266def gen_describe_transit_gateways_paginator(gen_ec2_client):267 return gen_ec2_client.get_paginator("describe_transit_gateways")268@pytest.fixture269def gen_describe_volumes_modifications_paginator(gen_ec2_client):270 return gen_ec2_client.get_paginator("describe_volumes_modifications")271@pytest.fixture272def gen_describe_vpc_classic_link_dns_support_paginator(gen_ec2_client):273 return gen_ec2_client.get_paginator("describe_vpc_classic_link_dns_support")274@pytest.fixture275def gen_describe_vpc_endpoint_connection_notifications_paginator(gen_ec2_client):276 return gen_ec2_client.get_paginator(277 "describe_vpc_endpoint_connection_notifications"278 )279@pytest.fixture280def gen_describe_vpc_endpoint_service_configurations_paginator(gen_ec2_client):281 return gen_ec2_client.get_paginator("describe_vpc_endpoint_service_configurations")282@pytest.fixture283def gen_describe_vpc_endpoint_service_permissions_paginator(gen_ec2_client):284 return gen_ec2_client.get_paginator("describe_vpc_endpoint_service_permissions")285@pytest.fixture286def gen_describe_vpc_peering_connections_paginator(gen_ec2_client):287 return gen_ec2_client.get_paginator("describe_vpc_peering_connections")288@pytest.fixture289def gen_get_transit_gateway_attachment_propagations_paginator(gen_ec2_client):290 return gen_ec2_client.get_paginator("get_transit_gateway_attachment_propagations")291@pytest.fixture292def gen_get_transit_gateway_route_table_associations_paginator(gen_ec2_client):293 return gen_ec2_client.get_paginator("get_transit_gateway_route_table_associations")294@pytest.fixture295def gen_get_transit_gateway_route_table_propagations_paginator(gen_ec2_client):296 return gen_ec2_client.get_paginator("get_transit_gateway_route_table_propagations")297@pytest.fixture298def gen_describe_internet_gateways_paginator(gen_ec2_client):299 return gen_ec2_client.get_paginator("describe_internet_gateways")300@pytest.fixture301def gen_describe_network_acls_paginator(gen_ec2_client):302 return gen_ec2_client.get_paginator("describe_network_acls")303@pytest.fixture304def gen_describe_vpcs_paginator(gen_ec2_client):305 return gen_ec2_client.get_paginator("describe_vpcs")306@pytest.fixture307def gen_describe_spot_instance_requests_paginator(gen_ec2_client):308 return gen_ec2_client.get_paginator("describe_spot_instance_requests")309@pytest.fixture310def gen_describe_dhcp_options_paginator(gen_ec2_client):311 return gen_ec2_client.get_paginator("describe_dhcp_options")312@pytest.fixture313def gen_describe_subnets_paginator(gen_ec2_client):314 return gen_ec2_client.get_paginator("describe_subnets")315@pytest.fixture316def gen_describe_traffic_mirror_filters_paginator(gen_ec2_client):317 return gen_ec2_client.get_paginator("describe_traffic_mirror_filters")318@pytest.fixture319def gen_describe_traffic_mirror_sessions_paginator(gen_ec2_client):320 return gen_ec2_client.get_paginator("describe_traffic_mirror_sessions")321@pytest.fixture322def gen_describe_traffic_mirror_targets_paginator(gen_ec2_client):323 return gen_ec2_client.get_paginator("describe_traffic_mirror_targets")324@pytest.fixture325def gen_describe_export_image_tasks_paginator(gen_ec2_client):326 return gen_ec2_client.get_paginator("describe_export_image_tasks")327@pytest.fixture328def gen_describe_fast_snapshot_restores_paginator(gen_ec2_client):329 return gen_ec2_client.get_paginator("describe_fast_snapshot_restores")330@pytest.fixture331def gen_describe_ipv6_pools_paginator(gen_ec2_client):332 return gen_ec2_client.get_paginator("describe_ipv6_pools")333@pytest.fixture334def gen_get_associated_ipv6_pool_cidrs_paginator(gen_ec2_client):335 return gen_ec2_client.get_paginator("get_associated_ipv6_pool_cidrs")336@pytest.fixture337def gen_describe_coip_pools_paginator(gen_ec2_client):338 return gen_ec2_client.get_paginator("describe_coip_pools")339@pytest.fixture340def gen_describe_instance_type_offerings_paginator(gen_ec2_client):341 return gen_ec2_client.get_paginator("describe_instance_type_offerings")342@pytest.fixture343def gen_describe_instance_types_paginator(gen_ec2_client):344 return gen_ec2_client.get_paginator("describe_instance_types")345@pytest.fixture346def gen_describe_local_gateway_route_table_virtual_interface_group_associations_paginator(347 gen_ec2_client,348):349 return gen_ec2_client.get_paginator(350 "describe_local_gateway_route_table_virtual_interface_group_associations"351 )352@pytest.fixture353def gen_describe_local_gateway_route_table_vpc_associations_paginator(gen_ec2_client):354 return gen_ec2_client.get_paginator(355 "describe_local_gateway_route_table_vpc_associations"356 )357@pytest.fixture358def gen_describe_local_gateway_route_tables_paginator(gen_ec2_client):359 return gen_ec2_client.get_paginator("describe_local_gateway_route_tables")360@pytest.fixture361def gen_describe_local_gateway_virtual_interface_groups_paginator(gen_ec2_client):362 return gen_ec2_client.get_paginator(363 "describe_local_gateway_virtual_interface_groups"364 )365@pytest.fixture366def gen_describe_local_gateway_virtual_interfaces_paginator(gen_ec2_client):367 return gen_ec2_client.get_paginator("describe_local_gateway_virtual_interfaces")368@pytest.fixture369def gen_describe_local_gateways_paginator(gen_ec2_client):370 return gen_ec2_client.get_paginator("describe_local_gateways")371@pytest.fixture372def gen_describe_transit_gateway_multicast_domains_paginator(gen_ec2_client):373 return gen_ec2_client.get_paginator("describe_transit_gateway_multicast_domains")374@pytest.fixture375def gen_describe_transit_gateway_peering_attachments_paginator(gen_ec2_client):376 return gen_ec2_client.get_paginator("describe_transit_gateway_peering_attachments")377@pytest.fixture378def gen_get_transit_gateway_multicast_domain_associations_paginator(gen_ec2_client):379 return gen_ec2_client.get_paginator(380 "get_transit_gateway_multicast_domain_associations"381 )382@pytest.fixture383def gen_search_local_gateway_routes_paginator(gen_ec2_client):384 return gen_ec2_client.get_paginator("search_local_gateway_routes")385@pytest.fixture386def gen_search_transit_gateway_multicast_groups_paginator(gen_ec2_client):387 return gen_ec2_client.get_paginator("search_transit_gateway_multicast_groups")388@pytest.fixture389def gen_describe_managed_prefix_lists_paginator(gen_ec2_client):390 return gen_ec2_client.get_paginator("describe_managed_prefix_lists")391@pytest.fixture392def gen_get_managed_prefix_list_associations_paginator(gen_ec2_client):393 return gen_ec2_client.get_paginator("get_managed_prefix_list_associations")394@pytest.fixture395def gen_get_managed_prefix_list_entries_paginator(gen_ec2_client):396 return gen_ec2_client.get_paginator("get_managed_prefix_list_entries")397@pytest.fixture398def gen_get_groups_for_capacity_reservation_paginator(gen_ec2_client):399 return gen_ec2_client.get_paginator("get_groups_for_capacity_reservation")400@pytest.fixture401def gen_describe_carrier_gateways_paginator(gen_ec2_client):402 return gen_ec2_client.get_paginator("describe_carrier_gateways")403@pytest.fixture404def gen_get_transit_gateway_prefix_list_references_paginator(gen_ec2_client):405 return gen_ec2_client.get_paginator("get_transit_gateway_prefix_list_references")406@pytest.fixture407def gen_describe_network_insights_analyses_paginator(gen_ec2_client):408 return gen_ec2_client.get_paginator("describe_network_insights_analyses")409@pytest.fixture410def gen_describe_network_insights_paths_paginator(gen_ec2_client):411 return gen_ec2_client.get_paginator("describe_network_insights_paths")412@pytest.fixture413def gen_describe_transit_gateway_connect_peers_paginator(gen_ec2_client):414 return gen_ec2_client.get_paginator("describe_transit_gateway_connect_peers")415@pytest.fixture416def gen_describe_transit_gateway_connects_paginator(gen_ec2_client):417 return gen_ec2_client.get_paginator("describe_transit_gateway_connects")418@pytest.fixture419def gen_describe_addresses_attribute_paginator(gen_ec2_client):420 return gen_ec2_client.get_paginator("describe_addresses_attribute")421@pytest.fixture422def gen_describe_replace_root_volume_tasks_paginator(gen_ec2_client):423 return gen_ec2_client.get_paginator("describe_replace_root_volume_tasks")424@pytest.fixture425def gen_describe_store_image_tasks_paginator(gen_ec2_client):426 return gen_ec2_client.get_paginator("describe_store_image_tasks")427@pytest.fixture428def gen_describe_security_group_rules_paginator(gen_ec2_client):429 return gen_ec2_client.get_paginator("describe_security_group_rules")430@pytest.fixture431def gen_describe_instance_event_windows_paginator(gen_ec2_client):432 return gen_ec2_client.get_paginator("describe_instance_event_windows")433@pytest.fixture434def gen_describe_trunk_interface_associations_paginator(gen_ec2_client):435 return gen_ec2_client.get_paginator("describe_trunk_interface_associations")436@pytest.fixture437def gen_get_vpn_connection_device_types_paginator(gen_ec2_client):438 return gen_ec2_client.get_paginator("get_vpn_connection_device_types")439@pytest.fixture440def gen_describe_capacity_reservation_fleets_paginator(gen_ec2_client):441 return gen_ec2_client.get_paginator("describe_capacity_reservation_fleets")442@pytest.fixture443def gen_get_instance_types_from_instance_requirements_paginator(gen_ec2_client):444 return gen_ec2_client.get_paginator("get_instance_types_from_instance_requirements")445@pytest.fixture446def gen_get_spot_placement_scores_paginator(gen_ec2_client):447 return gen_ec2_client.get_paginator("get_spot_placement_scores")448# ============================449# RESOURCES450# ============================451@pytest.fixture452def gen_classic_address(gen_ec2_resource):453 return gen_ec2_resource.ClassicAddress(random_str())454@pytest.fixture455def gen_dhcp_options(gen_ec2_resource):456 return gen_ec2_resource.DhcpOptions(random_str())457@pytest.fixture458def gen_image(gen_ec2_resource):459 return gen_ec2_resource.Image(random_str())460@pytest.fixture461def gen_instance(gen_ec2_resource):462 return gen_ec2_resource.Instance(random_str())463@pytest.fixture464def gen_internet_gateway(gen_ec2_resource):465 return gen_ec2_resource.InternetGateway(random_str())466@pytest.fixture467def gen_key_pair(gen_ec2_resource):468 return gen_ec2_resource.KeyPair(random_str())469@pytest.fixture470def gen_network_acl(gen_ec2_resource):471 return gen_ec2_resource.NetworkAcl(random_str())472@pytest.fixture473def gen_network_interface(gen_ec2_resource):474 return gen_ec2_resource.NetworkInterface(random_str())475@pytest.fixture476def gen_network_interface_association(gen_ec2_resource):477 return gen_ec2_resource.NetworkInterfaceAssociation(random_str())478@pytest.fixture479def gen_placement_group(gen_ec2_resource):480 return gen_ec2_resource.PlacementGroup(random_str())481@pytest.fixture482def gen_route(gen_ec2_resource):483 return gen_ec2_resource.Route(random_str(), random_str())484@pytest.fixture485def gen_route_table(gen_ec2_resource):486 return gen_ec2_resource.RouteTable(random_str())487@pytest.fixture488def gen_route_table_association(gen_ec2_resource):489 return gen_ec2_resource.RouteTableAssociation(random_str())490@pytest.fixture491def gen_security_group(gen_ec2_resource):492 return gen_ec2_resource.SecurityGroup(random_str())493@pytest.fixture494def gen_snapshot(gen_ec2_resource):495 return gen_ec2_resource.Snapshot(random_str())496@pytest.fixture497def gen_subnet(gen_ec2_resource):498 return gen_ec2_resource.Subnet(random_str())499@pytest.fixture500def gen_tag(gen_ec2_resource):501 return gen_ec2_resource.Tag(random_str(), random_str(), random_str())502@pytest.fixture503def gen_volume(gen_ec2_resource):504 return gen_ec2_resource.Volume(random_str())505@pytest.fixture506def gen_vpc(gen_ec2_resource):507 return gen_ec2_resource.Vpc(random_str())508@pytest.fixture509def gen_vpc_peering_connection(gen_ec2_resource):510 return gen_ec2_resource.VpcPeeringConnection(random_str())511@pytest.fixture512def gen_vpc_address(gen_ec2_resource):513 return gen_ec2_resource.VpcAddress(random_str())514# ============================515# COLLECTIONS516# ============================517@pytest.fixture518def gen_service_resource_classic_addresses_collection(gen_ec2_resource):519 return gen_ec2_resource.classic_addresses.all()520@pytest.fixture521def gen_service_resource_dhcp_options_sets_collection(gen_ec2_resource):522 return gen_ec2_resource.dhcp_options_sets.all()523@pytest.fixture524def gen_service_resource_images_collection(gen_ec2_resource):525 return gen_ec2_resource.images.all()526@pytest.fixture527def gen_service_resource_instances_collection(gen_ec2_resource):528 return gen_ec2_resource.instances.all()529@pytest.fixture530def gen_service_resource_internet_gateways_collection(gen_ec2_resource):531 return gen_ec2_resource.internet_gateways.all()532@pytest.fixture533def gen_service_resource_key_pairs_collection(gen_ec2_resource):534 return gen_ec2_resource.key_pairs.all()535@pytest.fixture536def gen_service_resource_network_acls_collection(gen_ec2_resource):537 return gen_ec2_resource.network_acls.all()538@pytest.fixture539def gen_service_resource_network_interfaces_collection(gen_ec2_resource):540 return gen_ec2_resource.network_interfaces.all()541@pytest.fixture542def gen_service_resource_placement_groups_collection(gen_ec2_resource):543 return gen_ec2_resource.placement_groups.all()544@pytest.fixture545def gen_service_resource_route_tables_collection(gen_ec2_resource):546 return gen_ec2_resource.route_tables.all()547@pytest.fixture548def gen_service_resource_security_groups_collection(gen_ec2_resource):549 return gen_ec2_resource.security_groups.all()550@pytest.fixture551def gen_service_resource_snapshots_collection(gen_ec2_resource):552 return gen_ec2_resource.snapshots.all()553@pytest.fixture554def gen_service_resource_subnets_collection(gen_ec2_resource):555 return gen_ec2_resource.subnets.all()556@pytest.fixture557def gen_service_resource_volumes_collection(gen_ec2_resource):558 return gen_ec2_resource.volumes.all()559@pytest.fixture560def gen_service_resource_vpc_addresses_collection(gen_ec2_resource):561 return gen_ec2_resource.vpc_addresses.all()562@pytest.fixture563def gen_service_resource_vpc_peering_connections_collection(gen_ec2_resource):564 return gen_ec2_resource.vpc_peering_connections.all()565@pytest.fixture566def gen_service_resource_vpcs_collection(gen_ec2_resource):567 return gen_ec2_resource.vpcs.all()568@pytest.fixture569def gen_instance_volumes_collection(gen_instance):570 return gen_instance.volumes.all()571@pytest.fixture572def gen_instance_vpc_addresses_collection(gen_instance):573 return gen_instance.vpc_addresses.all()574@pytest.fixture575def gen_placement_group_instances_collection(gen_placement_group):576 return gen_placement_group.instances.all()577@pytest.fixture578def gen_subnet_instances_collection(gen_subnet):579 return gen_subnet.instances.all()580@pytest.fixture581def gen_subnet_network_interfaces_collection(gen_subnet):582 return gen_subnet.network_interfaces.all()583@pytest.fixture584def gen_volume_snapshots_collection(gen_volume):585 return gen_volume.snapshots.all()586@pytest.fixture587def gen_vpc_accepted_vpc_peering_connections_collection(gen_vpc):588 return gen_vpc.accepted_vpc_peering_connections.all()589@pytest.fixture590def gen_vpc_instances_collection(gen_vpc):591 return gen_vpc.instances.all()592@pytest.fixture593def gen_vpc_internet_gateways_collection(gen_vpc):594 return gen_vpc.internet_gateways.all()595@pytest.fixture596def gen_vpc_network_acls_collection(gen_vpc):597 return gen_vpc.network_acls.all()598@pytest.fixture599def gen_vpc_network_interfaces_collection(gen_vpc):600 return gen_vpc.network_interfaces.all()601@pytest.fixture602def gen_vpc_requested_vpc_peering_connections_collection(gen_vpc):603 return gen_vpc.requested_vpc_peering_connections.all()604@pytest.fixture605def gen_vpc_route_tables_collection(gen_vpc):606 return gen_vpc.route_tables.all()607@pytest.fixture608def gen_vpc_security_groups_collection(gen_vpc):609 return gen_vpc.security_groups.all()610@pytest.fixture611def gen_vpc_subnets_collection(gen_vpc):...

Full Screen

Full Screen

fetch.py

Source:fetch.py Github

copy

Full Screen

1import logging2import os3from pathlib import Path4import time5from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple6import yaml7import botocore.exceptions8from botocore.session import Session as Boto9from introspector.error import GFInternal10from introspector.models.raw_import import ERROR_KEY11_log = logging.getLogger(__name__)12_THIS_DIR: Path = Path(os.path.dirname(__file__))13KeyFilter = Callable[[str], bool]14class ClientProxy(object):15 def __init__(self, client, service: str):16 self._client = client17 self._patch_client()18 self._service = service19 @property20 def _is_gov(self) -> bool:21 return '-gov-' in self._client.meta.region_name22 def _patch_client(self):23 pass24 def _should_import(self, key: str) -> bool:25 return True26 def resource_names(self) -> Iterator[str]:27 return filter(self._should_import, dir(self._client))28 def _list_args(self, key: str) -> Dict:29 return {}30 def _paginate_args(self, key: str) -> Dict:31 return {}32 def canonical_name(self, py_name: str) -> str:33 return self._client.meta.method_to_api_mapping[py_name]34 def _map_error_code(self, code: str, resource_name: str) -> Optional[str]:35 return None36 def list(self, key: str, kwargs,37 retry_on_throttle) -> Optional[Tuple[str, Any]]:38 prefix = len(key.split('_')[0])39 resource_name = self._client._PY_TO_OP_NAME[key][prefix:]40 extra_kwargs = dict(self._list_args(key), **kwargs)41 try:42 if self._client.can_paginate(key):43 paginator = self._client.get_paginator(key)44 method_args = dict(self._paginate_args(key), **extra_kwargs)45 iterator = paginator.paginate(**method_args)46 result = iterator.build_full_result()47 else:48 op = self._client.meta.method_to_api_mapping[key]49 op_model = self._client.meta.service_model.operation_model(op)50 output = op_model.output_shape51 attr = getattr(self._client, key)52 full_result = attr(**extra_kwargs)53 result = {54 result_key: full_result[result_key]55 for result_key in output.members.keys()56 if result_key in full_result57 }58 return resource_name, result59 except KeyError as e:60 raise GFInternal(61 f'Pagination Exception raise {self._client._PY_TO_OP_NAME[key]}')62 except botocore.exceptions.ParamValidationError as e:63 # TODO: fix this64 _log.debug(f'{key} Needs param input {str(e)}')65 return resource_name, {ERROR_KEY: 'needs param input'}66 except botocore.exceptions.ClientError as e:67 code = e.response.get('Error', {}).get('Code')68 if code == 'UnsupportedOperation':69 _log.info(f'{resource_name} Not supported in this region')70 return resource_name, {ERROR_KEY: 'unsupported in region'}71 elif code == 'MissingParameter':72 return resource_name, {ERROR_KEY: 'missing parameter'}73 elif code == 'OptInRequired':74 return resource_name, {ERROR_KEY: 'missing opt-in'}75 elif code in ('AuthFailure', 'AccessDeniedException',76 'UnauthorizedOperation', 'AccessDenied'):77 _log.warn(f'Missing permissions for {self._service} {key}')78 return resource_name, {ERROR_KEY: 'auth failure'}79 elif code == 'InvalidClientTokenId':80 return resource_name, {ERROR_KEY: 'invalid token'}81 elif code is not None and code.startswith('NoSuch'):82 # No results, return nothing83 return None84 elif code == 'Throttling' or code == 'ThrottlingException':85 if retry_on_throttle:86 _log.warn(f'Throttled for {key}, retrying')87 time.sleep(3)88 return self.list(key, kwargs, retry_on_throttle=False)89 else:90 _log.error(f'Throttled for {key}, not retrying')91 raise e92 else:93 mapped = self._map_error_code(code, resource_name)94 if mapped is not None:95 return resource_name, {ERROR_KEY: mapped}96 raise e97 def get(self, key: str, kwargs):98 try:99 api_call = getattr(self._client, key)100 full_result = api_call(**kwargs)101 op = self._client.meta.method_to_api_mapping[key]102 op_model = self._client.meta.service_model.operation_model(op)103 output = op_model.output_shape104 attr_result = {}105 saw_result = False106 for result_key in output.members.keys():107 value = full_result.get(result_key)108 if value is not None:109 saw_result = True110 attr_result[result_key] = value111 if saw_result:112 return attr_result113 except botocore.exceptions.ClientError as e:114 error = e.response.get('Error', {}).get('Code', '')115 if error.startswith('NoSuch') \116 or error.endswith('NotFoundError') \117 or error.endswith('NotFound') \118 or error == 'ResourceNotFoundException':119 # No results, nothing to return120 return None121 elif error in ('AuthFailure', 'MethodNotAllowed',122 'AccessDeniedException', 'AccessDenied'):123 # Auth failure124 _log.warn(f'Missing permissions for {self._service} {key}')125 else:126 raise e127class EC2ClientProxy(ClientProxy):128 MISSING_PAGINATION = {129 'describe_coip_pools':130 'PoolIds',131 'describe_elastic_gpus':132 'ElasticGpuSet',133 'describe_instance_type_offerings':134 'InstanceTypeOfferings',135 'describe_local_gateway_route_table_virtual_interface_group_associations':136 'LocalGatewayRouteTableVirtualInterfaceGroupAssociationIds',137 'describe_local_gateway_route_table_vpc_associations':138 'LocalGatewayRouteTableVpcAssociations',139 'describe_local_gateway_route_tables':140 'LocalGatewayRouteTableSet',141 'describe_local_gateway_virtual_interface_groups':142 'LocalGatewayVirtualInterfaceGroups',143 'describe_local_gateway_virtual_interfaces':144 'LocalGatewayVirtualInterfaces',145 'describe_local_gateways':146 'LocalGateways',147 'describe_transit_gateway_peering_attachments':148 'TransitGatewayPeeringAttachments',149 'describe_instance_types':150 'InstanceTypes',151 'describe_transit_gateway_multicast_domains':152 'TransitGatewayMulticastDomains'153 }154 SKIPLIST = [155 'describe_reserved_instances_offerings',156 # unsupported157 'describe_transit_gateway_connect_peers',158 'describe_transit_gateway_connects',159 'describe_spot_price_history',160 # Describes services that *can* have VPC endpoints, not ones that do161 'describe_vpc_endpoint_services',162 # TODO: verify this, i think it's about regional support for long ids163 'describe_aggregate_id_format',164 # TODO: look into this165 'describe_moving_addresses',166 # Failing in some cases, and we don't map167 'describe_id_format',168 # not needed, it's on most return values169 'describe_tags',170 # Not top level171 'describe_instance_attribute'172 ]173 GOV_SKIPLIST = [174 'describe_client_vpn_endpoints', 'describe_managed_prefix_lists',175 'describe_network_insights_analyses', 'describe_network_insights_paths'176 ]177 EXTRA_ARGS = {178 'describe_images': {179 'Filters': [{180 'Name': 'is-public',181 'Values': ['false']182 }]183 },184 'describe_snapshots': {185 'OwnerIds': ['self']186 }187 }188 PAGE_SIZES = {189 'describe_ipv6_pools': 10,190 'describe_public_ipv4_pools': 10,191 'describe_reserved_instances_modifications': None192 }193 INVALID_ACTIONS = [194 'FpgaImages', 'TransitGatewayMulticastDomains', 'ByoipCidrs',195 'Ipv6Pools', 'CoipPools',196 'LocalGatewayRouteTableVirtualInterfaceGroupAssociations',197 'LocalGatewayRouteTableVpcAssociations', 'LocalGatewayRouteTables',198 'LocalGatewayVirtualInterfaceGroups', 'LocalGatewayVirtualInterfaces',199 'LocalGateways'200 ]201 def __init__(self, *args, **kwargs):202 super().__init__(*args, **kwargs)203 ec2_svc_file = _THIS_DIR / 'svcs' / 'ec2.yml'204 with ec2_svc_file.open('r') as f:205 self._spec = yaml.safe_load(f)206 def _patch_client(self):207 # Force loading of the pagination config208 self._client.can_paginate('describe_instances')209 assert 'page_config' in self._client._cache210 for py_name, result_key in self.MISSING_PAGINATION.items():211 op_name = self._client._PY_TO_OP_NAME[py_name]212 self._client._cache['page_config'][op_name] = {213 'input_token': 'NextToken',214 'output_token': 'NextToken',215 'limit_key': 'MaxResults',216 'result_key': result_key217 }218 def _should_import(self, key: str) -> bool:219 return key.startswith('describe_') and key not in self.SKIPLIST and not (220 self._is_gov and key in self.GOV_SKIPLIST)221 def _list_args(self, key: str) -> Dict:222 return self.EXTRA_ARGS.get(key, {})223 def _paginate_args(self, key: str) -> Dict:224 # TODO: key this off of output shape225 page_size = self.PAGE_SIZES.get(key, 100)226 return {'PaginationConfig': {'PageSize': page_size}}227 def _map_error_code(self, code: str, resource_name: str) -> Optional[str]:228 if code == 'InvalidSpotDatafeed.NotFound':229 return 'Missing subscription'230 elif code == 'InvalidAction' and resource_name in self.INVALID_ACTIONS:231 return 'Missing Input params'232 return None233class S3ClientProxy(ClientProxy):234 MISSING_PAGINATION = {235 'list_bucket_analytics_configurations': 'AnalyticsConfigurationList',236 'list_bucket_inventory_configurations': 'InventoryConfigurationList',237 'list_bucket_metrics_configurations': 'MetricsConfigurationList'238 }239 GET_PREFIX = 'get_bucket_'240 LIST_PREFIX = 'list_bucket_'241 SKIPLIST = [242 # deprecated methods covered by other calls243 'get_bucket_notification',244 'get_bucket_lifecycle',245 'list_bucket_intelligent_tiering_configurations'246 ]247 GOV_SKIPLIST = ['get_bucket_accelerate_configuration']248 def _patch_client(self):249 # Force loading of the pagination config250 self._client.can_paginate('list_bucket_analytics_configurations')251 for py_name, result_key in self.MISSING_PAGINATION.items():252 op_name = self._client._PY_TO_OP_NAME[py_name]253 self._client._cache['page_config'][op_name] = {254 'input_token': 'ContinuationToken',255 'output_token': 'NextContinuationToken',256 'result_key': result_key257 }258 def _should_import(self, key: str) -> bool:259 if key in self.SKIPLIST:260 return False261 elif self._is_gov and key in self.GOV_SKIPLIST:262 return False263 elif key.startswith(self.LIST_PREFIX):264 return True265 elif key.startswith(self.GET_PREFIX):266 # Only return true if there is not a corresponding list call267 item = key[len(self.GET_PREFIX):]268 list_op = f'list_bucket_{item}s'269 return not hasattr(self._client, list_op)270 else:271 return False272class ELBClientProxy(ClientProxy):273 SKIPLIST = [274 'describe_load_balancers', 'describe_account_limits',275 'describe_instance_health', 'describe_load_balancer_policy_types'276 ]277 def _should_import(self, key: str) -> bool:278 return key.startswith('describe_') and key not in self.SKIPLIST279class LambdaClientProxy(ClientProxy):280 SKIPLIST: List[str] = []281 def _should_import(self, key: str) -> bool:282 return key.startswith('list_') and key not in self.SKIPLIST283class CloudtrailClientProxy(ClientProxy):284 SKIPLIST: List[str] = []285 def _should_import(self, key: str) -> bool:286 return key.startswith('describe_') and key not in self.SKIPLIST287class RDSClientProxy(ClientProxy):288 SKIPLIST = [289 'describe_custom_availability_zones',290 'describe_installation_media',291 'describe_export_tasks',292 'describe_reserved_db_instances_offerings',293 'describe_db_engine_versions',294 'describe_valid_db_instance_modifications',295 'describe_option_group_options',296 'describe_db_proxies', # Not sure why this comes back with unknown297 'describe_global_clusters',298 # migrating away299 'describe_db_snapshots',300 'describe_db_cluster_snapshots'301 ]302 def _should_import(self, key: str) -> bool:303 return key.startswith('describe_') and key not in self.SKIPLIST304class IAMClientProxy(ClientProxy):305 SKIPLIST: List[str] = []306 MISSING_PAGINATION = {'list_user_tags': 'Tags', 'list_role_tags': 'Tags'}307 def _should_import(self, key: str) -> bool:308 return key.startswith('list_') and key not in self.SKIPLIST309 def _patch_client(self):310 # Force loading of the pagination config311 self._client.can_paginate('list_users')312 for py_name, result_key in self.MISSING_PAGINATION.items():313 op_name = self._client._PY_TO_OP_NAME[py_name]314 self._client._cache['page_config'][op_name] = {315 'input_token': 'Marker',316 'limit_key': 'MaxItems',317 'more_results': 'IsTruncated',318 'output_token': 'Marker',319 'result_key': result_key320 }321class AWSFetch(object):322 SVC_CLASS = {323 'ec2': EC2ClientProxy,324 's3': S3ClientProxy,325 'elb': ELBClientProxy,326 'iam': IAMClientProxy,327 'rds': RDSClientProxy,328 'lambda': LambdaClientProxy,329 'cloudtrail': CloudtrailClientProxy330 }331 def __init__(self, boto: Boto):332 self._boto = boto333 def client(self,334 service: str,335 region: Optional[str] = None) -> 'ClientProxy':336 client_class = self.SVC_CLASS.get(service, ClientProxy)337 kwargs = {}338 if region is not None:339 kwargs['region_name'] = region340 client = self._boto.create_client(service, **kwargs)341 return client_class(client, service)342class ServiceProxy(object):343 def __init__(self, impl: ClientProxy):344 self._impl = impl345 def resource_names(self) -> Iterator[str]:346 return self._impl.resource_names()347 def list(self, resource: str, **kwargs) -> Optional[Tuple[str, Any]]:348 _log.debug(f'calling list {resource} {kwargs}')349 return self._impl.list(resource, kwargs, retry_on_throttle=True)350 def get(self, resource: str, **kwargs):351 _log.debug(f'calling get {resource} {kwargs}')352 return self._impl.get(resource, kwargs)353 def canonical_name(self, py_name: str) -> str:354 return self._impl.canonical_name(py_name)355class Proxy(object):356 @classmethod357 def build(cls, boto: Boto, patch_id: Optional[int] = None) -> 'Proxy':358 return cls(AWSFetch(boto))359 @classmethod360 def dummy(cls, boto: Boto) -> 'Proxy':361 return cls(AWSFetch(boto))362 def __init__(self, aws: AWSFetch):363 self._aws = aws364 def service(self,365 service: str,366 region: Optional[str] = None) -> ServiceProxy:...

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