Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 2e57576

Browse files
Update S3Test with aws-sdk-swift 5.0.0-alpha.3
1 parent c074762 commit 2e57576

File tree

4 files changed

+115
-8
lines changed

4 files changed

+115
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
lambda.zip
77
swift-shared-libs
88
default.profraw
9+
.swiftpm

Examples/S3Test/Package.resolved

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/S3Test/Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:5.1
22

33
import PackageDescription
44

55
let package = Package(
66
name: "S3Test",
7+
products: [
8+
.executable(name: "S3Test", targets: ["S3Test"])
9+
],
710
dependencies: [
811
// Dependencies declare other packages that this package depends on.
912
// .package(url: /* package url */, from: "1.0.0"),
1013
//.package(path: "../../../aws-lambda-swift-sprinter-core"),
1114
//.package(url: "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core", from: "1.0.0-alpha.3"),
1215
//.package(path: "../../../aws-lambda-swift-sprinter-nio-plugin"),
1316
.package(url: "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin", from: "1.0.0"),
14-
.package(url: "https://github.com/swift-aws/aws-sdk-swift.git", from: "4.0.0"),
17+
.package(url: "https://github.com/swift-aws/aws-sdk-swift.git", from: "5.0.0-alpha.3"),
1518
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
1619
],
1720
targets: [
1821
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
1922
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
2023
.target(
2124
name: "S3Test",
22-
dependencies: ["LambdaSwiftSprinterNioPlugin", "S3", "Logging"]
25+
dependencies: [
26+
"LambdaSwiftSprinterNioPlugin",
27+
.product(name: "AWSS3", package: "aws-sdk-swift"),
28+
"Logging"
29+
]
2330
),
2431
.testTarget(
2532
name: "S3TestTests",

Examples/S3Test/Sources/S3Test/main.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Foundation
1818
#endif
1919
import LambdaSwiftSprinterNioPlugin
2020
import Logging
21-
import S3
21+
import AWSS3
2222
import NIO
2323
import NIOFoundationCompat
2424
import AWSSDKSwiftCore
@@ -36,18 +36,20 @@ let logger = Logger(label: "AWS.Lambda.S3Test")
3636

3737
var s3: S3!
3838

39+
let awsClient: AWSHTTPClient = httpClient as! AWSHTTPClient
40+
3941
if ProcessInfo.processInfo.environment["LAMB_CI_EXEC"] == "1" {
4042
//Used for local test
4143
s3 = S3(region: .useast1, endpoint: "http://localstack:4572")
4244
logger.info("Endpoint-URI: http://localstack:4572")
43-
} else if let awsRegion = ProcessInfo.processInfo.environment["AWS_REGION"],
45+
} else if let awsRegion = ProcessInfo.processInfo.environment["AWS_REGION"] {
4446
//The S3 Bucket must be in the same region of the Lambda
45-
let region = Region(rawValue: awsRegion) {
46-
s3 = S3(region: region)
47+
let region = Region(rawValue: awsRegion)
48+
s3 = S3(region: region, httpClientProvider: .shared(awsClient))
4749
logger.info("AWS_REGION: \(region)")
4850
} else {
4951
//Default configuration
50-
s3 = S3(region: .useast1)
52+
s3 = S3(region: .useast1, httpClientProvider: .shared(awsClient))
5153
logger.info("AWS_REGION: us-east-1")
5254
}
5355

0 commit comments

Comments
 (0)