Files
swift-aws-lambda-runtime/Examples/LambdaFunctions/Sources/HelloWorld/HelloWorldHandler.swift
T
Fabian FettandGitHub 454fe2e037 Drop sync and closure APIs (#222)
motivation: with async/await, no need in closure based APIs

changes:
* Drop closure APIs
* Rename AsyncLambdaHandler -> LambdaHandler
* Removed unnecassary public acls from tests
2021-08-24 14:20:13 -07:00

31 lines
958 B
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftAWSLambdaRuntime open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftAWSLambdaRuntime project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import AWSLambdaRuntime
// introductory example, the obligatory "hello, world!"
@main
struct HelloWorldHandler: LambdaHandler {
typealias In = String
typealias Out = String
init(context: Lambda.InitializationContext) async throws {
// setup your resources that you want to reuse here.
}
func handle(event: String, context: Lambda.Context) async throws -> String {
"hello, world"
}
}