diff --git a/.github/composite_actions/get_platform_parameters/action.yml b/.github/composite_actions/get_platform_parameters/action.yml index ad4024b29e..55d1300511 100644 --- a/.github/composite_actions/get_platform_parameters/action.yml +++ b/.github/composite_actions/get_platform_parameters/action.yml @@ -42,7 +42,7 @@ runs: - id: get-xcode-version run: | LATEST_XCODE_VERSION=16.2.0 - MINIMUM_XCODE_VERSION=15.0.1 + MINIMUM_XCODE_VERSION=16.1.0 INPUT_XCODE_VERSION=${{ inputs.xcode_version }} @@ -71,7 +71,7 @@ runs: ;; iOS/*) DEVICE="iPhone 15" - OS_VERSION="17.0" + OS_VERSION="17.0.1" ;; tvOS/latest) DEVICE="Apple TV 4K (3rd generation)" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift index c602cf7108..e428e12ff4 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift @@ -7,6 +7,7 @@ import AWSCognitoIdentity import ClientRuntime +import Foundation extension GetCredentialsForIdentityOutput: Codable { enum CodingKeys: Swift.String, Swift.CodingKey { diff --git a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift index a430f331f7..61ca8e6e05 100644 --- a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift +++ b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift @@ -10,6 +10,7 @@ import AwsCommonRuntimeKit import Amplify import InternalAmplifyCredentials import SmithyIdentity +import Foundation public class MockAWSAuthService: AWSAuthCredentialsProviderBehavior { diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift index 35c4e6f974..ab09a19dc5 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift @@ -53,7 +53,7 @@ class AWSS3PreSignedURLBuilderAdapter: AWSS3PreSignedURLBuilderBehavior { expiration: expiration) case .uploadPart(let partNumber, let uploadId): let input = UploadPartInput(bucket: bucket, key: key, partNumber: partNumber, uploadId: uploadId) - preSignedUrl = try await input.customPresignURL( + preSignedUrl = try await input.presignURL( config: config, expiration: expiration) } diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift deleted file mode 100644 index 7b702f2300..0000000000 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift +++ /dev/null @@ -1,200 +0,0 @@ -// -// Copyright Amazon.com Inc. or its affiliates. -// All Rights Reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -import Foundation -import AWSS3 -@_spi(SmithyReadWrite) import ClientRuntime -@_spi(UnknownAWSHTTPServiceError) @_spi(SmithyReadWrite) @_spi(AWSEndpointResolverMiddleware) import AWSClientRuntime -import Smithy -import SmithyHTTPAPI -import SmithyRetries -@_spi(SmithyReadWrite) import SmithyXML - -// swiftlint:disable identifier_name -// swiftlint:disable line_length -extension UploadPartInput { - func customPresignURL( - config: S3Client.S3ClientConfiguration, - expiration: Foundation.TimeInterval - ) async throws -> Foundation.URL? { - let serviceName = "S3" - let input = self - let client: (SmithyHTTPAPI.HTTPRequest, Smithy.Context) async throws -> SmithyHTTPAPI.HTTPResponse = { (_, _) in - throw Smithy.ClientError.unknownError("No HTTP client configured for presigned request") - } - let context = Smithy.ContextBuilder() - .withMethod(value: .put) - .withServiceName(value: serviceName) - .withOperation(value: "uploadPart") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.telemetryProvider.loggerProvider.getLogger(name: S3Client.clientName)) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: false) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .withIdentityResolver(value: config.bearerTokenIdentityResolver, schemeID: "smithy.api#httpBearerAuth") - .withFlowType(value: .PRESIGN_URL) - .withExpiration(value: expiration) - .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") - .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a") - .withRegion(value: config.region) - .withSigningName(value: "s3") - .withSigningRegion(value: config.signingRegion) - .withUnsignedPayloadTrait(value: true) - .build() - let builder = ClientRuntime.OrchestratorBuilder() - config.interceptorProviders.forEach { provider in - builder.interceptors.add(provider.create()) - } - config.httpInterceptorProviders.forEach { provider in - builder.interceptors.add(provider.create()) - } - builder.interceptors.add(ClientRuntime.URLPathMiddleware(UploadPartInput.customUrlPathProvider(_:))) - builder.interceptors.add(ClientRuntime.URLHostMiddleware()) - builder.deserialize(ClientRuntime.DeserializeMiddleware(UploadPartOutput.customHttpOutput(from:), CustomUploadPartOutputError.httpError(from:))) - builder.interceptors.add(ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - builder.retryStrategy(SmithyRetries.DefaultRetryStrategy(options: config.retryStrategyOptions)) - builder.retryErrorInfoProvider(AWSClientRuntime.AWSRetryErrorInfoProvider.errorInfo(for:)) - builder.applySigner(ClientRuntime.SignerMiddleware()) - let endpointParamsBlock = { [config] (context: Smithy.Context) in - EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false) - } - context.set(key: Smithy.AttributeKey(name: "EndpointParams"), value: endpointParamsBlock(context)) - builder.applyEndpoint(AWSClientRuntime.AWSEndpointResolverMiddleware(paramsBlock: endpointParamsBlock, resolverBlock: { [config] in try config.endpointResolver.resolve(params: $0) })) - builder.selectAuthScheme(ClientRuntime.AuthSchemeMiddleware()) - builder.interceptors.add(AWSClientRuntime.AWSS3ErrorWith200StatusXMLMiddleware()) - builder.interceptors.add(AWSClientRuntime.FlexibleChecksumsRequestMiddleware(requestChecksumRequired: false, checksumAlgorithm: input.checksumAlgorithm?.rawValue, checksumAlgoHeaderName: "x-amz-sdk-checksum-algorithm")) - builder.serialize(UploadPartPresignedMiddleware()) - var metricsAttributes = Smithy.Attributes() - metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.service, value: "S3") - metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.method, value: "UploadPart") - let op = builder.attributes(context) - .telemetry(ClientRuntime.OrchestratorTelemetry( - telemetryProvider: config.telemetryProvider, - metricsAttributes: metricsAttributes, - meterScope: serviceName, - tracerScope: serviceName - )) - .executeRequest(client) - .build() - return try await op.presignRequest(input: input).endpoint.url - } -} - -private extension UploadPartInput { - static func customUrlPathProvider(_ value: UploadPartInput) -> Swift.String? { - guard let key = value.key else { - return nil - } - return "/\(key.urlPercentEncoding(encodeForwardSlash: false))" - } -} - -private extension UploadPartOutput { - static func customHttpOutput(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> UploadPartOutput { - var value = UploadPartOutput() - if let bucketKeyEnabledHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-bucket-key-enabled") { - value.bucketKeyEnabled = Swift.Bool(bucketKeyEnabledHeaderValue) ?? false - } - if let checksumCRC32HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-crc32") { - value.checksumCRC32 = checksumCRC32HeaderValue - } - if let checksumCRC32CHeaderValue = httpResponse.headers.value(for: "x-amz-checksum-crc32c") { - value.checksumCRC32C = checksumCRC32CHeaderValue - } - if let checksumSHA1HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-sha1") { - value.checksumSHA1 = checksumSHA1HeaderValue - } - if let checksumSHA256HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-sha256") { - value.checksumSHA256 = checksumSHA256HeaderValue - } - if let eTagHeaderValue = httpResponse.headers.value(for: "ETag") { - value.eTag = eTagHeaderValue - } - if let requestChargedHeaderValue = httpResponse.headers.value(for: "x-amz-request-charged") { - value.requestCharged = S3ClientTypes.RequestCharged(rawValue: requestChargedHeaderValue) - } - if let sseCustomerAlgorithmHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-customer-algorithm") { - value.sseCustomerAlgorithm = sseCustomerAlgorithmHeaderValue - } - if let sseCustomerKeyMD5HeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-customer-key-MD5") { - value.sseCustomerKeyMD5 = sseCustomerKeyMD5HeaderValue - } - if let ssekmsKeyIdHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-aws-kms-key-id") { - value.ssekmsKeyId = ssekmsKeyIdHeaderValue - } - if let serverSideEncryptionHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption") { - value.serverSideEncryption = S3ClientTypes.ServerSideEncryption(rawValue: serverSideEncryptionHeaderValue) - } - return value - } -} - -private enum CustomUploadPartOutputError { - static func httpError(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> Swift.Error { - let data = try await httpResponse.data() - let responseReader = try SmithyXML.Reader.from(data: data) - let baseError = try AWSClientRuntime.RestXMLError(httpResponse: httpResponse, responseReader: responseReader, noErrorWrapping: true) - if let error = baseError.customError() { return error } - if baseError.httpResponse.statusCode == .notFound && baseError.httpResponse.body.isEmpty { - return CustomUploadPartOutputError.NotFound( - httpResponse: baseError.httpResponse, - message: baseError.requestID, - requestID: baseError.message, - requestID2: baseError.requestID2 - ) - } - switch baseError.code { - default: return try AWSClientRuntime.UnknownAWSHTTPServiceError.makeError(baseError: baseError) - } - } - - private struct NotFound: ClientRuntime.ModeledError, AWSClientRuntime.AWSS3ServiceError, ClientRuntime.HTTPError, Swift.Error { - static var typeName: Swift.String { "NotFound" } - static var fault: ClientRuntime.ErrorFault { .client } - static var isRetryable: Swift.Bool { false } - static var isThrottling: Swift.Bool { false } - var httpResponse = SmithyHTTPAPI.HTTPResponse() - var message: Swift.String? - var requestID: Swift.String? - var requestID2: Swift.String? - } -} - -private struct UploadPartPresignedMiddleware: Smithy.RequestMessageSerializer { - typealias InputType = UploadPartInput - typealias RequestType = SmithyHTTPAPI.HTTPRequest - - let id: Swift.String = "UploadPartPresignedMiddleware" - - func apply( - input: InputType, - builder: SmithyHTTPAPI.HTTPRequestBuilder, - attributes: Smithy.Context - ) throws { - builder.withQueryItem(.init( - name: "x-id", - value: "UploadPart") - ) - - guard let partNumber = input.partNumber else { - throw ClientError.invalidValue("partNumber is required and must not be nil.") - } - builder.withQueryItem(.init( - name: "partNumber".urlPercentEncoding(), - value: Swift.String(partNumber).urlPercentEncoding()) - ) - - guard let uploadId = input.uploadId else { - throw ClientError.invalidValue("uploadId is required and must not be nil.") - } - builder.withQueryItem(.init( - name: "uploadId".urlPercentEncoding(), - value: Swift.String(uploadId).urlPercentEncoding()) - ) - } -} diff --git a/Package.resolved b/Package.resolved index b4fa872d2d..239a49f926 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "74d970dde8a0d6b2fe1d8374767ca9793088ce2c", - "version" : "0.48.0" + "revision" : "5be6550f81c760cceb0a43c30d4149ac55c5640c", + "version" : "0.52.1" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift", "state" : { - "revision" : "104958a898543582bb01102616bf5d61ed237352", - "version" : "1.2.59" + "revision" : "26ea2d0efea7f6fdc331433f1ac911ed91568ee9", + "version" : "1.5.10" } }, { @@ -45,13 +45,40 @@ "version" : "2.2.2" } }, + { + "identity" : "grpc-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift.git", + "state" : { + "revision" : "a56a157218877ef3e9625f7e1f7b2cb7e46ead1b", + "version" : "1.26.1" + } + }, + { + "identity" : "opentelemetry-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/open-telemetry/opentelemetry-swift", + "state" : { + "revision" : "ef63c346d05f4fa7c9ca883f92631fd139eb2cfe", + "version" : "1.17.1" + } + }, + { + "identity" : "opentracing-objc", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/opentracing-objc", + "state" : { + "revision" : "18c1a35ca966236cee0c5a714a51a73ff33384c1", + "version" : "0.5.2" + } + }, { "identity" : "smithy-swift", "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "755367ae4e10004f8b5a94fbfdf3f638a1f225bc", - "version" : "0.125.0" + "revision" : "9ba23ff32f2ebe555149c9317448fd5002511488", + "version" : "0.150.0" } }, { @@ -63,13 +90,202 @@ "version" : "0.15.3" } }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "042e1c4d9d19748c9c228f8d4ebc97bb1e339b0b", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "870f4d5fe5fcfedc13f25d70e103150511746404", + "version" : "1.11.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "8c0c0a8b49e080e54e5e328cc552821ff07cd341", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "84b1d494118d63629a785230135f82991f02329e", + "version" : "3.13.2" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "db6eea3692638a65e2124990155cd220c2915903", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", - "version" : "1.6.3" + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" + } + }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics.git", + "state" : { + "revision" : "4c83e1cdf4ba538ef6e43a9bbd0bcc33a0ca46e3", + "version" : "2.7.0" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "a5fea865badcb1c993c85b0f0e8d05a4bd2270fb", + "version" : "2.85.0" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a55c3dd3a81d035af8a20ce5718889c0dcab073d", + "version" : "1.29.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", + "version" : "1.38.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "385f5bd783ffbfff46b246a7db7be8e4f04c53bd", + "version" : "2.33.0" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "decfd235996bc163b44e10b8a24997a3d2104b90", + "version" : "1.25.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "e0ec0f5f3af6f3e4d5e7a19d2af26b481acb6ba8", + "version" : "1.0.3" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "102a647b573f60f73afdce5613a51d71349fe507", + "version" : "1.30.0" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", + "version" : "2.8.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "41daa93a5d229e1548ec86ab527ce4783ca84dda", + "version" : "1.6.0" + } + }, + { + "identity" : "thrift-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/Thrift-Swift", + "state" : { + "revision" : "18ff09e6b30e589ed38f90a1af23e193b8ecef8e", + "version" : "1.1.2" } } ], diff --git a/Package.swift b/Package.swift index 5d3449ac90..ad1f21b04d 100644 --- a/Package.swift +++ b/Package.swift @@ -9,7 +9,7 @@ let platforms: [SupportedPlatform] = [ .watchOS(.v9) ] let dependencies: [Package.Dependency] = [ - .package(url: "https://github.com/awslabs/aws-sdk-swift", exact: "1.2.59"), + .package(url: "https://github.com/awslabs/aws-sdk-swift", exact: "1.5.10"), .package(url: "https://github.com/stephencelis/SQLite.swift.git", exact: "0.15.3"), .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: "2.1.0"), .package(url: "https://github.com/aws-amplify/amplify-swift-utils-notifications.git", from: "1.1.0") diff --git a/README.md b/README.md index 4901a18a4f..3819b50eb5 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ This library is licensed under the Apache 2.0 License. ## Installation -Amplify requires Xcode 15.0 or later for all the supported platforms. +Amplify requires Xcode 16.0 or later for all the supported platforms. | For more detailed instructions, follow the getting started guides in our [documentation site](https://docs.amplify.aws/lib/q/platform/ios) | |-------------------------------------------------|