aws-solutions-constructs.aws-openapigateway-lambda 2.53.0__tar.gz → 2.54.1__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.
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/PKG-INFO +27 -23
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/README.md +26 -22
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/setup.py +7 -7
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs/aws_openapigateway_lambda/__init__.py +29 -22
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/__init__.py +5 -2
- aws-solutions-constructs.aws-openapigateway-lambda-2.54.1/src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/aws-openapigateway-lambda@2.54.1.jsii.tgz +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info}/PKG-INFO +27 -23
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/SOURCES.txt +1 -1
- aws-solutions-constructs.aws-openapigateway-lambda-2.54.1/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/requires.txt +8 -0
- aws-solutions-constructs.aws-openapigateway-lambda-2.53.0/src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/aws-openapigateway-lambda@2.53.0.jsii.tgz +0 -0
- aws-solutions-constructs.aws-openapigateway-lambda-2.53.0/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/requires.txt +0 -8
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/LICENSE +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/MANIFEST.in +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/pyproject.toml +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/setup.cfg +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs/aws_openapigateway_lambda/py.typed +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/dependency_links.txt +0 -0
- {aws-solutions-constructs.aws-openapigateway-lambda-2.53.0 → aws-solutions-constructs.aws-openapigateway-lambda-2.54.1}/src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aws-solutions-constructs.aws-openapigateway-lambda
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.54.1
|
|
4
4
|
Summary: CDK constructs for defining an interaction between an OpenAPI-defined API Gateway and one or more Lambda functions.
|
|
5
5
|
Home-page: https://github.com/awslabs/aws-solutions-constructs.git
|
|
6
6
|
Author: Amazon Web Services
|
|
@@ -45,7 +45,9 @@ License-File: LICENSE
|
|
|
45
45
|
|
|
46
46
|
This AWS Solutions Construct implements an Amazon API Gateway REST API defined by an OpenAPI specification file connected to an AWS Lambda function.
|
|
47
47
|
|
|
48
|
-
Here is a minimal deployable pattern definition
|
|
48
|
+
Here is a minimal deployable pattern definition.
|
|
49
|
+
|
|
50
|
+
**NOTE** The referenced `openapi/apiDefinition.yaml` openapi definition file and `messages-lambda` lambda package directory for the three code samples below can both be found under this constructs `test` folder (`<repository_root>/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test`)
|
|
49
51
|
|
|
50
52
|
Typescript
|
|
51
53
|
|
|
@@ -58,7 +60,7 @@ import * as path from 'path';
|
|
|
58
60
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
59
61
|
|
|
60
62
|
const apiDefinitionAsset = new Asset(this, 'ApiDefinitionAsset', {
|
|
61
|
-
path: path.join(__dirname, '
|
|
63
|
+
path: path.join(__dirname, 'openapi/apiDefinition.yaml')
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
@@ -79,30 +81,32 @@ new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
|
79
81
|
Python
|
|
80
82
|
|
|
81
83
|
```python
|
|
82
|
-
from aws_solutions_constructs.aws_openapigateway_lambda import ApiGatewayToLambda
|
|
83
84
|
from aws_cdk import (
|
|
84
|
-
Stack
|
|
85
|
+
Stack,
|
|
86
|
+
aws_s3_assets as s3_assets,
|
|
87
|
+
aws_lambda as lambda_,
|
|
85
88
|
)
|
|
86
|
-
|
|
87
|
-
import aws_cdk.aws_s3_assets as s3_assets
|
|
88
|
-
import aws_cdk.aws_lambda as lambda_
|
|
89
89
|
from constructs import Construct
|
|
90
|
-
from .
|
|
90
|
+
from aws_solutions_constructs.aws_openapigateway_lambda import OpenApiGatewayToLambda, ApiIntegration
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
path="openapispec.yaml"
|
|
94
|
-
)
|
|
92
|
+
class TestStack(Stack):
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
handler="index.handler",
|
|
99
|
-
code=lambda_.Code.from_inline("exports.handler = handler.toString()")
|
|
100
|
-
))
|
|
94
|
+
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
|
|
95
|
+
super().__init__(scope, construct_id, **kwargs)
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
api_definition_asset = s3_assets.Asset(self, "ApiDefinitionAsset", path="./openapi/apiDefinition.yaml")
|
|
98
|
+
|
|
99
|
+
api_integration = ApiIntegration(id="MessagesHandler", lambda_function_props={
|
|
100
|
+
"runtime": lambda_.Runtime.NODEJS_18_X,
|
|
101
|
+
"handler": "index.handler",
|
|
102
|
+
"code": lambda_.Code.from_asset("./messages-lambda")
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
openapigateway_to_lambda = OpenApiGatewayToLambda(self,
|
|
106
|
+
id="OpenApiGatewayToLambda",
|
|
107
|
+
api_integrations=[api_integration],
|
|
108
|
+
api_definition_asset=api_definition_asset
|
|
109
|
+
)
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
Java
|
|
@@ -123,13 +127,13 @@ import java.util.Collections;
|
|
|
123
127
|
|
|
124
128
|
import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_18_X;
|
|
125
129
|
|
|
126
|
-
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("
|
|
130
|
+
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("openapi/apiDefinition.yaml").build());
|
|
127
131
|
|
|
128
132
|
final ApiIntegration apiIntegration = ApiIntegration.builder()
|
|
129
133
|
.id("MessagesHandler")
|
|
130
134
|
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
131
135
|
.runtime(NODEJS_18_X)
|
|
132
|
-
.code(Code.fromAsset("lambda"))
|
|
136
|
+
.code(Code.fromAsset("messages-lambda"))
|
|
133
137
|
.handler("index.handler")
|
|
134
138
|
.build())
|
|
135
139
|
.build();
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
This AWS Solutions Construct implements an Amazon API Gateway REST API defined by an OpenAPI specification file connected to an AWS Lambda function.
|
|
25
25
|
|
|
26
|
-
Here is a minimal deployable pattern definition
|
|
26
|
+
Here is a minimal deployable pattern definition.
|
|
27
|
+
|
|
28
|
+
**NOTE** The referenced `openapi/apiDefinition.yaml` openapi definition file and `messages-lambda` lambda package directory for the three code samples below can both be found under this constructs `test` folder (`<repository_root>/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test`)
|
|
27
29
|
|
|
28
30
|
Typescript
|
|
29
31
|
|
|
@@ -36,7 +38,7 @@ import * as path from 'path';
|
|
|
36
38
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
37
39
|
|
|
38
40
|
const apiDefinitionAsset = new Asset(this, 'ApiDefinitionAsset', {
|
|
39
|
-
path: path.join(__dirname, '
|
|
41
|
+
path: path.join(__dirname, 'openapi/apiDefinition.yaml')
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
@@ -57,30 +59,32 @@ new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
|
57
59
|
Python
|
|
58
60
|
|
|
59
61
|
```python
|
|
60
|
-
from aws_solutions_constructs.aws_openapigateway_lambda import ApiGatewayToLambda
|
|
61
62
|
from aws_cdk import (
|
|
62
|
-
Stack
|
|
63
|
+
Stack,
|
|
64
|
+
aws_s3_assets as s3_assets,
|
|
65
|
+
aws_lambda as lambda_,
|
|
63
66
|
)
|
|
64
|
-
|
|
65
|
-
import aws_cdk.aws_s3_assets as s3_assets
|
|
66
|
-
import aws_cdk.aws_lambda as lambda_
|
|
67
67
|
from constructs import Construct
|
|
68
|
-
from .
|
|
68
|
+
from aws_solutions_constructs.aws_openapigateway_lambda import OpenApiGatewayToLambda, ApiIntegration
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
path="openapispec.yaml"
|
|
72
|
-
)
|
|
70
|
+
class TestStack(Stack):
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
handler="index.handler",
|
|
77
|
-
code=lambda_.Code.from_inline("exports.handler = handler.toString()")
|
|
78
|
-
))
|
|
72
|
+
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
|
|
73
|
+
super().__init__(scope, construct_id, **kwargs)
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
api_definition_asset = s3_assets.Asset(self, "ApiDefinitionAsset", path="./openapi/apiDefinition.yaml")
|
|
76
|
+
|
|
77
|
+
api_integration = ApiIntegration(id="MessagesHandler", lambda_function_props={
|
|
78
|
+
"runtime": lambda_.Runtime.NODEJS_18_X,
|
|
79
|
+
"handler": "index.handler",
|
|
80
|
+
"code": lambda_.Code.from_asset("./messages-lambda")
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
openapigateway_to_lambda = OpenApiGatewayToLambda(self,
|
|
84
|
+
id="OpenApiGatewayToLambda",
|
|
85
|
+
api_integrations=[api_integration],
|
|
86
|
+
api_definition_asset=api_definition_asset
|
|
87
|
+
)
|
|
84
88
|
```
|
|
85
89
|
|
|
86
90
|
Java
|
|
@@ -101,13 +105,13 @@ import java.util.Collections;
|
|
|
101
105
|
|
|
102
106
|
import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_18_X;
|
|
103
107
|
|
|
104
|
-
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("
|
|
108
|
+
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("openapi/apiDefinition.yaml").build());
|
|
105
109
|
|
|
106
110
|
final ApiIntegration apiIntegration = ApiIntegration.builder()
|
|
107
111
|
.id("MessagesHandler")
|
|
108
112
|
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
109
113
|
.runtime(NODEJS_18_X)
|
|
110
|
-
.code(Code.fromAsset("lambda"))
|
|
114
|
+
.code(Code.fromAsset("messages-lambda"))
|
|
111
115
|
.handler("index.handler")
|
|
112
116
|
.build())
|
|
113
117
|
.build();
|
|
@@ -5,7 +5,7 @@ kwargs = json.loads(
|
|
|
5
5
|
"""
|
|
6
6
|
{
|
|
7
7
|
"name": "aws-solutions-constructs.aws-openapigateway-lambda",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.54.1",
|
|
9
9
|
"description": "CDK constructs for defining an interaction between an OpenAPI-defined API Gateway and one or more Lambda functions.",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"url": "https://github.com/awslabs/aws-solutions-constructs.git",
|
|
@@ -26,7 +26,7 @@ kwargs = json.loads(
|
|
|
26
26
|
],
|
|
27
27
|
"package_data": {
|
|
28
28
|
"aws_solutions_constructs.aws_openapigateway_lambda._jsii": [
|
|
29
|
-
"aws-openapigateway-lambda@2.
|
|
29
|
+
"aws-openapigateway-lambda@2.54.1.jsii.tgz"
|
|
30
30
|
],
|
|
31
31
|
"aws_solutions_constructs.aws_openapigateway_lambda": [
|
|
32
32
|
"py.typed"
|
|
@@ -34,12 +34,12 @@ kwargs = json.loads(
|
|
|
34
34
|
},
|
|
35
35
|
"python_requires": "~=3.8",
|
|
36
36
|
"install_requires": [
|
|
37
|
-
"aws-cdk-lib>=2.
|
|
38
|
-
"aws-cdk.integ-tests-alpha==2.
|
|
39
|
-
"aws-solutions-constructs.core==2.
|
|
40
|
-
"aws-solutions-constructs.resources==2.
|
|
37
|
+
"aws-cdk-lib>=2.135.0, <3.0.0",
|
|
38
|
+
"aws-cdk.integ-tests-alpha==2.135.0.a0",
|
|
39
|
+
"aws-solutions-constructs.core==2.54.1",
|
|
40
|
+
"aws-solutions-constructs.resources==2.54.1",
|
|
41
41
|
"constructs>=10.0.0, <11.0.0",
|
|
42
|
-
"jsii>=1.
|
|
42
|
+
"jsii>=1.96.0, <2.0.0",
|
|
43
43
|
"publication>=0.0.3",
|
|
44
44
|
"typeguard~=2.13.3"
|
|
45
45
|
],
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
This AWS Solutions Construct implements an Amazon API Gateway REST API defined by an OpenAPI specification file connected to an AWS Lambda function.
|
|
26
26
|
|
|
27
|
-
Here is a minimal deployable pattern definition
|
|
27
|
+
Here is a minimal deployable pattern definition.
|
|
28
|
+
|
|
29
|
+
**NOTE** The referenced `openapi/apiDefinition.yaml` openapi definition file and `messages-lambda` lambda package directory for the three code samples below can both be found under this constructs `test` folder (`<repository_root>/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test`)
|
|
28
30
|
|
|
29
31
|
Typescript
|
|
30
32
|
|
|
@@ -37,7 +39,7 @@ import * as path from 'path';
|
|
|
37
39
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
38
40
|
|
|
39
41
|
const apiDefinitionAsset = new Asset(this, 'ApiDefinitionAsset', {
|
|
40
|
-
path: path.join(__dirname, '
|
|
42
|
+
path: path.join(__dirname, 'openapi/apiDefinition.yaml')
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
@@ -58,30 +60,32 @@ new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
|
58
60
|
Python
|
|
59
61
|
|
|
60
62
|
```python
|
|
61
|
-
from aws_solutions_constructs.aws_openapigateway_lambda import ApiGatewayToLambda
|
|
62
63
|
from aws_cdk import (
|
|
63
|
-
Stack
|
|
64
|
+
Stack,
|
|
65
|
+
aws_s3_assets as s3_assets,
|
|
66
|
+
aws_lambda as lambda_,
|
|
64
67
|
)
|
|
65
|
-
|
|
66
|
-
import aws_cdk.aws_s3_assets as s3_assets
|
|
67
|
-
import aws_cdk.aws_lambda as lambda_
|
|
68
68
|
from constructs import Construct
|
|
69
|
-
from .
|
|
69
|
+
from aws_solutions_constructs.aws_openapigateway_lambda import OpenApiGatewayToLambda, ApiIntegration
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
path="openapispec.yaml"
|
|
73
|
-
)
|
|
71
|
+
class TestStack(Stack):
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
handler="index.handler",
|
|
78
|
-
code=lambda_.Code.from_inline("exports.handler = handler.toString()")
|
|
79
|
-
))
|
|
73
|
+
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
|
|
74
|
+
super().__init__(scope, construct_id, **kwargs)
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
api_definition_asset = s3_assets.Asset(self, "ApiDefinitionAsset", path="./openapi/apiDefinition.yaml")
|
|
77
|
+
|
|
78
|
+
api_integration = ApiIntegration(id="MessagesHandler", lambda_function_props={
|
|
79
|
+
"runtime": lambda_.Runtime.NODEJS_18_X,
|
|
80
|
+
"handler": "index.handler",
|
|
81
|
+
"code": lambda_.Code.from_asset("./messages-lambda")
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
openapigateway_to_lambda = OpenApiGatewayToLambda(self,
|
|
85
|
+
id="OpenApiGatewayToLambda",
|
|
86
|
+
api_integrations=[api_integration],
|
|
87
|
+
api_definition_asset=api_definition_asset
|
|
88
|
+
)
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
Java
|
|
@@ -102,13 +106,13 @@ import java.util.Collections;
|
|
|
102
106
|
|
|
103
107
|
import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_18_X;
|
|
104
108
|
|
|
105
|
-
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("
|
|
109
|
+
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("openapi/apiDefinition.yaml").build());
|
|
106
110
|
|
|
107
111
|
final ApiIntegration apiIntegration = ApiIntegration.builder()
|
|
108
112
|
.id("MessagesHandler")
|
|
109
113
|
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
110
114
|
.runtime(NODEJS_18_X)
|
|
111
|
-
.code(Code.fromAsset("lambda"))
|
|
115
|
+
.code(Code.fromAsset("messages-lambda"))
|
|
112
116
|
.handler("index.handler")
|
|
113
117
|
.build())
|
|
114
118
|
.build();
|
|
@@ -233,6 +237,9 @@ Out of the box implementation of the Construct without any override will set the
|
|
|
233
237
|
|
|
234
238
|
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
235
239
|
'''
|
|
240
|
+
from pkgutil import extend_path
|
|
241
|
+
__path__ = extend_path(__path__, __name__)
|
|
242
|
+
|
|
236
243
|
import abc
|
|
237
244
|
import builtins
|
|
238
245
|
import datetime
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from pkgutil import extend_path
|
|
2
|
+
__path__ = extend_path(__path__, __name__)
|
|
3
|
+
|
|
1
4
|
import abc
|
|
2
5
|
import builtins
|
|
3
6
|
import datetime
|
|
@@ -18,9 +21,9 @@ import constructs._jsii
|
|
|
18
21
|
|
|
19
22
|
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
20
23
|
"@aws-solutions-constructs/aws-openapigateway-lambda",
|
|
21
|
-
"2.
|
|
24
|
+
"2.54.1",
|
|
22
25
|
__name__[0:-6],
|
|
23
|
-
"aws-openapigateway-lambda@2.
|
|
26
|
+
"aws-openapigateway-lambda@2.54.1.jsii.tgz",
|
|
24
27
|
)
|
|
25
28
|
|
|
26
29
|
__all__ = [
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aws-solutions-constructs.aws-openapigateway-lambda
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.54.1
|
|
4
4
|
Summary: CDK constructs for defining an interaction between an OpenAPI-defined API Gateway and one or more Lambda functions.
|
|
5
5
|
Home-page: https://github.com/awslabs/aws-solutions-constructs.git
|
|
6
6
|
Author: Amazon Web Services
|
|
@@ -45,7 +45,9 @@ License-File: LICENSE
|
|
|
45
45
|
|
|
46
46
|
This AWS Solutions Construct implements an Amazon API Gateway REST API defined by an OpenAPI specification file connected to an AWS Lambda function.
|
|
47
47
|
|
|
48
|
-
Here is a minimal deployable pattern definition
|
|
48
|
+
Here is a minimal deployable pattern definition.
|
|
49
|
+
|
|
50
|
+
**NOTE** The referenced `openapi/apiDefinition.yaml` openapi definition file and `messages-lambda` lambda package directory for the three code samples below can both be found under this constructs `test` folder (`<repository_root>/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test`)
|
|
49
51
|
|
|
50
52
|
Typescript
|
|
51
53
|
|
|
@@ -58,7 +60,7 @@ import * as path from 'path';
|
|
|
58
60
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
59
61
|
|
|
60
62
|
const apiDefinitionAsset = new Asset(this, 'ApiDefinitionAsset', {
|
|
61
|
-
path: path.join(__dirname, '
|
|
63
|
+
path: path.join(__dirname, 'openapi/apiDefinition.yaml')
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
@@ -79,30 +81,32 @@ new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', {
|
|
|
79
81
|
Python
|
|
80
82
|
|
|
81
83
|
```python
|
|
82
|
-
from aws_solutions_constructs.aws_openapigateway_lambda import ApiGatewayToLambda
|
|
83
84
|
from aws_cdk import (
|
|
84
|
-
Stack
|
|
85
|
+
Stack,
|
|
86
|
+
aws_s3_assets as s3_assets,
|
|
87
|
+
aws_lambda as lambda_,
|
|
85
88
|
)
|
|
86
|
-
|
|
87
|
-
import aws_cdk.aws_s3_assets as s3_assets
|
|
88
|
-
import aws_cdk.aws_lambda as lambda_
|
|
89
89
|
from constructs import Construct
|
|
90
|
-
from .
|
|
90
|
+
from aws_solutions_constructs.aws_openapigateway_lambda import OpenApiGatewayToLambda, ApiIntegration
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
path="openapispec.yaml"
|
|
94
|
-
)
|
|
92
|
+
class TestStack(Stack):
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
handler="index.handler",
|
|
99
|
-
code=lambda_.Code.from_inline("exports.handler = handler.toString()")
|
|
100
|
-
))
|
|
94
|
+
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
|
|
95
|
+
super().__init__(scope, construct_id, **kwargs)
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
api_definition_asset = s3_assets.Asset(self, "ApiDefinitionAsset", path="./openapi/apiDefinition.yaml")
|
|
98
|
+
|
|
99
|
+
api_integration = ApiIntegration(id="MessagesHandler", lambda_function_props={
|
|
100
|
+
"runtime": lambda_.Runtime.NODEJS_18_X,
|
|
101
|
+
"handler": "index.handler",
|
|
102
|
+
"code": lambda_.Code.from_asset("./messages-lambda")
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
openapigateway_to_lambda = OpenApiGatewayToLambda(self,
|
|
106
|
+
id="OpenApiGatewayToLambda",
|
|
107
|
+
api_integrations=[api_integration],
|
|
108
|
+
api_definition_asset=api_definition_asset
|
|
109
|
+
)
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
Java
|
|
@@ -123,13 +127,13 @@ import java.util.Collections;
|
|
|
123
127
|
|
|
124
128
|
import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_18_X;
|
|
125
129
|
|
|
126
|
-
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("
|
|
130
|
+
final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("openapi/apiDefinition.yaml").build());
|
|
127
131
|
|
|
128
132
|
final ApiIntegration apiIntegration = ApiIntegration.builder()
|
|
129
133
|
.id("MessagesHandler")
|
|
130
134
|
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
131
135
|
.runtime(NODEJS_18_X)
|
|
132
|
-
.code(Code.fromAsset("lambda"))
|
|
136
|
+
.code(Code.fromAsset("messages-lambda"))
|
|
133
137
|
.handler("index.handler")
|
|
134
138
|
.build())
|
|
135
139
|
.build();
|
|
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_openapigateway_lambda.egg-info/top_level.txt
|
|
|
11
11
|
src/aws_solutions_constructs/aws_openapigateway_lambda/__init__.py
|
|
12
12
|
src/aws_solutions_constructs/aws_openapigateway_lambda/py.typed
|
|
13
13
|
src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/__init__.py
|
|
14
|
-
src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/aws-openapigateway-lambda@2.
|
|
14
|
+
src/aws_solutions_constructs/aws_openapigateway_lambda/_jsii/aws-openapigateway-lambda@2.54.1.jsii.tgz
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|