diff --git a/.travis.yml b/.travis.yml index efdb32b..8de8ab0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ deploy: provider: releases api_key: secure: Ddgpz/LsTWeTTr8Xm0br+Vs3Is58V2bOHthwLOt5a1TbyhWAgU+tyc6lwvd51mhQxeNNVPSOWLKC4QgJEp2KI2ZCaw0K+Czb8lqMzWF5eJggDmJ0+wOZIHVEWMO7smLTwDc1jWtdnQA3qkPtXgSw0ERcJ9z4/haz1Q8v7Jj5qfoBJiNxnYYvw/79ElqROIjtQ0asX/i6xhZSlBFO1dXo5QPzX7XeNREQmh2dCkjfoeYSFSCah4Tnn5akxX36Pef1DJvWdFvc623pWAUoCpeswIMW/htby5tJQ6+C9PK+2yzqomKfU9gTK9iv7Nt3X1LN3KsXpk6VHgtljiUkEsecXjYB5WVBT00mY/4bnTPyY6RjI/V6C0aGnTE+0Pj78kDofJKj5uNevFi4vlBI2g4s4G0mRASFRp+sk3ASmzl62Lohkl1LfNiPYKRKRA2jT81s79zBnYv/MQ7t3fY+yd7iP+NrJfDFR/XG0vxBOQrNRpq6LR0M7DeHgTD/d9an2WEqJlX9pp+Ji/ywwepW7b/NLv42xeN99SnHbDmJJ/eZ4P1IC37JCOT5CjJ9wIyP8c+Q89JT30nlvON9xPM8MOx/MrVAGCeqC6FW1Zjc6oakTRZdngMqN1acH5OosLX83cOjjXo8ivRt5Sm2tfX3ZuOgL98kdaYsIBPIYbYhZDODdvM= - file: ".build/layer/swift-lambda-runtime-5-1-4.zip" + file: ".build/layer/swift-lambda-runtime-5-1-5.zip" skip_cleanup: true on: tags: true \ No newline at end of file diff --git a/Examples/HTTPSRequest/.devcontainer/Dockerfile b/Examples/HTTPSRequest/.devcontainer/Dockerfile index 2dd67d1..02f6cec 100644 --- a/Examples/HTTPSRequest/.devcontainer/Dockerfile +++ b/Examples/HTTPSRequest/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM nio-swift:5.1.4 +FROM nio-swift:5.1.5 # Or your actual UID, GID on Linux if not the default 1000 ARG USERNAME=vscode diff --git a/Examples/HTTPSRequest/README.md b/Examples/HTTPSRequest/README.md index 37ee88f..d49e04e 100644 --- a/Examples/HTTPSRequest/README.md +++ b/Examples/HTTPSRequest/README.md @@ -1,6 +1,6 @@ # HTTPSRequest -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an HTTPS request. diff --git a/Examples/HelloWorld/.devcontainer/Dockerfile b/Examples/HelloWorld/.devcontainer/Dockerfile index 2dd67d1..02f6cec 100644 --- a/Examples/HelloWorld/.devcontainer/Dockerfile +++ b/Examples/HelloWorld/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM nio-swift:5.1.4 +FROM nio-swift:5.1.5 # Or your actual UID, GID on Linux if not the default 1000 ARG USERNAME=vscode diff --git a/Examples/HelloWorld/README.md b/Examples/HelloWorld/README.md index 4668306..c358606 100644 --- a/Examples/HelloWorld/README.md +++ b/Examples/HelloWorld/README.md @@ -1,6 +1,6 @@ # HelloWorld -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework to build a simple lambda. diff --git a/Examples/PostgreSQLDemo/README.md b/Examples/PostgreSQLDemo/README.md index 10c38dc..7e2de81 100644 --- a/Examples/PostgreSQLDemo/README.md +++ b/Examples/PostgreSQLDemo/README.md @@ -1,6 +1,6 @@ # PostgreSQLDemo -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Postgres query using [PostgresNIO](https://github.com/vapor/postgres-nio.git). diff --git a/Examples/RedisDemo/Package.resolved b/Examples/RedisDemo/Package.resolved new file mode 100644 index 0000000..b0c70c3 --- /dev/null +++ b/Examples/RedisDemo/Package.resolved @@ -0,0 +1,88 @@ +{ + "object": { + "pins": [ + { + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", + "state": { + "branch": null, + "revision": "e2636a4c24e646d3e480fc666da0c090818beb09", + "version": "1.1.0" + } + }, + { + "package": "LambdaSwiftSprinter", + "repositoryURL": "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core", + "state": { + "branch": null, + "revision": "6941e41194bde0e57fb0deb23be620f2b8dd626d", + "version": "1.0.0" + } + }, + { + "package": "LambdaSwiftSprinterNioPlugin", + "repositoryURL": "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin", + "state": { + "branch": null, + "revision": "35d3ab84bf83fc881844b5f7483cb2a1d942a23f", + "version": "1.0.1" + } + }, + { + "package": "swift-log", + "repositoryURL": "https://github.com/apple/swift-log.git", + "state": { + "branch": null, + "revision": "74d7b91ceebc85daf387ebb206003f78813f71aa", + "version": "1.2.0" + } + }, + { + "package": "swift-metrics", + "repositoryURL": "https://github.com/apple/swift-metrics.git", + "state": { + "branch": null, + "revision": "708b960b4605abb20bc55d65abf6bad607252200", + "version": "2.0.0" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "a27a07719ca785bcaca019a5b9fe1814b981b4a2", + "version": "2.15.0" + } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "b4dbfacff47fb8d0f9e0a422d8d37935a9f10570", + "version": "1.4.0" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "af46d9b58fafbb76f9b01177568d435a1b024f99", + "version": "2.6.2" + } + }, + { + "package": "RediStack", + "repositoryURL": "https://gitlab.com/mordil/swift-redi-stack.git", + "state": { + "branch": null, + "revision": "b08ad5461af53276020a21c7fa66fa1237eea723", + "version": "1.0.0-alpha.8" + } + } + ] + }, + "version": 1 +} diff --git a/Examples/RedisDemo/README.md b/Examples/RedisDemo/README.md index dffab31..7c6c213 100644 --- a/Examples/RedisDemo/README.md +++ b/Examples/RedisDemo/README.md @@ -1,6 +1,6 @@ # RedisDemo -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Redis request using [RediStack](https://gitlab.com/mordil/swift-redi-stack.git). diff --git a/Examples/RedisDemo/Sources/RedisDemo/main.swift b/Examples/RedisDemo/Sources/RedisDemo/main.swift index 76c6881..5fb7572 100644 --- a/Examples/RedisDemo/Sources/RedisDemo/main.swift +++ b/Examples/RedisDemo/Sources/RedisDemo/main.swift @@ -52,13 +52,14 @@ let connection = try? RedisConnection.connect( let syncCodableNIOLambda: SyncCodableNIOLambda = { (event, context) throws -> EventLoopFuture in - guard let connection = connection else { + guard let connection = connection, + let key = RedisKey(rawValue: event.key) else { throw LambdaError.redisConnectionFailed } - let future = connection.set(event.key, to: event.value) - .flatMap { - return connection.get(event.key) + let future = connection.set(key, to: event.value) + .flatMap { _ in + return connection.get(key) } .map { content -> Response in return Response(value: content ?? "") diff --git a/Examples/S3Test/.devcontainer/Dockerfile b/Examples/S3Test/.devcontainer/Dockerfile index 2dd67d1..02f6cec 100644 --- a/Examples/S3Test/.devcontainer/Dockerfile +++ b/Examples/S3Test/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM nio-swift:5.1.4 +FROM nio-swift:5.1.5 # Or your actual UID, GID on Linux if not the default 1000 ARG USERNAME=vscode diff --git a/Examples/S3Test/README.md b/Examples/S3Test/README.md index 9690600..0ace07d 100644 --- a/Examples/S3Test/README.md +++ b/Examples/S3Test/README.md @@ -1,6 +1,6 @@ # S3Test -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework with the third-party library [https://github.com/swift-aws/aws-sdk-swift.git](https://github.com/swift-aws/aws-sdk-swift.git) to build a lambda capable to perform an HTTPS request to an S3 Bucket. diff --git a/Makefile b/Makefile index 4f60ee0..5a640aa 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Use this tag to build a customized local image -SWIFT_VERSION?=5.1.4 -LAYER_VERSION?=5-1-4 +SWIFT_VERSION?=5.1.5 +LAYER_VERSION?=5-1-5 # SWIFT_VERSION=5.0.3 # LAYER_VERSION=5-0-3 DOCKER_TAG=nio-swift:$(SWIFT_VERSION) diff --git a/README.md b/README.md index 7bd6ec9..116f3e1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # aws-lambda-swift-sprinter -[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.4](https://img.shields.io/badge/Swift-5.1.4-blue.svg)](https://swift.org/download/) ![](https://img.shields.io/badge/version-1.0.0-green) ![](https://travis-ci.com/swift-sprinter/aws-lambda-swift-sprinter.svg?branch=master) ![](https://img.shields.io/badge/@AWS-Open-orange.svg) +[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) ![](https://img.shields.io/badge/version-1.0.0-green) ![](https://travis-ci.com/swift-sprinter/aws-lambda-swift-sprinter.svg?branch=master) ![](https://img.shields.io/badge/@AWS-Open-orange.svg) ![](./images/aws-lambda-swift-sprinter.png) @@ -175,8 +175,8 @@ make invoke_lambda \ | AWS_PROFILE | An AWS AIM profile you create to authenticate to your account. | default | | IAM_ROLE_NAME | The execution role created that will be assumed by the Lambda. | lambda_sprinter_basic_execution | | AWS_BUCKET | The AWS S3 bucket where the layer and lambdas zip files get uploaded. | aws-lambda-swift-sprinter | -| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.1.4 | -| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-1-4 | +| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.1.5 | +| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-1-5 | | SWIFT_EXECUTABLE | Name of the binary file. | HelloWorld | | SWIFT_PROJECT_PATH | Path to your Swift project. | Examples/HelloWorld | | LAMBDA_FUNCTION_NAME | Display name of your Lambda in AWS. | HelloWorld | @@ -459,8 +459,8 @@ Stop the docker-compose test environment ### Configure: - Go to `AWS Lambda -> Layers` in AWS Console and create a new layer from scratch -- Enter layer name "swift-lambda-runtime-5-1-4" -- Upload the zip file `build/swift-lambda-runtime-5-1-4.zip` +- Enter layer name "swift-lambda-runtime-5-1-5" +- Upload the zip file `build/swift-lambda-runtime-5-1-5.zip` - Leave "Compatible runtimes" empty. - Click "Create" - Copy the `arn` from the created layer, it's required to set up the lambda. diff --git a/docker/5.1.4/Dockerfile b/docker/5.1.5/Dockerfile similarity index 73% rename from docker/5.1.4/Dockerfile rename to docker/5.1.5/Dockerfile index 8aef938..ff7286f 100644 --- a/docker/5.1.4/Dockerfile +++ b/docker/5.1.5/Dockerfile @@ -1,4 +1,4 @@ -FROM swift:5.1.4 as builder +FROM swift:5.1.5 as builder RUN apt-get -qq update && apt-get -q -y install \ libssl-dev libicu-dev diff --git a/docker/5.1.4/swift-shared-libraries.txt b/docker/5.1.5/swift-shared-libraries.txt similarity index 100% rename from docker/5.1.4/swift-shared-libraries.txt rename to docker/5.1.5/swift-shared-libraries.txt