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 1414
1515import AWSLambdaEvents
1616import AWSLambdaRuntime
17- import AWSS3
1817
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
2022
2123 var response : APIGatewayV2Response
2224 do {
2325 // read the list of buckets
2426 context. logger. debug ( " Reading list of buckets " )
25- let client = try await S3Client ( )
2627 let output = try await client. listBuckets ( input: ListBucketsInput ( ) )
2728 let bucketList = output. buckets? . compactMap { $0. name }
2829 response = APIGatewayV2Response ( statusCode: . ok, body: bucketList? . joined ( separator: " \n " ) )
@@ -33,5 +34,4 @@ func handler(event: APIGatewayV2Request, context: LambdaContext) async throws ->
3334 return response
3435}
3536
36- let runtime = LambdaRuntime . init ( body: handler)
3737try await runtime. run ( )
You can’t perform that action at this time.
0 commit comments