@gradientedge/cdk-utils 4.9.0 → 4.9.4

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.
@@ -188,7 +188,14 @@ class GraphQLApiLambda extends common_1.CommonConstruct {
188
188
  stage: this.graphQLApi.deploymentStage,
189
189
  }));
190
190
  });
191
+ return;
191
192
  }
193
+ // add default mapping if apiRootPaths not set
194
+ new apig.BasePathMapping(this, `${this.id}-base-bath-mapping`, {
195
+ domainName: this.graphQLApiDomain,
196
+ restApi: this.graphQLApi,
197
+ stage: this.graphQLApi.deploymentStage,
198
+ });
192
199
  }
193
200
  /**
194
201
  * @summary Method to create route53 records for GraphQL API
@@ -31,7 +31,6 @@ export declare class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
31
31
  graphQLElastiCache: elasticache.CfnCacheCluster;
32
32
  graphQLSecurityGroup: ec2.ISecurityGroup;
33
33
  securityGroupExportName: string;
34
- vpcExportName: string;
35
34
  constructor(parent: Construct, id: string, props: GraphQlApiLambdaWithCacheProps);
36
35
  protected initResources(): void;
37
36
  /**
@@ -55,7 +55,6 @@ class GraphQLApiLambdaWithCache extends __1.GraphQLApiLambda {
55
55
  graphQLElastiCache;
56
56
  graphQLSecurityGroup;
57
57
  securityGroupExportName;
58
- vpcExportName;
59
58
  constructor(parent, id, props) {
60
59
  super(parent, id, props);
61
60
  this.props = props;
@@ -101,7 +100,7 @@ class GraphQLApiLambdaWithCache extends __1.GraphQLApiLambda {
101
100
  * @protected
102
101
  */
103
102
  createElastiCache() {
104
- this.graphQLElastiCache = this.elasticacheManager.createElastiCache(`${this.id}-elasticache`, this, this.props.graphQLElastiCache, this.graphQLVpc.privateSubnets.map(subnet => subnet.subnetId), [this.graphQLSecurityGroup.toString()]);
103
+ this.graphQLElastiCache = this.elasticacheManager.createElastiCache(`${this.id}-elasticache`, this, this.props.graphQLElastiCache, this.graphQLVpc.privateSubnets.map(subnet => subnet.subnetId), [this.graphQLSecurityGroup.securityGroupId]);
105
104
  }
106
105
  /**
107
106
  * Create Lambda Role
@@ -48,11 +48,12 @@ export declare class ApiManager {
48
48
  * @param {string} path
49
49
  * @param {apig.Integration} integration
50
50
  * @param {boolean} addProxy
51
+ * @param {apig.IAuthorizer} authorizer
51
52
  * @param {string[]?} allowedOrigins
52
53
  * @param {string[]?} allowedMethods
53
54
  * @param {string[]?} allowedHeaders
54
55
  */
55
- createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[]): apig.Resource;
56
+ createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, authorizer?: apig.IAuthorizer, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[]): apig.Resource;
56
57
  /**
57
58
  * @summary Method to create an api deployment
58
59
  * @param {string} id
@@ -115,11 +115,12 @@ class ApiManager {
115
115
  * @param {string} path
116
116
  * @param {apig.Integration} integration
117
117
  * @param {boolean} addProxy
118
+ * @param {apig.IAuthorizer} authorizer
118
119
  * @param {string[]?} allowedOrigins
119
120
  * @param {string[]?} allowedMethods
120
121
  * @param {string[]?} allowedHeaders
121
122
  */
122
- createApiResource(id, scope, parent, path, integration, addProxy, allowedOrigins, allowedMethods, allowedHeaders) {
123
+ createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders) {
123
124
  const methods = allowedMethods ?? apig.Cors.ALL_METHODS;
124
125
  const resource = parent.addResource(path, {
125
126
  defaultCorsPreflightOptions: {
@@ -129,7 +130,7 @@ class ApiManager {
129
130
  allowCredentials: true,
130
131
  },
131
132
  });
132
- methods.forEach(method => resource.addMethod(method, integration));
133
+ methods.forEach(method => resource.addMethod(method, integration, { authorizer }));
133
134
  utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId);
134
135
  if (addProxy) {
135
136
  const resourceProxy = resource.addResource(`{${path}+}`, {
@@ -140,7 +141,7 @@ class ApiManager {
140
141
  allowCredentials: true,
141
142
  },
142
143
  });
143
- methods.forEach(method => resourceProxy.addMethod(method, integration));
144
+ methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }));
144
145
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId);
145
146
  }
146
147
  return resource;
@@ -92,8 +92,6 @@ class ElastiCacheManager {
92
92
  logDeliveryConfigurations: logDeliveryConfigurations,
93
93
  });
94
94
  utils.createCfnOutput(`${id}-clusterName`, scope, elasticacheCluster.clusterName);
95
- utils.createCfnOutput(`${id}-configurationEndpointAddress`, scope, elasticacheCluster.attrConfigurationEndpointAddress);
96
- utils.createCfnOutput(`${id}-configurationEndpointPort`, scope, elasticacheCluster.attrConfigurationEndpointPort);
97
95
  utils.createCfnOutput(`${id}-redisEndpointPort`, scope, elasticacheCluster.attrRedisEndpointPort);
98
96
  utils.createCfnOutput(`${id}-redisEndpointAddress`, scope, elasticacheCluster.attrRedisEndpointAddress);
99
97
  return elasticacheCluster;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "4.9.0",
3
+ "version": "4.9.4",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -231,7 +231,15 @@ export class GraphQLApiLambda extends CommonConstruct {
231
231
  })
232
232
  )
233
233
  })
234
+ return
234
235
  }
236
+
237
+ // add default mapping if apiRootPaths not set
238
+ new apig.BasePathMapping(this, `${this.id}-base-bath-mapping`, {
239
+ domainName: this.graphQLApiDomain,
240
+ restApi: this.graphQLApi,
241
+ stage: this.graphQLApi.deploymentStage,
242
+ })
235
243
  }
236
244
 
237
245
  /**
@@ -38,7 +38,6 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
38
38
  graphQLElastiCache: elasticache.CfnCacheCluster
39
39
  graphQLSecurityGroup: ec2.ISecurityGroup
40
40
  securityGroupExportName: string
41
- vpcExportName: string
42
41
 
43
42
  constructor(parent: Construct, id: string, props: GraphQlApiLambdaWithCacheProps) {
44
43
  super(parent, id, props)
@@ -99,7 +98,7 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
99
98
  this,
100
99
  this.props.graphQLElastiCache,
101
100
  this.graphQLVpc.privateSubnets.map(subnet => subnet.subnetId),
102
- [this.graphQLSecurityGroup.toString()]
101
+ [this.graphQLSecurityGroup.securityGroupId]
103
102
  )
104
103
  }
105
104
 
@@ -108,6 +108,7 @@ export class ApiManager {
108
108
  * @param {string} path
109
109
  * @param {apig.Integration} integration
110
110
  * @param {boolean} addProxy
111
+ * @param {apig.IAuthorizer} authorizer
111
112
  * @param {string[]?} allowedOrigins
112
113
  * @param {string[]?} allowedMethods
113
114
  * @param {string[]?} allowedHeaders
@@ -119,6 +120,7 @@ export class ApiManager {
119
120
  path: string,
120
121
  integration: apig.Integration,
121
122
  addProxy: boolean,
123
+ authorizer?: apig.IAuthorizer,
122
124
  allowedOrigins?: string[],
123
125
  allowedMethods?: string[],
124
126
  allowedHeaders?: string[]
@@ -132,7 +134,7 @@ export class ApiManager {
132
134
  allowCredentials: true,
133
135
  },
134
136
  })
135
- methods.forEach(method => resource.addMethod(method, integration))
137
+ methods.forEach(method => resource.addMethod(method, integration, { authorizer }))
136
138
  utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId)
137
139
 
138
140
  if (addProxy) {
@@ -144,7 +146,7 @@ export class ApiManager {
144
146
  allowCredentials: true,
145
147
  },
146
148
  })
147
- methods.forEach(method => resourceProxy.addMethod(method, integration))
149
+ methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }))
148
150
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
149
151
  }
150
152
 
@@ -84,12 +84,6 @@ export class ElastiCacheManager {
84
84
  })
85
85
 
86
86
  utils.createCfnOutput(`${id}-clusterName`, scope, elasticacheCluster.clusterName)
87
- utils.createCfnOutput(
88
- `${id}-configurationEndpointAddress`,
89
- scope,
90
- elasticacheCluster.attrConfigurationEndpointAddress
91
- )
92
- utils.createCfnOutput(`${id}-configurationEndpointPort`, scope, elasticacheCluster.attrConfigurationEndpointPort)
93
87
  utils.createCfnOutput(`${id}-redisEndpointPort`, scope, elasticacheCluster.attrRedisEndpointPort)
94
88
  utils.createCfnOutput(`${id}-redisEndpointAddress`, scope, elasticacheCluster.attrRedisEndpointAddress)
95
89