File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import AWSLambdaEvents
16
16
import AWSLambdaRuntime
17
- import AWSS3
18
17
19
- func handler( event: APIGatewayV2Request , context: LambdaContext ) async throws -> APIGatewayV2Response {
18
+ @preconcurrency import AWSS3
19
+ let client = try await S3Client ( )
20
+
21
+ let runtime = LambdaRuntime . init { ( event: APIGatewayV2Request , context: LambdaContext ) async throws -> APIGatewayV2Response in
20
22
21
23
var response : APIGatewayV2Response
22
24
do {
23
25
// read the list of buckets
24
26
context. logger. debug ( " Reading list of buckets " )
25
- let client = try await S3Client ( )
26
27
let output = try await client. listBuckets ( input: ListBucketsInput ( ) )
27
28
let bucketList = output. buckets? . compactMap { $0. name }
28
29
response = APIGatewayV2Response ( statusCode: . ok, body: bucketList? . joined ( separator: " \n " ) )
@@ -33,5 +34,4 @@ func handler(event: APIGatewayV2Request, context: LambdaContext) async throws ->
33
34
return response
34
35
}
35
36
36
- let runtime = LambdaRuntime . init ( body: handler)
37
37
try await runtime. run ( )
You can’t perform that action at this time.
0 commit comments