@mstuercke/pulumi-modules 0.0.4 → 0.0.6
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/dist/auth0/Auth0.d.ts +29 -0
- package/dist/auth0/index.d.ts +5 -0
- package/dist/domain/getDomain.d.ts +13 -0
- package/dist/domain/index.d.ts +4 -0
- package/dist/iam/SimpleIamRolePolicy.d.ts +6 -0
- package/dist/iam/SimpleIamRolePolicyConfig.d.ts +57 -0
- package/dist/iam/index.d.ts +6 -0
- package/dist/index.d.ts +40 -0
- package/dist/lambda/NodeLambdaFunction.d.ts +20 -0
- package/dist/lambda/WithInputs.d.ts +4 -0
- package/dist/lambda/index.d.ts +5 -0
- package/dist/mongodb/MongoDB.d.ts +13 -0
- package/dist/mongodb/MongoDBCustomInstance.d.ts +12 -0
- package/dist/mongodb/MongoDBDefaultInstance.d.ts +12 -0
- package/dist/mongodb/MongoDBUser.d.ts +12 -0
- package/dist/mongodb/index.d.ts +11 -0
- package/dist/rest/RestApi.d.ts +19 -0
- package/dist/rest/index.d.ts +5 -0
- package/dist/s3/PublicS3Bucket.d.ts +11 -0
- package/dist/s3/index.d.ts +5 -0
- package/dist/website/StaticWebsite.d.ts +17 -0
- package/dist/website/index.d.ts +5 -0
- package/dist/website/readFilesRecursive.d.ts +8 -0
- package/dist/websocket/WebsocketApi.d.ts +22 -0
- package/dist/websocket/index.d.ts +5 -0
- package/package.json +9 -9
- package/src/auth0/Auth0.ts +0 -162
- package/src/auth0/index.ts +0 -7
- package/src/domain/getDomain.ts +0 -32
- package/src/domain/index.ts +0 -7
- package/src/iam/SimpleIamRolePolicy.ts +0 -165
- package/src/iam/SimpleIamRolePolicyConfig.ts +0 -75
- package/src/iam/index.ts +0 -8
- package/src/index.ts +0 -31
- package/src/lambda/NodeLambdaFunction.ts +0 -120
- package/src/lambda/WithInputs.ts +0 -5
- package/src/lambda/index.ts +0 -7
- package/src/mongodb/MongoDB.ts +0 -86
- package/src/mongodb/index.ts +0 -9
- package/src/rest/RestApi.ts +0 -226
- package/src/rest/index.ts +0 -7
- package/src/s3/PublicS3Bucket.ts +0 -92
- package/src/s3/index.ts +0 -7
- package/src/website/StaticWebsite.ts +0 -159
- package/src/website/index.ts +0 -7
- package/src/website/readFilesRecursive.ts +0 -33
- package/src/websocket/WebsocketApi.ts +0 -219
- package/src/websocket/index.ts +0 -7
- package/tsconfig.json +0 -19
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import {type CustomResourceOptions, type Input, type Output, Resource} from '@pulumi/pulumi'
|
|
2
|
-
import {
|
|
3
|
-
Api,
|
|
4
|
-
ApiMapping,
|
|
5
|
-
Deployment,
|
|
6
|
-
DomainName,
|
|
7
|
-
Integration,
|
|
8
|
-
IntegrationResponse,
|
|
9
|
-
Route,
|
|
10
|
-
Stage,
|
|
11
|
-
} from '@pulumi/aws/apigatewayv2'
|
|
12
|
-
import {Policy, Role} from '@pulumi/aws/iam'
|
|
13
|
-
import {Record} from '@pulumi/aws/route53'
|
|
14
|
-
import type {NodeLambdaFunction} from '../lambda'
|
|
15
|
-
|
|
16
|
-
export interface WebsocketApiArgs {
|
|
17
|
-
name: string
|
|
18
|
-
lambdaFunction: NodeLambdaFunction
|
|
19
|
-
routeThrottling?: {
|
|
20
|
-
rateLimit?: number
|
|
21
|
-
burstLimit?: number
|
|
22
|
-
}
|
|
23
|
-
stageName?: string
|
|
24
|
-
domain: {
|
|
25
|
-
zoneId: Input<string>
|
|
26
|
-
fullName: Input<string>
|
|
27
|
-
euCentral1CertificateArn: Input<string>
|
|
28
|
-
}
|
|
29
|
-
projectId: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class WebsocketApi extends Resource {
|
|
33
|
-
id: Output<string>
|
|
34
|
-
url: string
|
|
35
|
-
|
|
36
|
-
constructor(id: string, args: WebsocketApiArgs, opts?: CustomResourceOptions) {
|
|
37
|
-
super('mstuercke:websocket:WebsocketApi', id, false, undefined, opts)
|
|
38
|
-
|
|
39
|
-
const {name, lambdaFunction, routeThrottling, stageName = 'v1', domain, projectId} = args
|
|
40
|
-
|
|
41
|
-
const api = new Api(
|
|
42
|
-
'api',
|
|
43
|
-
{
|
|
44
|
-
name,
|
|
45
|
-
protocolType: 'WEBSOCKET',
|
|
46
|
-
routeSelectionExpression: '\\$default',
|
|
47
|
-
tags: {
|
|
48
|
-
project: projectId,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{parent: this},
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
const executeLambdaPolicy = new Policy(
|
|
55
|
-
'execute-lambda',
|
|
56
|
-
{
|
|
57
|
-
name: `${name}-execute-lambda`,
|
|
58
|
-
path: '/',
|
|
59
|
-
policy: {
|
|
60
|
-
Version: '2012-10-17',
|
|
61
|
-
Statement: [
|
|
62
|
-
{
|
|
63
|
-
Action: 'lambda:InvokeFunction',
|
|
64
|
-
Effect: 'Allow',
|
|
65
|
-
Resource: lambdaFunction.arn,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
tags: {
|
|
70
|
-
project: projectId,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{parent: api},
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
const wsApiRole = new Role(
|
|
77
|
-
'role',
|
|
78
|
-
{
|
|
79
|
-
name: `${name}-role`,
|
|
80
|
-
assumeRolePolicy: JSON.stringify({
|
|
81
|
-
Version: '2012-10-17',
|
|
82
|
-
Statement: [
|
|
83
|
-
{
|
|
84
|
-
Effect: 'Allow',
|
|
85
|
-
Action: 'sts:AssumeRole',
|
|
86
|
-
Principal: {Service: 'apigateway.amazonaws.com'},
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
}),
|
|
90
|
-
tags: {
|
|
91
|
-
project: projectId,
|
|
92
|
-
},
|
|
93
|
-
managedPolicyArns: [executeLambdaPolicy.arn],
|
|
94
|
-
},
|
|
95
|
-
{parent: api},
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
const wsLambdaIntegration = new Integration(
|
|
99
|
-
'lambda-integration',
|
|
100
|
-
{
|
|
101
|
-
apiId: api.id,
|
|
102
|
-
integrationType: 'AWS_PROXY',
|
|
103
|
-
integrationUri: lambdaFunction.invokeArn,
|
|
104
|
-
credentialsArn: wsApiRole.arn,
|
|
105
|
-
contentHandlingStrategy: 'CONVERT_TO_TEXT',
|
|
106
|
-
passthroughBehavior: 'WHEN_NO_MATCH',
|
|
107
|
-
},
|
|
108
|
-
{parent: this},
|
|
109
|
-
)
|
|
110
|
-
new IntegrationResponse(
|
|
111
|
-
'lambda-integration-response',
|
|
112
|
-
{
|
|
113
|
-
apiId: api.id,
|
|
114
|
-
integrationId: wsLambdaIntegration.id,
|
|
115
|
-
integrationResponseKey: '/200/',
|
|
116
|
-
},
|
|
117
|
-
{parent: wsLambdaIntegration},
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
const routes: Route[] = []
|
|
121
|
-
const routeKeys = ['$connect', '$default', '$disconnect']
|
|
122
|
-
for (const routeKey of routeKeys) {
|
|
123
|
-
const route = new Route(
|
|
124
|
-
`${routeKey}-route`,
|
|
125
|
-
{
|
|
126
|
-
apiId: api.id,
|
|
127
|
-
routeKey: routeKey,
|
|
128
|
-
target: wsLambdaIntegration.id.apply((id) => `integrations/${id}`),
|
|
129
|
-
authorizationType: 'NONE',
|
|
130
|
-
},
|
|
131
|
-
{parent: wsLambdaIntegration},
|
|
132
|
-
)
|
|
133
|
-
routes.push(route)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const deployment = new Deployment(
|
|
137
|
-
'deployment',
|
|
138
|
-
{
|
|
139
|
-
apiId: api.id,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
dependsOn: [wsLambdaIntegration, ...routes],
|
|
143
|
-
parent: api,
|
|
144
|
-
},
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
const stage = new Stage(
|
|
148
|
-
'stage',
|
|
149
|
-
{
|
|
150
|
-
apiId: api.id,
|
|
151
|
-
name: stageName,
|
|
152
|
-
deploymentId: deployment.id,
|
|
153
|
-
defaultRouteSettings: {
|
|
154
|
-
throttlingRateLimit: routeThrottling?.rateLimit ?? 100,
|
|
155
|
-
throttlingBurstLimit: routeThrottling?.burstLimit ?? 100,
|
|
156
|
-
},
|
|
157
|
-
tags: {
|
|
158
|
-
project: projectId,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
{parent: deployment},
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
const domainName = new DomainName(
|
|
165
|
-
'domain',
|
|
166
|
-
{
|
|
167
|
-
domainName: domain.fullName,
|
|
168
|
-
domainNameConfiguration: {
|
|
169
|
-
certificateArn: domain.euCentral1CertificateArn,
|
|
170
|
-
endpointType: 'REGIONAL',
|
|
171
|
-
securityPolicy: 'TLS_1_2',
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
{parent: api},
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
new Record(
|
|
178
|
-
'redirect',
|
|
179
|
-
{
|
|
180
|
-
zoneId: domain.zoneId,
|
|
181
|
-
name: domain.fullName,
|
|
182
|
-
type: 'A',
|
|
183
|
-
aliases: [
|
|
184
|
-
{
|
|
185
|
-
zoneId: domainName.domainNameConfiguration.hostedZoneId,
|
|
186
|
-
name: domainName.domainNameConfiguration.targetDomainName,
|
|
187
|
-
evaluateTargetHealth: true,
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
allowOverwrite: true,
|
|
191
|
-
},
|
|
192
|
-
{parent: api},
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
new ApiMapping(
|
|
196
|
-
'root',
|
|
197
|
-
{
|
|
198
|
-
apiId: api.id,
|
|
199
|
-
domainName: domainName.id,
|
|
200
|
-
stage: stage.name,
|
|
201
|
-
},
|
|
202
|
-
{parent: api},
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
new ApiMapping(
|
|
206
|
-
'stage',
|
|
207
|
-
{
|
|
208
|
-
apiId: api.id,
|
|
209
|
-
domainName: domainName.id,
|
|
210
|
-
stage: stage.name,
|
|
211
|
-
apiMappingKey: stage.name,
|
|
212
|
-
},
|
|
213
|
-
{parent: api},
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
this.id = api.id
|
|
217
|
-
this.url = `wss://${domain.fullName}/`
|
|
218
|
-
}
|
|
219
|
-
}
|
package/src/websocket/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"strict": true,
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"module": "CommonJS",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"pretty": true,
|
|
11
|
-
"noFallthroughCasesInSwitch": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"skipLibCheck": true
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"src/index.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|