@gradientedge/cdk-utils 8.75.0 → 8.77.0

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.
@@ -83,3 +83,4 @@ export declare class CommonConstruct extends Construct {
83
83
  */
84
84
  isProductionStage: () => boolean;
85
85
  }
86
+ export declare const applyMixins: (derivedCtor: any, constructors: any[]) => void;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CommonConstruct = void 0;
26
+ exports.applyMixins = exports.CommonConstruct = void 0;
27
27
  const constructs_1 = require("constructs");
28
28
  const aws = __importStar(require("../manager/aws"));
29
29
  const utils = __importStar(require("../utils"));
@@ -147,3 +147,11 @@ class CommonConstruct extends constructs_1.Construct {
147
147
  isProductionStage = () => utils.isPrdStage(this.props.stage);
148
148
  }
149
149
  exports.CommonConstruct = CommonConstruct;
150
+ const applyMixins = (derivedCtor, constructors) => {
151
+ constructors.forEach(baseCtor => {
152
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
153
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
154
+ });
155
+ });
156
+ };
157
+ exports.applyMixins = applyMixins;
@@ -88,6 +88,9 @@ class RestApiLambdaWithCache extends __1.RestApiLambda {
88
88
  * @protected
89
89
  */
90
90
  resolveSecurityGroup() {
91
+ if (!this.props.restApiCache) {
92
+ return;
93
+ }
91
94
  if (this.props.securityGroupExportName) {
92
95
  this.restApiSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, `${this.id}`, cdk.Fn.importValue(this.props.securityGroupExportName));
93
96
  }
@@ -105,6 +108,9 @@ class RestApiLambdaWithCache extends __1.RestApiLambda {
105
108
  * @protected
106
109
  */
107
110
  createElastiCache() {
111
+ if (!this.props.restApiCache) {
112
+ return;
113
+ }
108
114
  this.restApiCache = this.elasticacheManager.createReplicatedElastiCache(`${this.id}-elasticache`, this, this.props.restApiCache, this.restApivpc.privateSubnets.map(subnet => subnet.subnetId), [this.restApiSecurityGroup.securityGroupId]);
109
115
  this.ssmManager.writeStringToParameters(`${this.id}-elasticache-endpoint-address`, this, {
110
116
  parameterName: `${this.id}-elasticache-endpoint-address`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.75.0",
3
+ "version": "8.77.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -3,7 +3,6 @@ import { Construct } from 'constructs'
3
3
  import * as aws from '../manager/aws'
4
4
  import * as types from '../types'
5
5
  import * as utils from '../utils'
6
- import { EfsManager } from '../manager/aws/efs-manager'
7
6
 
8
7
  /**
9
8
  * @stability stable
@@ -133,3 +132,15 @@ export class CommonConstruct extends Construct {
133
132
  */
134
133
  public isProductionStage = () => utils.isPrdStage(this.props.stage)
135
134
  }
135
+
136
+ export const applyMixins = (derivedCtor: any, constructors: any[]) => {
137
+ constructors.forEach(baseCtor => {
138
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
139
+ Object.defineProperty(
140
+ derivedCtor.prototype,
141
+ name,
142
+ Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null)
143
+ )
144
+ })
145
+ })
146
+ }
@@ -71,6 +71,10 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
71
71
  * @protected
72
72
  */
73
73
  protected resolveSecurityGroup() {
74
+ if (!this.props.restApiCache) {
75
+ return
76
+ }
77
+
74
78
  if (this.props.securityGroupExportName) {
75
79
  this.restApiSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(
76
80
  this,
@@ -94,6 +98,10 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
94
98
  * @protected
95
99
  */
96
100
  protected createElastiCache() {
101
+ if (!this.props.restApiCache) {
102
+ return
103
+ }
104
+
97
105
  this.restApiCache = this.elasticacheManager.createReplicatedElastiCache(
98
106
  `${this.id}-elasticache`,
99
107
  this,