@gradientedge/cdk-utils 9.37.0 → 9.38.1
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/src/lib/azure/common/construct.d.ts +3 -1
- package/dist/src/lib/azure/common/construct.js +4 -0
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +0 -3
- package/dist/src/lib/azure/services/eventgrid/index.d.ts +2 -0
- package/dist/src/lib/azure/services/eventgrid/index.js +18 -0
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +39 -0
- package/dist/src/lib/azure/services/eventgrid/main.js +77 -0
- package/dist/src/lib/azure/services/eventgrid/types.d.ts +6 -0
- package/dist/src/lib/azure/services/eventgrid/types.js +2 -0
- package/dist/src/lib/azure/services/function/main.d.ts +2 -2
- package/dist/src/lib/azure/services/function/main.js +8 -5
- package/dist/src/lib/azure/services/function/types.d.ts +2 -0
- package/dist/src/lib/azure/services/index.d.ts +2 -0
- package/dist/src/lib/azure/services/index.js +2 -0
- package/dist/src/lib/azure/services/servicebus/index.d.ts +2 -0
- package/dist/src/lib/azure/services/servicebus/index.js +18 -0
- package/dist/src/lib/azure/services/servicebus/main.d.ts +39 -0
- package/dist/src/lib/azure/services/servicebus/main.js +64 -0
- package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -0
- package/dist/src/lib/azure/services/servicebus/types.js +2 -0
- package/dist/src/lib/azure/services/storage/main.js +0 -13
- package/package.json +1 -1
- package/src/lib/azure/common/construct.ts +6 -0
- package/src/lib/azure/services/cosmosdb/main.ts +1 -2
- package/src/lib/azure/services/cosmosdb/types.ts +0 -2
- package/src/lib/azure/services/eventgrid/index.ts +2 -0
- package/src/lib/azure/services/eventgrid/main.ts +82 -0
- package/src/lib/azure/services/eventgrid/types.ts +5 -0
- package/src/lib/azure/services/function/main.ts +8 -5
- package/src/lib/azure/services/function/types.ts +2 -0
- package/src/lib/azure/services/index.ts +2 -0
- package/src/lib/azure/services/servicebus/index.ts +2 -0
- package/src/lib/azure/services/servicebus/main.ts +68 -0
- package/src/lib/azure/services/servicebus/types.ts +5 -0
- package/src/lib/azure/services/storage/main.ts +0 -15
|
@@ -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 } from '../services';
|
|
3
|
+
import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager } from '../services';
|
|
4
4
|
import { CommonAzureStackProps } from './types';
|
|
5
5
|
export declare class CommonAzureConstruct extends TerraformStack {
|
|
6
6
|
props: CommonAzureStackProps;
|
|
@@ -16,6 +16,8 @@ export declare class CommonAzureConstruct extends TerraformStack {
|
|
|
16
16
|
keyVaultManager: AzureKeyVaultManager;
|
|
17
17
|
resourceGroupManager: AzureResourceGroupManager;
|
|
18
18
|
storageManager: AzureStorageManager;
|
|
19
|
+
servicebusManager: AzureServicebusManager;
|
|
20
|
+
eventgridManager: AzureEventgridManager;
|
|
19
21
|
constructor(scope: Construct, id: string, props: CommonAzureStackProps);
|
|
20
22
|
/**
|
|
21
23
|
* @summary Determine the fully qualified domain name based on domainName & subDomain
|
|
@@ -21,6 +21,8 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
21
21
|
keyVaultManager;
|
|
22
22
|
resourceGroupManager;
|
|
23
23
|
storageManager;
|
|
24
|
+
servicebusManager;
|
|
25
|
+
eventgridManager;
|
|
24
26
|
constructor(scope, id, props) {
|
|
25
27
|
super(scope, id);
|
|
26
28
|
this.props = props;
|
|
@@ -34,6 +36,8 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
34
36
|
this.keyVaultManager = new services_1.AzureKeyVaultManager();
|
|
35
37
|
this.resourceGroupManager = new services_1.AzureResourceGroupManager();
|
|
36
38
|
this.storageManager = new services_1.AzureStorageManager();
|
|
39
|
+
this.servicebusManager = new services_1.AzureServicebusManager();
|
|
40
|
+
this.eventgridManager = new services_1.AzureEventgridManager();
|
|
37
41
|
this.determineFullyQualifiedDomain();
|
|
38
42
|
this.determineRemoteBackend();
|
|
39
43
|
this.determineTenantId();
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { CosmosdbAccountConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-account';
|
|
2
2
|
import { CosmosdbSqlDatabaseConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-database';
|
|
3
3
|
import { CosmosdbSqlContainerConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-container';
|
|
4
|
-
import { CosmosdbTableConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-table';
|
|
5
4
|
export interface CosmosdbAccountProps extends CosmosdbAccountConfig {
|
|
6
5
|
}
|
|
7
6
|
export interface CosmosdbSqlDatabaseProps extends CosmosdbSqlDatabaseConfig {
|
|
8
7
|
}
|
|
9
8
|
export interface CosmosdbSqlContainerProps extends CosmosdbSqlContainerConfig {
|
|
10
9
|
}
|
|
11
|
-
export interface CosmosdbTableProps extends CosmosdbTableConfig {
|
|
12
|
-
}
|
|
@@ -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,39 @@
|
|
|
1
|
+
import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
|
|
2
|
+
import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
|
|
3
|
+
import { CommonAzureConstruct } from '../../common';
|
|
4
|
+
import { EventgridTopicProps, EventgridEventSubscriptionProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* @classdesc Provides operations on Azure Event Grid
|
|
7
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
8
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
12
|
+
*
|
|
13
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
14
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(parent, id, props)
|
|
16
|
+
* this.props = props
|
|
17
|
+
* this.EventGridManager.createEventGrid('MyEventGrid', this, props)
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class AzureEventgridManager {
|
|
23
|
+
/**
|
|
24
|
+
* @summary Method to create a new eventgrid topic
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props eventgrid topic properties
|
|
28
|
+
* @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
|
|
29
|
+
*/
|
|
30
|
+
createEventgridTopic(id: string, scope: CommonAzureConstruct, props: EventgridTopicProps): EventgridTopic;
|
|
31
|
+
/**
|
|
32
|
+
* @summary Method to create a new eventgrid subscription
|
|
33
|
+
* @param id scoped id of the resource
|
|
34
|
+
* @param scope scope in which this resource is defined
|
|
35
|
+
* @param props eventgrid subsription properties
|
|
36
|
+
* @see [CDKTF Eventgrid Subscription Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridEventSubscription.typescript.md}
|
|
37
|
+
*/
|
|
38
|
+
createEventgridSubscription(id: string, scope: CommonAzureConstruct, props: EventgridEventSubscriptionProps): EventgridEventSubscription;
|
|
39
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureEventgridManager = void 0;
|
|
4
|
+
const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
|
|
5
|
+
const eventgrid_topic_1 = require("@cdktf/provider-azurerm/lib/eventgrid-topic");
|
|
6
|
+
const eventgrid_event_subscription_1 = require("@cdktf/provider-azurerm/lib/eventgrid-event-subscription");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
/**
|
|
9
|
+
* @classdesc Provides operations on Azure Event Grid
|
|
10
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
11
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
15
|
+
*
|
|
16
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
17
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
18
|
+
* super(parent, id, props)
|
|
19
|
+
* this.props = props
|
|
20
|
+
* this.EventGridManager.createEventGrid('MyEventGrid', this, props)
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class AzureEventgridManager {
|
|
26
|
+
/**
|
|
27
|
+
* @summary Method to create a new eventgrid topic
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param scope scope in which this resource is defined
|
|
30
|
+
* @param props eventgrid topic properties
|
|
31
|
+
* @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
|
|
32
|
+
*/
|
|
33
|
+
createEventgridTopic(id, scope, props) {
|
|
34
|
+
if (!props)
|
|
35
|
+
throw `Props undefined for ${id}`;
|
|
36
|
+
const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-et-rg`, {
|
|
37
|
+
name: scope.props.resourceGroupName
|
|
38
|
+
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
39
|
+
: `${props.resourceGroupName}`,
|
|
40
|
+
});
|
|
41
|
+
if (!resourceGroup)
|
|
42
|
+
throw `Resource group undefined for ${id}`;
|
|
43
|
+
const eventgridTopic = new eventgrid_topic_1.EventgridTopic(scope, `${id}-et`, {
|
|
44
|
+
...props,
|
|
45
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
46
|
+
location: resourceGroup.location,
|
|
47
|
+
resourceGroupName: resourceGroup.name,
|
|
48
|
+
tags: props.tags ?? {
|
|
49
|
+
environment: scope.props.stage,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicName`, scope, eventgridTopic.name);
|
|
53
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId);
|
|
54
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicId`, scope, eventgridTopic.id);
|
|
55
|
+
return eventgridTopic;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @summary Method to create a new eventgrid subscription
|
|
59
|
+
* @param id scoped id of the resource
|
|
60
|
+
* @param scope scope in which this resource is defined
|
|
61
|
+
* @param props eventgrid subsription properties
|
|
62
|
+
* @see [CDKTF Eventgrid Subscription Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridEventSubscription.typescript.md}
|
|
63
|
+
*/
|
|
64
|
+
createEventgridSubscription(id, scope, props) {
|
|
65
|
+
if (!props)
|
|
66
|
+
throw `Props undefined for ${id}`;
|
|
67
|
+
const eventgridSubscription = new eventgrid_event_subscription_1.EventgridEventSubscription(scope, `${id}-es`, {
|
|
68
|
+
...props,
|
|
69
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
70
|
+
});
|
|
71
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptiontName`, scope, eventgridSubscription.name);
|
|
72
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptionFriendlyUniqueId`, scope, eventgridSubscription.friendlyUniqueId);
|
|
73
|
+
(0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptionId`, scope, eventgridSubscription.id);
|
|
74
|
+
return eventgridSubscription;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.AzureEventgridManager = AzureEventgridManager;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
|
|
2
|
+
import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
|
|
3
|
+
export interface EventgridTopicProps extends EventgridTopicConfig {
|
|
4
|
+
}
|
|
5
|
+
export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataAzurermLinuxFunctionApp } from '@cdktf/provider-azurerm/lib/data-azurerm-linux-function-app';
|
|
2
1
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app';
|
|
3
2
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function';
|
|
3
|
+
import { Resource } from '../../.gen/providers/azapi/resource';
|
|
4
4
|
import { CommonAzureConstruct } from '../../common';
|
|
5
5
|
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types';
|
|
6
6
|
/**
|
|
@@ -43,5 +43,5 @@ export declare class AzureFunctionManager {
|
|
|
43
43
|
* @param scope scope in which this resource is defined
|
|
44
44
|
* @param props flex consumption function app properties
|
|
45
45
|
*/
|
|
46
|
-
createFunctionAppFlexConsumption(id: string, scope: CommonAzureConstruct, props: FunctionAppFlexConsumptionProps):
|
|
46
|
+
createFunctionAppFlexConsumption(id: string, scope: CommonAzureConstruct, props: FunctionAppFlexConsumptionProps): Resource;
|
|
47
47
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AzureFunctionManager = void 0;
|
|
4
4
|
const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
|
|
5
|
-
const data_azurerm_linux_function_app_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-linux-function-app");
|
|
6
5
|
const linux_function_app_1 = require("@cdktf/provider-azurerm/lib/linux-function-app");
|
|
7
6
|
const function_app_function_1 = require("@cdktf/provider-azurerm/lib/function-app-function");
|
|
8
7
|
const resource_1 = require("../../.gen/providers/azapi/resource");
|
|
8
|
+
const cdktf_local_exec_1 = require("cdktf-local-exec");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
/**
|
|
11
11
|
* @classdesc Provides operations on Azure Functions
|
|
@@ -145,11 +145,14 @@ class AzureFunctionManager {
|
|
|
145
145
|
ignoreCasing: true,
|
|
146
146
|
schemaValidationEnabled: false,
|
|
147
147
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
new cdktf_local_exec_1.Provider(scope, `${id}-local-exec-provider`);
|
|
149
|
+
new cdktf_local_exec_1.LocalExec(scope, `${id}-function-app-deploy`, {
|
|
150
|
+
triggers: {
|
|
151
|
+
hash: props.sourceCodeHash,
|
|
152
|
+
},
|
|
153
|
+
command: `az functionapp deployment source config-zip --resource-group ${resourceGroup.name} --name ${functionApp.name} --src ${props.deploySource}`,
|
|
151
154
|
});
|
|
152
|
-
return
|
|
155
|
+
return functionApp;
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
exports.AzureFunctionManager = AzureFunctionManager;
|
|
@@ -3,7 +3,9 @@ export * from './app-configuration';
|
|
|
3
3
|
export * from './app-service';
|
|
4
4
|
export * from './application-insights';
|
|
5
5
|
export * from './cosmosdb';
|
|
6
|
+
export * from './eventgrid';
|
|
6
7
|
export * from './function';
|
|
7
8
|
export * from './key-vault';
|
|
8
9
|
export * from './resource-group';
|
|
10
|
+
export * from './servicebus';
|
|
9
11
|
export * from './storage';
|
|
@@ -19,7 +19,9 @@ __exportStar(require("./app-configuration"), exports);
|
|
|
19
19
|
__exportStar(require("./app-service"), exports);
|
|
20
20
|
__exportStar(require("./application-insights"), exports);
|
|
21
21
|
__exportStar(require("./cosmosdb"), exports);
|
|
22
|
+
__exportStar(require("./eventgrid"), exports);
|
|
22
23
|
__exportStar(require("./function"), exports);
|
|
23
24
|
__exportStar(require("./key-vault"), exports);
|
|
24
25
|
__exportStar(require("./resource-group"), exports);
|
|
26
|
+
__exportStar(require("./servicebus"), exports);
|
|
25
27
|
__exportStar(require("./storage"), exports);
|
|
@@ -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,39 @@
|
|
|
1
|
+
import { ServicebusTopic } from '@cdktf/provider-azurerm/lib/servicebus-topic';
|
|
2
|
+
import { ServicebusSubscription } from '@cdktf/provider-azurerm/lib/servicebus-subscription';
|
|
3
|
+
import { CommonAzureConstruct } from '../../common';
|
|
4
|
+
import { ServicebusTopicProps, ServicebusSubscriptionProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* @classdesc Provides operations on Azure CosmosDB
|
|
7
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
8
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
12
|
+
*
|
|
13
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
14
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(parent, id, props)
|
|
16
|
+
* this.props = props
|
|
17
|
+
* this.CosmosDbManager.createCosmosAccount('MyCosmosDb', this, props)
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class AzureServicebusManager {
|
|
23
|
+
/**
|
|
24
|
+
* @summary Method to create a new servicebus topic
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props servicebus topic properties
|
|
28
|
+
* @see [CDKTF Servicebus Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusTopic.typescript.md}
|
|
29
|
+
*/
|
|
30
|
+
createServicebusTopic(id: string, scope: CommonAzureConstruct, props: ServicebusTopicProps): ServicebusTopic;
|
|
31
|
+
/**
|
|
32
|
+
* @summary Method to create a new servicebus subscription
|
|
33
|
+
* @param id scoped id of the resource
|
|
34
|
+
* @param scope scope in which this resource is defined
|
|
35
|
+
* @param props servicebus subscription properties
|
|
36
|
+
* @see [CDKTF Servicebus Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusSubscription.typescript.md}
|
|
37
|
+
*/
|
|
38
|
+
createServicebusSubscription(id: string, scope: CommonAzureConstruct, props: ServicebusSubscriptionProps): ServicebusSubscription;
|
|
39
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureServicebusManager = void 0;
|
|
4
|
+
const servicebus_topic_1 = require("@cdktf/provider-azurerm/lib/servicebus-topic");
|
|
5
|
+
const servicebus_subscription_1 = require("@cdktf/provider-azurerm/lib/servicebus-subscription");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
/**
|
|
8
|
+
* @classdesc Provides operations on Azure CosmosDB
|
|
9
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
10
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
11
|
+
* @example
|
|
12
|
+
* ```
|
|
13
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
14
|
+
*
|
|
15
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
16
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
17
|
+
* super(parent, id, props)
|
|
18
|
+
* this.props = props
|
|
19
|
+
* this.CosmosDbManager.createCosmosAccount('MyCosmosDb', this, props)
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
class AzureServicebusManager {
|
|
25
|
+
/**
|
|
26
|
+
* @summary Method to create a new servicebus topic
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param scope scope in which this resource is defined
|
|
29
|
+
* @param props servicebus topic properties
|
|
30
|
+
* @see [CDKTF Servicebus Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusTopic.typescript.md}
|
|
31
|
+
*/
|
|
32
|
+
createServicebusTopic(id, scope, props) {
|
|
33
|
+
if (!props)
|
|
34
|
+
throw `Props undefined for ${id}`;
|
|
35
|
+
const servicebusTopic = new servicebus_topic_1.ServicebusTopic(scope, `${id}-st`, {
|
|
36
|
+
...props,
|
|
37
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
38
|
+
});
|
|
39
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusTopicName`, scope, servicebusTopic.name);
|
|
40
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusTopicFriendlyUniqueId`, scope, servicebusTopic.friendlyUniqueId);
|
|
41
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusTopicId`, scope, servicebusTopic.id);
|
|
42
|
+
return servicebusTopic;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @summary Method to create a new servicebus subscription
|
|
46
|
+
* @param id scoped id of the resource
|
|
47
|
+
* @param scope scope in which this resource is defined
|
|
48
|
+
* @param props servicebus subscription properties
|
|
49
|
+
* @see [CDKTF Servicebus Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusSubscription.typescript.md}
|
|
50
|
+
*/
|
|
51
|
+
createServicebusSubscription(id, scope, props) {
|
|
52
|
+
if (!props)
|
|
53
|
+
throw `Props undefined for ${id}`;
|
|
54
|
+
const servicebusSubscription = new servicebus_subscription_1.ServicebusSubscription(scope, `${id}-ss`, {
|
|
55
|
+
...props,
|
|
56
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
57
|
+
});
|
|
58
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name);
|
|
59
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionFriendlyUniqueId`, scope, servicebusSubscription.friendlyUniqueId);
|
|
60
|
+
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionId`, scope, servicebusSubscription.id);
|
|
61
|
+
return servicebusSubscription;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.AzureServicebusManager = AzureServicebusManager;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ServicebusTopicConfig } from '@cdktf/provider-azurerm/lib/servicebus-topic';
|
|
2
|
+
import { ServicebusSubscriptionConfig } from '@cdktf/provider-azurerm/lib/servicebus-subscription';
|
|
3
|
+
export interface ServicebusTopicProps extends ServicebusTopicConfig {
|
|
4
|
+
}
|
|
5
|
+
export interface ServicebusSubscriptionProps extends ServicebusSubscriptionConfig {
|
|
6
|
+
}
|
|
@@ -68,22 +68,9 @@ class AzureStorageManager {
|
|
|
68
68
|
createStorageContainer(id, scope, props) {
|
|
69
69
|
if (!props)
|
|
70
70
|
throw `Props undefined for ${id}`;
|
|
71
|
-
const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-sc-rg`, {
|
|
72
|
-
name: scope.props.resourceGroupName
|
|
73
|
-
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
74
|
-
: `${props.resourceGroupName}`,
|
|
75
|
-
});
|
|
76
|
-
if (!resourceGroup)
|
|
77
|
-
throw `Resource group undefined for ${id}`;
|
|
78
|
-
const storageAccount = new data_azurerm_storage_account_1.DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
79
|
-
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
80
|
-
resourceGroupName: resourceGroup.name,
|
|
81
|
-
});
|
|
82
71
|
const storageContainer = new storage_container_1.StorageContainer(scope, `${id}-sc`, {
|
|
83
72
|
...props,
|
|
84
73
|
name: `${props.name}-${scope.props.stage}`,
|
|
85
|
-
storageAccountName: undefined, // the `storage_account_name` property has been deprecated in favour of `storage_account_id` and will be removed in version 5.0 of the Provider.
|
|
86
|
-
storageAccountId: storageAccount.id,
|
|
87
74
|
});
|
|
88
75
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerName`, scope, storageContainer.name);
|
|
89
76
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId);
|
package/package.json
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
AzureApplicationInsightsManager,
|
|
15
15
|
AzureAppConfigurationManager,
|
|
16
16
|
AzureCosmosDbManager,
|
|
17
|
+
AzureServicebusManager,
|
|
18
|
+
AzureEventgridManager,
|
|
17
19
|
} from '../services'
|
|
18
20
|
import { CommonAzureStackProps } from './types'
|
|
19
21
|
import { AzureRemoteBackend } from './constants'
|
|
@@ -32,6 +34,8 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
32
34
|
keyVaultManager: AzureKeyVaultManager
|
|
33
35
|
resourceGroupManager: AzureResourceGroupManager
|
|
34
36
|
storageManager: AzureStorageManager
|
|
37
|
+
servicebusManager: AzureServicebusManager
|
|
38
|
+
eventgridManager: AzureEventgridManager
|
|
35
39
|
|
|
36
40
|
constructor(scope: Construct, id: string, props: CommonAzureStackProps) {
|
|
37
41
|
super(scope, id)
|
|
@@ -47,6 +51,8 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
47
51
|
this.keyVaultManager = new AzureKeyVaultManager()
|
|
48
52
|
this.resourceGroupManager = new AzureResourceGroupManager()
|
|
49
53
|
this.storageManager = new AzureStorageManager()
|
|
54
|
+
this.servicebusManager = new AzureServicebusManager()
|
|
55
|
+
this.eventgridManager = new AzureEventgridManager()
|
|
50
56
|
|
|
51
57
|
this.determineFullyQualifiedDomain()
|
|
52
58
|
this.determineRemoteBackend()
|
|
@@ -2,10 +2,9 @@ import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azure
|
|
|
2
2
|
import { CosmosdbAccount } from '@cdktf/provider-azurerm/lib/cosmosdb-account'
|
|
3
3
|
import { CosmosdbSqlDatabase } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-database'
|
|
4
4
|
import { CosmosdbSqlContainer } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-container'
|
|
5
|
-
import { CosmosdbTable } from '@cdktf/provider-azurerm/lib/cosmosdb-table'
|
|
6
5
|
import { CommonAzureConstruct } from '../../common'
|
|
7
6
|
import { createAzureTfOutput } from '../../utils'
|
|
8
|
-
import { CosmosdbAccountProps,
|
|
7
|
+
import { CosmosdbAccountProps, CosmosdbSqlContainerProps, CosmosdbSqlDatabaseProps } from './types'
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @classdesc Provides operations on Azure CosmosDB
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { CosmosdbAccountConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-account'
|
|
2
2
|
import { CosmosdbSqlDatabaseConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-database'
|
|
3
3
|
import { CosmosdbSqlContainerConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-container'
|
|
4
|
-
import { CosmosdbTableConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-table'
|
|
5
4
|
|
|
6
5
|
export interface CosmosdbAccountProps extends CosmosdbAccountConfig {}
|
|
7
6
|
export interface CosmosdbSqlDatabaseProps extends CosmosdbSqlDatabaseConfig {}
|
|
8
7
|
export interface CosmosdbSqlContainerProps extends CosmosdbSqlContainerConfig {}
|
|
9
|
-
export interface CosmosdbTableProps extends CosmosdbTableConfig {}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
|
|
2
|
+
import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
|
|
3
|
+
import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
|
|
4
|
+
import { CommonAzureConstruct } from '../../common'
|
|
5
|
+
import { createAzureTfOutput } from '../../utils'
|
|
6
|
+
import { EventgridTopicProps, EventgridEventSubscriptionProps } from './types'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @classdesc Provides operations on Azure Event Grid
|
|
10
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
11
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
15
|
+
*
|
|
16
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
17
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
18
|
+
* super(parent, id, props)
|
|
19
|
+
* this.props = props
|
|
20
|
+
* this.EventGridManager.createEventGrid('MyEventGrid', this, props)
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class AzureEventgridManager {
|
|
26
|
+
/**
|
|
27
|
+
* @summary Method to create a new eventgrid topic
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param scope scope in which this resource is defined
|
|
30
|
+
* @param props eventgrid topic properties
|
|
31
|
+
* @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
|
|
32
|
+
*/
|
|
33
|
+
public createEventgridTopic(id: string, scope: CommonAzureConstruct, props: EventgridTopicProps) {
|
|
34
|
+
if (!props) throw `Props undefined for ${id}`
|
|
35
|
+
|
|
36
|
+
const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-et-rg`, {
|
|
37
|
+
name: scope.props.resourceGroupName
|
|
38
|
+
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
39
|
+
: `${props.resourceGroupName}`,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
43
|
+
|
|
44
|
+
const eventgridTopic = new EventgridTopic(scope, `${id}-et`, {
|
|
45
|
+
...props,
|
|
46
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
47
|
+
location: resourceGroup.location,
|
|
48
|
+
resourceGroupName: resourceGroup.name,
|
|
49
|
+
tags: props.tags ?? {
|
|
50
|
+
environment: scope.props.stage,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
createAzureTfOutput(`${id}-eventgridTopicName`, scope, eventgridTopic.name)
|
|
55
|
+
createAzureTfOutput(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId)
|
|
56
|
+
createAzureTfOutput(`${id}-eventgridTopicId`, scope, eventgridTopic.id)
|
|
57
|
+
|
|
58
|
+
return eventgridTopic
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @summary Method to create a new eventgrid subscription
|
|
63
|
+
* @param id scoped id of the resource
|
|
64
|
+
* @param scope scope in which this resource is defined
|
|
65
|
+
* @param props eventgrid subsription properties
|
|
66
|
+
* @see [CDKTF Eventgrid Subscription Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridEventSubscription.typescript.md}
|
|
67
|
+
*/
|
|
68
|
+
public createEventgridSubscription(id: string, scope: CommonAzureConstruct, props: EventgridEventSubscriptionProps) {
|
|
69
|
+
if (!props) throw `Props undefined for ${id}`
|
|
70
|
+
|
|
71
|
+
const eventgridSubscription = new EventgridEventSubscription(scope, `${id}-es`, {
|
|
72
|
+
...props,
|
|
73
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
createAzureTfOutput(`${id}-eventgridSubscriptiontName`, scope, eventgridSubscription.name)
|
|
77
|
+
createAzureTfOutput(`${id}-eventgridSubscriptionFriendlyUniqueId`, scope, eventgridSubscription.friendlyUniqueId)
|
|
78
|
+
createAzureTfOutput(`${id}-eventgridSubscriptionId`, scope, eventgridSubscription.id)
|
|
79
|
+
|
|
80
|
+
return eventgridSubscription
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
|
|
2
|
+
import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
|
|
3
|
+
|
|
4
|
+
export interface EventgridTopicProps extends EventgridTopicConfig {}
|
|
5
|
+
export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
|
|
2
|
-
import { DataAzurermLinuxFunctionApp } from '@cdktf/provider-azurerm/lib/data-azurerm-linux-function-app'
|
|
3
2
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
|
|
4
3
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
|
|
5
4
|
import { Resource } from '../../.gen/providers/azapi/resource'
|
|
5
|
+
import { LocalExec, Provider } from 'cdktf-local-exec'
|
|
6
6
|
import { CommonAzureConstruct } from '../../common'
|
|
7
7
|
import { createAzureTfOutput } from '../../utils'
|
|
8
8
|
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types'
|
|
@@ -165,11 +165,14 @@ export class AzureFunctionManager {
|
|
|
165
165
|
schemaValidationEnabled: false,
|
|
166
166
|
})
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
new Provider(scope, `${id}-local-exec-provider`)
|
|
169
|
+
new LocalExec(scope, `${id}-function-app-deploy`, {
|
|
170
|
+
triggers: {
|
|
171
|
+
hash: props.sourceCodeHash,
|
|
172
|
+
},
|
|
173
|
+
command: `az functionapp deployment source config-zip --resource-group ${resourceGroup.name} --name ${functionApp.name} --src ${props.deploySource}`,
|
|
171
174
|
})
|
|
172
175
|
|
|
173
|
-
return
|
|
176
|
+
return functionApp
|
|
174
177
|
}
|
|
175
178
|
}
|
|
@@ -3,7 +3,9 @@ export * from './app-configuration'
|
|
|
3
3
|
export * from './app-service'
|
|
4
4
|
export * from './application-insights'
|
|
5
5
|
export * from './cosmosdb'
|
|
6
|
+
export * from './eventgrid'
|
|
6
7
|
export * from './function'
|
|
7
8
|
export * from './key-vault'
|
|
8
9
|
export * from './resource-group'
|
|
10
|
+
export * from './servicebus'
|
|
9
11
|
export * from './storage'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ServicebusTopic } from '@cdktf/provider-azurerm/lib/servicebus-topic'
|
|
2
|
+
import { ServicebusSubscription } from '@cdktf/provider-azurerm/lib/servicebus-subscription'
|
|
3
|
+
import { CommonAzureConstruct } from '../../common'
|
|
4
|
+
import { createAzureTfOutput } from '../../utils'
|
|
5
|
+
import { ServicebusTopicProps, ServicebusSubscriptionProps } from './types'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @classdesc Provides operations on Azure CosmosDB
|
|
9
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
10
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
11
|
+
* @example
|
|
12
|
+
* ```
|
|
13
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
14
|
+
*
|
|
15
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
16
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
17
|
+
* super(parent, id, props)
|
|
18
|
+
* this.props = props
|
|
19
|
+
* this.CosmosDbManager.createCosmosAccount('MyCosmosDb', this, props)
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export class AzureServicebusManager {
|
|
25
|
+
/**
|
|
26
|
+
* @summary Method to create a new servicebus topic
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param scope scope in which this resource is defined
|
|
29
|
+
* @param props servicebus topic properties
|
|
30
|
+
* @see [CDKTF Servicebus Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusTopic.typescript.md}
|
|
31
|
+
*/
|
|
32
|
+
public createServicebusTopic(id: string, scope: CommonAzureConstruct, props: ServicebusTopicProps) {
|
|
33
|
+
if (!props) throw `Props undefined for ${id}`
|
|
34
|
+
|
|
35
|
+
const servicebusTopic = new ServicebusTopic(scope, `${id}-st`, {
|
|
36
|
+
...props,
|
|
37
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
createAzureTfOutput(`${id}-servicebusTopicName`, scope, servicebusTopic.name)
|
|
41
|
+
createAzureTfOutput(`${id}-servicebusTopicFriendlyUniqueId`, scope, servicebusTopic.friendlyUniqueId)
|
|
42
|
+
createAzureTfOutput(`${id}-servicebusTopicId`, scope, servicebusTopic.id)
|
|
43
|
+
|
|
44
|
+
return servicebusTopic
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @summary Method to create a new servicebus subscription
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props servicebus subscription properties
|
|
52
|
+
* @see [CDKTF Servicebus Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusSubscription.typescript.md}
|
|
53
|
+
*/
|
|
54
|
+
public createServicebusSubscription(id: string, scope: CommonAzureConstruct, props: ServicebusSubscriptionProps) {
|
|
55
|
+
if (!props) throw `Props undefined for ${id}`
|
|
56
|
+
|
|
57
|
+
const servicebusSubscription = new ServicebusSubscription(scope, `${id}-ss`, {
|
|
58
|
+
...props,
|
|
59
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
createAzureTfOutput(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name)
|
|
63
|
+
createAzureTfOutput(`${id}-servicebusSubscriptionFriendlyUniqueId`, scope, servicebusSubscription.friendlyUniqueId)
|
|
64
|
+
createAzureTfOutput(`${id}-servicebusSubscriptionId`, scope, servicebusSubscription.id)
|
|
65
|
+
|
|
66
|
+
return servicebusSubscription
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ServicebusTopicConfig } from '@cdktf/provider-azurerm/lib/servicebus-topic'
|
|
2
|
+
import { ServicebusSubscriptionConfig } from '@cdktf/provider-azurerm/lib/servicebus-subscription'
|
|
3
|
+
|
|
4
|
+
export interface ServicebusTopicProps extends ServicebusTopicConfig {}
|
|
5
|
+
export interface ServicebusSubscriptionProps extends ServicebusSubscriptionConfig {}
|
|
@@ -72,24 +72,9 @@ export class AzureStorageManager {
|
|
|
72
72
|
public createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps) {
|
|
73
73
|
if (!props) throw `Props undefined for ${id}`
|
|
74
74
|
|
|
75
|
-
const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sc-rg`, {
|
|
76
|
-
name: scope.props.resourceGroupName
|
|
77
|
-
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
78
|
-
: `${props.resourceGroupName}`,
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
82
|
-
|
|
83
|
-
const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
84
|
-
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
85
|
-
resourceGroupName: resourceGroup.name,
|
|
86
|
-
})
|
|
87
|
-
|
|
88
75
|
const storageContainer = new StorageContainer(scope, `${id}-sc`, {
|
|
89
76
|
...props,
|
|
90
77
|
name: `${props.name}-${scope.props.stage}`,
|
|
91
|
-
storageAccountName: undefined, // the `storage_account_name` property has been deprecated in favour of `storage_account_id` and will be removed in version 5.0 of the Provider.
|
|
92
|
-
storageAccountId: storageAccount.id,
|
|
93
78
|
})
|
|
94
79
|
|
|
95
80
|
createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
|