cdk-serverless 2.11.22 → 2.11.24
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.
- package/README.md +39 -0
- package/docs/constructs/assets/highlight.css +12 -12
- package/docs/constructs/classes/AssetCdn.html +31 -7
- package/docs/constructs/classes/BaseApi.html +4 -0
- package/docs/constructs/classes/CognitoAuthentication.html +35 -9
- package/docs/constructs/classes/GraphQlApi.html +47 -11
- package/docs/constructs/classes/LambdaFunction.html +34 -12
- package/docs/constructs/classes/RestApi.html +47 -11
- package/docs/constructs/classes/SingleTableDatastore.html +26 -5
- package/docs/constructs/classes/Workflow.html +34 -7
- package/docs/constructs/index.html +13 -0
- package/docs/constructs/interfaces/AssetCdnProps.html +4 -0
- package/docs/constructs/interfaces/BaseApiProps.html +7 -7
- package/docs/constructs/interfaces/CognitoAuthenticationProps.html +3 -3
- package/docs/constructs/interfaces/GraphQlApiProps.html +7 -7
- package/docs/constructs/interfaces/JsResolverOptions.html +2 -2
- package/docs/constructs/interfaces/LambdaFunctionProps.html +2 -2
- package/docs/constructs/interfaces/LambdaTracingOptions.html +1 -1
- package/docs/constructs/interfaces/RestApiProps.html +8 -8
- package/docs/constructs/interfaces/SingleTableDatastoreProps.html +1 -1
- package/docs/constructs/interfaces/SingleTableDesign.html +1 -1
- package/docs/constructs/interfaces/VtlResolverOptions.html +1 -1
- package/docs/lambda/assets/highlight.css +35 -0
- package/docs/lambda/classes/errors.BadRequestError.html +15 -3
- package/docs/lambda/classes/errors.ForbiddenError.html +15 -3
- package/docs/lambda/classes/errors.HttpError.html +18 -4
- package/docs/lambda/classes/errors.NotFoundError.html +15 -3
- package/docs/lambda/classes/errors.UnauthenticatedError.html +15 -3
- package/docs/lambda/index.html +13 -0
- package/docs/projen/assets/highlight.css +19 -12
- package/docs/projen/classes/Datastore.html +9 -0
- package/docs/projen/classes/GraphQlApi.html +9 -0
- package/docs/projen/classes/RestApi.html +79 -19
- package/docs/projen/classes/ServerlessProject.html +16 -2
- package/docs/projen/classes/Workflow.html +46 -10
- package/docs/projen/index.html +13 -0
- package/docs/projen/interfaces/ServerlessProjectOptions.html +74 -74
- package/lib/constructs/asset-cdn.d.ts +24 -0
- package/lib/constructs/asset-cdn.js +13 -1
- package/lib/constructs/authentication.d.ts +26 -0
- package/lib/constructs/authentication.js +12 -1
- package/lib/constructs/base-api.d.ts +3 -0
- package/lib/constructs/base-api.js +4 -1
- package/lib/constructs/func.d.ts +31 -0
- package/lib/constructs/func.js +32 -1
- package/lib/constructs/graphql.d.ts +41 -0
- package/lib/constructs/graphql.js +33 -1
- package/lib/constructs/rest-api.d.ts +41 -0
- package/lib/constructs/rest-api.js +36 -1
- package/lib/constructs/table.d.ts +40 -0
- package/lib/constructs/table.js +38 -1
- package/lib/constructs/workflow.d.ts +46 -0
- package/lib/constructs/workflow.js +38 -1
- package/lib/lambda/errors.d.ts +41 -0
- package/lib/lambda/errors.js +42 -1
- package/lib/projen/core.d.ts +19 -0
- package/lib/projen/core.js +20 -1
- package/lib/projen/datastore.d.ts +11 -0
- package/lib/projen/datastore.js +12 -1
- package/lib/projen/graphql.d.ts +11 -0
- package/lib/projen/graphql.js +12 -1
- package/lib/projen/rest-api.d.ts +52 -0
- package/lib/projen/rest-api.js +53 -1
- package/lib/projen/workflow.d.ts +34 -0
- package/lib/projen/workflow.js +35 -1
- package/package.json +5 -6
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
<li><a href="../modules.html">cdk-serverless</a></li>
|
|
16
16
|
<li><a href="RestApi.html">RestApi</a></li></ul>
|
|
17
17
|
<h1>Class RestApi</h1></div>
|
|
18
|
+
<section class="tsd-panel tsd-comment">
|
|
19
|
+
<div class="tsd-comment tsd-typography"><p>The RestApi construct sets up an OpenAPI-based REST API for a serverless project using projen.
|
|
20
|
+
This construct extends the projen Component to include dependencies and development dependencies required for OpenAPI and AWS Lambda,
|
|
21
|
+
and provides methods to generate TypeScript types from the OpenAPI definition file. It also generates sample handler files for the API endpoints.</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="tsd-comment tsd-typography">
|
|
24
|
+
<h4>Example</h4><pre><code class="language-ts"><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">restApi</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">RestApi</span><span class="hl-1">(</span><span class="hl-4">app</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">apiName:</span><span class="hl-1"> </span><span class="hl-2">'MyRestApi'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">definitionFile:</span><span class="hl-1"> </span><span class="hl-2">'src/openapi/schema.yaml'</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
|
25
|
+
</code><button>Copy</button></pre>
|
|
26
|
+
</div></section>
|
|
18
27
|
<section class="tsd-panel tsd-hierarchy">
|
|
19
28
|
<h4>Hierarchy</h4>
|
|
20
29
|
<ul class="tsd-hierarchy">
|
|
@@ -57,14 +66,21 @@
|
|
|
57
66
|
<ul class="tsd-signatures">
|
|
58
67
|
<li class="tsd-signature tsd-anchor-link" id="constructor.new_RestApi"><span class="tsd-kind-constructor-signature">new <wbr/>Rest<wbr/>Api</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">app</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="RestApi.html" class="tsd-signature-type tsd-kind-class">RestApi</a><a href="#constructor.new_RestApi" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
59
68
|
<li class="tsd-description">
|
|
69
|
+
<div class="tsd-comment tsd-typography"><p>Creates an instance of RestApi.</p>
|
|
70
|
+
</div>
|
|
60
71
|
<div class="tsd-parameters">
|
|
61
72
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
62
73
|
<ul class="tsd-parameter-list">
|
|
63
74
|
<li>
|
|
64
|
-
<h5><span class="tsd-kind-parameter">app</span>: <span class="tsd-signature-type ">AwsCdkTypeScriptApp</span></h5
|
|
75
|
+
<h5><span class="tsd-kind-parameter">app</span>: <span class="tsd-signature-type ">AwsCdkTypeScriptApp</span></h5>
|
|
76
|
+
<div class="tsd-comment tsd-typography"><p>The AWS CDK TypeScript app.</p>
|
|
77
|
+
</div></li>
|
|
65
78
|
<li>
|
|
66
|
-
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/RestApiOptions.html" class="tsd-signature-type tsd-kind-interface">RestApiOptions</a></h5
|
|
67
|
-
<
|
|
79
|
+
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/RestApiOptions.html" class="tsd-signature-type tsd-kind-interface">RestApiOptions</a></h5>
|
|
80
|
+
<div class="tsd-comment tsd-typography"><p>The options for configuring the RestApi.</p>
|
|
81
|
+
</div></li></ul></div>
|
|
82
|
+
<h4 class="tsd-returns-title">Returns <a href="RestApi.html" class="tsd-signature-type tsd-kind-class">RestApi</a></h4>
|
|
83
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
|
|
68
84
|
<p>Overrides pj.Component.constructor</p></aside></li></ul></section></section>
|
|
69
85
|
<section class="tsd-panel-group tsd-member-group">
|
|
70
86
|
<h2>Properties</h2>
|
|
@@ -77,7 +93,10 @@
|
|
|
77
93
|
<p>Inherited from pj.Component.node</p></aside></section>
|
|
78
94
|
<section class="tsd-panel tsd-member tsd-is-protected"><a id="options" class="tsd-anchor"></a>
|
|
79
95
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>options</span><a href="#options" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
80
|
-
<div class="tsd-signature"><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/RestApiOptions.html" class="tsd-signature-type tsd-kind-interface">RestApiOptions</a></div
|
|
96
|
+
<div class="tsd-signature"><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/RestApiOptions.html" class="tsd-signature-type tsd-kind-interface">RestApiOptions</a></div>
|
|
97
|
+
<div class="tsd-comment tsd-typography"><p>The options for configuring the RestApi.</p>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="tsd-comment tsd-typography"></div></section>
|
|
81
100
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="project" class="tsd-anchor"></a>
|
|
82
101
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>project</span><a href="#project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
83
102
|
<div class="tsd-signature"><span class="tsd-kind-property">project</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Project</span></div><aside class="tsd-sources">
|
|
@@ -89,11 +108,15 @@
|
|
|
89
108
|
<ul class="tsd-signatures tsd-is-protected">
|
|
90
109
|
<li class="tsd-signature tsd-anchor-link" id="addRestResourceHandlerSample.addRestResourceHandlerSample-1"><span class="tsd-kind-call-signature">add<wbr/>Rest<wbr/>Resource<wbr/>Handler<wbr/>Sample</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">files</span>, <span class="tsd-kind-parameter">apiSpec</span>, <span class="tsd-kind-parameter">path</span>, <span class="tsd-kind-parameter">method</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#addRestResourceHandlerSample.addRestResourceHandlerSample-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
91
110
|
<li class="tsd-description">
|
|
111
|
+
<div class="tsd-comment tsd-typography"><p>Adds a sample handler file for a REST API resource.</p>
|
|
112
|
+
</div>
|
|
92
113
|
<div class="tsd-parameters">
|
|
93
114
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
94
115
|
<ul class="tsd-parameter-list">
|
|
95
116
|
<li>
|
|
96
117
|
<h5><span class="tsd-kind-parameter">files</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </span>[<span class="tsd-kind-index-signature">fileName</span>: <span class="tsd-signature-type">string</span>]<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
|
|
118
|
+
<div class="tsd-comment tsd-typography"><p>The collection of file generators.</p>
|
|
119
|
+
</div>
|
|
97
120
|
<ul class="tsd-parameters">
|
|
98
121
|
<li class="tsd-parameter-index-signature">
|
|
99
122
|
<h5><span class="tsd-signature-symbol">[</span><span class="tsd-kind-parameter">fileName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span></h5>
|
|
@@ -104,42 +127,66 @@
|
|
|
104
127
|
<li class="tsd-description">
|
|
105
128
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></li></ul></li></ul></li>
|
|
106
129
|
<li>
|
|
107
|
-
<h5><span class="tsd-kind-parameter">apiSpec</span>: <span class="tsd-signature-type ">OpenAPI3</span></h5
|
|
130
|
+
<h5><span class="tsd-kind-parameter">apiSpec</span>: <span class="tsd-signature-type ">OpenAPI3</span></h5>
|
|
131
|
+
<div class="tsd-comment tsd-typography"><p>The OpenAPI specification object.</p>
|
|
132
|
+
</div></li>
|
|
108
133
|
<li>
|
|
109
|
-
<h5><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></h5
|
|
134
|
+
<h5><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></h5>
|
|
135
|
+
<div class="tsd-comment tsd-typography"><p>The path of the API resource.</p>
|
|
136
|
+
</div></li>
|
|
110
137
|
<li>
|
|
111
|
-
<h5><span class="tsd-kind-parameter">method</span>: <span class="tsd-signature-type">string</span></h5
|
|
112
|
-
<
|
|
138
|
+
<h5><span class="tsd-kind-parameter">method</span>: <span class="tsd-signature-type">string</span></h5>
|
|
139
|
+
<div class="tsd-comment tsd-typography"><p>The HTTP method of the API resource.</p>
|
|
140
|
+
</div></li></ul></div>
|
|
141
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
|
142
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
113
143
|
<section class="tsd-panel tsd-member tsd-is-protected"><a id="createConstructFile" class="tsd-anchor"></a>
|
|
114
144
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>create<wbr/>Construct<wbr/>File</span><a href="#createConstructFile" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
115
145
|
<ul class="tsd-signatures tsd-is-protected">
|
|
116
146
|
<li class="tsd-signature tsd-anchor-link" id="createConstructFile.createConstructFile-1"><span class="tsd-kind-call-signature">create<wbr/>Construct<wbr/>File</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">file</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#createConstructFile.createConstructFile-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
117
147
|
<li class="tsd-description">
|
|
148
|
+
<div class="tsd-comment tsd-typography"><p>Creates the construct file content for the generated REST API.</p>
|
|
149
|
+
</div>
|
|
118
150
|
<div class="tsd-parameters">
|
|
119
151
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
120
152
|
<ul class="tsd-parameter-list">
|
|
121
153
|
<li>
|
|
122
|
-
<h5><span class="tsd-kind-parameter">file</span>: <span class="tsd-signature-type ">FileBase</span></h5
|
|
123
|
-
<
|
|
154
|
+
<h5><span class="tsd-kind-parameter">file</span>: <span class="tsd-signature-type ">FileBase</span></h5>
|
|
155
|
+
<div class="tsd-comment tsd-typography"><p>The file object to create content for.</p>
|
|
156
|
+
</div></li></ul></div>
|
|
157
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The content of the construct file.</p>
|
|
158
|
+
|
|
159
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
124
160
|
<section class="tsd-panel tsd-member tsd-is-protected"><a id="createEntryFile" class="tsd-anchor"></a>
|
|
125
161
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>create<wbr/>Entry<wbr/>File</span><a href="#createEntryFile" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
126
162
|
<ul class="tsd-signatures tsd-is-protected">
|
|
127
163
|
<li class="tsd-signature tsd-anchor-link" id="createEntryFile.createEntryFile-1"><span class="tsd-kind-call-signature">create<wbr/>Entry<wbr/>File</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">method</span>, <span class="tsd-kind-parameter">operationId</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#createEntryFile.createEntryFile-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
128
164
|
<li class="tsd-description">
|
|
165
|
+
<div class="tsd-comment tsd-typography"><p>Creates the entry file content for a REST API handler.</p>
|
|
166
|
+
</div>
|
|
129
167
|
<div class="tsd-parameters">
|
|
130
168
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
131
169
|
<ul class="tsd-parameter-list">
|
|
132
170
|
<li>
|
|
133
|
-
<h5><span class="tsd-kind-parameter">method</span>: <span class="tsd-signature-type">string</span></h5
|
|
171
|
+
<h5><span class="tsd-kind-parameter">method</span>: <span class="tsd-signature-type">string</span></h5>
|
|
172
|
+
<div class="tsd-comment tsd-typography"><p>The HTTP method of the API resource.</p>
|
|
173
|
+
</div></li>
|
|
134
174
|
<li>
|
|
135
|
-
<h5><span class="tsd-kind-parameter">operationId</span>: <span class="tsd-signature-type">string</span></h5
|
|
136
|
-
<
|
|
175
|
+
<h5><span class="tsd-kind-parameter">operationId</span>: <span class="tsd-signature-type">string</span></h5>
|
|
176
|
+
<div class="tsd-comment tsd-typography"><p>The operation ID of the API resource.</p>
|
|
177
|
+
</div></li></ul></div>
|
|
178
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The content of the entry file.</p>
|
|
179
|
+
|
|
180
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
137
181
|
<section class="tsd-panel tsd-member tsd-is-private"><a id="generateSampleHandlerFiles" class="tsd-anchor"></a>
|
|
138
182
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>generate<wbr/>Sample<wbr/>Handler<wbr/>Files</span><a href="#generateSampleHandlerFiles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
139
183
|
<ul class="tsd-signatures tsd-is-private">
|
|
140
184
|
<li class="tsd-signature tsd-anchor-link" id="generateSampleHandlerFiles.generateSampleHandlerFiles-1"><span class="tsd-kind-call-signature">generate<wbr/>Sample<wbr/>Handler<wbr/>Files</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span><br/><span> </span>[<span class="tsd-kind-index-signature">fileName</span>: <span class="tsd-signature-type">string</span>]<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span><a href="#generateSampleHandlerFiles.generateSampleHandlerFiles-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
141
185
|
<li class="tsd-description">
|
|
142
|
-
<
|
|
186
|
+
<div class="tsd-comment tsd-typography"><p>Generates sample handler files for the REST API based on the OpenAPI specification.</p>
|
|
187
|
+
</div>
|
|
188
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span><br/><span> </span>[<span class="tsd-kind-index-signature">fileName</span>: <span class="tsd-signature-type">string</span>]<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h4><p>The collection of file generators for the sample handler files.</p>
|
|
189
|
+
|
|
143
190
|
<ul class="tsd-parameters">
|
|
144
191
|
<li class="tsd-parameter-index-signature">
|
|
145
192
|
<h5><span class="tsd-signature-symbol">[</span><span class="tsd-kind-parameter">fileName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span></h5>
|
|
@@ -148,7 +195,8 @@
|
|
|
148
195
|
<ul class="tsd-signatures">
|
|
149
196
|
<li class="tsd-signature" id="generateSampleHandlerFiles.generateSampleHandlerFiles-1.__type.__index.__type-1.__type-2"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
|
|
150
197
|
<li class="tsd-description">
|
|
151
|
-
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></li></ul></li></ul
|
|
198
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></li></ul></li></ul>
|
|
199
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
152
200
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="postSynthesize" class="tsd-anchor"></a>
|
|
153
201
|
<h3 class="tsd-anchor-link"><span>post<wbr/>Synthesize</span><a href="#postSynthesize" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
154
202
|
<ul class="tsd-signatures tsd-is-inherited tsd-is-external">
|
|
@@ -194,16 +242,28 @@
|
|
|
194
242
|
<ul class="tsd-signatures tsd-is-protected">
|
|
195
243
|
<li class="tsd-signature tsd-anchor-link" id="validatePathRef.validatePathRef-1"><span class="tsd-kind-call-signature">validate<wbr/>Path<wbr/>Ref</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">apiSpec</span>, <span class="tsd-kind-parameter">path</span>, <span class="tsd-kind-parameter">visited</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#validatePathRef.validatePathRef-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
196
244
|
<li class="tsd-description">
|
|
245
|
+
<div class="tsd-comment tsd-typography"><p>Validates a path reference in the OpenAPI specification.</p>
|
|
246
|
+
</div>
|
|
197
247
|
<div class="tsd-parameters">
|
|
198
248
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
199
249
|
<ul class="tsd-parameter-list">
|
|
200
250
|
<li>
|
|
201
|
-
<h5><span class="tsd-kind-parameter">apiSpec</span>: <span class="tsd-signature-type ">OpenAPI3</span></h5
|
|
251
|
+
<h5><span class="tsd-kind-parameter">apiSpec</span>: <span class="tsd-signature-type ">OpenAPI3</span></h5>
|
|
252
|
+
<div class="tsd-comment tsd-typography"><p>The OpenAPI specification object.</p>
|
|
253
|
+
</div></li>
|
|
202
254
|
<li>
|
|
203
|
-
<h5><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></h5
|
|
255
|
+
<h5><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></h5>
|
|
256
|
+
<div class="tsd-comment tsd-typography"><p>The path reference to validate.</p>
|
|
257
|
+
</div></li>
|
|
204
258
|
<li>
|
|
205
|
-
<h5><span class="tsd-kind-parameter">visited</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></h5
|
|
206
|
-
<
|
|
259
|
+
<h5><span class="tsd-kind-parameter">visited</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></h5>
|
|
260
|
+
<div class="tsd-comment tsd-typography"><p>The list of visited paths to detect cycles.</p>
|
|
261
|
+
</div></li></ul></div>
|
|
262
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p>True if the path reference is valid, otherwise false.</p>
|
|
263
|
+
|
|
264
|
+
<div class="tsd-comment tsd-typography">
|
|
265
|
+
<h4>Throws</h4><p>If the path reference is invalid or cyclical.</p>
|
|
266
|
+
</div></li></ul></section>
|
|
207
267
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="isComponent" class="tsd-anchor"></a>
|
|
208
268
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>is<wbr/>Component</span><a href="#isComponent" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
209
269
|
<ul class="tsd-signatures tsd-is-inherited tsd-is-external">
|
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
<li><a href="../modules.html">cdk-serverless</a></li>
|
|
16
16
|
<li><a href="ServerlessProject.html">ServerlessProject</a></li></ul>
|
|
17
17
|
<h1>Class ServerlessProject</h1></div>
|
|
18
|
+
<section class="tsd-panel tsd-comment">
|
|
19
|
+
<div class="tsd-comment tsd-typography"><p>The ServerlessProject construct sets up an AWS CDK TypeScript project with serverless application dependencies and configurations.
|
|
20
|
+
This construct extends the projen AwsCdkTypeScriptApp to include additional dependencies and development dependencies required
|
|
21
|
+
for serverless applications. It also enables TypeScript projen configuration (projenrcTs).</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="tsd-comment tsd-typography">
|
|
24
|
+
<h4>Example</h4><pre><code class="language-ts"><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">project</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">ServerlessProject</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">'MyServerlessApp'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">defaultReleaseBranch:</span><span class="hl-1"> </span><span class="hl-2">'main'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">cdkVersion:</span><span class="hl-1"> </span><span class="hl-2">'2.140.0'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">deps:</span><span class="hl-1"> [</span><span class="hl-2">'additional-dependency'</span><span class="hl-1">],</span><br/><span class="hl-1"> </span><span class="hl-4">devDeps:</span><span class="hl-1"> [</span><span class="hl-2">'additional-dev-dependency'</span><span class="hl-1">],</span><br/><span class="hl-1">});</span>
|
|
25
|
+
</code><button>Copy</button></pre>
|
|
26
|
+
</div></section>
|
|
18
27
|
<section class="tsd-panel tsd-hierarchy">
|
|
19
28
|
<h4>Hierarchy</h4>
|
|
20
29
|
<ul class="tsd-hierarchy">
|
|
@@ -152,12 +161,17 @@
|
|
|
152
161
|
<ul class="tsd-signatures">
|
|
153
162
|
<li class="tsd-signature tsd-anchor-link" id="constructor.new_ServerlessProject"><span class="tsd-kind-constructor-signature">new <wbr/>Serverless<wbr/>Project</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ServerlessProject.html" class="tsd-signature-type tsd-kind-class">ServerlessProject</a><a href="#constructor.new_ServerlessProject" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
154
163
|
<li class="tsd-description">
|
|
164
|
+
<div class="tsd-comment tsd-typography"><p>Creates an instance of ServerlessProject.</p>
|
|
165
|
+
</div>
|
|
155
166
|
<div class="tsd-parameters">
|
|
156
167
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
157
168
|
<ul class="tsd-parameter-list">
|
|
158
169
|
<li>
|
|
159
|
-
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ServerlessProjectOptions.html" class="tsd-signature-type tsd-kind-interface">ServerlessProjectOptions</a></h5
|
|
160
|
-
<
|
|
170
|
+
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ServerlessProjectOptions.html" class="tsd-signature-type tsd-kind-interface">ServerlessProjectOptions</a></h5>
|
|
171
|
+
<div class="tsd-comment tsd-typography"><p>The options for configuring the ServerlessProject.</p>
|
|
172
|
+
</div></li></ul></div>
|
|
173
|
+
<h4 class="tsd-returns-title">Returns <a href="ServerlessProject.html" class="tsd-signature-type tsd-kind-class">ServerlessProject</a></h4>
|
|
174
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
|
|
161
175
|
<p>Overrides pj.awscdk.AwsCdkTypeScriptApp.constructor</p></aside></li></ul></section></section>
|
|
162
176
|
<section class="tsd-panel-group tsd-member-group">
|
|
163
177
|
<h2>Properties</h2>
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
<li><a href="../modules.html">cdk-serverless</a></li>
|
|
16
16
|
<li><a href="Workflow.html">Workflow</a></li></ul>
|
|
17
17
|
<h1>Class Workflow</h1></div>
|
|
18
|
+
<section class="tsd-panel tsd-comment">
|
|
19
|
+
<div class="tsd-comment tsd-typography"><p>The Workflow construct sets up an AWS Step Functions workflow for a serverless project using projen.
|
|
20
|
+
This construct extends the projen Component to generate a sample state machine definition file and corresponding TypeScript construct file.</p>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="tsd-comment tsd-typography">
|
|
23
|
+
<h4>Example</h4><pre><code class="language-ts"><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">workflow</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">Workflow</span><span class="hl-1">(</span><span class="hl-4">app</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">workflowName:</span><span class="hl-1"> </span><span class="hl-2">'MyWorkflow'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">definitionFile:</span><span class="hl-1"> </span><span class="hl-2">'statemachine/definition.json'</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
|
24
|
+
</code><button>Copy</button></pre>
|
|
25
|
+
</div></section>
|
|
18
26
|
<section class="tsd-panel tsd-hierarchy">
|
|
19
27
|
<h4>Hierarchy</h4>
|
|
20
28
|
<ul class="tsd-hierarchy">
|
|
@@ -55,14 +63,21 @@
|
|
|
55
63
|
<ul class="tsd-signatures">
|
|
56
64
|
<li class="tsd-signature tsd-anchor-link" id="constructor.new_Workflow"><span class="tsd-kind-constructor-signature">new <wbr/>Workflow</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">app</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Workflow.html" class="tsd-signature-type tsd-kind-class">Workflow</a><a href="#constructor.new_Workflow" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
57
65
|
<li class="tsd-description">
|
|
66
|
+
<div class="tsd-comment tsd-typography"><p>Creates an instance of Workflow.</p>
|
|
67
|
+
</div>
|
|
58
68
|
<div class="tsd-parameters">
|
|
59
69
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
60
70
|
<ul class="tsd-parameter-list">
|
|
61
71
|
<li>
|
|
62
|
-
<h5><span class="tsd-kind-parameter">app</span>: <span class="tsd-signature-type ">AwsCdkTypeScriptApp</span></h5
|
|
72
|
+
<h5><span class="tsd-kind-parameter">app</span>: <span class="tsd-signature-type ">AwsCdkTypeScriptApp</span></h5>
|
|
73
|
+
<div class="tsd-comment tsd-typography"><p>The AWS CDK TypeScript app.</p>
|
|
74
|
+
</div></li>
|
|
63
75
|
<li>
|
|
64
|
-
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/WorkflowOptions.html" class="tsd-signature-type tsd-kind-interface">WorkflowOptions</a></h5
|
|
65
|
-
<
|
|
76
|
+
<h5><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/WorkflowOptions.html" class="tsd-signature-type tsd-kind-interface">WorkflowOptions</a></h5>
|
|
77
|
+
<div class="tsd-comment tsd-typography"><p>The options for configuring the Workflow.</p>
|
|
78
|
+
</div></li></ul></div>
|
|
79
|
+
<h4 class="tsd-returns-title">Returns <a href="Workflow.html" class="tsd-signature-type tsd-kind-class">Workflow</a></h4>
|
|
80
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
|
|
66
81
|
<p>Overrides pj.Component.constructor</p></aside></li></ul></section></section>
|
|
67
82
|
<section class="tsd-panel-group tsd-member-group">
|
|
68
83
|
<h2>Properties</h2>
|
|
@@ -75,7 +90,10 @@
|
|
|
75
90
|
<p>Inherited from pj.Component.node</p></aside></section>
|
|
76
91
|
<section class="tsd-panel tsd-member tsd-is-protected"><a id="options" class="tsd-anchor"></a>
|
|
77
92
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>options</span><a href="#options" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
78
|
-
<div class="tsd-signature"><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/WorkflowOptions.html" class="tsd-signature-type tsd-kind-interface">WorkflowOptions</a></div
|
|
93
|
+
<div class="tsd-signature"><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/WorkflowOptions.html" class="tsd-signature-type tsd-kind-interface">WorkflowOptions</a></div>
|
|
94
|
+
<div class="tsd-comment tsd-typography"><p>The options for configuring the Workflow.</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="tsd-comment tsd-typography"></div></section>
|
|
79
97
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="project" class="tsd-anchor"></a>
|
|
80
98
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>project</span><a href="#project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
81
99
|
<div class="tsd-signature"><span class="tsd-kind-property">project</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Project</span></div><aside class="tsd-sources">
|
|
@@ -87,12 +105,18 @@
|
|
|
87
105
|
<ul class="tsd-signatures tsd-is-protected">
|
|
88
106
|
<li class="tsd-signature tsd-anchor-link" id="createConstructFile.createConstructFile-1"><span class="tsd-kind-call-signature">create<wbr/>Construct<wbr/>File</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">file</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#createConstructFile.createConstructFile-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
89
107
|
<li class="tsd-description">
|
|
108
|
+
<div class="tsd-comment tsd-typography"><p>Creates the construct file content for the generated Workflow.</p>
|
|
109
|
+
</div>
|
|
90
110
|
<div class="tsd-parameters">
|
|
91
111
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
92
112
|
<ul class="tsd-parameter-list">
|
|
93
113
|
<li>
|
|
94
|
-
<h5><span class="tsd-kind-parameter">file</span>: <span class="tsd-signature-type ">FileBase</span></h5
|
|
95
|
-
<
|
|
114
|
+
<h5><span class="tsd-kind-parameter">file</span>: <span class="tsd-signature-type ">FileBase</span></h5>
|
|
115
|
+
<div class="tsd-comment tsd-typography"><p>The file object to create content for.</p>
|
|
116
|
+
</div></li></ul></div>
|
|
117
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The content of the construct file.</p>
|
|
118
|
+
|
|
119
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
96
120
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="postSynthesize" class="tsd-anchor"></a>
|
|
97
121
|
<h3 class="tsd-anchor-link"><span>post<wbr/>Synthesize</span><a href="#postSynthesize" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
98
122
|
<ul class="tsd-signatures tsd-is-inherited tsd-is-external">
|
|
@@ -118,23 +142,35 @@
|
|
|
118
142
|
<ul class="tsd-signatures tsd-is-protected">
|
|
119
143
|
<li class="tsd-signature tsd-anchor-link" id="renderDefinitionSubstitution.renderDefinitionSubstitution-1"><span class="tsd-kind-call-signature">render<wbr/>Definition<wbr/>Substitution</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">def</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#renderDefinitionSubstitution.renderDefinitionSubstitution-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
120
144
|
<li class="tsd-description">
|
|
145
|
+
<div class="tsd-comment tsd-typography"><p>Renders the definition substitution for a given variable.</p>
|
|
146
|
+
</div>
|
|
121
147
|
<div class="tsd-parameters">
|
|
122
148
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
123
149
|
<ul class="tsd-parameter-list">
|
|
124
150
|
<li>
|
|
125
|
-
<h5><span class="tsd-kind-parameter">def</span>: <span class="tsd-signature-type ">VariableDefinition</span></h5
|
|
126
|
-
<
|
|
151
|
+
<h5><span class="tsd-kind-parameter">def</span>: <span class="tsd-signature-type ">VariableDefinition</span></h5>
|
|
152
|
+
<div class="tsd-comment tsd-typography"><p>The variable definition.</p>
|
|
153
|
+
</div></li></ul></div>
|
|
154
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The definition substitution string.</p>
|
|
155
|
+
|
|
156
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
127
157
|
<section class="tsd-panel tsd-member tsd-is-protected"><a id="renderStateConfigDefinition" class="tsd-anchor"></a>
|
|
128
158
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>render<wbr/>State<wbr/>Config<wbr/>Definition</span><a href="#renderStateConfigDefinition" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
129
159
|
<ul class="tsd-signatures tsd-is-protected">
|
|
130
160
|
<li class="tsd-signature tsd-anchor-link" id="renderStateConfigDefinition.renderStateConfigDefinition-1"><span class="tsd-kind-call-signature">render<wbr/>State<wbr/>Config<wbr/>Definition</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">def</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#renderStateConfigDefinition.renderStateConfigDefinition-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
131
161
|
<li class="tsd-description">
|
|
162
|
+
<div class="tsd-comment tsd-typography"><p>Renders the state configuration definition for a given variable.</p>
|
|
163
|
+
</div>
|
|
132
164
|
<div class="tsd-parameters">
|
|
133
165
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
134
166
|
<ul class="tsd-parameter-list">
|
|
135
167
|
<li>
|
|
136
|
-
<h5><span class="tsd-kind-parameter">def</span>: <span class="tsd-signature-type ">VariableDefinition</span></h5
|
|
137
|
-
<
|
|
168
|
+
<h5><span class="tsd-kind-parameter">def</span>: <span class="tsd-signature-type ">VariableDefinition</span></h5>
|
|
169
|
+
<div class="tsd-comment tsd-typography"><p>The variable definition.</p>
|
|
170
|
+
</div></li></ul></div>
|
|
171
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The state configuration definition string.</p>
|
|
172
|
+
|
|
173
|
+
<div class="tsd-comment tsd-typography"></div></li></ul></section>
|
|
138
174
|
<section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="synthesize" class="tsd-anchor"></a>
|
|
139
175
|
<h3 class="tsd-anchor-link"><span>synthesize</span><a href="#synthesize" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
140
176
|
<ul class="tsd-signatures tsd-is-inherited tsd-is-external">
|
package/docs/projen/index.html
CHANGED
|
@@ -33,6 +33,15 @@
|
|
|
33
33
|
<li>Add 'cdk-serverless' as a dependency to your project</li>
|
|
34
34
|
<li>Run <code>npx projen</code> to install it</li>
|
|
35
35
|
</ol>
|
|
36
|
+
<p>Now you can use the project type <code>ServerlessProject</code> for your repo.</p>
|
|
37
|
+
<a id="md:adding-projen-constructs" class="tsd-anchor"></a><h3><a href="#md:adding-projen-constructs">Adding projen constructs</a></h3><p>First you need to add the desired construct to your projen configuration: (e.g. RestApi)</p>
|
|
38
|
+
<pre><code class="language-typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">RestApi</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'cdk-serverless/projen'</span><span class="hl-1">;</span><br/><br/><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">RestApi</span><span class="hl-1">(</span><span class="hl-4">project</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">apiName:</span><span class="hl-1"> </span><span class="hl-2">'TestApi'</span><span class="hl-1">, </span><span class="hl-6">// logical name of your API</span><br/><span class="hl-1"> </span><span class="hl-4">definitionFile:</span><span class="hl-1"> </span><span class="hl-2">'testapi.yaml'</span><span class="hl-1">, </span><span class="hl-6">// path to your OpenAPI spec</span><br/><span class="hl-1">});</span>
|
|
39
|
+
</code><button>Copy</button></pre>
|
|
40
|
+
<p>Then run projen to generate construct files and models for the API.</p>
|
|
41
|
+
<a id="md:using-the-cdk-serverless-l3-constructs" class="tsd-anchor"></a><h3><a href="#md:using-the-cdk-serverless-l3-constructs">Using the CDK serverless L3 constructs</a></h3><p>In your stack you can then reference the generated L3s to create the API:</p>
|
|
42
|
+
<pre><code class="language-typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">TestApiRestApi</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'./generated/rest.testapi-api.generated'</span><span class="hl-1">;</span><br/><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">api</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">TestApiRestApi</span><span class="hl-1">(</span><span class="hl-5">this</span><span class="hl-1">, </span><span class="hl-2">'Api'</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">stageName:</span><span class="hl-1"> </span><span class="hl-4">props</span><span class="hl-1">.</span><span class="hl-4">stageName</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">domainName:</span><span class="hl-1"> </span><span class="hl-4">props</span><span class="hl-1">.</span><span class="hl-4">domainName</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">apiHostname:</span><span class="hl-1"> </span><span class="hl-2">'api'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">singleTableDatastore</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">cors:</span><span class="hl-1"> </span><span class="hl-5">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">additionalEnv:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">DOMAIN_NAME:</span><span class="hl-1"> </span><span class="hl-4">props</span><span class="hl-1">.</span><span class="hl-4">domainName</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
|
|
43
|
+
</code><button>Copy</button></pre>
|
|
44
|
+
<p>This will also create Lambda functions for all operations defined in your spec and wire them accordingly.</p>
|
|
36
45
|
<a id="md:contribute" class="tsd-anchor"></a><h2><a href="#md:contribute">Contribute</a></h2><a id="md:how-to-contribute-to-cdk-serverless" class="tsd-anchor"></a><h3><a href="#md:how-to-contribute-to-cdk-serverless">How to contribute to CDK Serverless</a></h3><a id="md:did-you-find-a-bug" class="tsd-anchor"></a><h4><a href="#md:did-you-find-a-bug"><strong>Did you find a bug?</strong></a></h4><ul>
|
|
37
46
|
<li><p><strong>Ensure the bug was not already reported</strong> by searching on GitHub under <a href="https://github.com/taimos/cdk-serverless/issues">Issues</a>.</p>
|
|
38
47
|
</li>
|
|
@@ -83,6 +92,10 @@
|
|
|
83
92
|
<ul>
|
|
84
93
|
<li><a href="#md:features"><span>Features</span></a></li>
|
|
85
94
|
<li><a href="#md:quick-start"><span>Quick <wbr/>Start</span></a></li>
|
|
95
|
+
<li>
|
|
96
|
+
<ul>
|
|
97
|
+
<li><a href="#md:adding-projen-constructs"><span>Adding projen constructs</span></a></li>
|
|
98
|
+
<li><a href="#md:using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li>
|
|
86
99
|
<li><a href="#md:contribute"><span>Contribute</span></a></li>
|
|
87
100
|
<li>
|
|
88
101
|
<ul>
|