@gradientedge/cdk-utils 9.48.0 → 9.50.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.
- package/app/api-destined-function/node_modules/.bin/uuid +2 -2
- package/app/api-destined-function/package.json +1 -1
- package/dist/lib/lambda.d.ts.map +1 -1
- package/dist/src/lib/aws/services/cloudfront/main.js +1 -1
- package/dist/src/lib/aws/services/elastic-kubernetes-service/main.js +1 -0
- package/dist/src/lib/azure/common/construct.d.ts +2 -1
- package/dist/src/lib/azure/common/construct.js +2 -0
- package/dist/src/lib/azure/services/api-management/main.js +6 -5
- package/dist/src/lib/azure/services/app-service/main.js +1 -1
- package/dist/src/lib/azure/services/application-insights/main.js +1 -1
- package/dist/src/lib/azure/services/cosmosdb/main.js +1 -1
- package/dist/src/lib/azure/services/dns/main.js +3 -3
- package/dist/src/lib/azure/services/eventgrid/main.js +2 -2
- package/dist/src/lib/azure/services/function/main.js +10 -10
- package/dist/src/lib/azure/services/index.d.ts +1 -0
- package/dist/src/lib/azure/services/index.js +1 -0
- package/dist/src/lib/azure/services/key-vault/main.js +1 -1
- package/dist/src/lib/azure/services/monitor/index.d.ts +2 -0
- package/dist/src/lib/azure/services/monitor/index.js +18 -0
- package/dist/src/lib/azure/services/monitor/main.d.ts +30 -0
- package/dist/src/lib/azure/services/monitor/main.js +44 -0
- package/dist/src/lib/azure/services/monitor/types.d.ts +3 -0
- package/dist/src/lib/azure/services/monitor/types.js +2 -0
- package/dist/src/lib/azure/services/servicebus/main.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -21
- package/src/lib/aws/services/cloudfront/main.ts +1 -1
- package/src/lib/aws/services/elastic-kubernetes-service/main.ts +1 -0
- package/src/lib/azure/common/construct.ts +3 -0
- package/src/lib/azure/services/api-management/main.ts +7 -5
- package/src/lib/azure/services/app-service/main.ts +1 -1
- package/src/lib/azure/services/application-insights/main.ts +1 -1
- package/src/lib/azure/services/cosmosdb/main.ts +1 -1
- package/src/lib/azure/services/dns/main.ts +3 -3
- package/src/lib/azure/services/eventgrid/main.ts +2 -2
- package/src/lib/azure/services/function/main.ts +10 -10
- package/src/lib/azure/services/index.ts +1 -0
- package/src/lib/azure/services/key-vault/main.ts +1 -1
- package/src/lib/azure/services/monitor/index.ts +2 -0
- package/src/lib/azure/services/monitor/main.ts +53 -0
- package/src/lib/azure/services/monitor/types.ts +3 -0
- package/src/lib/azure/services/servicebus/main.ts +3 -3
|
@@ -6,9 +6,9 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.0
|
|
9
|
+
export NODE_PATH="/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/bin/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.0
|
|
11
|
+
export NODE_PATH="/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/bin/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/uuid@11.1.0/node_modules:/home/runner/work/cdk-utils/cdk-utils/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
14
|
exec "$basedir/node" "$basedir/../uuid/dist/esm/bin/uuid" "$@"
|
package/dist/lib/lambda.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../../app/api-destined-function/src/lib/lambda.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../../app/api-destined-function/src/lib/lambda.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG;;;;;;;;;;;;;;;CAmBtC,CAAA"}
|
|
@@ -116,7 +116,7 @@ class CloudFrontManager {
|
|
|
116
116
|
priceClass: props.priceClass ?? aws_cloudfront_1.PriceClass.PRICE_CLASS_ALL,
|
|
117
117
|
viewerCertificate: aws_cloudfront_1.ViewerCertificate.fromAcmCertificate(certificate, {
|
|
118
118
|
aliases: aliases,
|
|
119
|
-
securityPolicy: aws_cloudfront_1.SecurityPolicyProtocol.
|
|
119
|
+
securityPolicy: aws_cloudfront_1.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
120
120
|
sslMethod: aws_cloudfront_1.SSLMethod.SNI,
|
|
121
121
|
}),
|
|
122
122
|
});
|
|
@@ -76,6 +76,7 @@ class EksManager {
|
|
|
76
76
|
clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.eks),
|
|
77
77
|
defaultCapacity: props.appCapacity,
|
|
78
78
|
defaultCapacityInstance: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T3, aws_ec2_1.InstanceSize.LARGE),
|
|
79
|
+
kubectlLayer: props.kubectlLayer,
|
|
79
80
|
version: aws_eks_1.KubernetesVersion.V1_27,
|
|
80
81
|
vpc,
|
|
81
82
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraformStack } from 'cdktf';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
|
-
import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager, AzureDnsManager, AzureLogAnalyticsWorkspaceManager } from '../services';
|
|
3
|
+
import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager, AzureDnsManager, AzureLogAnalyticsWorkspaceManager, AzureMonitorManager } from '../services';
|
|
4
4
|
import { CommonAzureStackProps } from './types';
|
|
5
5
|
import { AzureResourceNameFormatter } from './resource-name-formatter';
|
|
6
6
|
export declare class CommonAzureConstruct extends TerraformStack {
|
|
@@ -17,6 +17,7 @@ export declare class CommonAzureConstruct extends TerraformStack {
|
|
|
17
17
|
id: string;
|
|
18
18
|
keyVaultManager: AzureKeyVaultManager;
|
|
19
19
|
logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager;
|
|
20
|
+
monitorManager: AzureMonitorManager;
|
|
20
21
|
resourceGroupManager: AzureResourceGroupManager;
|
|
21
22
|
resourceNameFormatter: AzureResourceNameFormatter;
|
|
22
23
|
servicebusManager: AzureServicebusManager;
|
|
@@ -22,6 +22,7 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
22
22
|
id;
|
|
23
23
|
keyVaultManager;
|
|
24
24
|
logAnalyticsWorkspaceManager;
|
|
25
|
+
monitorManager;
|
|
25
26
|
resourceGroupManager;
|
|
26
27
|
resourceNameFormatter;
|
|
27
28
|
servicebusManager;
|
|
@@ -41,6 +42,7 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
41
42
|
this.functiontManager = new services_1.AzureFunctionManager();
|
|
42
43
|
this.keyVaultManager = new services_1.AzureKeyVaultManager();
|
|
43
44
|
this.logAnalyticsWorkspaceManager = new services_1.AzureLogAnalyticsWorkspaceManager();
|
|
45
|
+
this.monitorManager = new services_1.AzureMonitorManager();
|
|
44
46
|
this.resourceGroupManager = new services_1.AzureResourceGroupManager();
|
|
45
47
|
this.resourceNameFormatter = new resource_name_formatter_1.AzureResourceNameFormatter(this, `${id}-rnf`, props);
|
|
46
48
|
this.servicebusManager = new services_1.AzureServicebusManager();
|
|
@@ -144,6 +144,7 @@ class AzureApiManagementManager {
|
|
|
144
144
|
ignoreMissingProperty: true,
|
|
145
145
|
ignoreCasing: true,
|
|
146
146
|
schemaValidationEnabled: false,
|
|
147
|
+
lifecycle: props.lifecycle,
|
|
147
148
|
});
|
|
148
149
|
if (applicationInsightsKey) {
|
|
149
150
|
new api_management_logger_1.ApiManagementLogger(scope, `${id}-am-logger`, {
|
|
@@ -173,8 +174,8 @@ class AzureApiManagementManager {
|
|
|
173
174
|
const apiManagementBackend = new api_management_backend_1.ApiManagementBackend(scope, `${id}-am-be`, {
|
|
174
175
|
...props,
|
|
175
176
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
|
|
176
|
-
description: props.description
|
|
177
|
-
protocol: props.protocol
|
|
177
|
+
description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
|
|
178
|
+
protocol: props.protocol ?? 'http',
|
|
178
179
|
});
|
|
179
180
|
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementBackendName`, scope, apiManagementBackend.name);
|
|
180
181
|
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementBackendFriendlyUniqueId`, scope, apiManagementBackend.friendlyUniqueId);
|
|
@@ -194,9 +195,9 @@ class AzureApiManagementManager {
|
|
|
194
195
|
const apiManagementApi = new api_management_api_1.ApiManagementApi(scope, `${id}-am-api`, {
|
|
195
196
|
...props,
|
|
196
197
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementApi),
|
|
197
|
-
displayName: props.displayName
|
|
198
|
-
revision: props.revision
|
|
199
|
-
protocols: props.protocols
|
|
198
|
+
displayName: props.displayName ?? props.name,
|
|
199
|
+
revision: props.revision ?? '1',
|
|
200
|
+
protocols: props.protocols ?? ['https'],
|
|
200
201
|
});
|
|
201
202
|
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementApiName`, scope, apiManagementApi.name);
|
|
202
203
|
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementApiFriendlyUniqueId`, scope, apiManagementApi.friendlyUniqueId);
|
|
@@ -75,7 +75,7 @@ class AzureAppServiceManager {
|
|
|
75
75
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxWebApp),
|
|
76
76
|
resourceGroupName: resourceGroup.name,
|
|
77
77
|
httpsOnly: props.httpsOnly ?? true,
|
|
78
|
-
identity: props.identity
|
|
78
|
+
identity: props.identity ?? {
|
|
79
79
|
type: 'SystemAssigned',
|
|
80
80
|
},
|
|
81
81
|
siteConfig: {
|
|
@@ -43,7 +43,7 @@ class AzureApplicationInsightsManager {
|
|
|
43
43
|
...props,
|
|
44
44
|
name: scope.resourceNameFormatter.format(props.name ?? '', scope.props.resourceNameOptions?.applicationInsights),
|
|
45
45
|
resourceGroupName: resourceGroup.name,
|
|
46
|
-
applicationType: props.applicationType
|
|
46
|
+
applicationType: props.applicationType ?? 'web',
|
|
47
47
|
tags: props.tags ?? {
|
|
48
48
|
environment: scope.props.stage,
|
|
49
49
|
},
|
|
@@ -67,7 +67,7 @@ class AzureDnsManager {
|
|
|
67
67
|
throw `Props undefined for ${id}`;
|
|
68
68
|
const dnsARecord = new dns_a_record_1.DnsARecord(scope, `${id}-da`, {
|
|
69
69
|
...props,
|
|
70
|
-
ttl: props.ttl
|
|
70
|
+
ttl: props.ttl ?? 300,
|
|
71
71
|
tags: props.tags ?? {
|
|
72
72
|
environment: scope.props.stage,
|
|
73
73
|
},
|
|
@@ -89,7 +89,7 @@ class AzureDnsManager {
|
|
|
89
89
|
throw `Props undefined for ${id}`;
|
|
90
90
|
const dnsCnameRecord = new dns_cname_record_1.DnsCnameRecord(scope, `${id}-dc`, {
|
|
91
91
|
...props,
|
|
92
|
-
ttl: props.ttl
|
|
92
|
+
ttl: props.ttl ?? 300,
|
|
93
93
|
tags: props.tags ?? {
|
|
94
94
|
environment: scope.props.stage,
|
|
95
95
|
},
|
|
@@ -111,7 +111,7 @@ class AzureDnsManager {
|
|
|
111
111
|
throw `Props undefined for ${id}`;
|
|
112
112
|
const dnsTxtRecord = new dns_txt_record_1.DnsTxtRecord(scope, `${id}-dc`, {
|
|
113
113
|
...props,
|
|
114
|
-
ttl: props.ttl
|
|
114
|
+
ttl: props.ttl ?? 300,
|
|
115
115
|
tags: props.tags ?? {
|
|
116
116
|
environment: scope.props.stage,
|
|
117
117
|
},
|
|
@@ -97,8 +97,8 @@ class AzureEventgridManager {
|
|
|
97
97
|
const eventgridSubscription = new eventgrid_event_subscription_1.EventgridEventSubscription(scope, `${id}-es`, {
|
|
98
98
|
...props,
|
|
99
99
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridEventSubscription),
|
|
100
|
-
eventDeliverySchema: props.eventDeliverySchema
|
|
101
|
-
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled
|
|
100
|
+
eventDeliverySchema: props.eventDeliverySchema ?? 'CloudEventSchemaV1_0',
|
|
101
|
+
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled ?? true,
|
|
102
102
|
});
|
|
103
103
|
(0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptiontName`, scope, eventgridSubscription.name);
|
|
104
104
|
(0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptionFriendlyUniqueId`, scope, eventgridSubscription.friendlyUniqueId);
|
|
@@ -68,7 +68,7 @@ class AzureFunctionManager {
|
|
|
68
68
|
const functionAppFunction = new function_app_function_1.FunctionAppFunction(scope, `${id}-fc`, {
|
|
69
69
|
...props,
|
|
70
70
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
|
|
71
|
-
configJson: JSON.stringify(props.configJson
|
|
71
|
+
configJson: JSON.stringify(props.configJson ?? {}),
|
|
72
72
|
});
|
|
73
73
|
(0, utils_1.createAzureTfOutput)(`${id}-functionName`, scope, functionAppFunction.name);
|
|
74
74
|
(0, utils_1.createAzureTfOutput)(`${id}-functionFriendlyUniqueId`, scope, functionAppFunction.friendlyUniqueId);
|
|
@@ -97,29 +97,29 @@ class AzureFunctionManager {
|
|
|
97
97
|
location: resourceGroup.location,
|
|
98
98
|
parentId: resourceGroup.id,
|
|
99
99
|
body: {
|
|
100
|
-
kind: props.kind
|
|
100
|
+
kind: props.kind ?? 'functionapp,linux',
|
|
101
101
|
properties: {
|
|
102
102
|
serverFarmId: props.appServicePlanId,
|
|
103
|
-
httpsOnly: props.httpsOnly
|
|
103
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
104
104
|
functionAppConfig: {
|
|
105
105
|
deployment: {
|
|
106
106
|
storage: {
|
|
107
|
-
type: props.deploymentStorageType
|
|
107
|
+
type: props.deploymentStorageType ?? 'blobContainer',
|
|
108
108
|
value: `${props.blobEndpoint}${props.containerName}`,
|
|
109
109
|
authentication: {
|
|
110
|
-
type: props.deploymentAuthenticationType
|
|
111
|
-
storageAccountConnectionStringName: props.storageAccountConnectionStringName
|
|
110
|
+
type: props.deploymentAuthenticationType ?? 'StorageAccountConnectionString',
|
|
111
|
+
storageAccountConnectionStringName: props.storageAccountConnectionStringName ?? 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
runtime: {
|
|
116
|
-
name: props.runtime
|
|
117
|
-
version: props.runtimeVersion
|
|
116
|
+
name: props.runtime ?? 'node',
|
|
117
|
+
version: props.runtimeVersion ?? '20',
|
|
118
118
|
},
|
|
119
119
|
scaleAndConcurrency: {
|
|
120
120
|
alwaysReady: props.alwaysReady,
|
|
121
|
-
instanceMemoryMB: props.instanceMemory
|
|
122
|
-
maximumInstanceCount: props.maximumInstanceCount
|
|
121
|
+
instanceMemoryMB: props.instanceMemory ?? 2048,
|
|
122
|
+
maximumInstanceCount: props.maximumInstanceCount ?? 40,
|
|
123
123
|
triggers: {},
|
|
124
124
|
},
|
|
125
125
|
},
|
|
@@ -24,6 +24,7 @@ __exportStar(require("./eventgrid"), exports);
|
|
|
24
24
|
__exportStar(require("./function"), exports);
|
|
25
25
|
__exportStar(require("./key-vault"), exports);
|
|
26
26
|
__exportStar(require("./log-analytics-workspace"), exports);
|
|
27
|
+
__exportStar(require("./monitor"), exports);
|
|
27
28
|
__exportStar(require("./resource-group"), exports);
|
|
28
29
|
__exportStar(require("./servicebus"), exports);
|
|
29
30
|
__exportStar(require("./storage"), exports);
|
|
@@ -44,7 +44,7 @@ class AzureKeyVaultManager {
|
|
|
44
44
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
45
45
|
location: resourceGroup.location,
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
|
-
skuName: props.skuName
|
|
47
|
+
skuName: props.skuName ?? 'standard',
|
|
48
48
|
enableRbacAuthorization: props.enableRbacAuthorization ?? true,
|
|
49
49
|
softDeleteRetentionDays: props.softDeleteRetentionDays ?? 90,
|
|
50
50
|
purgeProtectionEnabled: props.purgeProtectionEnabled ?? true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./main"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MonitorDiagnosticSetting } from '@cdktf/provider-azurerm/lib/monitor-diagnostic-setting';
|
|
2
|
+
import { CommonAzureConstruct } from '../../common';
|
|
3
|
+
import { MonitorDiagnosticSettingProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Provides operations on Azure Key Vault
|
|
6
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
7
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
11
|
+
*
|
|
12
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
13
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
14
|
+
* super(parent, id, props)
|
|
15
|
+
* this.props = props
|
|
16
|
+
* this.monitorManager.createMonitor('MyMonitor', this, props)
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class AzureMonitorManager {
|
|
22
|
+
/**
|
|
23
|
+
* @summary Method to create a new monitor diagnostic setting
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props monitor diagnostics settings properties
|
|
27
|
+
* @see [CDKTF Monitor Diagnostics Settings Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/monitorDiagnosticSetting.typescript.md}
|
|
28
|
+
*/
|
|
29
|
+
createMonitorDiagnosticSettings(id: string, scope: CommonAzureConstruct, props: MonitorDiagnosticSettingProps): MonitorDiagnosticSetting;
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureMonitorManager = void 0;
|
|
4
|
+
const monitor_diagnostic_setting_1 = require("@cdktf/provider-azurerm/lib/monitor-diagnostic-setting");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Azure Key Vault
|
|
8
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
|
+
*
|
|
14
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
16
|
+
* super(parent, id, props)
|
|
17
|
+
* this.props = props
|
|
18
|
+
* this.monitorManager.createMonitor('MyMonitor', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class AzureMonitorManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new monitor diagnostic setting
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props monitor diagnostics settings properties
|
|
29
|
+
* @see [CDKTF Monitor Diagnostics Settings Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/monitorDiagnosticSetting.typescript.md}
|
|
30
|
+
*/
|
|
31
|
+
createMonitorDiagnosticSettings(id, scope, props) {
|
|
32
|
+
if (!props)
|
|
33
|
+
throw `Props undefined for ${id}`;
|
|
34
|
+
const monitorDiagnosticSetting = new monitor_diagnostic_setting_1.MonitorDiagnosticSetting(scope, `${id}-ds`, {
|
|
35
|
+
...props,
|
|
36
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.monitorDiagnosticSetting),
|
|
37
|
+
});
|
|
38
|
+
(0, utils_1.createAzureTfOutput)(`${id}-monitorDiagnosticSettingName`, scope, monitorDiagnosticSetting.name);
|
|
39
|
+
(0, utils_1.createAzureTfOutput)(`${id}-monitorDiagnosticSettingFriendlyUniqueId`, scope, monitorDiagnosticSetting.friendlyUniqueId);
|
|
40
|
+
(0, utils_1.createAzureTfOutput)(`${id}-monitorDiagnosticSettingId`, scope, monitorDiagnosticSetting.id);
|
|
41
|
+
return monitorDiagnosticSetting;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AzureMonitorManager = AzureMonitorManager;
|
|
@@ -48,9 +48,9 @@ class AzureServicebusManager {
|
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
location: resourceGroup.location,
|
|
50
50
|
identity: {
|
|
51
|
-
type: props.identity?.type
|
|
51
|
+
type: props.identity?.type ?? 'SystemAssigned',
|
|
52
52
|
},
|
|
53
|
-
sku: props.sku
|
|
53
|
+
sku: props.sku ?? 'Standard',
|
|
54
54
|
tags: props.tags ?? {
|
|
55
55
|
environment: scope.props.stage,
|
|
56
56
|
},
|
|
@@ -113,7 +113,7 @@ class AzureServicebusManager {
|
|
|
113
113
|
const servicebusSubscription = new servicebus_subscription_1.ServicebusSubscription(scope, `${id}-ss`, {
|
|
114
114
|
...props,
|
|
115
115
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
116
|
-
maxDeliveryCount: props.maxDeliveryCount
|
|
116
|
+
maxDeliveryCount: props.maxDeliveryCount ?? 1,
|
|
117
117
|
});
|
|
118
118
|
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name);
|
|
119
119
|
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionFriendlyUniqueId`, scope, servicebusSubscription.friendlyUniqueId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../app/api-destined-function/src/lib/lambda.ts","../app/api-destined-function/src/test/lambda.test.ts"],"version":"5.
|
|
1
|
+
{"root":["../app/api-destined-function/src/lib/lambda.ts","../app/api-destined-function/src/test/lambda.test.ts"],"version":"5.8.2"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.50.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16 <=22",
|
|
8
8
|
"pnpm": "=10"
|
|
9
9
|
},
|
|
10
|
-
"packageManager": "pnpm@10.
|
|
10
|
+
"packageManager": "pnpm@10.7.0",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git+https://github.com/gradientedge/cdk-utils.git"
|
|
@@ -50,44 +50,46 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
54
|
-
"@aws-sdk/credential-providers": "^3.
|
|
55
|
-
"@aws-sdk/types": "^3.
|
|
56
|
-
"@cdktf/provider-aws": "^19.
|
|
53
|
+
"@aws-sdk/client-secrets-manager": "^3.775.0",
|
|
54
|
+
"@aws-sdk/credential-providers": "^3.775.0",
|
|
55
|
+
"@aws-sdk/types": "^3.775.0",
|
|
56
|
+
"@cdktf/provider-aws": "^19.58.0",
|
|
57
57
|
"@cdktf/provider-azurerm": "^13.23.0",
|
|
58
58
|
"@cdktf/provider-cloudflare": "^11.29.0",
|
|
59
|
-
"@types/lodash": "^4.17.
|
|
60
|
-
"@types/node": "^22.13.
|
|
59
|
+
"@types/lodash": "^4.17.16",
|
|
60
|
+
"@types/node": "^22.13.13",
|
|
61
61
|
"@types/uuid": "^10.0.0",
|
|
62
62
|
"app-root-path": "^3.1.0",
|
|
63
|
-
"aws-cdk-lib": "^2.
|
|
63
|
+
"aws-cdk-lib": "^2.185.0",
|
|
64
64
|
"cdktf": "^0.20.11",
|
|
65
|
-
"cdktf-local-exec": "^0.5.
|
|
65
|
+
"cdktf-local-exec": "^0.5.61",
|
|
66
66
|
"constructs": "^10.4.2",
|
|
67
67
|
"lodash": "^4.17.21",
|
|
68
68
|
"moment": "^2.30.1",
|
|
69
69
|
"nconf": "^0.12.1",
|
|
70
70
|
"pluralize": "^8.0.0",
|
|
71
71
|
"ts-node": "^10.9.2",
|
|
72
|
-
"uuid": "^11.0
|
|
72
|
+
"uuid": "^11.1.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/core": "^7.26.10",
|
|
76
|
-
"@babel/eslint-parser": "^7.
|
|
76
|
+
"@babel/eslint-parser": "^7.27.0",
|
|
77
77
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
78
|
+
"@eslint/config-array": "^0.20.0",
|
|
79
|
+
"@eslint/object-schema": "^2.1.6",
|
|
78
80
|
"@types/jest": "^29.5.14",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
80
|
-
"@typescript-eslint/parser": "^8.
|
|
81
|
-
"aws-cdk": "^2.
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
82
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
83
|
+
"aws-cdk": "^2.1006.0",
|
|
82
84
|
"better-docs": "^2.7.3",
|
|
83
85
|
"codecov": "^3.8.3",
|
|
84
86
|
"commitizen": "^4.3.1",
|
|
85
87
|
"docdash": "^2.0.2",
|
|
86
88
|
"dotenv": "^16.4.7",
|
|
87
|
-
"eslint": "^9.
|
|
88
|
-
"eslint-config-prettier": "^10.
|
|
89
|
+
"eslint": "^9.23.0",
|
|
90
|
+
"eslint-config-prettier": "^10.1.1",
|
|
89
91
|
"eslint-plugin-import": "^2.31.0",
|
|
90
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
92
|
+
"eslint-plugin-jsdoc": "^50.6.9",
|
|
91
93
|
"husky": "^9.1.7",
|
|
92
94
|
"jest": "^29.7.0",
|
|
93
95
|
"jest-extended": "^4.0.2",
|
|
@@ -100,11 +102,11 @@
|
|
|
100
102
|
"prettier": "^3.5.3",
|
|
101
103
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
102
104
|
"rimraf": "^6.0.1",
|
|
103
|
-
"semantic-release": "^24.2.
|
|
105
|
+
"semantic-release": "^24.2.3",
|
|
104
106
|
"taffydb": "^2.7.3",
|
|
105
|
-
"ts-jest": "^29.
|
|
107
|
+
"ts-jest": "^29.3.0",
|
|
106
108
|
"ts-node": "^10.9.2",
|
|
107
|
-
"typescript": "5.
|
|
109
|
+
"typescript": "5.8.2",
|
|
108
110
|
"yaml": "^2.7.0"
|
|
109
111
|
},
|
|
110
112
|
"optionalDependencies": {
|
|
@@ -109,7 +109,7 @@ export class CloudFrontManager {
|
|
|
109
109
|
priceClass: props.priceClass ?? PriceClass.PRICE_CLASS_ALL,
|
|
110
110
|
viewerCertificate: ViewerCertificate.fromAcmCertificate(certificate, {
|
|
111
111
|
aliases: aliases,
|
|
112
|
-
securityPolicy: SecurityPolicyProtocol.
|
|
112
|
+
securityPolicy: SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
113
113
|
sslMethod: SSLMethod.SNI,
|
|
114
114
|
}),
|
|
115
115
|
})
|
|
@@ -85,6 +85,7 @@ export class EksManager {
|
|
|
85
85
|
clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.eks),
|
|
86
86
|
defaultCapacity: props.appCapacity,
|
|
87
87
|
defaultCapacityInstance: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE),
|
|
88
|
+
kubectlLayer: props.kubectlLayer,
|
|
88
89
|
version: KubernetesVersion.V1_27,
|
|
89
90
|
vpc,
|
|
90
91
|
})
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
AzureEventgridManager,
|
|
19
19
|
AzureDnsManager,
|
|
20
20
|
AzureLogAnalyticsWorkspaceManager,
|
|
21
|
+
AzureMonitorManager,
|
|
21
22
|
} from '../services'
|
|
22
23
|
import { CommonAzureStackProps } from './types'
|
|
23
24
|
import { AzureRemoteBackend } from './constants'
|
|
@@ -37,6 +38,7 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
37
38
|
id: string
|
|
38
39
|
keyVaultManager: AzureKeyVaultManager
|
|
39
40
|
logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager
|
|
41
|
+
monitorManager: AzureMonitorManager
|
|
40
42
|
resourceGroupManager: AzureResourceGroupManager
|
|
41
43
|
resourceNameFormatter: AzureResourceNameFormatter
|
|
42
44
|
servicebusManager: AzureServicebusManager
|
|
@@ -58,6 +60,7 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
58
60
|
this.functiontManager = new AzureFunctionManager()
|
|
59
61
|
this.keyVaultManager = new AzureKeyVaultManager()
|
|
60
62
|
this.logAnalyticsWorkspaceManager = new AzureLogAnalyticsWorkspaceManager()
|
|
63
|
+
this.monitorManager = new AzureMonitorManager()
|
|
61
64
|
this.resourceGroupManager = new AzureResourceGroupManager()
|
|
62
65
|
this.resourceNameFormatter = new AzureResourceNameFormatter(this, `${id}-rnf`, props)
|
|
63
66
|
this.servicebusManager = new AzureServicebusManager()
|
|
@@ -176,6 +176,8 @@ export class AzureApiManagementManager {
|
|
|
176
176
|
ignoreMissingProperty: true,
|
|
177
177
|
ignoreCasing: true,
|
|
178
178
|
schemaValidationEnabled: false,
|
|
179
|
+
|
|
180
|
+
lifecycle: props.lifecycle,
|
|
179
181
|
})
|
|
180
182
|
|
|
181
183
|
if (applicationInsightsKey) {
|
|
@@ -209,8 +211,8 @@ export class AzureApiManagementManager {
|
|
|
209
211
|
const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
|
|
210
212
|
...props,
|
|
211
213
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
|
|
212
|
-
description: props.description
|
|
213
|
-
protocol: props.protocol
|
|
214
|
+
description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
|
|
215
|
+
protocol: props.protocol ?? 'http',
|
|
214
216
|
})
|
|
215
217
|
|
|
216
218
|
createAzureTfOutput(`${id}-apiManagementBackendName`, scope, apiManagementBackend.name)
|
|
@@ -233,9 +235,9 @@ export class AzureApiManagementManager {
|
|
|
233
235
|
const apiManagementApi = new ApiManagementApi(scope, `${id}-am-api`, {
|
|
234
236
|
...props,
|
|
235
237
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementApi),
|
|
236
|
-
displayName: props.displayName
|
|
237
|
-
revision: props.revision
|
|
238
|
-
protocols: props.protocols
|
|
238
|
+
displayName: props.displayName ?? props.name,
|
|
239
|
+
revision: props.revision ?? '1',
|
|
240
|
+
protocols: props.protocols ?? ['https'],
|
|
239
241
|
})
|
|
240
242
|
|
|
241
243
|
createAzureTfOutput(`${id}-apiManagementApiName`, scope, apiManagementApi.name)
|
|
@@ -44,7 +44,7 @@ export class AzureApplicationInsightsManager {
|
|
|
44
44
|
...props,
|
|
45
45
|
name: scope.resourceNameFormatter.format(props.name ?? '', scope.props.resourceNameOptions?.applicationInsights),
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
|
-
applicationType: props.applicationType
|
|
47
|
+
applicationType: props.applicationType ?? 'web',
|
|
48
48
|
tags: props.tags ?? {
|
|
49
49
|
environment: scope.props.stage,
|
|
50
50
|
},
|
|
@@ -71,7 +71,7 @@ export class AzureDnsManager {
|
|
|
71
71
|
|
|
72
72
|
const dnsARecord = new DnsARecord(scope, `${id}-da`, {
|
|
73
73
|
...props,
|
|
74
|
-
ttl: props.ttl
|
|
74
|
+
ttl: props.ttl ?? 300,
|
|
75
75
|
tags: props.tags ?? {
|
|
76
76
|
environment: scope.props.stage,
|
|
77
77
|
},
|
|
@@ -96,7 +96,7 @@ export class AzureDnsManager {
|
|
|
96
96
|
|
|
97
97
|
const dnsCnameRecord = new DnsCnameRecord(scope, `${id}-dc`, {
|
|
98
98
|
...props,
|
|
99
|
-
ttl: props.ttl
|
|
99
|
+
ttl: props.ttl ?? 300,
|
|
100
100
|
tags: props.tags ?? {
|
|
101
101
|
environment: scope.props.stage,
|
|
102
102
|
},
|
|
@@ -121,7 +121,7 @@ export class AzureDnsManager {
|
|
|
121
121
|
|
|
122
122
|
const dnsTxtRecord = new DnsTxtRecord(scope, `${id}-dc`, {
|
|
123
123
|
...props,
|
|
124
|
-
ttl: props.ttl
|
|
124
|
+
ttl: props.ttl ?? 300,
|
|
125
125
|
tags: props.tags ?? {
|
|
126
126
|
environment: scope.props.stage,
|
|
127
127
|
},
|
|
@@ -108,8 +108,8 @@ export class AzureEventgridManager {
|
|
|
108
108
|
const eventgridSubscription = new EventgridEventSubscription(scope, `${id}-es`, {
|
|
109
109
|
...props,
|
|
110
110
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridEventSubscription),
|
|
111
|
-
eventDeliverySchema: props.eventDeliverySchema
|
|
112
|
-
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled
|
|
111
|
+
eventDeliverySchema: props.eventDeliverySchema ?? 'CloudEventSchemaV1_0',
|
|
112
|
+
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled ?? true,
|
|
113
113
|
})
|
|
114
114
|
|
|
115
115
|
createAzureTfOutput(`${id}-eventgridSubscriptiontName`, scope, eventgridSubscription.name)
|
|
@@ -72,7 +72,7 @@ export class AzureFunctionManager {
|
|
|
72
72
|
const functionAppFunction = new FunctionAppFunction(scope, `${id}-fc`, {
|
|
73
73
|
...props,
|
|
74
74
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
|
|
75
|
-
configJson: JSON.stringify(props.configJson
|
|
75
|
+
configJson: JSON.stringify(props.configJson ?? {}),
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
createAzureTfOutput(`${id}-functionName`, scope, functionAppFunction.name)
|
|
@@ -110,32 +110,32 @@ export class AzureFunctionManager {
|
|
|
110
110
|
parentId: resourceGroup.id,
|
|
111
111
|
|
|
112
112
|
body: {
|
|
113
|
-
kind: props.kind
|
|
113
|
+
kind: props.kind ?? 'functionapp,linux',
|
|
114
114
|
|
|
115
115
|
properties: {
|
|
116
116
|
serverFarmId: props.appServicePlanId,
|
|
117
|
-
httpsOnly: props.httpsOnly
|
|
117
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
118
118
|
|
|
119
119
|
functionAppConfig: {
|
|
120
120
|
deployment: {
|
|
121
121
|
storage: {
|
|
122
|
-
type: props.deploymentStorageType
|
|
122
|
+
type: props.deploymentStorageType ?? 'blobContainer',
|
|
123
123
|
value: `${props.blobEndpoint}${props.containerName}`,
|
|
124
124
|
authentication: {
|
|
125
|
-
type: props.deploymentAuthenticationType
|
|
125
|
+
type: props.deploymentAuthenticationType ?? 'StorageAccountConnectionString',
|
|
126
126
|
storageAccountConnectionStringName:
|
|
127
|
-
props.storageAccountConnectionStringName
|
|
127
|
+
props.storageAccountConnectionStringName ?? 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
130
|
},
|
|
131
131
|
runtime: {
|
|
132
|
-
name: props.runtime
|
|
133
|
-
version: props.runtimeVersion
|
|
132
|
+
name: props.runtime ?? 'node',
|
|
133
|
+
version: props.runtimeVersion ?? '20',
|
|
134
134
|
},
|
|
135
135
|
scaleAndConcurrency: {
|
|
136
136
|
alwaysReady: props.alwaysReady,
|
|
137
|
-
instanceMemoryMB: props.instanceMemory
|
|
138
|
-
maximumInstanceCount: props.maximumInstanceCount
|
|
137
|
+
instanceMemoryMB: props.instanceMemory ?? 2048,
|
|
138
|
+
maximumInstanceCount: props.maximumInstanceCount ?? 40,
|
|
139
139
|
triggers: {},
|
|
140
140
|
},
|
|
141
141
|
},
|
|
@@ -45,7 +45,7 @@ export class AzureKeyVaultManager {
|
|
|
45
45
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
46
46
|
location: resourceGroup.location,
|
|
47
47
|
resourceGroupName: resourceGroup.name,
|
|
48
|
-
skuName: props.skuName
|
|
48
|
+
skuName: props.skuName ?? 'standard',
|
|
49
49
|
enableRbacAuthorization: props.enableRbacAuthorization ?? true,
|
|
50
50
|
softDeleteRetentionDays: props.softDeleteRetentionDays ?? 90,
|
|
51
51
|
purgeProtectionEnabled: props.purgeProtectionEnabled ?? true,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MonitorDiagnosticSetting } from '@cdktf/provider-azurerm/lib/monitor-diagnostic-setting'
|
|
2
|
+
import { CommonAzureConstruct } from '../../common'
|
|
3
|
+
import { createAzureTfOutput } from '../../utils'
|
|
4
|
+
import { MonitorDiagnosticSettingProps } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Azure Key Vault
|
|
8
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
|
+
*
|
|
14
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
16
|
+
* super(parent, id, props)
|
|
17
|
+
* this.props = props
|
|
18
|
+
* this.monitorManager.createMonitor('MyMonitor', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class AzureMonitorManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new monitor diagnostic setting
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props monitor diagnostics settings properties
|
|
29
|
+
* @see [CDKTF Monitor Diagnostics Settings Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/monitorDiagnosticSetting.typescript.md}
|
|
30
|
+
*/
|
|
31
|
+
public createMonitorDiagnosticSettings(
|
|
32
|
+
id: string,
|
|
33
|
+
scope: CommonAzureConstruct,
|
|
34
|
+
props: MonitorDiagnosticSettingProps
|
|
35
|
+
) {
|
|
36
|
+
if (!props) throw `Props undefined for ${id}`
|
|
37
|
+
|
|
38
|
+
const monitorDiagnosticSetting = new MonitorDiagnosticSetting(scope, `${id}-ds`, {
|
|
39
|
+
...props,
|
|
40
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.monitorDiagnosticSetting),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
createAzureTfOutput(`${id}-monitorDiagnosticSettingName`, scope, monitorDiagnosticSetting.name)
|
|
44
|
+
createAzureTfOutput(
|
|
45
|
+
`${id}-monitorDiagnosticSettingFriendlyUniqueId`,
|
|
46
|
+
scope,
|
|
47
|
+
monitorDiagnosticSetting.friendlyUniqueId
|
|
48
|
+
)
|
|
49
|
+
createAzureTfOutput(`${id}-monitorDiagnosticSettingId`, scope, monitorDiagnosticSetting.id)
|
|
50
|
+
|
|
51
|
+
return monitorDiagnosticSetting
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -54,9 +54,9 @@ export class AzureServicebusManager {
|
|
|
54
54
|
resourceGroupName: resourceGroup.name,
|
|
55
55
|
location: resourceGroup.location,
|
|
56
56
|
identity: {
|
|
57
|
-
type: props.identity?.type
|
|
57
|
+
type: props.identity?.type ?? 'SystemAssigned',
|
|
58
58
|
},
|
|
59
|
-
sku: props.sku
|
|
59
|
+
sku: props.sku ?? 'Standard',
|
|
60
60
|
tags: props.tags ?? {
|
|
61
61
|
environment: scope.props.stage,
|
|
62
62
|
},
|
|
@@ -128,7 +128,7 @@ export class AzureServicebusManager {
|
|
|
128
128
|
const servicebusSubscription = new ServicebusSubscription(scope, `${id}-ss`, {
|
|
129
129
|
...props,
|
|
130
130
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
131
|
-
maxDeliveryCount: props.maxDeliveryCount
|
|
131
|
+
maxDeliveryCount: props.maxDeliveryCount ?? 1,
|
|
132
132
|
})
|
|
133
133
|
|
|
134
134
|
createAzureTfOutput(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name)
|