mirror of
https://github.com/swift-server/swift-aws-lambda-runtime.git
synced 2026-05-03 07:22:27 +00:00
Use explicit NIO imports (#220)
- Use explicit NIO modules `NIOCore`, `NIOPosix` and `NIOEmbedded` introduced with SwiftNIO 2.32.0
This commit is contained in:
+4
-2
@@ -20,14 +20,16 @@ let package = Package(
|
||||
targets: [
|
||||
.target(name: "AWSLambdaRuntime", dependencies: [
|
||||
.byName(name: "AWSLambdaRuntimeCore"),
|
||||
.product(name: "NIO", package: "swift-nio"),
|
||||
.product(name: "NIOCore", package: "swift-nio"),
|
||||
.product(name: "NIOFoundationCompat", package: "swift-nio"),
|
||||
]),
|
||||
.target(name: "AWSLambdaRuntimeCore", dependencies: [
|
||||
.product(name: "Logging", package: "swift-log"),
|
||||
.product(name: "Backtrace", package: "swift-backtrace"),
|
||||
.product(name: "NIOHTTP1", package: "swift-nio"),
|
||||
.product(name: "NIO", package: "swift-nio"),
|
||||
.product(name: "NIOCore", package: "swift-nio"),
|
||||
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
||||
.product(name: "NIOPosix", package: "swift-nio"),
|
||||
.product(name: "_NIOConcurrency", package: "swift-nio"),
|
||||
]),
|
||||
.testTarget(name: "AWSLambdaRuntimeCoreTests", dependencies: [
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import struct Foundation.Data
|
||||
import class Foundation.JSONDecoder
|
||||
import class Foundation.JSONEncoder
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOFoundationCompat
|
||||
|
||||
/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `Codable` events.
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import NIO
|
||||
import NIOConcurrencyHelpers
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
|
||||
/// A barebone HTTP client to interact with AWS Runtime Engine which is an HTTP server.
|
||||
/// Note that Lambda Runtime API dictate that only one requests runs at a time.
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#if DEBUG
|
||||
import Dispatch
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOConcurrencyHelpers
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
|
||||
// This functionality is designed for local testing hence beind a #if DEBUG flag.
|
||||
// For example:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `String` events.
|
||||
extension Lambda {
|
||||
|
||||
@@ -21,7 +21,8 @@ import Darwin.C
|
||||
import _NIOConcurrency
|
||||
import Backtrace
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
|
||||
public enum Lambda {
|
||||
public typealias Handler = ByteBufferLambdaHandler
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import Dispatch
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
extension Lambda {
|
||||
internal struct Configuration: CustomStringConvertible {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import Dispatch
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
// MARK: - InitializationContext
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import _NIOConcurrency
|
||||
import Dispatch
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
// MARK: - LambdaHandler
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOConcurrencyHelpers
|
||||
import NIOCore
|
||||
|
||||
extension Lambda {
|
||||
/// `Lifecycle` manages the Lambda process lifecycle.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import Dispatch
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
extension Lambda {
|
||||
/// LambdaRunner manages the Lambda runtime workflow, or business logic.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
|
||||
/// An HTTP based client for AWS Runtime Engine. This encapsulates the RESTful methods exposed by the Runtime Engine:
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Dispatch
|
||||
import NIO
|
||||
import NIOPosix
|
||||
|
||||
internal enum Consts {
|
||||
static let apiPrefix = "/2018-06-01"
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Dispatch
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
|
||||
extension Lambda {
|
||||
public struct TestConfig {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import AWSLambdaRuntime
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
struct Request: Codable {
|
||||
let body: String
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Foundation
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
|
||||
internal struct MockServer {
|
||||
private let group: EventLoopGroup
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import AWSLambdaRuntimeCore
|
||||
import NIO
|
||||
import NIOCore
|
||||
|
||||
// in this example we are receiving and responding with strings
|
||||
struct Handler: EventLoopLambdaHandler {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import NIO
|
||||
import NIOCore
|
||||
import XCTest
|
||||
|
||||
class LambdaHandlerTest: XCTestCase {
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
import XCTest
|
||||
|
||||
class LambdaLifecycleTest: XCTestCase {
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOFoundationCompat
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
import NIOTestUtils
|
||||
import XCTest
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
import XCTest
|
||||
|
||||
class LambdaTest: XCTestCase {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Foundation // for JSON
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOHTTP1
|
||||
import NIOPosix
|
||||
|
||||
internal final class MockLambdaServer {
|
||||
private let logger = Logger(label: "MockLambdaServer")
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
import XCTest
|
||||
|
||||
func runLambda(behavior: LambdaServerBehavior, handler: Lambda.Handler) throws {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
@testable import AWSLambdaRuntime
|
||||
@testable import AWSLambdaRuntimeCore
|
||||
import Logging
|
||||
import NIO
|
||||
import NIOCore
|
||||
import NIOFoundationCompat
|
||||
import NIOPosix
|
||||
import XCTest
|
||||
|
||||
class CodableLambdaTest: XCTestCase {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import AWSLambdaRuntime
|
||||
import AWSLambdaTesting
|
||||
import NIO
|
||||
import NIOCore
|
||||
import XCTest
|
||||
|
||||
class LambdaTestingTests: XCTestCase {
|
||||
|
||||
Reference in New Issue
Block a user