Skip to content

Commit 9258f8e

Browse files
committed
update examples
1 parent 457e0c3 commit 9258f8e

File tree

16 files changed

+11
-42
lines changed

16 files changed

+11
-42
lines changed

Examples/Benchmark/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/Deployment/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/Deployment/Sources/Benchmark/BenchmarkHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import AWSLambdaRuntimeCore
16-
import NIO
16+
import NIOCore
1717

1818
// If you would like to benchmark Swift's Lambda Runtime,
1919
// use this example which is more performant.

Examples/Deployment/Sources/HelloWorld/HelloWorldHandler.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ import AWSLambdaRuntime
1717
// introductory example, the obligatory "hello, world!"
1818
@main
1919
struct HelloWorldHandler: LambdaHandler {
20-
typealias Event = String
21-
typealias Output = String
22-
23-
init(context: LambdaInitializationContext) async throws {
24-
// setup your resources that you want to reuse here.
25-
}
26-
2720
func handle(_ event: String, context: LambdaContext) async throws -> String {
2821
"hello, world"
2922
}

Examples/Echo/Lambda.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ import AWSLambdaRuntime
1818

1919
@main
2020
struct MyLambda: LambdaHandler {
21-
typealias Event = String
22-
typealias Output = String
23-
24-
init(context: LambdaInitializationContext) async throws {
25-
// setup your resources that you want to reuse for every invocation here.
26-
}
27-
2821
func handle(_ input: String, context: LambdaContext) async throws -> String {
2922
// as an example, respond with the input's reversed
3023
String(input.reversed())

Examples/Echo/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/ErrorHandling/Lambda.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ struct MyLambda: LambdaHandler {
2121
typealias Event = Request
2222
typealias Output = Response
2323

24-
init(context: LambdaInitializationContext) async throws {}
25-
2624
func handle(_ request: Request, context: LambdaContext) async throws -> Response {
2725
// switch over the error type "requested" by the request, and trigger such error accordingly
2826
switch request.error {

Examples/ErrorHandling/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/Foundation/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/JSON/Lambda.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ struct MyLambda: LambdaHandler {
3030
typealias Event = Request
3131
typealias Output = Response
3232

33-
init(context: LambdaInitializationContext) async throws {
34-
// setup your resources that you want to reuse for every invocation here.
35-
}
36-
3733
func handle(_ event: Request, context: LambdaContext) async throws -> Response {
3834
// as an example, respond with the input event's reversed body
3935
Response(body: String(event.body.reversed()))

Examples/JSON/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/LocalDebugging/MyLambda/Lambda.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ struct MyLambda: LambdaHandler {
2323
typealias Event = Request
2424
typealias Output = Response
2525

26-
init(context: LambdaInitializationContext) async throws {
27-
// setup your resources that you want to reuse for every invocation here.
28-
}
29-
3026
func handle(_ request: Request, context: LambdaContext) async throws -> Response {
3127
// TODO: something useful
3228
Response(message: "Hello, \(request.name)!")

Examples/LocalDebugging/MyLambda/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/Testing/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

Examples/Testing/Sources/Lambda.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ import AWSLambdaRuntime
1818

1919
@main
2020
struct MyLambda: LambdaHandler {
21-
typealias Event = String
22-
typealias Output = String
23-
24-
init(context: LambdaInitializationContext) async throws {
25-
// setup your resources that you want to reuse for every invocation here.
26-
}
27-
2821
func handle(_ event: String, context: LambdaContext) async throws -> String {
2922
// as an example, respond with the event's reversed body
3023
String(event.reversed())

Examples/Testing/Tests/LambdaTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import AWSLambdaTesting
1818
import XCTest
1919

2020
class LambdaTest: XCTestCase {
21-
func testIt() throws {
21+
func testIt() async throws {
2222
let input = UUID().uuidString
23-
let result = try Lambda.test(MyLambda.self, with: input)
23+
let result = try await Lambda.test(MyLambda.self, with: input)
2424
XCTAssertEqual(result, String(input.reversed()))
2525
}
2626
}

0 commit comments

Comments
 (0)