From 3455ba0d563caa669824580a45ecd651cf8844f1 Mon Sep 17 00:00:00 2001 From: LocalStack Bot Date: Mon, 21 Oct 2024 05:06:51 +0000 Subject: [PATCH 1/2] update generated ASF APIs to latest version --- .../localstack/aws/api/ec2/__init__.py | 2 +- .../localstack/aws/api/redshift/__init__.py | 156 +++++++++++++++++- .../localstack/aws/api/s3/__init__.py | 8 +- pyproject.toml | 4 +- requirements-base-runtime.txt | 4 +- requirements-dev.txt | 6 +- requirements-runtime.txt | 6 +- requirements-test.txt | 6 +- requirements-typehint.txt | 6 +- 9 files changed, 179 insertions(+), 19 deletions(-) diff --git a/localstack-core/localstack/aws/api/ec2/__init__.py b/localstack-core/localstack/aws/api/ec2/__init__.py index a3b3a0416a8fe..c6ac5cca92885 100644 --- a/localstack-core/localstack/aws/api/ec2/__init__.py +++ b/localstack-core/localstack/aws/api/ec2/__init__.py @@ -18089,7 +18089,7 @@ class RequestSpotLaunchSpecification(TypedDict, total=False): ImageId: Optional[ImageId] InstanceType: Optional[InstanceType] KernelId: Optional[KernelId] - KeyName: Optional[KeyPairName] + KeyName: Optional[KeyPairNameWithResolver] Monitoring: Optional[RunInstancesMonitoringEnabled] NetworkInterfaces: Optional[InstanceNetworkInterfaceSpecificationList] Placement: Optional[SpotPlacement] diff --git a/localstack-core/localstack/aws/api/redshift/__init__.py b/localstack-core/localstack/aws/api/redshift/__init__.py index 154fb962fb2e2..6ef50b9e2d364 100644 --- a/localstack-core/localstack/aws/api/redshift/__init__.py +++ b/localstack-core/localstack/aws/api/redshift/__init__.py @@ -1,6 +1,6 @@ from datetime import datetime from enum import StrEnum -from typing import List, Optional, TypedDict +from typing import Dict, List, Optional, TypedDict from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler @@ -9,12 +9,16 @@ BooleanOptional = bool CustomDomainCertificateArnString = str CustomDomainNameString = str +Description = str Double = float DoubleOptional = float IdcDisplayNameString = str IdentityNamespaceString = str Integer = int IntegerOptional = int +IntegrationArn = str +IntegrationDescription = str +IntegrationName = str PartnerIntegrationAccountId = str PartnerIntegrationClusterIdentifier = str PartnerIntegrationDatabaseName = str @@ -71,6 +75,13 @@ class DataShareStatusForProducer(StrEnum): REJECTED = "REJECTED" +class DescribeIntegrationsFilterName(StrEnum): + integration_arn = "integration-arn" + source_arn = "source-arn" + source_types = "source-types" + status = "status" + + class ImpactRankingType(StrEnum): HIGH = "HIGH" MEDIUM = "MEDIUM" @@ -545,12 +556,48 @@ class InsufficientS3BucketPolicyFault(ServiceException): status_code: int = 400 +class IntegrationAlreadyExistsFault(ServiceException): + code: str = "IntegrationAlreadyExistsFault" + sender_fault: bool = True + status_code: int = 400 + + +class IntegrationConflictOperationFault(ServiceException): + code: str = "IntegrationConflictOperationFault" + sender_fault: bool = True + status_code: int = 400 + + +class IntegrationConflictStateFault(ServiceException): + code: str = "IntegrationConflictStateFault" + sender_fault: bool = True + status_code: int = 400 + + class IntegrationNotFoundFault(ServiceException): code: str = "IntegrationNotFoundFault" sender_fault: bool = True status_code: int = 404 +class IntegrationQuotaExceededFault(ServiceException): + code: str = "IntegrationQuotaExceededFault" + sender_fault: bool = True + status_code: int = 400 + + +class IntegrationSourceNotFoundFault(ServiceException): + code: str = "IntegrationSourceNotFoundFault" + sender_fault: bool = True + status_code: int = 404 + + +class IntegrationTargetNotFoundFault(ServiceException): + code: str = "IntegrationTargetNotFoundFault" + sender_fault: bool = True + status_code: int = 404 + + class InvalidAuthenticationProfileRequestFault(ServiceException): code: str = "InvalidAuthenticationProfileRequestFault" sender_fault: bool = True @@ -1910,6 +1957,19 @@ class CreateHsmConfigurationResult(TypedDict, total=False): HsmConfiguration: Optional[HsmConfiguration] +EncryptionContextMap = Dict[String, String] + + +class CreateIntegrationMessage(ServiceRequest): + SourceArn: String + TargetArn: String + IntegrationName: IntegrationName + KMSKeyId: Optional[String] + TagList: Optional[TagList] + AdditionalEncryptionContext: Optional[EncryptionContextMap] + Description: Optional[IntegrationDescription] + + class LakeFormationQuery(TypedDict, total=False): Authorization: ServiceAuthorization @@ -2135,6 +2195,10 @@ class DeleteHsmConfigurationMessage(ServiceRequest): HsmConfigurationIdentifier: String +class DeleteIntegrationMessage(ServiceRequest): + IntegrationArn: IntegrationArn + + class DeleteRedshiftIdcApplicationMessage(ServiceRequest): RedshiftIdcApplicationArn: String @@ -2378,6 +2442,24 @@ class DescribeInboundIntegrationsMessage(ServiceRequest): Marker: Optional[String] +DescribeIntegrationsFilterValueList = List[String] + + +class DescribeIntegrationsFilter(TypedDict, total=False): + Name: DescribeIntegrationsFilterName + Values: DescribeIntegrationsFilterValueList + + +DescribeIntegrationsFilterList = List[DescribeIntegrationsFilter] + + +class DescribeIntegrationsMessage(ServiceRequest): + IntegrationArn: Optional[IntegrationArn] + MaxRecords: Optional[IntegerOptional] + Marker: Optional[String] + Filters: Optional[DescribeIntegrationsFilterList] + + class DescribeLoggingStatusMessage(ServiceRequest): ClusterIdentifier: String @@ -2835,6 +2917,28 @@ class InboundIntegrationsMessage(TypedDict, total=False): InboundIntegrations: Optional[InboundIntegrationList] +class Integration(TypedDict, total=False): + IntegrationArn: Optional[String] + IntegrationName: Optional[IntegrationName] + SourceArn: Optional[String] + TargetArn: Optional[String] + Status: Optional[ZeroETLIntegrationStatus] + Errors: Optional[IntegrationErrorList] + CreateTime: Optional[TStamp] + Description: Optional[Description] + KMSKeyId: Optional[String] + AdditionalEncryptionContext: Optional[EncryptionContextMap] + Tags: Optional[TagList] + + +IntegrationList = List[Integration] + + +class IntegrationsMessage(TypedDict, total=False): + Marker: Optional[String] + Integrations: Optional[IntegrationList] + + class ListRecommendationsMessage(ServiceRequest): ClusterIdentifier: Optional[String] NamespaceArn: Optional[String] @@ -3051,6 +3155,12 @@ class ModifyEventSubscriptionResult(TypedDict, total=False): EventSubscription: Optional[EventSubscription] +class ModifyIntegrationMessage(ServiceRequest): + IntegrationArn: IntegrationArn + Description: Optional[IntegrationDescription] + IntegrationName: Optional[IntegrationName] + + class ModifyRedshiftIdcApplicationMessage(ServiceRequest): RedshiftIdcApplicationArn: String IdentityNamespace: Optional[IdentityNamespaceString] @@ -3718,6 +3828,21 @@ def create_hsm_configuration( ) -> CreateHsmConfigurationResult: raise NotImplementedError + @handler("CreateIntegration") + def create_integration( + self, + context: RequestContext, + source_arn: String, + target_arn: String, + integration_name: IntegrationName, + kms_key_id: String = None, + tag_list: TagList = None, + additional_encryption_context: EncryptionContextMap = None, + description: IntegrationDescription = None, + **kwargs, + ) -> Integration: + raise NotImplementedError + @handler("CreateRedshiftIdcApplication") def create_redshift_idc_application( self, @@ -3884,6 +4009,12 @@ def delete_hsm_configuration( ) -> None: raise NotImplementedError + @handler("DeleteIntegration") + def delete_integration( + self, context: RequestContext, integration_arn: IntegrationArn, **kwargs + ) -> Integration: + raise NotImplementedError + @handler("DeletePartner") def delete_partner( self, @@ -4227,6 +4358,18 @@ def describe_inbound_integrations( ) -> InboundIntegrationsMessage: raise NotImplementedError + @handler("DescribeIntegrations") + def describe_integrations( + self, + context: RequestContext, + integration_arn: IntegrationArn = None, + max_records: IntegerOptional = None, + marker: String = None, + filters: DescribeIntegrationsFilterList = None, + **kwargs, + ) -> IntegrationsMessage: + raise NotImplementedError + @handler("DescribeLoggingStatus") def describe_logging_status( self, context: RequestContext, cluster_identifier: String, **kwargs @@ -4705,6 +4848,17 @@ def modify_event_subscription( ) -> ModifyEventSubscriptionResult: raise NotImplementedError + @handler("ModifyIntegration") + def modify_integration( + self, + context: RequestContext, + integration_arn: IntegrationArn, + description: IntegrationDescription = None, + integration_name: IntegrationName = None, + **kwargs, + ) -> Integration: + raise NotImplementedError + @handler("ModifyRedshiftIdcApplication") def modify_redshift_idc_application( self, diff --git a/localstack-core/localstack/aws/api/s3/__init__.py b/localstack-core/localstack/aws/api/s3/__init__.py index f448ef27a14f2..25e7d6b722f92 100644 --- a/localstack-core/localstack/aws/api/s3/__init__.py +++ b/localstack-core/localstack/aws/api/s3/__init__.py @@ -18,6 +18,7 @@ BucketKeyEnabled = bool BucketLocationName = str BucketName = str +BucketRegion = str BypassGovernanceRetention = bool CacheControl = str ChecksumCRC32 = str @@ -166,7 +167,6 @@ VersionIdMarker = str WebsiteRedirectLocation = str Years = int -BucketRegion = str BucketContentType = str IfCondition = str RestoreObjectOutputStatusCode = int @@ -1085,6 +1085,7 @@ class AnalyticsConfiguration(TypedDict, total=False): class Bucket(TypedDict, total=False): Name: Optional[BucketName] CreationDate: Optional[CreationDate] + BucketRegion: Optional[BucketRegion] class BucketInfo(TypedDict, total=False): @@ -2554,12 +2555,15 @@ class ListBucketMetricsConfigurationsRequest(ServiceRequest): class ListBucketsOutput(TypedDict, total=False): Owner: Optional[Owner] ContinuationToken: Optional[NextToken] + Prefix: Optional[Prefix] Buckets: Optional[Buckets] class ListBucketsRequest(ServiceRequest): MaxBuckets: Optional[MaxBuckets] ContinuationToken: Optional[Token] + Prefix: Optional[Prefix] + BucketRegion: Optional[BucketRegion] class ListDirectoryBucketsOutput(TypedDict, total=False): @@ -4207,6 +4211,8 @@ def list_buckets( context: RequestContext, max_buckets: MaxBuckets = None, continuation_token: Token = None, + prefix: Prefix = None, + bucket_region: BucketRegion = None, **kwargs, ) -> ListBucketsOutput: raise NotImplementedError diff --git a/pyproject.toml b/pyproject.toml index 7d56bfeaff065..53f03ef6d5a3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,9 +53,9 @@ Issues = "https://github.com/localstack/localstack/issues" # minimal required to actually run localstack on the host for services natively implemented in python base-runtime = [ # pinned / updated by ASF update action - "boto3==1.35.39", + "boto3==1.35.44", # pinned / updated by ASF update action - "botocore==1.35.39", + "botocore==1.35.44", "awscrt>=0.13.14", "cbor2>=5.2.0", "dnspython>=1.16.0", diff --git a/requirements-base-runtime.txt b/requirements-base-runtime.txt index 8e4d8a3be5951..9e607302f7229 100644 --- a/requirements-base-runtime.txt +++ b/requirements-base-runtime.txt @@ -11,9 +11,9 @@ attrs==24.2.0 # referencing awscrt==0.22.0 # via localstack-core (pyproject.toml) -boto3==1.35.39 +boto3==1.35.44 # via localstack-core (pyproject.toml) -botocore==1.35.39 +botocore==1.35.44 # via # boto3 # localstack-core (pyproject.toml) diff --git a/requirements-dev.txt b/requirements-dev.txt index b572e98286554..32bf5ff7c0777 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -43,17 +43,17 @@ aws-sam-translator==1.91.0 # localstack-core aws-xray-sdk==2.14.0 # via moto-ext -awscli==1.35.5 +awscli==1.35.10 # via localstack-core awscrt==0.22.0 # via localstack-core -boto3==1.35.39 +boto3==1.35.44 # via # amazon-kclpy # aws-sam-translator # localstack-core # moto-ext -botocore==1.35.39 +botocore==1.35.44 # via # aws-xray-sdk # awscli diff --git a/requirements-runtime.txt b/requirements-runtime.txt index ddd29cf801b16..871e386d98f43 100644 --- a/requirements-runtime.txt +++ b/requirements-runtime.txt @@ -29,17 +29,17 @@ aws-sam-translator==1.91.0 # localstack-core (pyproject.toml) aws-xray-sdk==2.14.0 # via moto-ext -awscli==1.35.5 +awscli==1.35.10 # via localstack-core (pyproject.toml) awscrt==0.22.0 # via localstack-core -boto3==1.35.39 +boto3==1.35.44 # via # amazon-kclpy # aws-sam-translator # localstack-core # moto-ext -botocore==1.35.39 +botocore==1.35.44 # via # aws-xray-sdk # awscli diff --git a/requirements-test.txt b/requirements-test.txt index 4e4503a133c57..25759abb84af8 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -43,17 +43,17 @@ aws-sam-translator==1.91.0 # localstack-core aws-xray-sdk==2.14.0 # via moto-ext -awscli==1.35.5 +awscli==1.35.10 # via localstack-core awscrt==0.22.0 # via localstack-core -boto3==1.35.39 +boto3==1.35.44 # via # amazon-kclpy # aws-sam-translator # localstack-core # moto-ext -botocore==1.35.39 +botocore==1.35.44 # via # aws-xray-sdk # awscli diff --git a/requirements-typehint.txt b/requirements-typehint.txt index 6bb75b4478d25..12a1b2ea208df 100644 --- a/requirements-typehint.txt +++ b/requirements-typehint.txt @@ -43,11 +43,11 @@ aws-sam-translator==1.91.0 # localstack-core aws-xray-sdk==2.14.0 # via moto-ext -awscli==1.35.5 +awscli==1.35.10 # via localstack-core awscrt==0.22.0 # via localstack-core -boto3==1.35.39 +boto3==1.35.44 # via # amazon-kclpy # aws-sam-translator @@ -55,7 +55,7 @@ boto3==1.35.39 # moto-ext boto3-stubs==1.35.40 # via localstack-core (pyproject.toml) -botocore==1.35.39 +botocore==1.35.44 # via # aws-xray-sdk # awscli From 72e5c0edf3e827aea3c2dc2fbe41d3233a044249 Mon Sep 17 00:00:00 2001 From: Alexander Rashed Date: Mon, 21 Oct 2024 09:16:40 +0200 Subject: [PATCH 2/2] update S3 provider signature --- localstack-core/localstack/services/s3/provider.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/localstack-core/localstack/services/s3/provider.py b/localstack-core/localstack/services/s3/provider.py index 5daf368e49111..6b2cd28b796b5 100644 --- a/localstack-core/localstack/services/s3/provider.py +++ b/localstack-core/localstack/services/s3/provider.py @@ -29,6 +29,7 @@ BucketLoggingStatus, BucketName, BucketNotEmpty, + BucketRegion, BucketVersioningStatus, BypassGovernanceRetention, ChecksumAlgorithm, @@ -549,9 +550,11 @@ def list_buckets( context: RequestContext, max_buckets: MaxBuckets = None, continuation_token: Token = None, + prefix: Prefix = None, + bucket_region: BucketRegion = None, **kwargs, ) -> ListBucketsOutput: - # TODO add support for max_buckets and continuation_token + # TODO add support for max_buckets, continuation_token, prefix, and bucket_region owner = get_owner_for_account_id(context.account_id) store = self.get_store(context.account_id, context.region) buckets = [