@mstuercke/pulumi-modules 0.0.7 → 0.0.9

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.
Files changed (51) hide show
  1. package/dist/auth0/Auth0.d.ts +30 -0
  2. package/dist/auth0/Auth0.js +81 -0
  3. package/dist/auth0/index.d.ts +6 -0
  4. package/dist/auth0/index.js +5 -0
  5. package/dist/domain/getDomain.d.ts +14 -0
  6. package/dist/domain/getDomain.js +14 -0
  7. package/dist/domain/index.d.ts +5 -0
  8. package/dist/domain/index.js +5 -0
  9. package/dist/iam/SimpleIamRolePolicy.d.ts +7 -0
  10. package/dist/iam/SimpleIamRolePolicy.js +115 -0
  11. package/dist/iam/SimpleIamRolePolicyConfig.d.ts +58 -0
  12. package/dist/iam/SimpleIamRolePolicyConfig.js +1 -0
  13. package/dist/iam/index.d.ts +7 -0
  14. package/dist/iam/index.js +6 -0
  15. package/dist/index.d.ts +41 -0
  16. package/dist/index.js +29 -0
  17. package/dist/lambda/NodeLambdaFunction.d.ts +21 -0
  18. package/dist/lambda/NodeLambdaFunction.js +71 -0
  19. package/dist/lambda/WithInputs.d.ts +5 -0
  20. package/dist/lambda/WithInputs.js +1 -0
  21. package/dist/lambda/index.d.ts +6 -0
  22. package/dist/lambda/index.js +5 -0
  23. package/dist/mongodb/MongoDB.d.ts +14 -0
  24. package/dist/mongodb/MongoDB.js +51 -0
  25. package/dist/mongodb/MongoDBCustomInstance.d.ts +13 -0
  26. package/dist/mongodb/MongoDBCustomInstance.js +32 -0
  27. package/dist/mongodb/MongoDBDefaultInstance.d.ts +13 -0
  28. package/dist/mongodb/MongoDBDefaultInstance.js +19 -0
  29. package/dist/mongodb/MongoDBUser.d.ts +13 -0
  30. package/dist/mongodb/MongoDBUser.js +28 -0
  31. package/dist/mongodb/index.d.ts +12 -0
  32. package/dist/mongodb/index.js +11 -0
  33. package/dist/rest/RestApi.d.ts +20 -0
  34. package/dist/rest/RestApi.js +129 -0
  35. package/dist/rest/index.d.ts +6 -0
  36. package/dist/rest/index.js +5 -0
  37. package/dist/s3/PublicS3Bucket.d.ts +12 -0
  38. package/dist/s3/PublicS3Bucket.js +48 -0
  39. package/dist/s3/index.d.ts +6 -0
  40. package/dist/s3/index.js +5 -0
  41. package/dist/website/StaticWebsite.d.ts +18 -0
  42. package/dist/website/StaticWebsite.js +129 -0
  43. package/dist/website/index.d.ts +6 -0
  44. package/dist/website/index.js +5 -0
  45. package/dist/website/readFilesRecursive.d.ts +9 -0
  46. package/dist/website/readFilesRecursive.js +23 -0
  47. package/dist/websocket/WebsocketApi.d.ts +23 -0
  48. package/dist/websocket/WebsocketApi.js +130 -0
  49. package/dist/websocket/index.d.ts +6 -0
  50. package/dist/websocket/index.js +5 -0
  51. package/package.json +6 -3
@@ -0,0 +1,130 @@
1
+ import { Resource } from '@pulumi/pulumi';
2
+ import { Api, ApiMapping, Deployment, DomainName, Integration, IntegrationResponse, Route, Stage, } from '@pulumi/aws/apigatewayv2';
3
+ import { Policy, Role } from '@pulumi/aws/iam';
4
+ import { Record } from '@pulumi/aws/route53';
5
+ export class WebsocketApi extends Resource {
6
+ id;
7
+ url;
8
+ constructor(id, args, opts) {
9
+ super('mstuercke:websocket:WebsocketApi', id, false, undefined, opts);
10
+ const { name, lambdaFunction, routeThrottling, stageName = 'v1', domain, projectId } = args;
11
+ const api = new Api('api', {
12
+ name,
13
+ protocolType: 'WEBSOCKET',
14
+ routeSelectionExpression: '\\$default',
15
+ tags: {
16
+ project: projectId,
17
+ },
18
+ }, { parent: this });
19
+ const executeLambdaPolicy = new Policy('execute-lambda', {
20
+ name: `${name}-execute-lambda`,
21
+ path: '/',
22
+ policy: {
23
+ Version: '2012-10-17',
24
+ Statement: [
25
+ {
26
+ Action: 'lambda:InvokeFunction',
27
+ Effect: 'Allow',
28
+ Resource: lambdaFunction.arn,
29
+ },
30
+ ],
31
+ },
32
+ tags: {
33
+ project: projectId,
34
+ },
35
+ }, { parent: api });
36
+ const wsApiRole = new Role('role', {
37
+ name: `${name}-role`,
38
+ assumeRolePolicy: JSON.stringify({
39
+ Version: '2012-10-17',
40
+ Statement: [
41
+ {
42
+ Effect: 'Allow',
43
+ Action: 'sts:AssumeRole',
44
+ Principal: { Service: 'apigateway.amazonaws.com' },
45
+ },
46
+ ],
47
+ }),
48
+ tags: {
49
+ project: projectId,
50
+ },
51
+ managedPolicyArns: [executeLambdaPolicy.arn],
52
+ }, { parent: api });
53
+ const wsLambdaIntegration = new Integration('lambda-integration', {
54
+ apiId: api.id,
55
+ integrationType: 'AWS_PROXY',
56
+ integrationUri: lambdaFunction.invokeArn,
57
+ credentialsArn: wsApiRole.arn,
58
+ contentHandlingStrategy: 'CONVERT_TO_TEXT',
59
+ passthroughBehavior: 'WHEN_NO_MATCH',
60
+ }, { parent: this });
61
+ new IntegrationResponse('lambda-integration-response', {
62
+ apiId: api.id,
63
+ integrationId: wsLambdaIntegration.id,
64
+ integrationResponseKey: '/200/',
65
+ }, { parent: wsLambdaIntegration });
66
+ const routes = [];
67
+ const routeKeys = ['$connect', '$default', '$disconnect'];
68
+ for (const routeKey of routeKeys) {
69
+ const route = new Route(`${routeKey}-route`, {
70
+ apiId: api.id,
71
+ routeKey: routeKey,
72
+ target: wsLambdaIntegration.id.apply((id) => `integrations/${id}`),
73
+ authorizationType: 'NONE',
74
+ }, { parent: wsLambdaIntegration });
75
+ routes.push(route);
76
+ }
77
+ const deployment = new Deployment('deployment', {
78
+ apiId: api.id,
79
+ }, {
80
+ dependsOn: [wsLambdaIntegration, ...routes],
81
+ parent: api,
82
+ });
83
+ const stage = new Stage('stage', {
84
+ apiId: api.id,
85
+ name: stageName,
86
+ deploymentId: deployment.id,
87
+ defaultRouteSettings: {
88
+ throttlingRateLimit: routeThrottling?.rateLimit ?? 100,
89
+ throttlingBurstLimit: routeThrottling?.burstLimit ?? 100,
90
+ },
91
+ tags: {
92
+ project: projectId,
93
+ },
94
+ }, { parent: deployment });
95
+ const domainName = new DomainName('domain', {
96
+ domainName: domain.fullName,
97
+ domainNameConfiguration: {
98
+ certificateArn: domain.euCentral1CertificateArn,
99
+ endpointType: 'REGIONAL',
100
+ securityPolicy: 'TLS_1_2',
101
+ },
102
+ }, { parent: api });
103
+ new Record('redirect', {
104
+ zoneId: domain.zoneId,
105
+ name: domain.fullName,
106
+ type: 'A',
107
+ aliases: [
108
+ {
109
+ zoneId: domainName.domainNameConfiguration.hostedZoneId,
110
+ name: domainName.domainNameConfiguration.targetDomainName,
111
+ evaluateTargetHealth: true,
112
+ },
113
+ ],
114
+ allowOverwrite: true,
115
+ }, { parent: api });
116
+ new ApiMapping('root', {
117
+ apiId: api.id,
118
+ domainName: domainName.id,
119
+ stage: stage.name,
120
+ }, { parent: api });
121
+ new ApiMapping('stage', {
122
+ apiId: api.id,
123
+ domainName: domainName.id,
124
+ stage: stage.name,
125
+ apiMappingKey: stage.name,
126
+ }, { parent: api });
127
+ this.id = api.id;
128
+ this.url = `wss://${domain.fullName}/`;
129
+ }
130
+ }
@@ -0,0 +1,6 @@
1
+ import { WebsocketApi } from './WebsocketApi';
2
+ export * from './WebsocketApi';
3
+ export declare const websocket: {
4
+ WebsocketApi: typeof WebsocketApi;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { WebsocketApi } from './WebsocketApi';
2
+ export * from './WebsocketApi';
3
+ export const websocket = {
4
+ WebsocketApi,
5
+ };
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@mstuercke/pulumi-modules",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "files": [
5
- "dist/**/!(*.test|*.fixture)(.d.ts|.js)",
5
+ "dist/**/!(*.test|*.fixture){.d.ts,.js}",
6
6
  "README.md"
7
7
  ],
8
- "exports": "./dist/index.js",
9
8
  "type": "module",
9
+ "exports": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
10
13
  "scripts": {
11
14
  "typeCheck": "tsc --noEmit",
12
15
  "build": "tsc",