From 2cf0130d13d9e587b1fd064857f394ae903c511a Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Tue, 11 Apr 2023 14:31:46 +0000 Subject: [PATCH] Prep Release 4.1.7 (#6201) --- CHANGELOG.md | 70 +++++++++ CLOUDFORMATION_COVERAGE.md | 5 + IMPLEMENTATION_COVERAGE.md | 37 +++-- Makefile | 2 +- docs/docs/services/cf.rst | 193 +++++++++++++++++++++++++ docs/docs/services/config.rst | 10 ++ docs/docs/services/ec2.rst | 4 +- docs/docs/services/guardduty.rst | 2 + docs/docs/services/lambda.rst | 1 + docs/docs/services/mediaconnect.rst | 4 + docs/docs/services/medialive.rst | 8 + docs/docs/services/quicksight.rst | 8 + docs/docs/services/rds.rst | 2 +- docs/docs/services/rekognition.rst | 2 + docs/docs/services/scheduler.rst | 6 +- docs/docs/services/sqs.rst | 4 +- docs/index.rst | 1 + moto/ec2/models/launch_templates.py | 3 + moto/ec2/responses/launch_templates.py | 2 +- moto/rds/models.py | 4 +- moto/rds/responses.py | 2 +- moto/sqs/constants.py | 3 + moto/sqs/models.py | 55 +++++++ moto/sqs/responses.py | 75 ++-------- scripts/cloudformation_coverage.py | 100 +++++++++++-- 25 files changed, 509 insertions(+), 94 deletions(-) create mode 100644 docs/docs/services/cf.rst create mode 100644 moto/sqs/constants.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ae68f5684..df7dfa72c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,76 @@ Moto Changelog ============== +4.1.7 +----- +Docker Digest for 4.1.7: + + New Services: + * LakeFormation: + * batch_grant_permissions() + * batch_revoke_permissions() + * create_lf_tag() + * delete_lf_tag() + * deregister_resource() + * describe_resource() + * get_data_lake_settings() + * get_lf_tag() + * grant_permissions() + * list_data_cells_filter() + * list_lf_tags() + * list_permissions() + * list_resources() + * put_data_lake_settings() + * register_resource() + * revoke_permissions() + * RDS Data: + * execute_statement() + * Scheduler: + * create_schedule() + * create_schedule_group() + * delete_schedule() + * delete_schedule_group() + * get_schedule() + * get_schedule_group() + * list_schedule_groups() + * list_schedules() + * list_tags_for_resource() + * tag_resource() + * untag_resource() + * update_schedule() + + New Methods: + * Config: + * delete_retention_configuration() + * describe_retention_configurations() + * put_retention_configuration() + * EC2: + * get_launch_template_data() + * RDS: + * create_db_cluster_parameter_group() + * create_global_cluster() + * delete_db_cluster_parameter_group() + * delete_global_cluster() + * describe_db_cluster_parameter_groups() + * describe_db_cluster_parameters() + * describe_db_subnet_groups() + * describe_global_clusters() + * promote_read_replica_db_cluster() + * remove_from_global_cluster() + + Miscellaneous: + * APIGateway now allows semicolons in paths + * CloudFormation now supports Fn::ToJsonString + * DynamoDB: update_item() now supports number-sets in the AttributeUpdates-parameter + * DynamoDB: query() - The KeyConditionExpression now allows enclosing the sort key condition in brackets + * EC2: assign_private_ip_addresses() now supports the PrivateIpAddresses-argument + * ECR: put_image() now supports the imageManifestMediaType parameter + * ECS: run_task() now validates the provided launch-type + * Logs: put_subscription_filter() now supports KinesisStream destinations + * RDS: describe_db_clusters() now supports filtering by db-cluster-id and engine + * RDS: describe_db_clusters() now returns the parameters KmsKeyId, NetworkType, DBSubnetGroupName, ScalingConfiguration + * S3: head_object() now returns the AcceptRanges header + * SQS: Improvements in the deduplication-logic 4.1.6 ----- diff --git a/CLOUDFORMATION_COVERAGE.md b/CLOUDFORMATION_COVERAGE.md index 44f33f1c8..f74dc3052 100644 --- a/CLOUDFORMATION_COVERAGE.md +++ b/CLOUDFORMATION_COVERAGE.md @@ -1,3 +1,8 @@ +## Supported CloudFormation resources + +A list of all resources that can be created via CloudFormation. +Please let us know if you'd like support for a resource not yet listed here. + - AWS::ApiGateway::Deployment: - [x] create implemented - [ ] update implemented diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 0d8bf7a73..641ba7cdb 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -1280,7 +1280,7 @@ ## config
-34% implemented +38% implemented - [X] batch_get_aggregate_resource_config - [X] batch_get_resource_config @@ -1297,7 +1297,7 @@ - [ ] delete_remediation_configuration - [ ] delete_remediation_exceptions - [ ] delete_resource_config -- [ ] delete_retention_configuration +- [X] delete_retention_configuration - [ ] delete_stored_query - [ ] deliver_config_snapshot - [ ] describe_aggregate_compliance_by_config_rules @@ -1324,7 +1324,7 @@ - [ ] describe_remediation_configurations - [ ] describe_remediation_exceptions - [ ] describe_remediation_execution_status -- [ ] describe_retention_configurations +- [X] describe_retention_configurations - [ ] get_aggregate_compliance_details_by_config_rule - [ ] get_aggregate_config_rule_compliance_summary - [ ] get_aggregate_conformance_pack_compliance_summary @@ -1363,7 +1363,7 @@ - [ ] put_remediation_configurations - [ ] put_remediation_exceptions - [ ] put_resource_config -- [ ] put_retention_configuration +- [X] put_retention_configuration - [ ] put_stored_query - [ ] select_aggregate_resource_config - [ ] select_resource_config @@ -2191,7 +2191,7 @@ - [ ] get_ipam_pool_allocations - [ ] get_ipam_pool_cidrs - [ ] get_ipam_resource_cidrs -- [x] get_launch_template_data +- [X] get_launch_template_data - [ ] get_managed_prefix_list_associations - [X] get_managed_prefix_list_entries - [ ] get_network_insights_access_scope_analysis_findings @@ -2212,6 +2212,7 @@ - [ ] get_verified_access_group_policy - [ ] get_vpn_connection_device_sample_configuration - [ ] get_vpn_connection_device_types +- [ ] get_vpn_tunnel_replacement_status - [ ] import_client_vpn_client_certificate_revocation_list - [ ] import_image - [ ] import_instance @@ -2312,6 +2313,7 @@ - [X] replace_route - [X] replace_route_table_association - [ ] replace_transit_gateway_route +- [ ] replace_vpn_tunnel - [ ] report_instance_status - [X] request_spot_fleet - [X] request_spot_instances @@ -3454,6 +3456,7 @@ - [ ] disassociate_members - [X] enable_organization_admin_account - [ ] get_administrator_account +- [ ] get_coverage_statistics - [X] get_detector - [X] get_filter - [ ] get_findings @@ -3468,6 +3471,7 @@ - [ ] get_threat_intel_set - [ ] get_usage_statistics - [ ] invite_members +- [ ] list_coverage - [X] list_detectors - [ ] list_filters - [ ] list_findings @@ -4169,6 +4173,7 @@ - [ ] get_runtime_management_config - [X] invoke - [ ] invoke_async +- [ ] invoke_with_response_stream - [ ] list_aliases - [ ] list_code_signing_configs - [X] list_event_source_mappings @@ -4978,7 +4983,7 @@ ## quicksight
-11% implemented +10% implemented - [ ] cancel_ingestion - [ ] create_account_customization @@ -4994,6 +4999,7 @@ - [ ] create_iam_policy_assignment - [X] create_ingestion - [ ] create_namespace +- [ ] create_refresh_schedule - [ ] create_template - [ ] create_template_alias - [ ] create_theme @@ -5003,6 +5009,7 @@ - [ ] delete_analysis - [ ] delete_dashboard - [ ] delete_data_set +- [ ] delete_data_set_refresh_properties - [ ] delete_data_source - [ ] delete_folder - [ ] delete_folder_membership @@ -5010,6 +5017,7 @@ - [ ] delete_group_membership - [ ] delete_iam_policy_assignment - [ ] delete_namespace +- [ ] delete_refresh_schedule - [ ] delete_template - [ ] delete_template_alias - [ ] delete_theme @@ -5027,6 +5035,7 @@ - [ ] describe_dashboard_permissions - [ ] describe_data_set - [ ] describe_data_set_permissions +- [ ] describe_data_set_refresh_properties - [ ] describe_data_source - [ ] describe_data_source_permissions - [ ] describe_folder @@ -5038,6 +5047,7 @@ - [ ] describe_ingestion - [ ] describe_ip_restriction - [ ] describe_namespace +- [ ] describe_refresh_schedule - [ ] describe_template - [ ] describe_template_alias - [ ] describe_template_definition @@ -5063,6 +5073,7 @@ - [ ] list_iam_policy_assignments_for_user - [ ] list_ingestions - [ ] list_namespaces +- [ ] list_refresh_schedules - [ ] list_tags_for_resource - [ ] list_template_aliases - [ ] list_template_versions @@ -5072,6 +5083,7 @@ - [ ] list_themes - [ ] list_user_groups - [X] list_users +- [ ] put_data_set_refresh_properties - [X] register_user - [ ] restore_analysis - [ ] search_analyses @@ -5099,6 +5111,7 @@ - [ ] update_iam_policy_assignment - [ ] update_ip_restriction - [ ] update_public_sharing_settings +- [ ] update_refresh_schedule - [ ] update_template - [ ] update_template_alias - [ ] update_template_permissions @@ -5141,7 +5154,7 @@ ## rds
-37% implemented +38% implemented - [ ] add_role_to_db_cluster - [ ] add_role_to_db_instance @@ -5213,7 +5226,7 @@ - [ ] describe_db_proxy_targets - [ ] describe_db_security_groups - [ ] describe_db_snapshot_attributes -- [ ] describe_db_snapshots +- [X] describe_db_snapshots - [X] describe_db_subnet_groups - [ ] describe_engine_default_cluster_parameters - [ ] describe_engine_default_parameters @@ -5447,6 +5460,7 @@ - [ ] copy_project_version - [ ] create_collection - [ ] create_dataset +- [ ] create_face_liveness_session - [ ] create_project - [ ] create_project_version - [ ] create_stream_processor @@ -5473,6 +5487,7 @@ - [ ] get_celebrity_recognition - [ ] get_content_moderation - [ ] get_face_detection +- [ ] get_face_liveness_session_results - [X] get_face_search - [ ] get_label_detection - [ ] get_person_tracking @@ -6441,14 +6456,14 @@ ## sqs
-90% implemented +100% implemented - [X] add_permission - [X] change_message_visibility -- [ ] change_message_visibility_batch +- [X] change_message_visibility_batch - [X] create_queue - [X] delete_message -- [ ] delete_message_batch +- [X] delete_message_batch - [X] delete_queue - [X] get_queue_attributes - [X] get_queue_url diff --git a/Makefile b/Makefile index fb85b99b2..f9f3d8c6a 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ implementation_coverage: git commit IMPLEMENTATION_COVERAGE.md -m "Updating implementation coverage" || true cloudformation_coverage: - ./scripts/cloudformation_coverage.py > CLOUDFORMATION_COVERAGE.md + ./scripts/cloudformation_coverage.py git commit CLOUDFORMATION_COVERAGE.md -m "Updating CloudFormation coverage" || true coverage: implementation_coverage cloudformation_coverage diff --git a/docs/docs/services/cf.rst b/docs/docs/services/cf.rst new file mode 100644 index 000000000..57ff415b6 --- /dev/null +++ b/docs/docs/services/cf.rst @@ -0,0 +1,193 @@ +.. _cloudformation_resources: + +================================== +Supported CloudFormation resources +================================== + + +A list of all resources that can be created via CloudFormation. +Please let us know if you'd like support for a resource not yet listed here. + +.. table:: + + +---------------------------------------+--------+--------+--------+-----------------------------------+ + | | Create | Update | Delete | Fn::GetAtt | + +=======================================+========+========+========+===================================+ + |AWS::ApiGateway::Deployment | x | | | - [ ] DeploymentId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ApiGateway::Method | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ApiGateway::Resource | x | | | - [ ] ResourceId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::AutoScaling::AutoScalingGroup | x | x | x | - [ ] LaunchConfigurationName | + +---------------------------------------+--------+--------+--------+ - [ ] LaunchTemplateSpecification | + | | | | | - [ ] MixedInstancesPolicy | + +---------------------------------------+--------+--------+--------+ - [ ] PlacementGroup | + | | | | | - [ ] VPCZoneIdentifier | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::AutoScaling::LaunchConfiguration | x | x | x | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::AutoScaling::ScheduledAction | x | | | - [ ] ScheduledActionName | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Batch::ComputeEnvironment | x | | | - [ ] ComputeEnvironmentArn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Batch::JobDefinition | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Batch::JobQueue | x | | | - [ ] JobQueueArn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::CloudFormation::Stack | x | x | x | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::DataPipeline::Pipeline | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::DynamoDB::Table | x | | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+ - [x] StreamArn | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::Instance | x | | x | - [x] AvailabilityZone | + +---------------------------------------+--------+--------+--------+ - [x] PrivateDnsName | + | | | | | - [x] PrivateIp | + +---------------------------------------+--------+--------+--------+ - [x] PublicDnsName | + | | | | | - [x] PublicIp | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::InternetGateway | x | | | - [ ] InternetGatewayId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::LaunchTemplate | x | x | x | - [ ] LatestVersionNumber | + +---------------------------------------+--------+--------+--------+ - [ ] DefaultVersionNumber | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::NatGateway | x | | | - [ ] NatGatewayId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::NetworkInterface | x | | | - [x] SecondaryPrivateIpAddresses | + +---------------------------------------+--------+--------+--------+ - [x] PrimaryPrivateIpAddress | + | | | | | - [ ] Id | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::Route | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::RouteTable | x | | | - [ ] RouteTableId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::SecurityGroup | x | x | x | - [x] GroupId | + +---------------------------------------+--------+--------+--------+ - [ ] VpcId | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::SecurityGroupIngress | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::Subnet | x | | x | - [ ] VpcId | + +---------------------------------------+--------+--------+--------+ - [ ] NetworkAclAssociationId | + | | | | | - [ ] OutpostArn | + +---------------------------------------+--------+--------+--------+ - [x] AvailabilityZone | + | | | | | - [ ] SubnetId | + +---------------------------------------+--------+--------+--------+ - [ ] Ipv6CidrBlocks | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::SubnetRouteTableAssociation | x | | | - [ ] Id | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::TransitGateway | x | | | - [ ] Id | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::VPC | x | | x | - [ ] VpcId | + +---------------------------------------+--------+--------+--------+ - [ ] CidrBlockAssociations | + | | | | | - [ ] CidrBlock | + +---------------------------------------+--------+--------+--------+ - [ ] DefaultNetworkAcl | + | | | | | - [ ] Ipv6CidrBlocks | + +---------------------------------------+--------+--------+--------+ - [ ] DefaultSecurityGroup | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::VPCGatewayAttachment | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::VPCPeeringConnection | x | | | - [ ] Id | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::Volume | x | | | - [ ] VolumeId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EC2::VolumeAttachment | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ECR::Repository | x | x | | - [x] RepositoryUri | + +---------------------------------------+--------+--------+--------+ - [x] Arn | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ECS::Cluster | x | x | | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ECS::Service | x | x | | - [ ] ServiceArn | + +---------------------------------------+--------+--------+--------+ - [x] Name | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::ECS::TaskDefinition | x | x | | - [ ] TaskDefinitionArn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EFS::FileSystem | x | x | x | - [ ] FileSystemId | + +---------------------------------------+--------+--------+--------+ - [ ] Arn | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::EFS::MountTarget | x | x | x | - [ ] IpAddress | + +---------------------------------------+--------+--------+--------+ - [ ] Id | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Events::Archive | x | x | | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Events::EventBus | x | x | x | - [x] Policy | + +---------------------------------------+--------+--------+--------+ - [x] Arn | + | | | | | - [x] Name | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Events::Rule | x | x | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::AccessKey | x | x | x | - [x] SecretAccessKey | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::InstanceProfile | x | | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::ManagedPolicy | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::Policy | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::Role | x | | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+ - [ ] RoleId | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::IAM::User | x | x | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::KMS::Key | x | | | - [ ] KeyId | + +---------------------------------------+--------+--------+--------+ - [x] Arn | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Kinesis::Stream | x | x | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Logs::LogGroup | x | | | - [x] Arn | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::RDS::DBParameterGroup | x | | | - [ ] DBParameterGroupName | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Redshift::Cluster | x | | | - [x] Endpoint.Address | + +---------------------------------------+--------+--------+--------+ - [x] Endpoint.Port | + | | | | | - [ ] Id | + +---------------------------------------+--------+--------+--------+ - [ ] DeferMaintenanceIdentifier | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Route53::HealthCheck | x | | | - [ ] HealthCheckId | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Route53::RecordSet | x | x | x | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::Route53::RecordSetGroup | x | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::S3::Bucket | x | x | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+ - [x] DomainName | + | | | | | - [x] DualStackDomainName | + +---------------------------------------+--------+--------+--------+ - [x] RegionalDomainName | + | | | | | - [x] WebsiteURL | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SNS::Topic | x | x | x | - [ ] TopicArn | + +---------------------------------------+--------+--------+--------+ - [x] TopicName | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SQS::Queue | x | x | x | - [x] Arn | + +---------------------------------------+--------+--------+--------+ - [x] QueueName | + | | | | | - [ ] QueueUrl | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SSM::Parameter | x | x | x | - [ ] Type | + +---------------------------------------+--------+--------+--------+ - [ ] Value | + | | | | | | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SageMaker::Endpoint | x | x | x | - [x] EndpointName | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SageMaker::EndpointConfig | x | x | x | - [x] EndpointConfigName | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::SageMaker::Model | x | x | x | - [x] ModelName | + +---------------------------------------+--------+--------+--------+-----------------------------------+ + |AWS::StepFunctions::StateMachine | x | x | x | - [ ] StateMachineRevisionId | + +---------------------------------------+--------+--------+--------+ - [ ] Arn | + | | | | | - [x] Name | + +---------------------------------------+--------+--------+--------+-----------------------------------+ diff --git a/docs/docs/services/config.rst b/docs/docs/services/config.rst index 8da87e152..a1c919599 100644 --- a/docs/docs/services/config.rst +++ b/docs/docs/services/config.rst @@ -63,6 +63,8 @@ config - [ ] delete_remediation_exceptions - [ ] delete_resource_config - [X] delete_retention_configuration + This will delete the retention configuration if one is present with the provided name. + - [ ] delete_stored_query - [ ] deliver_config_snapshot - [ ] describe_aggregate_compliance_by_config_rules @@ -92,6 +94,12 @@ config - [ ] describe_remediation_exceptions - [ ] describe_remediation_execution_status - [X] describe_retention_configurations + + This will return the retention configuration if one is present. + + This should only receive at most 1 name in. It will raise a ValidationException if more than 1 is supplied. + + - [ ] get_aggregate_compliance_details_by_config_rule - [ ] get_aggregate_config_rule_compliance_summary - [ ] get_aggregate_conformance_pack_compliance_summary @@ -180,6 +188,8 @@ config - [ ] put_remediation_exceptions - [ ] put_resource_config - [X] put_retention_configuration + Creates a Retention Configuration. + - [ ] put_stored_query - [ ] select_aggregate_resource_config - [ ] select_resource_config diff --git a/docs/docs/services/ec2.rst b/docs/docs/services/ec2.rst index e9e85e36d..9c0916363 100644 --- a/docs/docs/services/ec2.rst +++ b/docs/docs/services/ec2.rst @@ -488,7 +488,7 @@ ec2 - [ ] get_ipam_pool_allocations - [ ] get_ipam_pool_cidrs - [ ] get_ipam_resource_cidrs -- [ ] get_launch_template_data +- [X] get_launch_template_data - [ ] get_managed_prefix_list_associations - [X] get_managed_prefix_list_entries - [ ] get_network_insights_access_scope_analysis_findings @@ -509,6 +509,7 @@ ec2 - [ ] get_verified_access_group_policy - [ ] get_vpn_connection_device_sample_configuration - [ ] get_vpn_connection_device_types +- [ ] get_vpn_tunnel_replacement_status - [ ] import_client_vpn_client_certificate_revocation_list - [ ] import_image - [ ] import_instance @@ -613,6 +614,7 @@ ec2 - [X] replace_route - [X] replace_route_table_association - [ ] replace_transit_gateway_route +- [ ] replace_vpn_tunnel - [ ] report_instance_status - [X] request_spot_fleet - [X] request_spot_instances diff --git a/docs/docs/services/guardduty.rst b/docs/docs/services/guardduty.rst index 844e75028..fb889d0aa 100644 --- a/docs/docs/services/guardduty.rst +++ b/docs/docs/services/guardduty.rst @@ -52,6 +52,7 @@ guardduty - [ ] disassociate_members - [X] enable_organization_admin_account - [ ] get_administrator_account +- [ ] get_coverage_statistics - [X] get_detector - [X] get_filter - [ ] get_findings @@ -66,6 +67,7 @@ guardduty - [ ] get_threat_intel_set - [ ] get_usage_statistics - [ ] invite_members +- [ ] list_coverage - [X] list_detectors The MaxResults and NextToken-parameter have not yet been implemented. diff --git a/docs/docs/services/lambda.rst b/docs/docs/services/lambda.rst index 468287157..f7b926898 100644 --- a/docs/docs/services/lambda.rst +++ b/docs/docs/services/lambda.rst @@ -83,6 +83,7 @@ lambda - [ ] invoke_async +- [ ] invoke_with_response_stream - [ ] list_aliases - [ ] list_code_signing_configs - [X] list_event_source_mappings diff --git a/docs/docs/services/mediaconnect.rst b/docs/docs/services/mediaconnect.rst index 9e09bba04..af12af561 100644 --- a/docs/docs/services/mediaconnect.rst +++ b/docs/docs/services/mediaconnect.rst @@ -37,6 +37,10 @@ mediaconnect - [X] grant_flow_entitlements - [ ] list_entitlements - [X] list_flows + + Pagination is not yet implemented + + - [ ] list_offerings - [ ] list_reservations - [X] list_tags_for_resource diff --git a/docs/docs/services/medialive.rst b/docs/docs/services/medialive.rst index d7574a94d..d3346d4db 100644 --- a/docs/docs/services/medialive.rst +++ b/docs/docs/services/medialive.rst @@ -66,10 +66,18 @@ medialive - [ ] describe_reservation - [ ] describe_schedule - [X] list_channels + + Pagination is not yet implemented + + - [ ] list_input_device_transfers - [ ] list_input_devices - [ ] list_input_security_groups - [X] list_inputs + + Pagination is not yet implemented + + - [ ] list_multiplex_programs - [ ] list_multiplexes - [ ] list_offerings diff --git a/docs/docs/services/quicksight.rst b/docs/docs/services/quicksight.rst index 48c82ac46..a76ec70a6 100644 --- a/docs/docs/services/quicksight.rst +++ b/docs/docs/services/quicksight.rst @@ -41,6 +41,7 @@ quicksight - [ ] create_iam_policy_assignment - [X] create_ingestion - [ ] create_namespace +- [ ] create_refresh_schedule - [ ] create_template - [ ] create_template_alias - [ ] create_theme @@ -50,6 +51,7 @@ quicksight - [ ] delete_analysis - [ ] delete_dashboard - [ ] delete_data_set +- [ ] delete_data_set_refresh_properties - [ ] delete_data_source - [ ] delete_folder - [ ] delete_folder_membership @@ -57,6 +59,7 @@ quicksight - [ ] delete_group_membership - [ ] delete_iam_policy_assignment - [ ] delete_namespace +- [ ] delete_refresh_schedule - [ ] delete_template - [ ] delete_template_alias - [ ] delete_theme @@ -74,6 +77,7 @@ quicksight - [ ] describe_dashboard_permissions - [ ] describe_data_set - [ ] describe_data_set_permissions +- [ ] describe_data_set_refresh_properties - [ ] describe_data_source - [ ] describe_data_source_permissions - [ ] describe_folder @@ -85,6 +89,7 @@ quicksight - [ ] describe_ingestion - [ ] describe_ip_restriction - [ ] describe_namespace +- [ ] describe_refresh_schedule - [ ] describe_template - [ ] describe_template_alias - [ ] describe_template_definition @@ -118,6 +123,7 @@ quicksight - [ ] list_iam_policy_assignments_for_user - [ ] list_ingestions - [ ] list_namespaces +- [ ] list_refresh_schedules - [ ] list_tags_for_resource - [ ] list_template_aliases - [ ] list_template_versions @@ -131,6 +137,7 @@ quicksight The NextToken and MaxResults parameters are not yet implemented +- [ ] put_data_set_refresh_properties - [X] register_user The following parameters are not yet implemented: @@ -163,6 +170,7 @@ quicksight - [ ] update_iam_policy_assignment - [ ] update_ip_restriction - [ ] update_public_sharing_settings +- [ ] update_refresh_schedule - [ ] update_template - [ ] update_template_alias - [ ] update_template_permissions diff --git a/docs/docs/services/rds.rst b/docs/docs/services/rds.rst index e03f5de43..8b258f899 100644 --- a/docs/docs/services/rds.rst +++ b/docs/docs/services/rds.rst @@ -95,7 +95,7 @@ rds - [ ] describe_db_proxy_targets - [ ] describe_db_security_groups - [ ] describe_db_snapshot_attributes -- [ ] describe_db_snapshots +- [X] describe_db_snapshots - [X] describe_db_subnet_groups - [ ] describe_engine_default_cluster_parameters - [ ] describe_engine_default_parameters diff --git a/docs/docs/services/rekognition.rst b/docs/docs/services/rekognition.rst index c46f5d42e..eda6cbfac 100644 --- a/docs/docs/services/rekognition.rst +++ b/docs/docs/services/rekognition.rst @@ -31,6 +31,7 @@ rekognition - [ ] copy_project_version - [ ] create_collection - [ ] create_dataset +- [ ] create_face_liveness_session - [ ] create_project - [ ] create_project_version - [ ] create_stream_processor @@ -57,6 +58,7 @@ rekognition - [ ] get_celebrity_recognition - [ ] get_content_moderation - [ ] get_face_detection +- [ ] get_face_liveness_session_results - [X] get_face_search This returns hardcoded values and none of the parameters are taken into account. diff --git a/docs/docs/services/scheduler.rst b/docs/docs/services/scheduler.rst index 74fe1433f..029553b9f 100644 --- a/docs/docs/services/scheduler.rst +++ b/docs/docs/services/scheduler.rst @@ -46,7 +46,11 @@ scheduler The MaxResults-parameter and pagination options are not yet implemented -- [ ] list_schedules +- [X] list_schedules + + The following parameters are not yet implemented: MaxResults, NamePrefix, NextToken + + - [X] list_tags_for_resource - [X] tag_resource - [X] untag_resource diff --git a/docs/docs/services/sqs.rst b/docs/docs/services/sqs.rst index a2eb1821f..fed16f5ac 100644 --- a/docs/docs/services/sqs.rst +++ b/docs/docs/services/sqs.rst @@ -27,10 +27,10 @@ sqs - [X] add_permission - [X] change_message_visibility -- [ ] change_message_visibility_batch +- [X] change_message_visibility_batch - [X] create_queue - [X] delete_message -- [ ] delete_message_batch +- [X] delete_message_batch - [X] delete_queue - [X] get_queue_attributes - [X] get_queue_url diff --git a/docs/index.rst b/docs/index.rst index 0ba6134a9..cbf9cd485 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -49,6 +49,7 @@ Additional Resources :caption: Implemented Services docs/services/index + docs/services/cf docs/services/patching_other_services .. toctree:: diff --git a/moto/ec2/models/launch_templates.py b/moto/ec2/models/launch_templates.py index 8ce6909ff..99b135036 100644 --- a/moto/ec2/models/launch_templates.py +++ b/moto/ec2/models/launch_templates.py @@ -255,3 +255,6 @@ class LaunchTemplateBackend: templates = list(self.launch_templates.values()) return generic_filter(filters, templates) + + def get_launch_template_data(self, instance_id: str) -> Any: + return self.get_instance(instance_id) # type: ignore[attr-defined] diff --git a/moto/ec2/responses/launch_templates.py b/moto/ec2/responses/launch_templates.py index ce30c985a..58eb05ddd 100644 --- a/moto/ec2/responses/launch_templates.py +++ b/moto/ec2/responses/launch_templates.py @@ -261,7 +261,7 @@ class LaunchTemplates(EC2BaseResponse): def get_launch_template_data(self) -> str: instance_id = self._get_param("InstanceId") - instance = self.ec2_backend.get_instance(instance_id) + instance = self.ec2_backend.get_launch_template_data(instance_id) template = self.response_template(GET_LAUNCH_TEMPLATE_DATA_RESPONSE) return template.render(i=instance) diff --git a/moto/rds/models.py b/moto/rds/models.py index 2173de3cc..c080794cc 100644 --- a/moto/rds/models.py +++ b/moto/rds/models.py @@ -1601,7 +1601,7 @@ class RDSBackend(BaseBackend): raise DBInstanceNotFoundError(db_instance_identifier) return list(databases.values()) - def describe_database_snapshots( + def describe_db_snapshots( self, db_instance_identifier, db_snapshot_identifier, filters=None ): snapshots = self.database_snapshots @@ -1642,7 +1642,7 @@ class RDSBackend(BaseBackend): return database def restore_db_instance_from_db_snapshot(self, from_snapshot_id, overrides): - snapshot = self.describe_database_snapshots( + snapshot = self.describe_db_snapshots( db_instance_identifier=None, db_snapshot_identifier=from_snapshot_id )[0] original_database = snapshot.database diff --git a/moto/rds/responses.py b/moto/rds/responses.py index 4c47b5fac..dc8fcee45 100644 --- a/moto/rds/responses.py +++ b/moto/rds/responses.py @@ -330,7 +330,7 @@ class RDSResponse(BaseResponse): db_snapshot_identifier = self._get_param("DBSnapshotIdentifier") filters = self._get_multi_param("Filters.Filter.") filters = {f["Name"]: f["Values"] for f in filters} - snapshots = self.backend.describe_database_snapshots( + snapshots = self.backend.describe_db_snapshots( db_instance_identifier, db_snapshot_identifier, filters ) template = self.response_template(DESCRIBE_SNAPSHOTS_TEMPLATE) diff --git a/moto/sqs/constants.py b/moto/sqs/constants.py new file mode 100644 index 000000000..917eb4b4b --- /dev/null +++ b/moto/sqs/constants.py @@ -0,0 +1,3 @@ +MAXIMUM_VISIBILITY_TIMEOUT = 43200 +MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB +DEFAULT_RECEIVED_MESSAGES = 1 diff --git a/moto/sqs/models.py b/moto/sqs/models.py index b4939e9d7..004aa86fb 100644 --- a/moto/sqs/models.py +++ b/moto/sqs/models.py @@ -20,6 +20,7 @@ from moto.core.utils import ( ) from moto.moto_api._internal import mock_random as random from moto.utilities.utils import md5_hash +from .constants import MAXIMUM_VISIBILITY_TIMEOUT from .utils import generate_receipt_handle from .exceptions import ( MessageAttributesInvalid, @@ -985,6 +986,24 @@ class SQSBackend(BaseBackend): queue.delete_message(receipt_handle) + def delete_message_batch(self, queue_name, receipts): + success = [] + errors = [] + for receipt_and_id in receipts: + try: + self.delete_message(queue_name, receipt_and_id["receipt_handle"]) + success.append(receipt_and_id["msg_user_id"]) + except ReceiptHandleIsInvalid: + errors.append( + { + "Id": receipt_and_id["msg_user_id"], + "SenderFault": "true", + "Code": "ReceiptHandleIsInvalid", + "Message": f'The input receipt handle "{receipt_and_id["receipt_handle"]}" is not a valid receipt handle.', + } + ) + return success, errors + def change_message_visibility(self, queue_name, receipt_handle, visibility_timeout): queue = self.get_queue(queue_name) for message in queue._messages: @@ -1006,6 +1025,42 @@ class SQSBackend(BaseBackend): return raise ReceiptHandleIsInvalid + def change_message_visibility_batch(self, queue_name: str, entries): + success = [] + error = [] + for entry in entries: + try: + visibility_timeout = int(entry["visibility_timeout"]) + assert visibility_timeout <= MAXIMUM_VISIBILITY_TIMEOUT + except: # noqa: E722 Do not use bare except + error.append( + { + "Id": entry["id"], + "SenderFault": "true", + "Code": "InvalidParameterValue", + "Message": "Visibility timeout invalid", + } + ) + continue + + try: + self.change_message_visibility( + queue_name=queue_name, + receipt_handle=entry["receipt_handle"], + visibility_timeout=visibility_timeout, + ) + success.append(entry["id"]) + except ReceiptHandleIsInvalid as e: + error.append( + { + "Id": entry["id"], + "SenderFault": "true", + "Code": "ReceiptHandleIsInvalid", + "Message": e.description, + } + ) + return success, error + def purge_queue(self, queue_name): queue = self.get_queue(queue_name) queue._messages = [] diff --git a/moto/sqs/responses.py b/moto/sqs/responses.py index a0c775092..90165c0ee 100644 --- a/moto/sqs/responses.py +++ b/moto/sqs/responses.py @@ -6,19 +6,19 @@ from moto.core.utils import underscores_to_camelcase, camelcase_to_pascal from moto.utilities.aws_headers import amz_crc32, amzn_request_id from urllib.parse import urlparse +from .constants import ( + DEFAULT_RECEIVED_MESSAGES, + MAXIMUM_MESSAGE_LENGTH, + MAXIMUM_VISIBILITY_TIMEOUT, +) from .exceptions import ( EmptyBatchRequest, InvalidAttributeName, - ReceiptHandleIsInvalid, BatchEntryIdsNotDistinct, ) -from .models import sqs_backends +from .models import sqs_backends, SQSBackend from .utils import parse_message_attributes, extract_input_message_attributes -MAXIMUM_VISIBILTY_TIMEOUT = 43200 -MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB -DEFAULT_RECEIVED_MESSAGES = 1 - class SQSResponse(BaseResponse): @@ -28,7 +28,7 @@ class SQSResponse(BaseResponse): super().__init__(service_name="sqs") @property - def sqs_backend(self): + def sqs_backend(self) -> SQSBackend: return sqs_backends[self.current_account][self.region] @property @@ -59,7 +59,7 @@ class SQSResponse(BaseResponse): def _get_validated_visibility_timeout(self, timeout=None): """ - :raises ValueError: If specified visibility timeout exceeds MAXIMUM_VISIBILTY_TIMEOUT + :raises ValueError: If specified visibility timeout exceeds MAXIMUM_VISIBILITY_TIMEOUT :raises TypeError: If visibility timeout was not specified """ if timeout is not None: @@ -67,7 +67,7 @@ class SQSResponse(BaseResponse): else: visibility_timeout = int(self.querystring.get("VisibilityTimeout")[0]) - if visibility_timeout > MAXIMUM_VISIBILTY_TIMEOUT: + if visibility_timeout > MAXIMUM_VISIBILITY_TIMEOUT: raise ValueError return visibility_timeout @@ -134,40 +134,9 @@ class SQSResponse(BaseResponse): queue_name = self._get_queue_name() entries = self._get_list_prefix("ChangeMessageVisibilityBatchRequestEntry") - success = [] - error = [] - for entry in entries: - try: - visibility_timeout = self._get_validated_visibility_timeout( - entry["visibility_timeout"] - ) - except ValueError: - error.append( - { - "Id": entry["id"], - "SenderFault": "true", - "Code": "InvalidParameterValue", - "Message": "Visibility timeout invalid", - } - ) - continue - - try: - self.sqs_backend.change_message_visibility( - queue_name=queue_name, - receipt_handle=entry["receipt_handle"], - visibility_timeout=visibility_timeout, - ) - success.append(entry["id"]) - except ReceiptHandleIsInvalid as e: - error.append( - { - "Id": entry["id"], - "SenderFault": "true", - "Code": "ReceiptHandleIsInvalid", - "Message": e.description, - } - ) + success, error = self.sqs_backend.change_message_visibility_batch( + queue_name, entries + ) template = self.response_template(CHANGE_MESSAGE_VISIBILITY_BATCH_RESPONSE) return template.render(success=success, errors=error) @@ -359,23 +328,7 @@ class SQSResponse(BaseResponse): raise BatchEntryIdsNotDistinct(receipt_and_id["msg_user_id"]) receipt_seen.add(receipt) - success = [] - errors = [] - for receipt_and_id in receipts: - try: - self.sqs_backend.delete_message( - queue_name, receipt_and_id["receipt_handle"] - ) - success.append(receipt_and_id["msg_user_id"]) - except ReceiptHandleIsInvalid: - errors.append( - { - "Id": receipt_and_id["msg_user_id"], - "SenderFault": "true", - "Code": "ReceiptHandleIsInvalid", - "Message": f'The input receipt handle "{receipt_and_id["receipt_handle"]}" is not a valid receipt handle.', - } - ) + success, errors = self.sqs_backend.delete_message_batch(queue_name, receipts) template = self.response_template(DELETE_MESSAGE_BATCH_RESPONSE) return template.render(success=success, errors=errors) @@ -811,7 +764,7 @@ ERROR_TOO_LONG_RESPONSE = """ diff --git a/scripts/cloudformation_coverage.py b/scripts/cloudformation_coverage.py index cb00dace5..e3a823d36 100755 --- a/scripts/cloudformation_coverage.py +++ b/scripts/cloudformation_coverage.py @@ -1,8 +1,7 @@ #!/usr/bin/env python -import importlib -import json -import mock +from unittest.mock import patch import requests +import os import moto @@ -10,6 +9,9 @@ import moto moto.mock_all() +script_dir = os.path.dirname(os.path.abspath(__file__)) + + def check(condition): if bool(condition): return "x" @@ -17,6 +19,10 @@ def check(condition): return " " +def utf_checkbox(condition): + return "☑" if bool(condition) else " " + + def is_implemented(model, method_name): # method_name in model.__dict__ will be True if the method # exists on the model and False if it's only inherited from @@ -73,7 +79,7 @@ class CloudFormationChecklist: for attr in self.expected_attrs: try: # TODO: Change the actual abstract method to return False - with mock.patch( + with patch( "moto.core.common_models.CloudFormationModel.has_cfn_attr", return_value=False, ): @@ -96,16 +102,86 @@ class CloudFormationChecklist: return is_implemented(self.moto_model, "delete_from_cloudformation_json") +def write_main_document(supported): + implementation_coverage_file = "{}/../CLOUDFORMATION_COVERAGE.md".format(script_dir) + try: + os.remove(implementation_coverage_file) + except OSError: + pass + + print("Writing to {}".format(implementation_coverage_file)) + with open(implementation_coverage_file, "w+") as file: + file.write("## Supported CloudFormation resources") + file.write("\n\n") + file.write("A list of all resources that can be created via CloudFormation. \n") + file.write("Please let us know if you'd like support for a resource not yet listed here.") + file.write("\n\n") + + for checklist in supported: + file.write(str(checklist)) + file.write("\n") + + +def write_documentation(supported): + docs_file = "{}/../docs/docs/services/cf.rst".format(script_dir) + try: + os.remove(docs_file) + except OSError: + pass + + print("Writing to {}".format(docs_file)) + with open(docs_file, "w+") as file: + file.write(f".. _cloudformation_resources:\n") + file.write("\n") + file.write("==================================\n") + file.write("Supported CloudFormation resources\n") + file.write("==================================\n") + file.write("\n\n") + file.write("A list of all resources that can be created via CloudFormation. \n") + file.write("Please let us know if you'd like support for a resource not yet listed here.") + file.write("\n\n") + + max_resource_name_length = max([len(cf.resource_name) for cf in supported]) + 2 + max_fn_att_length = 35 + + file.write(".. table:: \n\n") + file.write(f" +{('-'*max_resource_name_length)}+--------+--------+--------+{('-' * max_fn_att_length)}+\n") + file.write(f" |{(' '*max_resource_name_length)}| Create | Update | Delete | {('Fn::GetAtt'.ljust(max_fn_att_length-2))} |\n") + file.write(f" +{('='*max_resource_name_length)}+========+========+========+{('=' * max_fn_att_length)}+\n") + + for checklist in supported: + attrs = [f" - [{check(att not in checklist.missing_attrs)}] {att}" for att in checklist.expected_attrs] + first_attr = attrs[0] if attrs else "" + file.write(" |") + file.write(checklist.resource_name.ljust(max_resource_name_length)) + file.write("|") + file.write(f" {check(checklist.creatable)} ") + file.write("|") + file.write(f" {check(checklist.updatable)} ") + file.write("|") + file.write(f" {check(checklist.deletable)} ") + file.write(f"|{first_attr.ljust(max_fn_att_length)}|") + file.write("\n") + for index, attr in enumerate(attrs[1:]): + if index % 2 == 0: + file.write( + f" +{('-' * max_resource_name_length)}+--------+--------+--------+{attr.ljust(max_fn_att_length)}|\n") + else: + file.write( + f" |{(' ' * max_resource_name_length)}| | | |{attr.ljust(max_fn_att_length)}|\n") + if len(attrs) > 1 and len(attrs) % 2 == 0: + file.write(f" |{(' ' * max_resource_name_length)}| | | |{(' ' * max_fn_att_length)}|\n") + file.write(f" +{('-'*max_resource_name_length)}+--------+--------+--------+{('-' * max_fn_att_length)}+\n") + + if __name__ == "__main__": # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html cfn_spec = requests.get( "https://dnwj8swjjbsbt.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json" ).json() - for resource_name, schema in sorted(cfn_spec["ResourceTypes"].items()): - checklist = CloudFormationChecklist(resource_name, schema) - # Only print checklists for models that implement CloudFormationModel; - # otherwise the checklist is very long and mostly empty because there - # are so many niche AWS services and resources that moto doesn't - # implement yet. - if checklist.moto_model: - print(checklist) + # Only collect checklists for models that implement CloudFormationModel; + # otherwise the checklist is very long and mostly empty because there + # are so many niche AWS services and resources that moto doesn't implement yet. + supported = [CloudFormationChecklist(resource_name, schema) for resource_name, schema in sorted(cfn_spec["ResourceTypes"].items()) if CloudFormationChecklist(resource_name, schema).moto_model] + #write_main_document(supported) + write_documentation(supported)