From 10f82585e32758899b899ef2a7ef5c74da6b02a9 Mon Sep 17 00:00:00 2001 From: rafcio19 Date: Sat, 2 Dec 2023 00:07:52 +0100 Subject: [PATCH] Lambda: event invoke config (#7078) --- IMPLEMENTATION_COVERAGE.md | 152 ++---------- docs/docs/services/comprehend.rst | 1 - docs/docs/services/ec2.rst | 13 -- docs/docs/services/ecr.rst | 2 - docs/docs/services/eks.rst | 5 - docs/docs/services/elb.rst | 4 +- docs/docs/services/glue.rst | 11 - docs/docs/services/iot.rst | 20 ++ docs/docs/services/lambda.rst | 10 +- docs/docs/services/logs.rst | 21 +- docs/docs/services/quicksight.rst | 6 - docs/docs/services/rds.rst | 5 - docs/docs/services/redshift.rst | 4 - docs/docs/services/s3control.rst | 8 - docs/docs/services/sso-admin.rst | 36 --- docs/docs/services/stepfunctions.rst | 1 - moto/awslambda/exceptions.py | 10 + moto/awslambda/models.py | 106 +++++++++ moto/awslambda/responses.py | 41 +++- moto/awslambda/urls.py | 6 + tests/test_awslambda/test_lambda.py | 332 +++++++++++++++++++++++++++ 21 files changed, 548 insertions(+), 246 deletions(-) diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 7a75fb3abaad..47dbbb82f3f2 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -1275,7 +1275,7 @@ ## comprehend
-12% implemented +13% implemented - [ ] batch_detect_dominant_language - [ ] batch_detect_entities @@ -1318,7 +1318,6 @@ - [X] detect_sentiment - [ ] detect_syntax - [ ] detect_targeted_sentiment -- [ ] detect_toxic_content - [ ] import_model - [ ] list_datasets - [ ] list_document_classification_jobs @@ -1898,7 +1897,7 @@ ## ec2
-33% implemented +34% implemented - [ ] accept_address_transfer - [ ] accept_reserved_instances_exchange_quote @@ -1921,7 +1920,6 @@ - [ ] associate_enclave_certificate_iam_role - [X] associate_iam_instance_profile - [ ] associate_instance_event_window -- [ ] associate_ipam_byoasn - [ ] associate_ipam_resource_discovery - [ ] associate_nat_gateway_address - [X] associate_route_table @@ -2112,7 +2110,6 @@ - [ ] delete_vpn_connection_route - [X] delete_vpn_gateway - [ ] deprovision_byoip_cidr -- [ ] deprovision_ipam_byoasn - [ ] deprovision_ipam_pool_cidr - [ ] deprovision_public_ipv4_pool_cidr - [X] deregister_image @@ -2170,12 +2167,10 @@ - [ ] describe_instance_event_notification_attributes - [ ] describe_instance_event_windows - [X] describe_instance_status -- [ ] describe_instance_topology - [X] describe_instance_type_offerings - [X] describe_instance_types - [X] describe_instances - [X] describe_internet_gateways -- [ ] describe_ipam_byoasn - [ ] describe_ipam_pools - [ ] describe_ipam_resource_discoveries - [ ] describe_ipam_resource_discovery_associations @@ -2191,7 +2186,6 @@ - [ ] describe_local_gateway_virtual_interface_groups - [ ] describe_local_gateway_virtual_interfaces - [ ] describe_local_gateways -- [ ] describe_locked_snapshots - [X] describe_managed_prefix_lists - [ ] describe_moving_addresses - [X] describe_nat_gateways @@ -2284,7 +2278,6 @@ - [ ] disable_image_deprecation - [ ] disable_ipam_organization_admin_account - [ ] disable_serial_console_access -- [ ] disable_snapshot_block_public_access - [X] disable_transit_gateway_route_table_propagation - [ ] disable_vgw_route_propagation - [X] disable_vpc_classic_link @@ -2294,7 +2287,6 @@ - [ ] disassociate_enclave_certificate_iam_role - [X] disassociate_iam_instance_profile - [ ] disassociate_instance_event_window -- [ ] disassociate_ipam_byoasn - [ ] disassociate_ipam_resource_discovery - [ ] disassociate_nat_gateway_address - [X] disassociate_route_table @@ -2315,7 +2307,6 @@ - [ ] enable_ipam_organization_admin_account - [ ] enable_reachability_analyzer_organization_sharing - [ ] enable_serial_console_access -- [ ] enable_snapshot_block_public_access - [X] enable_transit_gateway_route_table_propagation - [ ] enable_vgw_route_propagation - [ ] enable_volume_io @@ -2343,7 +2334,6 @@ - [ ] get_instance_uefi_data - [ ] get_ipam_address_history - [ ] get_ipam_discovered_accounts -- [ ] get_ipam_discovered_public_addresses - [ ] get_ipam_discovered_resource_cidrs - [ ] get_ipam_pool_allocations - [ ] get_ipam_pool_cidrs @@ -2357,7 +2347,6 @@ - [ ] get_reserved_instances_exchange_quote - [ ] get_security_groups_for_vpc - [ ] get_serial_console_access_status -- [ ] get_snapshot_block_public_access_state - [ ] get_spot_placement_scores - [ ] get_subnet_cidr_reservations - [ ] get_transit_gateway_attachment_propagations @@ -2380,7 +2369,6 @@ - [ ] import_volume - [ ] list_images_in_recycle_bin - [ ] list_snapshots_in_recycle_bin -- [ ] lock_snapshot - [ ] modify_address_attribute - [ ] modify_availability_zone_group - [ ] modify_capacity_reservation @@ -2449,7 +2437,6 @@ - [ ] move_address_to_vpc - [ ] move_byoip_cidr_to_ipam - [ ] provision_byoip_cidr -- [ ] provision_ipam_byoasn - [ ] provision_ipam_pool_cidr - [ ] provision_public_ipv4_pool_cidr - [ ] purchase_capacity_block @@ -2510,7 +2497,6 @@ - [X] unassign_ipv6_addresses - [X] unassign_private_ip_addresses - [ ] unassign_private_nat_gateway_address -- [ ] unlock_snapshot - [ ] unmonitor_instances - [X] update_security_group_rule_descriptions_egress - [X] update_security_group_rule_descriptions_ingress @@ -2527,7 +2513,7 @@ ## ecr
-65% implemented +68% implemented - [ ] batch_check_layer_availability - [X] batch_delete_image @@ -2569,9 +2555,7 @@ - [ ] start_lifecycle_policy_preview - [X] tag_resource - [X] untag_resource -- [ ] update_pull_through_cache_rule - [ ] upload_layer_part -- [ ] validate_pull_through_cache_rule
## ecs @@ -2674,18 +2658,16 @@ ## eks
-37% implemented +42% implemented - [ ] associate_encryption_config - [ ] associate_identity_provider_config - [ ] create_addon - [X] create_cluster -- [ ] create_eks_anywhere_subscription - [X] create_fargate_profile - [X] create_nodegroup - [ ] delete_addon - [X] delete_cluster -- [ ] delete_eks_anywhere_subscription - [X] delete_fargate_profile - [X] delete_nodegroup - [ ] deregister_cluster @@ -2693,7 +2675,6 @@ - [ ] describe_addon_configuration - [ ] describe_addon_versions - [X] describe_cluster -- [ ] describe_eks_anywhere_subscription - [X] describe_fargate_profile - [ ] describe_identity_provider_config - [X] describe_nodegroup @@ -2701,7 +2682,6 @@ - [ ] disassociate_identity_provider_config - [ ] list_addons - [X] list_clusters -- [ ] list_eks_anywhere_subscriptions - [X] list_fargate_profiles - [ ] list_identity_provider_configs - [X] list_nodegroups @@ -2713,7 +2693,6 @@ - [ ] update_addon - [ ] update_cluster_config - [ ] update_cluster_version -- [ ] update_eks_anywhere_subscription - [ ] update_nodegroup_config - [ ] update_nodegroup_version
@@ -2868,7 +2847,7 @@ ## elb
-65% implemented +72% implemented - [ ] add_tags - [X] apply_security_groups_to_load_balancer @@ -2878,7 +2857,7 @@ - [X] create_lb_cookie_stickiness_policy - [X] create_load_balancer - [X] create_load_balancer_listeners -- [ ] create_load_balancer_policy +- [X] create_load_balancer_policy - [X] delete_load_balancer - [X] delete_load_balancer_listeners - [X] delete_load_balancer_policy @@ -2897,7 +2876,7 @@ - [ ] register_instances_with_load_balancer - [ ] remove_tags - [X] set_load_balancer_listener_ssl_certificate -- [ ] set_load_balancer_policies_for_backend_server +- [X] set_load_balancer_policies_for_backend_server - [X] set_load_balancer_policies_of_listener
@@ -3294,7 +3273,7 @@ ## glue
-31% implemented +33% implemented - [X] batch_create_partition - [ ] batch_delete_connection @@ -3308,7 +3287,6 @@ - [ ] batch_get_dev_endpoints - [X] batch_get_jobs - [X] batch_get_partition -- [ ] batch_get_table_optimizer - [X] batch_get_triggers - [ ] batch_get_workflows - [ ] batch_stop_job_run @@ -3336,7 +3314,6 @@ - [ ] create_security_configuration - [X] create_session - [X] create_table -- [ ] create_table_optimizer - [X] create_trigger - [ ] create_user_defined_function - [ ] create_workflow @@ -3361,7 +3338,6 @@ - [ ] delete_security_configuration - [X] delete_session - [X] delete_table -- [ ] delete_table_optimizer - [X] delete_table_version - [X] delete_trigger - [ ] delete_user_defined_function @@ -3374,8 +3350,6 @@ - [ ] get_classifiers - [ ] get_column_statistics_for_partition - [ ] get_column_statistics_for_table -- [ ] get_column_statistics_task_run -- [ ] get_column_statistics_task_runs - [ ] get_connection - [ ] get_connections - [X] get_crawler @@ -3418,7 +3392,6 @@ - [X] get_session - [ ] get_statement - [X] get_table -- [ ] get_table_optimizer - [X] get_table_version - [X] get_table_versions - [X] get_tables @@ -3436,7 +3409,6 @@ - [ ] get_workflow_runs - [ ] import_catalog_to_glue - [ ] list_blueprints -- [ ] list_column_statistics_task_runs - [X] list_crawlers - [ ] list_crawls - [ ] list_custom_entity_types @@ -3452,7 +3424,6 @@ - [ ] list_schemas - [X] list_sessions - [ ] list_statements -- [ ] list_table_optimizer_runs - [X] list_triggers - [ ] list_workflows - [ ] put_data_catalog_encryption_settings @@ -3467,7 +3438,6 @@ - [ ] run_statement - [ ] search_tables - [ ] start_blueprint_run -- [ ] start_column_statistics_task_run - [X] start_crawler - [ ] start_crawler_schedule - [ ] start_data_quality_rule_recommendation_run @@ -3479,7 +3449,6 @@ - [ ] start_ml_labeling_set_generation_task_run - [X] start_trigger - [ ] start_workflow_run -- [ ] stop_column_statistics_task_run - [X] stop_crawler - [ ] stop_crawler_schedule - [X] stop_session @@ -3505,7 +3474,6 @@ - [X] update_schema - [ ] update_source_control_from_job - [X] update_table -- [ ] update_table_optimizer - [ ] update_trigger - [ ] update_user_defined_function - [ ] update_workflow @@ -4427,7 +4395,7 @@ ## lambda
-54% implemented +62% implemented - [ ] add_layer_version_permission - [X] add_permission @@ -4442,7 +4410,7 @@ - [X] delete_function - [ ] delete_function_code_signing_config - [X] delete_function_concurrency -- [ ] delete_function_event_invoke_config +- [X] delete_function_event_invoke_config - [X] delete_function_url_config - [X] delete_layer_version - [ ] delete_provisioned_concurrency_config @@ -4454,7 +4422,7 @@ - [ ] get_function_code_signing_config - [X] get_function_concurrency - [ ] get_function_configuration -- [ ] get_function_event_invoke_config +- [X] get_function_event_invoke_config - [X] get_function_url_config - [X] get_layer_version - [ ] get_layer_version_by_arn @@ -4468,7 +4436,7 @@ - [X] list_aliases - [ ] list_code_signing_configs - [X] list_event_source_mappings -- [ ] list_function_event_invoke_configs +- [X] list_function_event_invoke_configs - [ ] list_function_url_configs - [X] list_functions - [ ] list_functions_by_code_signing_config @@ -4481,7 +4449,7 @@ - [ ] publish_version - [ ] put_function_code_signing_config - [X] put_function_concurrency -- [ ] put_function_event_invoke_config +- [X] put_function_event_invoke_config - [ ] put_provisioned_concurrency_config - [ ] put_runtime_management_config - [ ] remove_layer_version_permission @@ -4493,26 +4461,21 @@ - [X] update_event_source_mapping - [X] update_function_code - [X] update_function_configuration -- [ ] update_function_event_invoke_config +- [X] update_function_event_invoke_config - [X] update_function_url_config
## logs
-51% implemented +68% implemented - [ ] associate_kms_key - [ ] cancel_export_task -- [ ] create_delivery - [X] create_export_task - [X] create_log_group - [X] create_log_stream - [ ] delete_account_policy - [ ] delete_data_protection_policy -- [ ] delete_delivery -- [ ] delete_delivery_destination -- [ ] delete_delivery_destination_policy -- [ ] delete_delivery_source - [X] delete_destination - [X] delete_log_group - [X] delete_log_stream @@ -4522,11 +4485,8 @@ - [X] delete_retention_policy - [X] delete_subscription_filter - [ ] describe_account_policies -- [ ] describe_deliveries -- [ ] describe_delivery_destinations -- [ ] describe_delivery_sources - [X] describe_destinations -- [ ] describe_export_tasks +- [X] describe_export_tasks - [X] describe_log_groups - [X] describe_log_streams - [X] describe_metric_filters @@ -4537,10 +4497,6 @@ - [ ] disassociate_kms_key - [X] filter_log_events - [ ] get_data_protection_policy -- [ ] get_delivery -- [ ] get_delivery_destination -- [ ] get_delivery_destination_policy -- [ ] get_delivery_source - [X] get_log_events - [ ] get_log_group_fields - [ ] get_log_record @@ -4549,9 +4505,6 @@ - [X] list_tags_log_group - [ ] put_account_policy - [ ] put_data_protection_policy -- [ ] put_delivery_destination -- [ ] put_delivery_destination_policy -- [ ] put_delivery_source - [X] put_destination - [X] put_destination_policy - [X] put_log_events @@ -5344,7 +5297,6 @@ - [X] create_ingestion - [ ] create_namespace - [ ] create_refresh_schedule -- [ ] create_role_membership - [ ] create_template - [ ] create_template_alias - [ ] create_theme @@ -5366,8 +5318,6 @@ - [ ] delete_iam_policy_assignment - [ ] delete_namespace - [ ] delete_refresh_schedule -- [ ] delete_role_custom_permission -- [ ] delete_role_membership - [ ] delete_template - [ ] delete_template_alias - [ ] delete_theme @@ -5405,7 +5355,6 @@ - [ ] describe_ip_restriction - [ ] describe_namespace - [ ] describe_refresh_schedule -- [ ] describe_role_custom_permission - [ ] describe_template - [ ] describe_template_alias - [ ] describe_template_definition @@ -5439,7 +5388,6 @@ - [ ] list_ingestions - [ ] list_namespaces - [ ] list_refresh_schedules -- [ ] list_role_memberships - [ ] list_tags_for_resource - [ ] list_template_aliases - [ ] list_template_versions @@ -5484,7 +5432,6 @@ - [ ] update_ip_restriction - [ ] update_public_sharing_settings - [ ] update_refresh_schedule -- [ ] update_role_custom_permission - [ ] update_template - [ ] update_template_alias - [ ] update_template_permissions @@ -5540,7 +5487,7 @@ ## rds
-36% implemented +38% implemented - [ ] add_role_to_db_cluster - [ ] add_role_to_db_instance @@ -5573,7 +5520,6 @@ - [X] create_global_cluster - [ ] create_integration - [X] create_option_group -- [ ] create_tenant_database - [ ] delete_blue_green_deployment - [ ] delete_custom_db_engine_version - [X] delete_db_cluster @@ -5593,7 +5539,6 @@ - [X] delete_global_cluster - [ ] delete_integration - [X] delete_option_group -- [ ] delete_tenant_database - [ ] deregister_db_proxy_targets - [ ] describe_account_attributes - [ ] describe_blue_green_deployments @@ -5618,7 +5563,6 @@ - [ ] describe_db_proxy_targets - [ ] describe_db_security_groups - [ ] describe_db_snapshot_attributes -- [ ] describe_db_snapshot_tenant_databases - [X] describe_db_snapshots - [X] describe_db_subnet_groups - [ ] describe_engine_default_cluster_parameters @@ -5636,7 +5580,6 @@ - [ ] describe_reserved_db_instances - [ ] describe_reserved_db_instances_offerings - [ ] describe_source_regions -- [ ] describe_tenant_databases - [ ] describe_valid_db_instance_modifications - [ ] download_db_log_file_portion - [ ] failover_db_cluster @@ -5661,7 +5604,6 @@ - [ ] modify_event_subscription - [ ] modify_global_cluster - [X] modify_option_group -- [ ] modify_tenant_database - [X] promote_read_replica - [X] promote_read_replica_db_cluster - [ ] purchase_reserved_db_instances_offering @@ -5710,7 +5652,7 @@ ## redshift
-22% implemented +23% implemented - [ ] accept_reserved_node_exchange - [ ] add_partner @@ -5734,7 +5676,6 @@ - [ ] create_event_subscription - [ ] create_hsm_client_certificate - [ ] create_hsm_configuration -- [ ] create_redshift_idc_application - [ ] create_scheduled_action - [X] create_snapshot_copy_grant - [ ] create_snapshot_schedule @@ -5753,7 +5694,6 @@ - [ ] delete_hsm_client_certificate - [ ] delete_hsm_configuration - [ ] delete_partner -- [ ] delete_redshift_idc_application - [ ] delete_resource_policy - [ ] delete_scheduled_action - [X] delete_snapshot_copy_grant @@ -5788,7 +5728,6 @@ - [ ] describe_node_configuration_options - [ ] describe_orderable_cluster_options - [ ] describe_partners -- [ ] describe_redshift_idc_applications - [ ] describe_reserved_node_exchange_status - [ ] describe_reserved_node_offerings - [ ] describe_reserved_nodes @@ -5824,7 +5763,6 @@ - [ ] modify_custom_domain_association - [ ] modify_endpoint_access - [ ] modify_event_subscription -- [ ] modify_redshift_idc_application - [ ] modify_scheduled_action - [X] modify_snapshot_copy_retention_period - [ ] modify_snapshot_schedule @@ -6299,14 +6237,13 @@ ## s3control
-12% implemented +14% implemented - [X] create_access_point - [ ] create_access_point_for_object_lambda - [ ] create_bucket - [ ] create_job - [ ] create_multi_region_access_point -- [ ] create_storage_lens_group - [X] delete_access_point - [ ] delete_access_point_for_object_lambda - [X] delete_access_point_policy @@ -6321,7 +6258,6 @@ - [X] delete_public_access_block - [ ] delete_storage_lens_configuration - [ ] delete_storage_lens_configuration_tagging -- [ ] delete_storage_lens_group - [ ] describe_job - [ ] describe_multi_region_access_point_operation - [X] get_access_point @@ -6345,15 +6281,12 @@ - [X] get_public_access_block - [ ] get_storage_lens_configuration - [ ] get_storage_lens_configuration_tagging -- [ ] get_storage_lens_group - [ ] list_access_points - [ ] list_access_points_for_object_lambda - [ ] list_jobs - [ ] list_multi_region_access_points - [ ] list_regional_buckets - [ ] list_storage_lens_configurations -- [ ] list_storage_lens_groups -- [ ] list_tags_for_resource - [ ] put_access_point_configuration_for_object_lambda - [ ] put_access_point_policy - [ ] put_access_point_policy_for_object_lambda @@ -6368,11 +6301,8 @@ - [ ] put_storage_lens_configuration - [ ] put_storage_lens_configuration_tagging - [ ] submit_multi_region_access_point_routes -- [ ] tag_resource -- [ ] untag_resource - [ ] update_job_priority - [ ] update_job_status -- [ ] update_storage_lens_group
## sagemaker @@ -7238,59 +7168,31 @@ ## sso-admin
-10% implemented +21% implemented - [ ] attach_customer_managed_policy_reference_to_permission_set - [ ] attach_managed_policy_to_permission_set - [X] create_account_assignment -- [ ] create_application -- [ ] create_application_assignment -- [ ] create_instance - [ ] create_instance_access_control_attribute_configuration - [X] create_permission_set -- [ ] create_trusted_token_issuer - [X] delete_account_assignment -- [ ] delete_application -- [ ] delete_application_access_scope -- [ ] delete_application_assignment -- [ ] delete_application_authentication_method -- [ ] delete_application_grant - [ ] delete_inline_policy_from_permission_set -- [ ] delete_instance - [ ] delete_instance_access_control_attribute_configuration - [X] delete_permission_set - [ ] delete_permissions_boundary_from_permission_set -- [ ] delete_trusted_token_issuer - [ ] describe_account_assignment_creation_status - [ ] describe_account_assignment_deletion_status -- [ ] describe_application -- [ ] describe_application_assignment -- [ ] describe_application_provider -- [ ] describe_instance - [ ] describe_instance_access_control_attribute_configuration - [X] describe_permission_set - [ ] describe_permission_set_provisioning_status -- [ ] describe_trusted_token_issuer - [ ] detach_customer_managed_policy_reference_from_permission_set - [ ] detach_managed_policy_from_permission_set -- [ ] get_application_access_scope -- [ ] get_application_assignment_configuration -- [ ] get_application_authentication_method -- [ ] get_application_grant - [ ] get_inline_policy_for_permission_set - [ ] get_permissions_boundary_for_permission_set - [ ] list_account_assignment_creation_status - [ ] list_account_assignment_deletion_status - [X] list_account_assignments -- [ ] list_account_assignments_for_principal - [ ] list_accounts_for_provisioned_permission_set -- [ ] list_application_access_scopes -- [ ] list_application_assignments -- [ ] list_application_assignments_for_principal -- [ ] list_application_authentication_methods -- [ ] list_application_grants -- [ ] list_application_providers -- [ ] list_applications - [ ] list_customer_managed_policy_references_in_permission_set - [ ] list_instances - [ ] list_managed_policies_in_permission_set @@ -7298,26 +7200,18 @@ - [X] list_permission_sets - [ ] list_permission_sets_provisioned_to_account - [ ] list_tags_for_resource -- [ ] list_trusted_token_issuers - [ ] provision_permission_set -- [ ] put_application_access_scope -- [ ] put_application_assignment_configuration -- [ ] put_application_authentication_method -- [ ] put_application_grant - [ ] put_inline_policy_to_permission_set - [ ] put_permissions_boundary_to_permission_set - [ ] tag_resource - [ ] untag_resource -- [ ] update_application -- [ ] update_instance - [ ] update_instance_access_control_attribute_configuration - [X] update_permission_set -- [ ] update_trusted_token_issuer
## stepfunctions
-37% implemented +38% implemented - [ ] create_activity - [X] create_state_machine @@ -7342,7 +7236,6 @@ - [X] list_state_machines - [X] list_tags_for_resource - [ ] publish_state_machine_version -- [ ] redrive_execution - [ ] send_task_failure - [ ] send_task_heartbeat - [ ] send_task_success @@ -7719,7 +7612,6 @@ - kinesis-video-webrtc-storage - kinesisanalytics - kinesisanalyticsv2 -- launch-wizard - lex-models - lex-runtime - lexv2-models @@ -7734,6 +7626,7 @@ - lookoutvision - m2 - machinelearning +- macie - macie2 - managedblockchain-query - marketplace-catalog @@ -7821,7 +7714,6 @@ - tnb - transfer - translate -- trustedadvisor - verifiedpermissions - voice-id - vpc-lattice diff --git a/docs/docs/services/comprehend.rst b/docs/docs/services/comprehend.rst index a7255a75fb3c..4b477a9c742d 100644 --- a/docs/docs/services/comprehend.rst +++ b/docs/docs/services/comprehend.rst @@ -72,7 +72,6 @@ comprehend - [X] detect_sentiment - [ ] detect_syntax - [ ] detect_targeted_sentiment -- [ ] detect_toxic_content - [ ] import_model - [ ] list_datasets - [ ] list_document_classification_jobs diff --git a/docs/docs/services/ec2.rst b/docs/docs/services/ec2.rst index 95c9d6a8b8b6..319602d36eab 100644 --- a/docs/docs/services/ec2.rst +++ b/docs/docs/services/ec2.rst @@ -48,7 +48,6 @@ ec2 - [ ] associate_enclave_certificate_iam_role - [X] associate_iam_instance_profile - [ ] associate_instance_event_window -- [ ] associate_ipam_byoasn - [ ] associate_ipam_resource_discovery - [ ] associate_nat_gateway_address - [X] associate_route_table @@ -243,7 +242,6 @@ ec2 - [ ] delete_vpn_connection_route - [X] delete_vpn_gateway - [ ] deprovision_byoip_cidr -- [ ] deprovision_ipam_byoasn - [ ] deprovision_ipam_pool_cidr - [ ] deprovision_public_ipv4_pool_cidr - [X] deregister_image @@ -309,12 +307,10 @@ ec2 - [ ] describe_instance_event_notification_attributes - [ ] describe_instance_event_windows - [X] describe_instance_status -- [ ] describe_instance_topology - [X] describe_instance_type_offerings - [X] describe_instance_types - [X] describe_instances - [X] describe_internet_gateways -- [ ] describe_ipam_byoasn - [ ] describe_ipam_pools - [ ] describe_ipam_resource_discoveries - [ ] describe_ipam_resource_discovery_associations @@ -330,7 +326,6 @@ ec2 - [ ] describe_local_gateway_virtual_interface_groups - [ ] describe_local_gateway_virtual_interfaces - [ ] describe_local_gateways -- [ ] describe_locked_snapshots - [X] describe_managed_prefix_lists - [ ] describe_moving_addresses - [X] describe_nat_gateways @@ -442,7 +437,6 @@ ec2 - [ ] disable_image_deprecation - [ ] disable_ipam_organization_admin_account - [ ] disable_serial_console_access -- [ ] disable_snapshot_block_public_access - [X] disable_transit_gateway_route_table_propagation - [ ] disable_vgw_route_propagation - [X] disable_vpc_classic_link @@ -452,7 +446,6 @@ ec2 - [ ] disassociate_enclave_certificate_iam_role - [X] disassociate_iam_instance_profile - [ ] disassociate_instance_event_window -- [ ] disassociate_ipam_byoasn - [ ] disassociate_ipam_resource_discovery - [ ] disassociate_nat_gateway_address - [X] disassociate_route_table @@ -473,7 +466,6 @@ ec2 - [ ] enable_ipam_organization_admin_account - [ ] enable_reachability_analyzer_organization_sharing - [ ] enable_serial_console_access -- [ ] enable_snapshot_block_public_access - [X] enable_transit_gateway_route_table_propagation - [ ] enable_vgw_route_propagation - [ ] enable_volume_io @@ -501,7 +493,6 @@ ec2 - [ ] get_instance_uefi_data - [ ] get_ipam_address_history - [ ] get_ipam_discovered_accounts -- [ ] get_ipam_discovered_public_addresses - [ ] get_ipam_discovered_resource_cidrs - [ ] get_ipam_pool_allocations - [ ] get_ipam_pool_cidrs @@ -515,7 +506,6 @@ ec2 - [ ] get_reserved_instances_exchange_quote - [ ] get_security_groups_for_vpc - [ ] get_serial_console_access_status -- [ ] get_snapshot_block_public_access_state - [ ] get_spot_placement_scores - [ ] get_subnet_cidr_reservations - [ ] get_transit_gateway_attachment_propagations @@ -538,7 +528,6 @@ ec2 - [ ] import_volume - [ ] list_images_in_recycle_bin - [ ] list_snapshots_in_recycle_bin -- [ ] lock_snapshot - [ ] modify_address_attribute - [ ] modify_availability_zone_group - [ ] modify_capacity_reservation @@ -611,7 +600,6 @@ ec2 - [ ] move_address_to_vpc - [ ] move_byoip_cidr_to_ipam - [ ] provision_byoip_cidr -- [ ] provision_ipam_byoasn - [ ] provision_ipam_pool_cidr - [ ] provision_public_ipv4_pool_cidr - [ ] purchase_capacity_block @@ -689,7 +677,6 @@ ec2 - [X] unassign_ipv6_addresses - [X] unassign_private_ip_addresses - [ ] unassign_private_nat_gateway_address -- [ ] unlock_snapshot - [ ] unmonitor_instances - [X] update_security_group_rule_descriptions_egress - [X] update_security_group_rule_descriptions_ingress diff --git a/docs/docs/services/ecr.rst b/docs/docs/services/ecr.rst index 857f737afdc4..64cab014634e 100644 --- a/docs/docs/services/ecr.rst +++ b/docs/docs/services/ecr.rst @@ -77,7 +77,5 @@ ecr - [ ] start_lifecycle_policy_preview - [X] tag_resource - [X] untag_resource -- [ ] update_pull_through_cache_rule - [ ] upload_layer_part -- [ ] validate_pull_through_cache_rule diff --git a/docs/docs/services/eks.rst b/docs/docs/services/eks.rst index 2c5094545162..47798868ae88 100644 --- a/docs/docs/services/eks.rst +++ b/docs/docs/services/eks.rst @@ -29,12 +29,10 @@ eks - [ ] associate_identity_provider_config - [ ] create_addon - [X] create_cluster -- [ ] create_eks_anywhere_subscription - [X] create_fargate_profile - [X] create_nodegroup - [ ] delete_addon - [X] delete_cluster -- [ ] delete_eks_anywhere_subscription - [X] delete_fargate_profile - [X] delete_nodegroup - [ ] deregister_cluster @@ -42,7 +40,6 @@ eks - [ ] describe_addon_configuration - [ ] describe_addon_versions - [X] describe_cluster -- [ ] describe_eks_anywhere_subscription - [X] describe_fargate_profile - [ ] describe_identity_provider_config - [X] describe_nodegroup @@ -50,7 +47,6 @@ eks - [ ] disassociate_identity_provider_config - [ ] list_addons - [X] list_clusters -- [ ] list_eks_anywhere_subscriptions - [X] list_fargate_profiles - [ ] list_identity_provider_configs - [X] list_nodegroups @@ -74,7 +70,6 @@ eks - [ ] update_addon - [ ] update_cluster_config - [ ] update_cluster_version -- [ ] update_eks_anywhere_subscription - [ ] update_nodegroup_config - [ ] update_nodegroup_version diff --git a/docs/docs/services/elb.rst b/docs/docs/services/elb.rst index e4cc475ebf2c..6286d27a59c9 100644 --- a/docs/docs/services/elb.rst +++ b/docs/docs/services/elb.rst @@ -33,7 +33,7 @@ elb - [X] create_lb_cookie_stickiness_policy - [X] create_load_balancer - [X] create_load_balancer_listeners -- [ ] create_load_balancer_policy +- [X] create_load_balancer_policy - [X] delete_load_balancer - [X] delete_load_balancer_listeners - [X] delete_load_balancer_policy @@ -52,6 +52,6 @@ elb - [ ] register_instances_with_load_balancer - [ ] remove_tags - [X] set_load_balancer_listener_ssl_certificate -- [ ] set_load_balancer_policies_for_backend_server +- [X] set_load_balancer_policies_for_backend_server - [X] set_load_balancer_policies_of_listener diff --git a/docs/docs/services/glue.rst b/docs/docs/services/glue.rst index 58fd07358f25..2aeac64675f5 100644 --- a/docs/docs/services/glue.rst +++ b/docs/docs/services/glue.rst @@ -37,7 +37,6 @@ glue - [ ] batch_get_dev_endpoints - [X] batch_get_jobs - [X] batch_get_partition -- [ ] batch_get_table_optimizer - [X] batch_get_triggers - [ ] batch_get_workflows - [ ] batch_stop_job_run @@ -69,7 +68,6 @@ glue - [ ] create_security_configuration - [X] create_session - [X] create_table -- [ ] create_table_optimizer - [X] create_trigger - [ ] create_user_defined_function - [ ] create_workflow @@ -94,7 +92,6 @@ glue - [ ] delete_security_configuration - [X] delete_session - [X] delete_table -- [ ] delete_table_optimizer - [X] delete_table_version - [X] delete_trigger - [ ] delete_user_defined_function @@ -107,8 +104,6 @@ glue - [ ] get_classifiers - [ ] get_column_statistics_for_partition - [ ] get_column_statistics_for_table -- [ ] get_column_statistics_task_run -- [ ] get_column_statistics_task_runs - [ ] get_connection - [ ] get_connections - [X] get_crawler @@ -163,7 +158,6 @@ glue - [X] get_session - [ ] get_statement - [X] get_table -- [ ] get_table_optimizer - [X] get_table_version - [X] get_table_versions - [X] get_tables @@ -181,7 +175,6 @@ glue - [ ] get_workflow_runs - [ ] import_catalog_to_glue - [ ] list_blueprints -- [ ] list_column_statistics_task_runs - [X] list_crawlers - [ ] list_crawls - [ ] list_custom_entity_types @@ -197,7 +190,6 @@ glue - [ ] list_schemas - [X] list_sessions - [ ] list_statements -- [ ] list_table_optimizer_runs - [X] list_triggers - [ ] list_workflows - [ ] put_data_catalog_encryption_settings @@ -212,7 +204,6 @@ glue - [ ] run_statement - [ ] search_tables - [ ] start_blueprint_run -- [ ] start_column_statistics_task_run - [X] start_crawler - [ ] start_crawler_schedule - [ ] start_data_quality_rule_recommendation_run @@ -224,7 +215,6 @@ glue - [ ] start_ml_labeling_set_generation_task_run - [X] start_trigger - [ ] start_workflow_run -- [ ] stop_column_statistics_task_run - [X] stop_crawler - [ ] stop_crawler_schedule - [X] stop_session @@ -254,7 +244,6 @@ glue - [ ] update_source_control_from_job - [X] update_table -- [ ] update_table_optimizer - [ ] update_trigger - [ ] update_user_defined_function - [ ] update_workflow diff --git a/docs/docs/services/iot.rst b/docs/docs/services/iot.rst index f6504e44a990..b52b080f41ec 100644 --- a/docs/docs/services/iot.rst +++ b/docs/docs/services/iot.rst @@ -181,6 +181,10 @@ iot - [ ] get_v2_logging_options - [ ] list_active_violations - [X] list_attached_policies + + Pagination is not yet implemented + + - [ ] list_audit_findings - [ ] list_audit_mitigation_actions_executions - [ ] list_audit_mitigation_actions_tasks @@ -222,9 +226,21 @@ iot - [ ] list_package_versions - [ ] list_packages - [X] list_policies + + Pagination is not yet implemented + + - [X] list_policy_principals + + Pagination is not yet implemented + + - [X] list_policy_versions - [X] list_principal_policies + + Pagination is not yet implemented + + - [X] list_principal_things - [ ] list_provisioning_template_versions - [ ] list_provisioning_templates @@ -236,6 +252,10 @@ iot - [ ] list_streams - [ ] list_tags_for_resource - [X] list_targets_for_policy + + Pagination is not yet implemented + + - [ ] list_targets_for_security_profile - [X] list_thing_groups - [X] list_thing_groups_for_thing diff --git a/docs/docs/services/lambda.rst b/docs/docs/services/lambda.rst index cfd8bb308d16..ecc51425b535 100644 --- a/docs/docs/services/lambda.rst +++ b/docs/docs/services/lambda.rst @@ -49,7 +49,7 @@ lambda - [X] delete_function - [ ] delete_function_code_signing_config - [X] delete_function_concurrency -- [ ] delete_function_event_invoke_config +- [X] delete_function_event_invoke_config - [X] delete_function_url_config The Qualifier-parameter is not yet implemented @@ -65,7 +65,7 @@ lambda - [ ] get_function_code_signing_config - [X] get_function_concurrency - [ ] get_function_configuration -- [ ] get_function_event_invoke_config +- [X] get_function_event_invoke_config - [X] get_function_url_config The Qualifier-parameter is not yet implemented @@ -87,7 +87,7 @@ lambda - [X] list_aliases - [ ] list_code_signing_configs - [X] list_event_source_mappings -- [ ] list_function_event_invoke_configs +- [X] list_function_event_invoke_configs - [ ] list_function_url_configs - [X] list_functions - [ ] list_functions_by_code_signing_config @@ -113,7 +113,7 @@ lambda variable prior to testing. -- [ ] put_function_event_invoke_config +- [X] put_function_event_invoke_config - [ ] put_provisioned_concurrency_config - [ ] put_runtime_management_config - [ ] remove_layer_version_permission @@ -129,7 +129,7 @@ lambda - [X] update_event_source_mapping - [X] update_function_code - [X] update_function_configuration -- [ ] update_function_event_invoke_config +- [X] update_function_event_invoke_config - [X] update_function_url_config The Qualifier-parameter is not yet implemented diff --git a/docs/docs/services/logs.rst b/docs/docs/services/logs.rst index 09596c2b21d8..c9b4206e07ec 100644 --- a/docs/docs/services/logs.rst +++ b/docs/docs/services/logs.rst @@ -27,16 +27,11 @@ logs - [ ] associate_kms_key - [ ] cancel_export_task -- [ ] create_delivery - [X] create_export_task - [X] create_log_group - [X] create_log_stream - [ ] delete_account_policy - [ ] delete_data_protection_policy -- [ ] delete_delivery -- [ ] delete_delivery_destination -- [ ] delete_delivery_destination_policy -- [ ] delete_delivery_source - [X] delete_destination - [X] delete_log_group - [X] delete_log_stream @@ -50,11 +45,12 @@ logs - [X] delete_retention_policy - [X] delete_subscription_filter - [ ] describe_account_policies -- [ ] describe_deliveries -- [ ] describe_delivery_destinations -- [ ] describe_delivery_sources - [X] describe_destinations -- [ ] describe_export_tasks +- [X] describe_export_tasks + + Pagination is not yet implemented + + - [X] describe_log_groups - [X] describe_log_streams - [X] describe_metric_filters @@ -82,10 +78,6 @@ logs - [ ] get_data_protection_policy -- [ ] get_delivery -- [ ] get_delivery_destination -- [ ] get_delivery_destination_policy -- [ ] get_delivery_source - [X] get_log_events - [ ] get_log_group_fields - [ ] get_log_record @@ -98,9 +90,6 @@ logs - [X] list_tags_log_group - [ ] put_account_policy - [ ] put_data_protection_policy -- [ ] put_delivery_destination -- [ ] put_delivery_destination_policy -- [ ] put_delivery_source - [X] put_destination - [X] put_destination_policy - [X] put_log_events diff --git a/docs/docs/services/quicksight.rst b/docs/docs/services/quicksight.rst index 51e65ce0ce32..1cdc89deb954 100644 --- a/docs/docs/services/quicksight.rst +++ b/docs/docs/services/quicksight.rst @@ -42,7 +42,6 @@ quicksight - [X] create_ingestion - [ ] create_namespace - [ ] create_refresh_schedule -- [ ] create_role_membership - [ ] create_template - [ ] create_template_alias - [ ] create_theme @@ -64,8 +63,6 @@ quicksight - [ ] delete_iam_policy_assignment - [ ] delete_namespace - [ ] delete_refresh_schedule -- [ ] delete_role_custom_permission -- [ ] delete_role_membership - [ ] delete_template - [ ] delete_template_alias - [ ] delete_theme @@ -103,7 +100,6 @@ quicksight - [ ] describe_ip_restriction - [ ] describe_namespace - [ ] describe_refresh_schedule -- [ ] describe_role_custom_permission - [ ] describe_template - [ ] describe_template_alias - [ ] describe_template_definition @@ -145,7 +141,6 @@ quicksight - [ ] list_ingestions - [ ] list_namespaces - [ ] list_refresh_schedules -- [ ] list_role_memberships - [ ] list_tags_for_resource - [ ] list_template_aliases - [ ] list_template_versions @@ -199,7 +194,6 @@ quicksight - [ ] update_ip_restriction - [ ] update_public_sharing_settings - [ ] update_refresh_schedule -- [ ] update_role_custom_permission - [ ] update_template - [ ] update_template_alias - [ ] update_template_permissions diff --git a/docs/docs/services/rds.rst b/docs/docs/services/rds.rst index 1a08f09c467a..d821f6f9aa54 100644 --- a/docs/docs/services/rds.rst +++ b/docs/docs/services/rds.rst @@ -56,7 +56,6 @@ rds - [X] create_global_cluster - [ ] create_integration - [X] create_option_group -- [ ] create_tenant_database - [ ] delete_blue_green_deployment - [ ] delete_custom_db_engine_version - [X] delete_db_cluster @@ -76,7 +75,6 @@ rds - [X] delete_global_cluster - [ ] delete_integration - [X] delete_option_group -- [ ] delete_tenant_database - [ ] deregister_db_proxy_targets - [ ] describe_account_attributes - [ ] describe_blue_green_deployments @@ -101,7 +99,6 @@ rds - [ ] describe_db_proxy_targets - [ ] describe_db_security_groups - [ ] describe_db_snapshot_attributes -- [ ] describe_db_snapshot_tenant_databases - [X] describe_db_snapshots - [X] describe_db_subnet_groups - [ ] describe_engine_default_cluster_parameters @@ -123,7 +120,6 @@ rds - [ ] describe_reserved_db_instances - [ ] describe_reserved_db_instances_offerings - [ ] describe_source_regions -- [ ] describe_tenant_databases - [ ] describe_valid_db_instance_modifications - [ ] download_db_log_file_portion - [ ] failover_db_cluster @@ -148,7 +144,6 @@ rds - [ ] modify_event_subscription - [ ] modify_global_cluster - [X] modify_option_group -- [ ] modify_tenant_database - [X] promote_read_replica - [X] promote_read_replica_db_cluster - [ ] purchase_reserved_db_instances_offering diff --git a/docs/docs/services/redshift.rst b/docs/docs/services/redshift.rst index 6abb8ead6196..31bbeeaea8a0 100644 --- a/docs/docs/services/redshift.rst +++ b/docs/docs/services/redshift.rst @@ -47,7 +47,6 @@ redshift - [ ] create_event_subscription - [ ] create_hsm_client_certificate - [ ] create_hsm_configuration -- [ ] create_redshift_idc_application - [ ] create_scheduled_action - [X] create_snapshot_copy_grant - [ ] create_snapshot_schedule @@ -66,7 +65,6 @@ redshift - [ ] delete_hsm_client_certificate - [ ] delete_hsm_configuration - [ ] delete_partner -- [ ] delete_redshift_idc_application - [ ] delete_resource_policy - [ ] delete_scheduled_action - [X] delete_snapshot_copy_grant @@ -101,7 +99,6 @@ redshift - [ ] describe_node_configuration_options - [ ] describe_orderable_cluster_options - [ ] describe_partners -- [ ] describe_redshift_idc_applications - [ ] describe_reserved_node_exchange_status - [ ] describe_reserved_node_offerings - [ ] describe_reserved_nodes @@ -137,7 +134,6 @@ redshift - [ ] modify_custom_domain_association - [ ] modify_endpoint_access - [ ] modify_event_subscription -- [ ] modify_redshift_idc_application - [ ] modify_scheduled_action - [X] modify_snapshot_copy_retention_period - [ ] modify_snapshot_schedule diff --git a/docs/docs/services/s3control.rst b/docs/docs/services/s3control.rst index 9f1ebdf2f925..0370d22b8d39 100644 --- a/docs/docs/services/s3control.rst +++ b/docs/docs/services/s3control.rst @@ -30,7 +30,6 @@ s3control - [ ] create_bucket - [ ] create_job - [ ] create_multi_region_access_point -- [ ] create_storage_lens_group - [X] delete_access_point - [ ] delete_access_point_for_object_lambda - [X] delete_access_point_policy @@ -45,7 +44,6 @@ s3control - [X] delete_public_access_block - [ ] delete_storage_lens_configuration - [ ] delete_storage_lens_configuration_tagging -- [ ] delete_storage_lens_group - [ ] describe_job - [ ] describe_multi_region_access_point_operation - [X] get_access_point @@ -73,15 +71,12 @@ s3control - [X] get_public_access_block - [ ] get_storage_lens_configuration - [ ] get_storage_lens_configuration_tagging -- [ ] get_storage_lens_group - [ ] list_access_points - [ ] list_access_points_for_object_lambda - [ ] list_jobs - [ ] list_multi_region_access_points - [ ] list_regional_buckets - [ ] list_storage_lens_configurations -- [ ] list_storage_lens_groups -- [ ] list_tags_for_resource - [ ] put_access_point_configuration_for_object_lambda - [ ] put_access_point_policy - [ ] put_access_point_policy_for_object_lambda @@ -96,9 +91,6 @@ s3control - [ ] put_storage_lens_configuration - [ ] put_storage_lens_configuration_tagging - [ ] submit_multi_region_access_point_routes -- [ ] tag_resource -- [ ] untag_resource - [ ] update_job_priority - [ ] update_job_status -- [ ] update_storage_lens_group diff --git a/docs/docs/services/sso-admin.rst b/docs/docs/services/sso-admin.rst index 6e6003a4cb0b..07eb000e2a80 100644 --- a/docs/docs/services/sso-admin.rst +++ b/docs/docs/services/sso-admin.rst @@ -30,40 +30,20 @@ sso-admin - [ ] attach_customer_managed_policy_reference_to_permission_set - [ ] attach_managed_policy_to_permission_set - [X] create_account_assignment -- [ ] create_application -- [ ] create_application_assignment -- [ ] create_instance - [ ] create_instance_access_control_attribute_configuration - [X] create_permission_set -- [ ] create_trusted_token_issuer - [X] delete_account_assignment -- [ ] delete_application -- [ ] delete_application_access_scope -- [ ] delete_application_assignment -- [ ] delete_application_authentication_method -- [ ] delete_application_grant - [ ] delete_inline_policy_from_permission_set -- [ ] delete_instance - [ ] delete_instance_access_control_attribute_configuration - [X] delete_permission_set - [ ] delete_permissions_boundary_from_permission_set -- [ ] delete_trusted_token_issuer - [ ] describe_account_assignment_creation_status - [ ] describe_account_assignment_deletion_status -- [ ] describe_application -- [ ] describe_application_assignment -- [ ] describe_application_provider -- [ ] describe_instance - [ ] describe_instance_access_control_attribute_configuration - [X] describe_permission_set - [ ] describe_permission_set_provisioning_status -- [ ] describe_trusted_token_issuer - [ ] detach_customer_managed_policy_reference_from_permission_set - [ ] detach_managed_policy_from_permission_set -- [ ] get_application_access_scope -- [ ] get_application_assignment_configuration -- [ ] get_application_authentication_method -- [ ] get_application_grant - [ ] get_inline_policy_for_permission_set - [ ] get_permissions_boundary_for_permission_set - [ ] list_account_assignment_creation_status @@ -73,15 +53,7 @@ sso-admin Pagination has not yet been implemented -- [ ] list_account_assignments_for_principal - [ ] list_accounts_for_provisioned_permission_set -- [ ] list_application_access_scopes -- [ ] list_application_assignments -- [ ] list_application_assignments_for_principal -- [ ] list_application_authentication_methods -- [ ] list_application_grants -- [ ] list_application_providers -- [ ] list_applications - [ ] list_customer_managed_policy_references_in_permission_set - [ ] list_instances - [ ] list_managed_policies_in_permission_set @@ -89,19 +61,11 @@ sso-admin - [X] list_permission_sets - [ ] list_permission_sets_provisioned_to_account - [ ] list_tags_for_resource -- [ ] list_trusted_token_issuers - [ ] provision_permission_set -- [ ] put_application_access_scope -- [ ] put_application_assignment_configuration -- [ ] put_application_authentication_method -- [ ] put_application_grant - [ ] put_inline_policy_to_permission_set - [ ] put_permissions_boundary_to_permission_set - [ ] tag_resource - [ ] untag_resource -- [ ] update_application -- [ ] update_instance - [ ] update_instance_access_control_attribute_configuration - [X] update_permission_set -- [ ] update_trusted_token_issuer diff --git a/docs/docs/services/stepfunctions.rst b/docs/docs/services/stepfunctions.rst index 6ac74fc5916d..e374ca7e1b83 100644 --- a/docs/docs/services/stepfunctions.rst +++ b/docs/docs/services/stepfunctions.rst @@ -75,7 +75,6 @@ stepfunctions - [X] list_state_machines - [X] list_tags_for_resource - [ ] publish_state_machine_version -- [ ] redrive_execution - [ ] send_task_failure - [ ] send_task_heartbeat - [ ] send_task_success diff --git a/moto/awslambda/exceptions.py b/moto/awslambda/exceptions.py index 36636fff763a..85c91ecf6a10 100644 --- a/moto/awslambda/exceptions.py +++ b/moto/awslambda/exceptions.py @@ -100,6 +100,16 @@ def __init__(self) -> None: ) +class UnknownEventConfig(LambdaClientError): + code = 404 + + def __init__(self, arn: str) -> None: + super().__init__( + "ResourceNotFoundException", + f"The function {arn} doesn't have an EventInvokeConfig", + ) + + class ValidationException(LambdaClientError): def __init__(self, value: str, property_name: str, specific_message: str): message = f"1 validation error detected: Value '{value}' at '{property_name}' failed to satisfy constraint: {specific_message}" diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py index f5be1747b7e3..ffac0db24e9e 100644 --- a/moto/awslambda/models.py +++ b/moto/awslambda/models.py @@ -47,6 +47,7 @@ InvalidParameterValueException, InvalidRoleFormat, UnknownAliasException, + UnknownEventConfig, UnknownFunctionException, UnknownLayerException, UnknownLayerVersionException, @@ -294,6 +295,72 @@ def _validate_s3_bucket_and_key( return key +class EventInvokeConfig: + def __init__(self, arn: str, last_modified: str, config: Dict[str, Any]) -> None: + self.config = config + self.validate_max() + self.validate() + self.arn = arn + self.last_modified = last_modified + + def validate_max(self) -> None: + if "MaximumRetryAttempts" in self.config: + mra = self.config["MaximumRetryAttempts"] + if mra > 2: + raise ValidationException( + mra, + "maximumRetryAttempts", + "Member must have value less than or equal to 2", + ) + + # < 0 validation done by botocore + if "MaximumEventAgeInSeconds" in self.config: + mra = self.config["MaximumEventAgeInSeconds"] + if mra > 21600: + raise ValidationException( + mra, + "maximumEventAgeInSeconds", + "Member must have value less than or equal to 21600", + ) + + # < 60 validation done by botocore + + def validate(self) -> None: + # https://docs.aws.amazon.com/lambda/latest/dg/API_OnSuccess.html + regex = r"^$|arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)" + pattern = re.compile(regex) + + if self.config["DestinationConfig"]: + destination_config = self.config["DestinationConfig"] + if ( + "OnSuccess" in destination_config + and "Destination" in destination_config["OnSuccess"] + ): + contents = destination_config["OnSuccess"]["Destination"] + if not pattern.match(contents): + raise ValidationException( + contents, + "destinationConfig.onSuccess.destination", + f"Member must satisfy regular expression pattern: {regex}", + ) + if ( + "OnFailure" in destination_config + and "Destination" in destination_config["OnFailure"] + ): + contents = destination_config["OnFailure"]["Destination"] + if not pattern.match(contents): + raise ValidationException( + contents, + "destinationConfig.onFailure.destination", + f"Member must satisfy regular expression pattern: {regex}", + ) + + def response(self) -> Dict[str, Any]: + response = {"FunctionArn": self.arn, "LastModified": self.last_modified} + response.update(self.config) + return response + + class ImageConfig: def __init__(self, config: Dict[str, Any]) -> None: self.cmd = config.get("Command", []) @@ -549,6 +616,7 @@ def __init__( self.ephemeral_storage: str self.code_digest: str self.code_bytes: bytes + self.event_invoke_config: List[EventInvokeConfig] = [] self.description = spec.get("Description", "") self.memory_size = spec.get("MemorySize", 128) @@ -2302,6 +2370,44 @@ def get_function_concurrency(self, function_name: str) -> str: fn = self.get_function(function_name) return fn.reserved_concurrency + def put_function_event_invoke_config( + self, function_name: str, config: Dict[str, Any] + ) -> Dict[str, Any]: + fn = self.get_function(function_name) + event_config = EventInvokeConfig(fn.function_arn, fn.last_modified, config) + fn.event_invoke_config.append(event_config) + return event_config.response() + + def update_function_event_invoke_config( + self, function_name: str, config: Dict[str, Any] + ) -> Dict[str, Any]: + # partial functionality, the update function just does a put + # instead of partial update + return self.put_function_event_invoke_config(function_name, config) + + def get_function_event_invoke_config(self, function_name: str) -> Dict[str, Any]: + fn = self.get_function(function_name) + if fn.event_invoke_config: + response = fn.event_invoke_config[0] + return response.response() + else: + raise UnknownEventConfig(fn.function_arn) + + def delete_function_event_invoke_config(self, function_name: str) -> None: + if self.get_function_event_invoke_config(function_name): + fn = self.get_function(function_name) + fn.event_invoke_config = [] + + def list_function_event_invoke_configs(self, function_name: str) -> Dict[str, Any]: + response: Dict[str, List[Dict[str, Any]]] = {"FunctionEventInvokeConfigs": []} + try: + response["FunctionEventInvokeConfigs"] = [ + self.get_function_event_invoke_config(function_name) + ] + return response + except UnknownEventConfig: + return response + def do_validate_s3() -> bool: return os.environ.get("VALIDATE_LAMBDA_S3", "") in ["", "1", "true"] diff --git a/moto/awslambda/responses.py b/moto/awslambda/responses.py index 78f3ecbb854f..d1cdef3b8d4b 100644 --- a/moto/awslambda/responses.py +++ b/moto/awslambda/responses.py @@ -7,7 +7,10 @@ from moto.core.utils import path_url from moto.utilities.aws_headers import amz_crc32, amzn_request_id -from .exceptions import FunctionAlreadyExists, UnknownFunctionException +from .exceptions import ( + FunctionAlreadyExists, + UnknownFunctionException, +) from .models import LambdaBackend, lambda_backends @@ -606,3 +609,39 @@ def _update_alias(self) -> TYPE_RESPONSE: routing_config=routing_config, ) return 201, {}, json.dumps(alias.to_json()) + + def event_invoke_config_handler( + self, request: Any, full_url: str, headers: Any + ) -> TYPE_RESPONSE: + self.setup_class(request, full_url, headers) + function_name = unquote(self.path.rsplit("/", 2)[1]) + + if self.method == "PUT": + response = self.backend.put_function_event_invoke_config( + function_name, self.json_body + ) + return 200, {}, json.dumps(response) + elif self.method == "GET": + response = self.backend.get_function_event_invoke_config(function_name) + return 200, {}, json.dumps(response) + elif self.method == "DELETE": + self.backend.delete_function_event_invoke_config(function_name) + return 204, {}, json.dumps({}) + elif self.method == "POST": + response = self.backend.update_function_event_invoke_config( + function_name, self.json_body + ) + return 200, {}, json.dumps(response) + else: + raise NotImplementedError + + def event_invoke_config_list( + self, request: Any, full_url: str, headers: Any + ) -> TYPE_RESPONSE: + self.setup_class(request, full_url, headers) + function_name = unquote(self.path.rsplit("/", 3)[1]) + return ( + 200, + {}, + json.dumps(self.backend.list_function_event_invoke_configs(function_name)), + ) diff --git a/moto/awslambda/urls.py b/moto/awslambda/urls.py index 284a681c3a2c..f2699591653a 100644 --- a/moto/awslambda/urls.py +++ b/moto/awslambda/urls.py @@ -79,4 +79,10 @@ r"{0}/(?P[^/]+)/layers/(?P.+)/versions/(?P[\w_-]+)$": LambdaResponse.method_dispatch( LambdaResponse.layers_version ), + r"{0}/(?P[^/]+)/functions/(?P[\w_:%-]+)/event-invoke-config/?$": LambdaResponse.method_dispatch( + LambdaResponse.event_invoke_config_handler + ), + r"{0}/(?P[^/]+)/functions/(?P[\w_:%-]+)/event-invoke-config/list$": LambdaResponse.method_dispatch( + LambdaResponse.event_invoke_config_list + ), } diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index e4b9820393a7..0eb17edb322f 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -24,6 +24,7 @@ ) PYTHON_VERSION = "python3.11" +LAMBDA_FUNC_NAME = "test" _lambda_region = "us-west-2" boto3.setup_default_session(region_name=_lambda_region) @@ -1845,3 +1846,334 @@ def test_put_function_concurrency_i_can_has_math(): assert exc.value.response["Error"]["Code"] == "InvalidParameterValueException" response = conn.get_function_concurrency(FunctionName=function_name_2) assert response["ReservedConcurrentExecutions"] == 100 + + +@mock_lambda +@pytest.mark.parametrize( + "config", + [ + { + "OnSuccess": { + "Destination": f"arn:aws:lambda:us-west-2:123456789012:function:{LAMBDA_FUNC_NAME}-2" + }, + "OnFailure": {}, + }, + { + "OnFailure": { + "Destination": f"arn:aws:lambda:us-west-2:123456789012:function:{LAMBDA_FUNC_NAME}-2" + }, + "OnSuccess": {}, + }, + { + "OnFailure": { + "Destination": "arn:aws:lambda:us-west-2:123456789012:function:test-2" + }, + "OnSuccess": { + "Destination": "arn:aws:lambda:us-west-2:123456789012:function:test-2" + }, + }, + ], +) +def test_put_event_invoke_config(config): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + + # the name has to match ARNs in pytest parameterize + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + + # Execute + result = client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Verify + assert result["FunctionArn"] == arn_1 + assert result["DestinationConfig"] == config + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +@mock_lambda +@pytest.mark.parametrize( + "config", + [ + { + "OnSuccess": { + "Destination": f"arn:aws:lambda:us-west-2:123456789012:function:{LAMBDA_FUNC_NAME}-2" + }, + "OnFailure": {}, + }, + { + "OnFailure": { + "Destination": f"arn:aws:lambda:us-west-2:123456789012:function:{LAMBDA_FUNC_NAME}-2" + }, + "OnSuccess": {}, + }, + { + "OnFailure": { + "Destination": "arn:aws:lambda:us-west-2:123456789012:function:test-2" + }, + "OnSuccess": { + "Destination": "arn:aws:lambda:us-west-2:123456789012:function:test-2" + }, + }, + ], +) +def test_update_event_invoke_config(config): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + + # the name has to match ARNs in pytest parameterize + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + + # Execute + result = client.update_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Verify + assert result["FunctionArn"] == arn_1 + assert result["DestinationConfig"] == config + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +@mock_lambda +def test_put_event_invoke_config_errors_1(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + config = { + "OnSuccess": {"Destination": "invalid"}, + "OnFailure": {}, + } + + # Execute + with pytest.raises(ClientError) as exc: + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Verify + err = exc.value.response["Error"] + assert err["Code"] == "ValidationException" + assert ( + err["Message"] == "1 validation error detected: " + "Value 'invalid' at 'destinationConfig.onSuccess.destination' failed to satisfy constraint: " + "Member must satisfy regular expression pattern: " + r"^$|arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)" + ) + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + + +@mock_lambda +def test_put_event_invoke_config_errors_2(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + config = { + "OnFailure": {"Destination": "invalid"}, + "OnSuccess": {}, + } + + # Execute + with pytest.raises(ClientError) as exc: + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Verify + err = exc.value.response["Error"] + assert err["Code"] == "ValidationException" + assert ( + err["Message"] == "1 validation error detected: " + "Value 'invalid' at 'destinationConfig.onFailure.destination' failed to satisfy constraint: " + "Member must satisfy regular expression pattern: " + r"^$|arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)" + ) + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +@mock_lambda +def test_put_event_invoke_config_errors_3(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + test_val = 5 + + # Execute + with pytest.raises(ClientError) as exc: + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, MaximumRetryAttempts=test_val + ) + + # Verify + err = exc.value.response["Error"] + assert err["Code"] == "ValidationException" + assert ( + err["Message"] == "1 validation error detected: " + f"Value '{test_val}' at 'maximumRetryAttempts' failed to satisfy constraint: " + "Member must have value less than or equal to 2" + ) + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + + +@mock_lambda +def test_put_event_invoke_config_errors_4(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + test_val = 44444 + + # Execute + with pytest.raises(ClientError) as exc: + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, MaximumEventAgeInSeconds=test_val + ) + + # Verify + err = exc.value.response["Error"] + assert err["Code"] == "ValidationException" + assert ( + err["Message"] == "1 validation error detected: " + f"Value '{test_val}' at 'maximumEventAgeInSeconds' failed to satisfy constraint: " + "Member must have value less than or equal to 21600" + ) + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + + +@mock_lambda +def test_get_event_invoke_config(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + config = { + "OnFailure": {"Destination": arn_2}, + "OnSuccess": {"Destination": arn_2}, + } + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Execute + result = client.get_function_event_invoke_config(FunctionName=LAMBDA_FUNC_NAME) + + # Verify + assert result["DestinationConfig"] == config + assert result["FunctionArn"] == arn_1 + assert "LastModified" in result + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +@mock_lambda +def test_list_event_invoke_configs(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + config = { + "OnFailure": {"Destination": arn_2}, + "OnSuccess": {"Destination": arn_2}, + } + + # Execute + result = client.list_function_event_invoke_configs(FunctionName=LAMBDA_FUNC_NAME) + + # Verify + assert "FunctionEventInvokeConfigs" in result + assert result["FunctionEventInvokeConfigs"] == [] + + # Execute + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + result = client.list_function_event_invoke_configs(FunctionName=LAMBDA_FUNC_NAME) + + # Verify + assert len(result["FunctionEventInvokeConfigs"]) == 1 + assert result["FunctionEventInvokeConfigs"][0]["DestinationConfig"] == config + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +@mock_lambda +def test_get_event_invoke_config_empty(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + + # Execute + with pytest.raises(ClientError) as exc: + client.get_function_event_invoke_config(FunctionName=LAMBDA_FUNC_NAME) + + err = exc.value.response + + # Verify + assert err["Error"]["Code"] == "ResourceNotFoundException" + assert ( + err["Error"]["Message"] + == f"The function {arn_1} doesn't have an EventInvokeConfig" + ) + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + + +@mock_lambda +def test_delete_event_invoke_config(): + # Setup + client = boto3.client("lambda", _lambda_region) + arn_1 = setup_lambda(client, LAMBDA_FUNC_NAME)["FunctionArn"] + + # the name has to match ARNs in pytest parameterize + arn_2 = setup_lambda(client, f"{LAMBDA_FUNC_NAME}-2")["FunctionArn"] + config = {"OnSuccess": {"Destination": arn_2}, "OnFailure": {}} + client.put_function_event_invoke_config( + FunctionName=LAMBDA_FUNC_NAME, DestinationConfig=config + ) + + # Execute + result = client.delete_function_event_invoke_config(FunctionName=LAMBDA_FUNC_NAME) + # Verify + assert result["ResponseMetadata"]["HTTPStatusCode"] == 204 + + # Clean up for servertests + client.delete_function(FunctionName=arn_1) + client.delete_function(FunctionName=arn_2) + + +def setup_lambda(client, name): + zip_content = get_test_zip_file1() + return client.create_function( + FunctionName=name, + Runtime=PYTHON_VERSION, + Role=get_role_name(), + Handler="lambda_function.lambda_handler", + Code={"ZipFile": zip_content}, + Description="test lambda function", + Timeout=3, + MemorySize=128, + Publish=True, + )