pygrestqlambda 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/PKG-INFO +4 -1
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/README.md +3 -0
- pygrestqlambda-0.0.2/docs/examples/direct/README.md +16 -0
- pygrestqlambda-0.0.2/docs/examples/direct/json_response.py +9 -0
- pygrestqlambda-0.0.2/docs/examples/direct/string_response.py +8 -0
- pygrestqlambda-0.0.2/docs/examples/lambda/Dockerfile +7 -0
- pygrestqlambda-0.0.2/docs/examples/lambda/README.md +35 -0
- pygrestqlambda-0.0.2/docs/examples/lambda/app.py +23 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/README.md +23 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/docker-compose.yaml +12 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/lambda/Dockerfile +9 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/lambda/app.py +22 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/lambda/requirements.txt +1 -0
- pygrestqlambda-0.0.2/docs/examples/local_lambda_gateway_compose/openapi.yaml +19 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/pyproject.toml +1 -1
- pygrestqlambda-0.0.2/tests/aws/lambda_function/__init__.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/.github/workflows/publish.yml +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/.github/workflows/validate.yml +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/.gitignore +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/LICENSE +0 -0
- /pygrestqlambda-0.0.1/src/__init__.py → /pygrestqlambda-0.0.2/docs/examples/direct/requirements.txt +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/scripts/validate.sh +0 -0
- {pygrestqlambda-0.0.1/src/pygrestqlambda → pygrestqlambda-0.0.2/src}/__init__.py +0 -0
- {pygrestqlambda-0.0.1/src/pygrestqlambda/aws → pygrestqlambda-0.0.2/src/pygrestqlambda}/__init__.py +0 -0
- {pygrestqlambda-0.0.1/src/pygrestqlambda/aws/lambda_function → pygrestqlambda-0.0.2/src/pygrestqlambda/aws}/__init__.py +0 -0
- {pygrestqlambda-0.0.1/src/pygrestqlambda/db → pygrestqlambda-0.0.2/src/pygrestqlambda/aws/lambda_function}/__init__.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/src/pygrestqlambda/aws/lambda_function/json_transform.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/src/pygrestqlambda/aws/lambda_function/rest_api_gateway_proxy_integration.py +0 -0
- {pygrestqlambda-0.0.1/tests → pygrestqlambda-0.0.2/src/pygrestqlambda/db}/__init__.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/src/pygrestqlambda/db/record.py +0 -0
- {pygrestqlambda-0.0.1/tests/aws → pygrestqlambda-0.0.2/tests}/__init__.py +0 -0
- {pygrestqlambda-0.0.1/tests/aws/lambda_function → pygrestqlambda-0.0.2/tests/aws}/__init__.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/tests/aws/lambda_function/test_json_transform.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/tests/aws/lambda_function/test_rest_api_gateway_proxy_integration.py +0 -0
- {pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/tests/test_record.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pygrestqlambda
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.2
|
4
4
|
Summary: PostgreSQL REST API framework for AWS Lambda functions
|
5
5
|
Project-URL: Homepage, https://github.com/mesogate/pygrestqlambda
|
6
6
|
Project-URL: Issues, https://github.com/mesogate/pygrestqlambda/issues
|
@@ -32,3 +32,6 @@ A REST API web framework for persisting records in a PostgreSQL database.
|
|
32
32
|
- Automatic setting of `created_at` and `last_updated_at` timestamps
|
33
33
|
- Automatic setting of `creator_uid` and `last_updater_uid`
|
34
34
|
- RDS with IAM credentials
|
35
|
+
|
36
|
+
## Examples
|
37
|
+
See [Examples docs directory](./docs/examples/)
|
@@ -9,3 +9,6 @@ A REST API web framework for persisting records in a PostgreSQL database.
|
|
9
9
|
- Automatic setting of `created_at` and `last_updated_at` timestamps
|
10
10
|
- Automatic setting of `creator_uid` and `last_updater_uid`
|
11
11
|
- RDS with IAM credentials
|
12
|
+
|
13
|
+
## Examples
|
14
|
+
See [Examples docs directory](./docs/examples/)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Direct python script invocation example
|
2
|
+
|
3
|
+
Navigate to the current directory from the root of this project:
|
4
|
+
```shell
|
5
|
+
cd docs/examples/direct
|
6
|
+
```
|
7
|
+
|
8
|
+
First install dependency with:
|
9
|
+
```shell
|
10
|
+
pip install pygrestqlambda
|
11
|
+
```
|
12
|
+
|
13
|
+
Then execute the scripts in this directory with, for example:
|
14
|
+
```shell
|
15
|
+
python json_response.py
|
16
|
+
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Lambda function docker container example
|
2
|
+
|
3
|
+
Navigate to the current directory from the root of this project:
|
4
|
+
```shell
|
5
|
+
cd docs/examples/lambda
|
6
|
+
```
|
7
|
+
|
8
|
+
From the current directory, build image with:
|
9
|
+
```shell
|
10
|
+
docker build -t pygrestqlambda/lambda .
|
11
|
+
```
|
12
|
+
|
13
|
+
The run the container with:
|
14
|
+
```shell
|
15
|
+
docker run -p 9095:8080 pygrestqlambda/lambda
|
16
|
+
```
|
17
|
+
|
18
|
+
In a separate terminal, run the following commands:
|
19
|
+
```shell
|
20
|
+
curl \
|
21
|
+
-X POST \
|
22
|
+
-d '{"hello": "from terminal"}' \
|
23
|
+
http://127.0.0.1:9095/2015-03-31/functions/function/invocations
|
24
|
+
```
|
25
|
+
|
26
|
+
The following is returned:
|
27
|
+
```json
|
28
|
+
{
|
29
|
+
"isBase64Encoded": false,
|
30
|
+
"statusCode": 200,
|
31
|
+
"headers": {"Content-Type": "application/json"},
|
32
|
+
"multiValueHeaders": null,
|
33
|
+
"body": "{\"hello\": \"from lambda handler\", \"original_input\": {\"hello\": \"from terminal\"}}"
|
34
|
+
}
|
35
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""
|
2
|
+
Lambda handler
|
3
|
+
"""
|
4
|
+
|
5
|
+
import logging
|
6
|
+
from pygrestqlambda.aws.lambda_function.rest_api_gateway_proxy_integration import Response
|
7
|
+
|
8
|
+
def handler(event: dict, context: dict):
|
9
|
+
"""
|
10
|
+
Lambda handler to return supplied JSON in a format expected by AWS REST API Gateway
|
11
|
+
"""
|
12
|
+
|
13
|
+
logging.debug(context)
|
14
|
+
response = Response(
|
15
|
+
body={
|
16
|
+
'hello': 'from lambda handler',
|
17
|
+
'original_input': event
|
18
|
+
},
|
19
|
+
status_code=200,
|
20
|
+
)
|
21
|
+
payload = response.get_payload()
|
22
|
+
|
23
|
+
return payload
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# REST API Gateway Lambda function docker compose example
|
2
|
+
|
3
|
+
Navigate to the current directory from the root of this project:
|
4
|
+
```shell
|
5
|
+
cd docs/examples/local_lambda_gateway_compose
|
6
|
+
```
|
7
|
+
|
8
|
+
Start the stack with:
|
9
|
+
```shell
|
10
|
+
docker compose up --build
|
11
|
+
```
|
12
|
+
|
13
|
+
In another terminal, make a request to the example endpoint:
|
14
|
+
```shell
|
15
|
+
curl http://127.0.0.1:9096/example
|
16
|
+
```
|
17
|
+
|
18
|
+
The following response should be returned:
|
19
|
+
```json
|
20
|
+
{
|
21
|
+
"hello": "through local OpenAPI REST gateway"
|
22
|
+
}
|
23
|
+
```
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"""
|
2
|
+
Lambda handler
|
3
|
+
"""
|
4
|
+
|
5
|
+
import logging
|
6
|
+
from pygrestqlambda.aws.lambda_function.rest_api_gateway_proxy_integration import Response
|
7
|
+
|
8
|
+
def handler(event: dict, context: dict):
|
9
|
+
"""
|
10
|
+
Lambda handler to return supplied JSON in a format expected by AWS REST API Gateway
|
11
|
+
"""
|
12
|
+
|
13
|
+
logging.debug(context)
|
14
|
+
response = Response(
|
15
|
+
body={
|
16
|
+
'hello': 'through local OpenAPI REST gateway'
|
17
|
+
},
|
18
|
+
status_code=200,
|
19
|
+
)
|
20
|
+
payload = response.get_payload()
|
21
|
+
|
22
|
+
return payload
|
@@ -0,0 +1 @@
|
|
1
|
+
pygrestqlambda
|
@@ -0,0 +1,19 @@
|
|
1
|
+
openapi: 3.0.1
|
2
|
+
info:
|
3
|
+
title: Example API
|
4
|
+
version: 0.0.2
|
5
|
+
servers:
|
6
|
+
- url: http://127.0.0.1:9096
|
7
|
+
paths:
|
8
|
+
/example:
|
9
|
+
get:
|
10
|
+
responses:
|
11
|
+
'200':
|
12
|
+
description: An example response.
|
13
|
+
content:
|
14
|
+
application/json:
|
15
|
+
schema:
|
16
|
+
type: object
|
17
|
+
properties:
|
18
|
+
hello:
|
19
|
+
type: string
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/pygrestqlambda-0.0.1/src/__init__.py → /pygrestqlambda-0.0.2/docs/examples/direct/requirements.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pygrestqlambda-0.0.1/src/pygrestqlambda/aws → pygrestqlambda-0.0.2/src/pygrestqlambda}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pygrestqlambda-0.0.1/tests/aws/lambda_function → pygrestqlambda-0.0.2/tests/aws}/__init__.py
RENAMED
File without changes
|
{pygrestqlambda-0.0.1 → pygrestqlambda-0.0.2}/tests/aws/lambda_function/test_json_transform.py
RENAMED
File without changes
|
File without changes
|
File without changes
|