How to use describe_moving_addresses method in localstack

Best Python code snippet using localstack_python

bruteforce_tests.py

Source:bruteforce_tests.py Github

copy

Full Screen

1BRUTEFORCE_TESTS = {2 "a4b": [3 "get_conference_preference",4 "get_device",5 "get_invitation_configuration",6 "get_profile",7 "get_room",8 "get_skill_group",9 "list_business_report_schedules",10 "list_conference_providers",11 "list_skills",12 "list_skills_store_categories"13 ],14 "acm": [15 "list_certificates"16 ],17 "amplify": [18 "list_apps"19 ],20 "apigateway": [21 "get_account",22 "get_api_keys",23 "get_client_certificates",24 "get_domain_names",25 "get_rest_apis",26 "get_sdk_types",27 "get_usage_plans",28 "get_vpc_links",29 "get_domain_names"30 ],31 "appmesh": [32 "list_meshes",33 "list_meshes"34 ],35 "appstream2": [36 "describe_directory_configs",37 "describe_fleets",38 "describe_image_builders",39 "describe_images",40 "describe_user_stack_associations"41 ],42 "appsync": [43 "list_graphql_apis"44 ],45 "athena": [46 "list_named_queries",47 "list_query_executions",48 "list_work_groups"49 ],50 "autoscaling": [51 "describe_account_limits",52 "describe_adjustment_types",53 "describe_auto_scaling_groups",54 "describe_auto_scaling_instances",55 "describe_auto_scaling_notification_types",56 "describe_launch_configurations",57 "describe_lifecycle_hook_types",58 "describe_metric_collection_types",59 "describe_notification_configurations",60 "describe_policies",61 "describe_scaling_activities",62 "describe_scaling_process_types",63 "describe_scheduled_actions",64 "describe_tags",65 "describe_termination_policy_types"66 ],67 "backup": [68 "get_supported_resource_types",69 "list_backup_jobs",70 "list_backup_plan_templates",71 "list_backup_plans",72 "list_backup_vaults",73 "list_protected_resources",74 "list_restore_jobs"75 ],76 "batch": [77 "describe_compute_environments",78 "describe_job_definitions",79 "describe_job_queues",80 "list_jobs"81 ],82 "chime": [83 "list_accounts"84 ],85 "cloud9": [86 "describe_environment_memberships",87 "list_environments"88 ],89 "clouddirectory": [90 "list_development_schema_arns",91 "list_directories",92 "list_published_schema_arns",93 "list_development_schema_arns",94 "list_directories",95 "list_managed_schema_arns",96 "list_published_schema_arns"97 ],98 "cloudformation": [99 "describe_account_limits",100 "describe_stack_events",101 "describe_stack_resources",102 "get_template",103 "get_template_summary",104 "list_exports",105 "list_stack_sets",106 "list_stacks"107 ],108 "cloudfront": [109 "list_cloud_front_origin_access_identities",110 "list_distributions",111 "list_field_level_encryption_configs",112 "list_field_level_encryption_profiles",113 "list_streaming_distributions",114 "list_cloud_front_origin_access_identities",115 "list_distributions",116 "list_streaming_distributions",117 "list_cloud_front_origin_access_identities",118 "list_distributions",119 "list_field_level_encryption_configs",120 "list_field_level_encryption_profiles",121 "list_streaming_distributions",122 "list_cloud_front_origin_access_identities",123 "list_distributions",124 "list_field_level_encryption_configs",125 "list_field_level_encryption_profiles",126 "list_streaming_distributions",127 "list_cloud_front_origin_access_identities",128 "list_distributions",129 "list_streaming_distributions"130 ],131 "cloudhsm": [132 "describe_hsm",133 "describe_luna_client",134 "list_available_zones",135 "list_hapgs",136 "list_hsms",137 "list_luna_clients"138 ],139 "cloudhsmv2": [140 "describe_backups",141 "describe_clusters"142 ],143 "cloudsearch": [144 "describe_domains",145 "list_domain_names",146 "describe_domains"147 ],148 "cloudtrail": [149 "describe_trails"150 ],151 "codebuild": [152 "list_builds",153 "list_curated_environment_images",154 "list_projects",155 "list_source_credentials"156 ],157 "codecommit": [158 "get_branch",159 "list_repositories"160 ],161 "codedeploy": [162 "batch_get_deployment_targets",163 "get_deployment_target",164 "list_applications",165 "list_deployment_configs",166 "list_deployment_targets",167 "list_deployments",168 "list_git_hub_account_token_names",169 "list_on_premises_instances"170 ],171 "codepipeline": [172 "list_action_types",173 "list_pipelines",174 "list_webhooks"175 ],176 "codestar": [177 "list_projects",178 "list_user_profiles"179 ],180 "cognito-sync": [181 "list_identity_pool_usage"182 ],183 "comprehend": [184 "list_document_classification_jobs",185 "list_document_classifiers",186 "list_dominant_language_detection_jobs",187 "list_entities_detection_jobs",188 "list_entity_recognizers",189 "list_key_phrases_detection_jobs",190 "list_sentiment_detection_jobs",191 "list_topics_detection_jobs"192 ],193 "config": [194 "describe_aggregation_authorizations",195 "describe_compliance_by_config_rule",196 "describe_compliance_by_resource",197 "describe_config_rule_evaluation_status",198 "describe_config_rules",199 "describe_configuration_aggregators",200 "describe_configuration_recorder_status",201 "describe_configuration_recorders",202 "describe_delivery_channel_status",203 "describe_delivery_channels",204 "describe_pending_aggregation_requests",205 "describe_retention_configurations",206 "get_compliance_summary_by_config_rule",207 "get_compliance_summary_by_resource_type",208 "get_discovered_resource_counts"209 ],210 "cur": [211 "describe_report_definitions"212 ],213 "data.mediastore": [214 "list_items"215 ],216 "datapipeline": [217 "list_pipelines"218 ],219 "datasync": [220 "list_agents",221 "list_locations",222 "list_task_executions",223 "list_tasks"224 ],225 "dax": [226 "describe_clusters",227 "describe_default_parameters",228 "describe_parameter_groups",229 "describe_subnet_groups"230 ],231 "devicefarm": [232 "get_account_settings",233 "get_offering_status",234 "list_device_instances",235 "list_devices",236 "list_instance_profiles",237 "list_offering_promotions",238 "list_offering_transactions",239 "list_offerings",240 "list_projects",241 "list_vpce_configurations"242 ],243 "devices.iot1click": [244 "list_devices"245 ],246 "directconnect": [247 "describe_connections",248 "describe_direct_connect_gateway_associations",249 "describe_direct_connect_gateway_attachments",250 "describe_direct_connect_gateways",251 "describe_interconnects",252 "describe_lags",253 "describe_locations",254 "describe_virtual_gateways",255 "describe_virtual_interfaces"256 ],257 "discovery": [258 "describe_agents",259 "describe_continuous_exports",260 "describe_export_configurations",261 "describe_export_tasks",262 "describe_import_tasks",263 "get_discovery_summary"264 ],265 "dlm": [266 "get_lifecycle_policies"267 ],268 "dms": [269 "describe_account_attributes",270 "describe_certificates",271 "describe_connections",272 "describe_endpoint_types",273 "describe_endpoints",274 "describe_event_categories",275 "describe_event_subscriptions",276 "describe_orderable_replication_instances",277 "describe_replication_instances",278 "describe_replication_subnet_groups",279 "describe_replication_task_assessment_results",280 "describe_replication_tasks"281 ],282 "ds": [283 "describe_directories",284 "describe_event_topics",285 "describe_snapshots",286 "describe_trusts",287 "get_directory_limits",288 "list_log_subscriptions"289 ],290 "dynamodb": [291 "describe_endpoints",292 "describe_limits",293 "list_backups",294 "list_global_tables",295 "list_tables",296 "list_tables"297 ],298 "ec2": [299 "describe_account_attributes",300 "describe_addresses",301 "describe_aggregate_id_format",302 "describe_availability_zones",303 "describe_bundle_tasks",304 "describe_capacity_reservations",305 "describe_classic_link_instances",306 "describe_client_vpn_endpoints",307 "describe_conversion_tasks",308 "describe_customer_gateways",309 "describe_dhcp_options",310 "describe_egress_only_internet_gateways",311 "describe_elastic_gpus",312 "describe_export_tasks",313 "describe_fleets",314 "describe_flow_logs",315 "describe_fpga_images",316 "describe_host_reservation_offerings",317 "describe_host_reservations",318 "describe_hosts",319 "describe_iam_instance_profile_associations",320 "describe_id_format",321 "describe_images",322 "describe_import_image_tasks",323 "describe_import_snapshot_tasks",324 "describe_instance_credit_specifications",325 "describe_instance_status",326 "describe_instances",327 "describe_internet_gateways",328 "describe_key_pairs",329 "describe_launch_template_versions",330 "describe_launch_templates",331 "describe_moving_addresses",332 "describe_nat_gateways",333 "describe_network_acls",334 "describe_network_interface_permissions",335 "describe_network_interfaces",336 "describe_placement_groups",337 "describe_prefix_lists",338 "describe_principal_id_format",339 "describe_public_ipv4_pools",340 "describe_regions",341 "describe_reserved_instances",342 "describe_reserved_instances_listings",343 "describe_reserved_instances_modifications",344 "describe_reserved_instances_offerings",345 "describe_route_tables",346 "describe_scheduled_instances",347 "describe_security_groups",348 "describe_snapshots",349 "describe_spot_datafeed_subscription",350 "describe_spot_fleet_requests",351 "describe_spot_instance_requests",352 "describe_spot_price_history",353 "describe_subnets",354 "describe_tags",355 "describe_transit_gateway_attachments",356 "describe_transit_gateway_route_tables",357 "describe_transit_gateway_vpc_attachments",358 "describe_transit_gateways",359 "describe_volume_status",360 "describe_volumes",361 "describe_volumes_modifications",362 "describe_vpc_classic_link",363 "describe_vpc_classic_link_dns_support",364 "describe_vpc_endpoint_connection_notifications",365 "describe_vpc_endpoint_connections",366 "describe_vpc_endpoint_service_configurations",367 "describe_vpc_endpoint_services",368 "describe_vpc_endpoints",369 "describe_vpc_peering_connections",370 "describe_vpcs",371 "describe_vpn_connections",372 "describe_vpn_gateways"373 ],374 "ecr": [375 "describe_repositories",376 "get_authorization_token"377 ],378 "ecs": [379 "describe_clusters",380 "list_account_settings",381 "list_clusters",382 "list_container_instances",383 "list_services",384 "list_task_definition_families",385 "list_task_definitions",386 "list_tasks"387 ],388 "eks": [389 "list_clusters"390 ],391 "elasticache": [392 "describe_cache_clusters",393 "describe_cache_engine_versions",394 "describe_cache_parameter_groups",395 "describe_cache_security_groups",396 "describe_cache_subnet_groups",397 "describe_replication_groups",398 "describe_reserved_cache_nodes",399 "describe_reserved_cache_nodes_offerings",400 "describe_snapshots",401 "list_allowed_node_type_modifications"402 ],403 "elasticbeanstalk": [404 "describe_account_attributes",405 "describe_configuration_options",406 "describe_environment_health",407 "describe_environment_managed_action_history",408 "describe_environment_managed_actions",409 "describe_environment_resources",410 "describe_instances_health",411 "describe_platform_version"412 ],413 "elasticfilesystem": [414 "describe_file_systems",415 "describe_mount_targets"416 ],417 "elasticloadbalancing": [418 "describe_account_limits",419 "describe_load_balancer_policies",420 "describe_load_balancer_policy_types",421 "describe_load_balancers",422 "describe_account_limits",423 "describe_listeners",424 "describe_load_balancers",425 "describe_rules",426 "describe_ssl_policies",427 "describe_target_groups"428 ],429 "elasticmapreduce": [430 "describe_job_flows",431 "list_clusters",432 "list_security_configurations"433 ],434 "elastictranscoder": [435 "list_pipelines",436 "list_presets"437 ],438 "email": [439 "get_account",440 "get_dedicated_ips",441 "get_deliverability_dashboard_options",442 "list_configuration_sets",443 "list_dedicated_ip_pools",444 "list_deliverability_test_reports",445 "list_email_identities",446 "describe_active_receipt_rule_set",447 "get_account_sending_enabled",448 "get_send_quota",449 "get_send_statistics",450 "list_configuration_sets",451 "list_custom_verification_email_templates",452 "list_identities",453 "list_receipt_filters",454 "list_receipt_rule_sets",455 "list_templates",456 "list_verified_email_addresses"457 ],458 "es": [459 "describe_reserved_elasticsearch_instance_offerings",460 "describe_reserved_elasticsearch_instances",461 "get_compatible_elasticsearch_versions",462 "list_domain_names",463 "list_elasticsearch_versions"464 ],465 "events": [466 "describe_event_bus",467 "list_rules"468 ],469 "firehose": [470 "list_delivery_streams"471 ],472 "fms": [473 "get_admin_account",474 "get_notification_channel",475 "list_member_accounts",476 "list_policies"477 ],478 "fsx": [479 "describe_backups",480 "describe_file_systems"481 ],482 "gamelift": [483 "describe_ec2_instance_limits",484 "describe_fleet_attributes",485 "describe_fleet_capacity",486 "describe_fleet_utilization",487 "describe_game_session_details",488 "describe_game_session_queues",489 "describe_game_sessions",490 "describe_matchmaking_configurations",491 "describe_matchmaking_rule_sets",492 "describe_player_sessions",493 "describe_vpc_peering_authorizations",494 "describe_vpc_peering_connections",495 "list_aliases",496 "list_builds",497 "list_fleets"498 ],499 "globalaccelerator": [500 "describe_accelerator_attributes",501 "list_accelerators"502 ],503 "glue": [504 "get_catalog_import_status",505 "get_classifiers",506 "get_connections",507 "get_crawler_metrics",508 "get_crawlers",509 "get_data_catalog_encryption_settings",510 "get_databases",511 "get_dataflow_graph",512 "get_dev_endpoints",513 "get_jobs",514 "get_resource_policy",515 "get_security_configurations",516 "get_triggers",517 "list_crawlers",518 "list_dev_endpoints",519 "list_jobs",520 "list_triggers"521 ],522 "greengrass": [523 "get_service_role_for_account",524 "list_bulk_deployments",525 "list_connector_definitions",526 "list_core_definitions",527 "list_device_definitions",528 "list_function_definitions",529 "list_groups",530 "list_logger_definitions",531 "list_resource_definitions",532 "list_subscription_definitions"533 ],534 "guardduty": [535 "get_invitations_count",536 "list_detectors",537 "list_invitations"538 ],539 "health": [540 "describe_entity_aggregates",541 "describe_event_types"542 ],543 "iam": [544 "get_account_authorization_details",545 "get_account_password_policy",546 "get_account_summary",547 "get_credential_report",548 "get_user",549 "list_access_keys",550 "list_account_aliases",551 "list_groups",552 "list_instance_profiles",553 "list_mfa_devices",554 "list_open_id_connect_providers",555 "list_policies",556 "list_roles",557 "list_saml_providers",558 "list_server_certificates",559 "list_service_specific_credentials",560 "list_signing_certificates",561 "list_ssh_public_keys",562 "list_users",563 "list_virtual_mfa_devices"564 ],565 "importexport": [566 "list_jobs"567 ],568 "inspector": [569 "describe_cross_account_access_role",570 "list_assessment_runs",571 "list_assessment_targets",572 "list_assessment_templates",573 "list_event_subscriptions",574 "list_findings",575 "list_rules_packages"576 ],577 "iot": [578 "describe_account_audit_configuration",579 "describe_default_authorizer",580 "describe_endpoint",581 "describe_event_configurations",582 "get_effective_policies",583 "get_indexing_configuration",584 "get_logging_options",585 "get_registration_code",586 "get_v2_logging_options",587 "list_active_violations",588 "list_audit_findings",589 "list_authorizers",590 "list_billing_groups",591 "list_ca_certificates",592 "list_certificates",593 "list_indices",594 "list_jobs",595 "list_ota_updates",596 "list_outgoing_certificates",597 "list_policies",598 "list_role_aliases",599 "list_scheduled_audits",600 "list_security_profiles",601 "list_streams",602 "list_thing_groups",603 "list_thing_registration_tasks",604 "list_thing_types",605 "list_things",606 "list_topic_rules",607 "list_v2_logging_levels"608 ],609 "iotanalytics": [610 "describe_logging_options",611 "list_channels",612 "list_datasets",613 "list_datastores",614 "list_pipelines"615 ],616 "kafka": [617 "list_clusters"618 ],619 "kinesis": [620 "describe_limits",621 "describe_stream_consumer",622 "list_shards",623 "list_streams"624 ],625 "kinesisanalytics": [626 "list_applications",627 "list_applications"628 ],629 "kinesisvideo": [630 "describe_stream",631 "list_streams",632 "list_tags_for_stream"633 ],634 "kms": [635 "describe_custom_key_stores",636 "list_aliases",637 "list_keys"638 ],639 "lambda": [640 "list_functions",641 "get_account_settings",642 "list_event_source_mappings",643 "list_functions",644 "list_layers"645 ],646 "license-manager": [647 "get_service_settings",648 "list_license_configurations"649 ],650 "lightsail": [651 "get_active_names",652 "get_blueprints",653 "get_bundles",654 "get_cloud_formation_stack_records",655 "get_disk_snapshots",656 "get_disks",657 "get_domains",658 "get_export_snapshot_records",659 "get_instance_snapshots",660 "get_instances",661 "get_key_pairs",662 "get_load_balancers",663 "get_operations",664 "get_regions",665 "get_relational_database_blueprints",666 "get_relational_database_bundles",667 "get_relational_database_snapshots",668 "get_relational_databases",669 "get_static_ips"670 ],671 "logs": [672 "describe_destinations",673 "describe_export_tasks",674 "describe_log_groups",675 "describe_metric_filters",676 "describe_queries",677 "describe_resource_policies"678 ],679 "machinelearning": [680 "describe_batch_predictions",681 "describe_data_sources",682 "describe_evaluations",683 "describe_ml_models"684 ],685 "macie": [686 "list_member_accounts",687 "list_s3_resources"688 ],689 "mediaconnect": [690 "list_entitlements",691 "list_flows"692 ],693 "mediaconvert": [694 "describe_endpoints",695 "list_job_templates",696 "list_jobs",697 "list_presets",698 "list_queues"699 ],700 "medialive": [701 "list_channels",702 "list_input_security_groups",703 "list_inputs",704 "list_offerings",705 "list_reservations"706 ],707 "mediapackage": [708 "list_channels",709 "list_origin_endpoints"710 ],711 "mediastore": [712 "describe_container",713 "list_containers"714 ],715 "mediatailor": [716 "list_playback_configurations"717 ],718 "mgh": [719 "list_migration_tasks",720 "list_progress_update_streams"721 ],722 "mobile": [723 "list_bundles",724 "list_projects"725 ],726 "models.lex": [727 "get_bots",728 "get_builtin_intents",729 "get_builtin_slot_types",730 "get_intents",731 "get_slot_types"732 ],733 "monitoring": [734 "describe_alarm_history",735 "describe_alarms",736 "list_dashboards"737 ],738 "mq": [739 "list_brokers",740 "list_configurations"741 ],742 "mturk-requester": [743 "get_account_balance",744 "list_bonus_payments",745 "list_hi_ts",746 "list_qualification_requests",747 "list_reviewable_hi_ts",748 "list_worker_blocks"749 ],750 "opsworks": [751 "describe_agent_versions",752 "describe_apps",753 "describe_commands",754 "describe_deployments",755 "describe_ecs_clusters",756 "describe_elastic_ips",757 "describe_elastic_load_balancers",758 "describe_instances",759 "describe_layers",760 "describe_my_user_profile",761 "describe_operating_systems",762 "describe_permissions",763 "describe_raid_arrays",764 "describe_user_profiles",765 "describe_volumes"766 ],767 "opworks": [768 "describe_account_attributes",769 "describe_backups",770 "describe_servers"771 ],772 "organizations": [773 "describe_organization",774 "list_accounts",775 "list_aws_service_access_for_organization",776 "list_create_account_status",777 "list_handshakes_for_account",778 "list_handshakes_for_organization",779 "list_roots"780 ],781 "pinpoint": [782 "get_apps"783 ],784 "polly": [785 "describe_voices",786 "list_lexicons",787 "list_speech_synthesis_tasks"788 ],789 "pricing": [790 "describe_services"791 ],792 "projects.iot1click": [793 "list_projects"794 ],795 "ram": [796 "get_resource_share_invitations"797 ],798 "rds": [799 "describe_db_engine_versions",800 "describe_db_instances",801 "describe_db_parameter_groups",802 "describe_db_security_groups",803 "describe_db_snapshots",804 "describe_db_subnet_groups",805 "describe_event_categories",806 "describe_event_subscriptions",807 "describe_option_groups",808 "describe_reserved_db_instances",809 "describe_reserved_db_instances_offerings",810 "describe_db_engine_versions",811 "describe_db_instances",812 "describe_db_parameter_groups",813 "describe_db_security_groups",814 "describe_db_snapshots",815 "describe_db_subnet_groups",816 "describe_event_categories",817 "describe_event_subscriptions",818 "describe_option_groups",819 "describe_reserved_db_instances",820 "describe_reserved_db_instances_offerings",821 "describe_account_attributes",822 "describe_certificates",823 "describe_db_cluster_endpoints",824 "describe_db_cluster_parameter_groups",825 "describe_db_cluster_snapshots",826 "describe_db_clusters",827 "describe_db_engine_versions",828 "describe_db_instance_automated_backups",829 "describe_db_instances",830 "describe_db_parameter_groups",831 "describe_db_security_groups",832 "describe_db_snapshots",833 "describe_db_subnet_groups",834 "describe_event_categories",835 "describe_event_subscriptions",836 "describe_global_clusters",837 "describe_option_groups",838 "describe_pending_maintenance_actions",839 "describe_reserved_db_instances",840 "describe_reserved_db_instances_offerings",841 "describe_source_regions",842 "describe_db_cluster_parameter_groups",843 "describe_db_cluster_snapshots",844 "describe_db_clusters",845 "describe_db_engine_versions",846 "describe_db_instances",847 "describe_db_parameter_groups",848 "describe_db_subnet_groups",849 "describe_event_categories",850 "describe_event_subscriptions",851 "describe_pending_maintenance_actions",852 "describe_db_engine_versions",853 "describe_db_instances",854 "describe_db_parameter_groups",855 "describe_db_security_groups",856 "describe_db_snapshots",857 "describe_db_subnet_groups",858 "describe_event_categories",859 "describe_event_subscriptions",860 "describe_option_groups",861 "describe_reserved_db_instances",862 "describe_reserved_db_instances_offerings",863 "describe_db_engine_versions",864 "describe_db_instances",865 "describe_db_parameter_groups",866 "describe_db_security_groups",867 "describe_db_snapshots",868 "describe_db_subnet_groups",869 "describe_event_categories",870 "describe_event_subscriptions",871 "describe_option_groups",872 "describe_reserved_db_instances",873 "describe_reserved_db_instances_offerings",874 "describe_db_cluster_parameter_groups",875 "describe_db_cluster_snapshots",876 "describe_db_clusters",877 "describe_db_engine_versions",878 "describe_db_instances",879 "describe_db_subnet_groups",880 "describe_event_categories",881 "describe_pending_maintenance_actions"882 ],883 "redshift": [884 "describe_account_attributes",885 "describe_cluster_db_revisions",886 "describe_cluster_parameter_groups",887 "describe_cluster_security_groups",888 "describe_cluster_subnet_groups",889 "describe_cluster_tracks",890 "describe_cluster_versions",891 "describe_clusters",892 "describe_event_categories",893 "describe_event_subscriptions",894 "describe_hsm_client_certificates",895 "describe_hsm_configurations",896 "describe_orderable_cluster_options",897 "describe_reserved_node_offerings",898 "describe_reserved_nodes",899 "describe_snapshot_copy_grants",900 "describe_snapshot_schedules",901 "describe_storage",902 "describe_table_restore_status",903 "describe_tags"904 ],905 "rekognition": [906 "list_collections",907 "list_stream_processors"908 ],909 "robomaker": [910 "list_deployment_jobs",911 "list_fleets",912 "list_robot_applications",913 "list_robots",914 "list_simulation_applications",915 "list_simulation_jobs"916 ],917 "route53": [918 "get_health_check_count",919 "get_hosted_zone_count",920 "get_traffic_policy_instance_count",921 "list_health_checks",922 "list_hosted_zones",923 "list_hosted_zones_by_name",924 "list_query_logging_configs",925 "list_reusable_delegation_sets",926 "list_traffic_policies",927 "list_traffic_policy_instances"928 ],929 "route53domains": [930 "get_contact_reachability_status",931 "list_domains",932 "list_operations"933 ],934 "route53resolver": [935 "list_resolver_endpoints",936 "list_resolver_rule_associations",937 "list_resolver_rules"938 ],939 "s3": [940 "list_buckets"941 ],942 "sagemaker": [943 "list_algorithms",944 "list_code_repositories",945 "list_compilation_jobs",946 "list_endpoint_configs",947 "list_endpoints",948 "list_hyper_parameter_tuning_jobs",949 "list_labeling_jobs",950 "list_model_packages",951 "list_models",952 "list_notebook_instance_lifecycle_configs",953 "list_notebook_instances",954 "list_subscribed_workteams",955 "list_training_jobs",956 "list_transform_jobs",957 "list_workteams"958 ],959 "sdb": [960 "list_domains"961 ],962 "secretsmanager": [963 "get_random_password",964 "list_secrets"965 ],966 "securityhub": [967 "get_enabled_standards",968 "get_findings",969 "get_insights",970 "get_invitations_count",971 "get_master_account",972 "list_enabled_products_for_import",973 "list_invitations",974 "list_members"975 ],976 "serverlessrepo": [977 "list_applications"978 ],979 "servicecatalog": [980 "get_aws_organizations_access_status",981 "list_accepted_portfolio_shares",982 "list_portfolios",983 "list_provisioned_product_plans",984 "list_record_history",985 "list_service_actions",986 "list_tag_options"987 ],988 "shield": [989 "describe_drt_access",990 "describe_emergency_contact_settings",991 "describe_protection",992 "describe_subscription",993 "get_subscription_state",994 "list_attacks",995 "list_protections"996 ],997 "signer": [998 "list_signing_jobs",999 "list_signing_platforms",1000 "list_signing_profiles"1001 ],1002 "sms": [1003 "get_app",1004 "get_app_launch_configuration",1005 "get_app_replication_configuration",1006 "get_connectors",1007 "get_replication_jobs",1008 "get_servers",1009 "list_apps"1010 ],1011 "sms-voice.pinpoint": [1012 "list_configuration_sets"1013 ],1014 "snowball": [1015 "describe_addresses",1016 "get_snowball_usage",1017 "list_clusters",1018 "list_compatible_images",1019 "list_jobs"1020 ],1021 "sns": [1022 "get_sms_attributes",1023 "list_phone_numbers_opted_out",1024 "list_platform_applications",1025 "list_subscriptions",1026 "list_topics"1027 ],1028 "sqs": [1029 "list_queues"1030 ],1031 "ssm": [1032 "describe_activations",1033 "describe_association",1034 "describe_available_patches",1035 "describe_inventory_deletions",1036 "describe_maintenance_window_schedule",1037 "describe_maintenance_windows",1038 "describe_patch_baselines",1039 "describe_patch_groups",1040 "get_default_patch_baseline",1041 "get_inventory_schema",1042 "list_command_invocations",1043 "list_commands",1044 "list_compliance_items",1045 "list_compliance_summaries",1046 "list_resource_compliance_summaries",1047 "list_resource_data_sync"1048 ],1049 "states": [1050 "list_activities",1051 "list_state_machines"1052 ],1053 "storagegateway": [1054 "describe_tape_archives",1055 "list_file_shares",1056 "list_gateways",1057 "list_tapes",1058 "list_volumes"1059 ],1060 "streams.dynamodb": [1061 "list_streams"1062 ],1063 "sts": [1064 "get_caller_identity",1065 "get_session_token"1066 ],1067 "support": [1068 "describe_cases",1069 "describe_services",1070 "describe_severity_levels"1071 ],1072 "tagging": [1073 "get_resources",1074 "get_tag_keys"1075 ],1076 "transcribe": [1077 "list_transcription_jobs",1078 "list_vocabularies"1079 ],1080 "transfer": [1081 "list_servers"1082 ],1083 "translate": [1084 "list_terminologies"1085 ],1086 "waf": [1087 "get_change_token",1088 "list_activated_rules_in_rule_group",1089 "list_byte_match_sets",1090 "list_geo_match_sets",1091 "list_ip_sets",1092 "list_logging_configurations",1093 "list_rate_based_rules",1094 "list_regex_match_sets",1095 "list_regex_pattern_sets",1096 "list_rule_groups",1097 "list_rules",1098 "list_size_constraint_sets",1099 "list_sql_injection_match_sets",1100 "list_subscribed_rule_groups",1101 "list_xss_match_sets"1102 ],1103 "waf-regional": [1104 "get_change_token",1105 "list_activated_rules_in_rule_group",1106 "list_byte_match_sets",1107 "list_geo_match_sets",1108 "list_ip_sets",1109 "list_logging_configurations",1110 "list_rate_based_rules",1111 "list_regex_match_sets",1112 "list_regex_pattern_sets",1113 "list_rule_groups",1114 "list_rules",1115 "list_size_constraint_sets",1116 "list_sql_injection_match_sets",1117 "list_subscribed_rule_groups",1118 "list_xss_match_sets"1119 ],1120 "workdocs": [1121 "describe_activities",1122 "describe_users",1123 "get_resources"1124 ],1125 "worklink": [1126 "list_fleets"1127 ],1128 "workmail": [1129 "list_organizations"1130 ],1131 "workspaces": [1132 "describe_account",1133 "describe_account_modifications",1134 "describe_ip_groups",1135 "describe_workspace_bundles",1136 "describe_workspace_directories",1137 "describe_workspace_images",1138 "describe_workspaces",1139 "describe_workspaces_connection_status"1140 ],1141 "xray": [1142 "get_encryption_config",1143 "get_group",1144 "get_groups",1145 "get_sampling_rules",1146 "get_sampling_statistic_summaries"1147 ]...

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

awshelper.py

Source:awshelper.py Github

copy

Full Screen

1import boto32_clients = {}3_functions = {}4_session = None5# the last two keys should both be None or both be non-None6def _get_client(client_type, region):7 if _session is None:8 raise ValueError("Session has not been initialized")9 return _session.client(client_type, region_name=region)10def _aws_response(response_func, args_dict):11 response = response_func(**args_dict)12 metadata = response["ResponseMetadata"]13 if "HTTPStatusCode" not in metadata or metadata["HTTPStatusCode"] != 200:14 raise IOError("Unexpected status code " + metadata.get("HTTPStatusCode", None))15 response.pop("ResponseMetadata")16 return response17def aws_get_config(region):18 config = {}19 for key in _functions[region]:20 (response_func, args_dict) = _functions[region][key]21 try:22 response = _aws_response(response_func, args_dict)23 except Exception as e:24 print("Exception getting {} for {}: {}".format(key, region, e))25 continue26 config[key] = response27 if key == "TransitGatewayRouteTables":28 _aws_get_route_table_details(_clients[region]["ec2"], config, response["TransitGatewayRouteTables"])29 if key == "LoadBalancers":30 _aws_get_load_balancer_details(_clients[region]["elbv2"], config, response["LoadBalancers"])31 if key == "TargetGroups":32 _aws_get_elbv2_target_health(_clients[region]["elbv2"], config, response["TargetGroups"])33 return config34import json35def _aws_get_load_balancer_details(client, config, load_balancers):36 listeners = []37 attributes = []38 for load_balancer in load_balancers:39 lb_arn = load_balancer["LoadBalancerArn"]40 try:41 response = _aws_response(client.describe_listeners, dict(LoadBalancerArn=lb_arn))42 response["LoadBalancerArn"] = lb_arn43 listeners.append(response)44 except Exception as e:45 print(46 "Exception getting load balancer listeners for {} with arn {}: {}".format(47 load_balancer["LoadBalancerName"],48 lb_arn, e))49 try:50 response = _aws_response(client.describe_load_balancer_attributes, dict(LoadBalancerArn=lb_arn))51 response["LoadBalancerArn"] = lb_arn52 attributes.append(response)53 except Exception as e:54 print(55 "Exception getting load balancer attributes for {} with arn {}: {}".format(56 load_balancer["LoadBalancerName"],57 lb_arn, e))58 config["LoadBalancerListeners"] = {"LoadBalancerListeners": listeners}59 config["LoadBalancerAttributes"] = {"LoadBalancerAttributes" : attributes}60def _aws_get_elbv2_target_health(client, config, target_groups):61 healths = []62 for target_group in target_groups:63 tg_arn = target_group["TargetGroupArn"]64 try:65 response = _aws_response(client.describe_target_health, dict(TargetGroupArn=tg_arn))66 response["TargetGroupArn"] = tg_arn67 healths.append(response)68 except Exception as e:69 print(70 "Exception getting target health for target group {} with Arn {}: {}".format(71 target_group["TargetGroupName"], tg_arn, e))72 config["LoadBalancerTargetHealth"] = {"LoadBalancerTargetHealth": healths}73def _aws_get_route_table_details(client, config, route_tables):74 static_routes = []75 propogations = []76 for table in route_tables:77 table_id = table["TransitGatewayRouteTableId"]78 try:79 propogations_response = _aws_response(client.get_transit_gateway_route_table_propagations,80 dict(TransitGatewayRouteTableId=table_id))81 propogations_response["TransitGatewayRouteTableId"] = table_id82 propogations.append(propogations_response)83 except Exception as e:84 print("Exception getting Propagations for {}: {}".format(table_id, e))85 try:86 static_routes_response = _aws_response(client.search_transit_gateway_routes,87 dict(TransitGatewayRouteTableId=table_id,88 Filters=[{"Name": "type", "Values": ["static"]}]))89 if static_routes_response['AdditionalRoutesAvailable']:90 raise IOError("Could not fetch all static routes for " + table_id)91 static_routes_response["TransitGatewayRouteTableId"] = table_id92 static_routes.append(static_routes_response)93 except Exception as e:94 print("Exception getting Static routes for {}: {}".format(table_id, e))95 config["TransitGatewayPropagations"] = {"TransitGatewayPropagations": propogations}96 config["TransitGatewayStaticRoutes"] = {"TransitGatewayStaticRoutes": static_routes}97def aws_get_regions():98 return _clients.keys()99def aws_init(regions=None, vpc_ids=None, skip_data=None, profile=None):100 global _session, _clients, _functions101 _session = boto3.session.Session(profile_name=profile)102 if regions is None or len(regions) == 0:103 ec2_client = _get_client('ec2', "us-west-1")104 response = ec2_client.describe_regions()105 regions_to_get = [region["RegionName"] for region in response["Regions"]]106 else:107 regions_to_get = regions108 if vpc_ids is None or len(vpc_ids) == 0:109 vpc_filter = []110 attachment_vpc_filter = []111 else:112 vpc_filter = [{'Name': "vpc-id", 'Values': vpc_ids}]113 attachment_vpc_filter = [{'Name': "attachment.vpc-id", 'Values': vpc_ids}]114 for region in regions_to_get:115 _clients[region] = {}116 ec2_client = _get_client("ec2", region)117 _clients[region]["ec2"] = ec2_client118 _functions[region] = {}119 _functions[region]["Addresses"] = (ec2_client.describe_addresses, dict())120 _functions[region]["AvailabilityZones"] = (ec2_client.describe_availability_zones, dict())121 _functions[region]["ClassicLinkInstances"] = (122 ec2_client.describe_classic_link_instances, dict(Filters=vpc_filter))123 _functions[region]["CustomerGateways"] = (ec2_client.describe_customer_gateways, dict())124 _functions[region]["DhcpOptions"] = (ec2_client.describe_dhcp_options, dict())125 _functions[region]["Hosts"] = (ec2_client.describe_hosts, dict())126 _functions[region]["InstanceStatuses"] = (ec2_client.describe_instance_status, dict())127 _functions[region]["InternetGateways"] = (128 ec2_client.describe_internet_gateways, dict(Filters=attachment_vpc_filter))129 _functions[region]["MovingAddressStatuses"] = (ec2_client.describe_moving_addresses, dict())130 _functions[region]["NatGateways"] = (ec2_client.describe_nat_gateways, dict(Filters=vpc_filter))131 _functions[region]["NetworkAcls"] = (ec2_client.describe_network_acls, dict(Filters=vpc_filter))132 _functions[region]["NetworkInterfaces"] = (ec2_client.describe_network_interfaces, dict(Filters=vpc_filter))133 _functions[region]["PlacementGroups"] = (ec2_client.describe_placement_groups, dict())134 _functions[region]["PrefixLists"] = (ec2_client.describe_prefix_lists, dict())135 _functions[region]["Reservations"] = (ec2_client.describe_instances, dict(Filters=vpc_filter))136 _functions[region]["RouteTables"] = (ec2_client.describe_route_tables, dict(Filters=vpc_filter))137 _functions[region]["SecurityGroups"] = (ec2_client.describe_security_groups, dict(Filters=vpc_filter))138 _functions[region]["Subnets"] = (ec2_client.describe_subnets, dict(Filters=vpc_filter))139 _functions[region]["Tags"] = (ec2_client.describe_tags, dict())140 _functions[region]["TransitGatewayAttachments"] = (ec2_client.describe_transit_gateway_attachments, dict())141 _functions[region]["TransitGatewayRouteTables"] = (ec2_client.describe_transit_gateway_route_tables, dict())142 _functions[region]["TransitGatewayVpcAttachments"] = (143 ec2_client.describe_transit_gateway_vpc_attachments, dict(Filters=vpc_filter))144 _functions[region]["TransitGateways"] = (ec2_client.describe_transit_gateways, dict())145 _functions[region]["VpcEndpoints"] = (ec2_client.describe_vpc_endpoints, dict(Filters=vpc_filter))146 _functions[region]["VpcPeeringConnections"] = (ec2_client.describe_vpc_peering_connections, dict())147 _functions[region]["Vpcs"] = (ec2_client.describe_vpcs, dict(Filters=vpc_filter))148 _functions[region]["VpcClassicLink"] = (ec2_client.describe_vpc_classic_link, dict())149 _functions[region]["VpcClassicLinkDnsSupport"] = (ec2_client.describe_vpc_classic_link_dns_support, dict())150 _functions[region]["VpnConnections"] = (ec2_client.describe_vpn_connections, dict())151 _functions[region]["VpnGateways"] = (ec2_client.describe_vpn_gateways, dict(Filters=attachment_vpc_filter))152 # get all elasticsearch domain names for this account (VPC based filtering is not supported yet)153 es_client = _get_client('es', region)154 _clients[region]["es"] = es_client155 domain_names = es_client.list_domain_names()156 _functions[region]["ElasticsearchDomains"] = (es_client.describe_elasticsearch_domains, dict(157 DomainNames=[domainEntry["DomainName"] for domainEntry in domain_names["DomainNames"]]))158 # get all RDS instances (VPC based filtering is not supported yet)159 rds_client = _get_client('rds', region)160 _clients[region]["rds"] = rds_client161 _functions[region]["RdsInstances"] = (rds_client.describe_db_instances, dict())162 elbv2_client = _get_client('elbv2', region)163 _clients[region]["elbv2"] = elbv2_client164 _functions[region]["LoadBalancers"] = (elbv2_client.describe_load_balancers, dict())165 _functions[region]["TargetGroups"] = (elbv2_client.describe_target_groups, dict())166 if skip_data is not None:167 for key in skip_data:168 _functions[region].pop(key)169def aws_test_access(profile=None):170 try:171 session = boto3.session.Session(profile_name=profile)172 client = session.client("ec2", "us-west-1")173 client.describe_regions()174 print("You have access to AWS!\n")175 except Exception as e:...

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