Skip to content

Commit f059809

Browse files
committed
update tutorial code snippets
1 parent c22f527 commit f059809

File tree

11 files changed

+64
-43
lines changed

11 files changed

+64
-43
lines changed

Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-01-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.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "SquareNumberLambda",
88
platforms: [
9-
.macOS(.v12)
9+
.macOS(.v15)
1010
]
1111
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "SquareNumberLambda",
88
platforms: [
9-
.macOS(.v12)
9+
.macOS(.v15)
1010
],
1111
dependencies: [
12-
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha")
12+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "main")
1313
]
1414
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "SquareNumberLambda",
88
platforms: [
9-
.macOS(.v12)
9+
.macOS(.v15)
1010
],
1111
products: [
1212
.executable(name: "SquareNumberLambda", targets: ["SquareNumberLambda"])
1313
],
1414
dependencies: [
15-
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha")
15+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "main")
1616
]
1717
)

Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-05-package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "SquareNumberLambda",
88
platforms: [
9-
.macOS(.v12)
9+
.macOS(.v15)
1010
],
1111
products: [
1212
.executable(name: "SquareNumberLambda", targets: ["SquareNumberLambda"])
1313
],
1414
dependencies: [
15-
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha")
15+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "main")
1616
],
1717
targets: [
1818
.executableTarget(
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
@main
2-
struct SquareNumberHandler: SimpleLambdaHandler {}
1+
// the data structure to represent the input parameter
2+
struct Request: Decodable {
3+
let number: Double
4+
}
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import AWSLambdaRuntime
1+
// the data structure to represent the input parameter
2+
struct Request: Decodable {
3+
let number: Double
4+
}
25

3-
@main
4-
struct SquareNumberHandler: SimpleLambdaHandler {}
6+
// the data structure to represent the output response
7+
struct Response: Encodable {
8+
let result: Double
9+
}
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import AWSLambdaRuntime
22

3-
@main
4-
struct SquareNumberHandler: SimpleLambdaHandler {
5-
func handle(_ event: Event, context: LambdaContext) async throws -> Output {}
3+
// the data structure to represent the input parameter
4+
struct Request: Decodable {
5+
let number: Double
66
}
7+
8+
// the data structure to represent the output response
9+
struct Response: Encodable {
10+
let result: Double
11+
}
12+
13+
// the Lambda runtime
14+
let runtime = LambdaRuntime {
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import AWSLambdaRuntime
22

3-
struct Input: Codable {
3+
// the data structure to represent the input parameter
4+
struct Request: Decodable {
45
let number: Double
56
}
67

7-
struct Number: Codable {
8+
// the data structure to represent the output response
9+
struct Response: Encodable {
810
let result: Double
911
}
1012

11-
@main
12-
struct SquareNumberHandler: SimpleLambdaHandler {
13-
func handle(_ event: Event, context: LambdaContext) async throws -> Output {}
14-
}
13+
// the Lambda runtime
14+
let runtime = LambdaRuntime {
15+
(event: Request, context: LambdaContext) in
16+
17+
}
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import AWSLambdaRuntime
22

3-
struct Input: Codable {
3+
// the data structure to represent the input parameter
4+
struct Request: Decodable {
45
let number: Double
56
}
67

7-
struct Number: Codable {
8+
// the data structure to represent the output response
9+
struct Response: Encodable {
810
let result: Double
911
}
1012

11-
@main
12-
struct SquareNumberHandler: SimpleLambdaHandler {
13-
typealias Event = Input
14-
typealias Output = Number
13+
// the Lambda runtime
14+
let runtime = LambdaRuntime {
15+
(event: Request, context: LambdaContext) in
1516

16-
func handle(_ event: Event, context: LambdaContext) async throws -> Output {}
17-
}
17+
Response(result: event.number * event.number)
18+
}

0 commit comments

Comments
 (0)