@gradientedge/cdk-utils 9.36.0 → 9.38.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/dist/src/lib/azure/.gen/providers/azapi/provider/index.d.ts +414 -0
- package/dist/src/lib/azure/.gen/providers/azapi/provider/index.js +884 -0
- package/dist/src/lib/azure/.gen/providers/azapi/resource/index.d.ts +639 -0
- package/dist/src/lib/azure/.gen/providers/azapi/resource/index.js +1177 -0
- package/dist/src/lib/azure/common/construct.d.ts +3 -1
- package/dist/src/lib/azure/common/construct.js +6 -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 +10 -2
- package/dist/src/lib/azure/services/function/main.js +74 -1
- package/dist/src/lib/azure/services/function/types.d.ts +18 -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 +5 -3
- package/package.json +1 -1
- package/src/lib/azure/.gen/constraints.json +6 -0
- package/src/lib/azure/.gen/providers/azapi/data-azapi-client-config/index.ts +257 -0
- package/src/lib/azure/.gen/providers/azapi/data-azapi-resource/index.ts +876 -0
- package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-action/index.ts +779 -0
- package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-id/index.ts +383 -0
- package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-list/index.ts +713 -0
- package/src/lib/azure/.gen/providers/azapi/data-plane-resource/index.ts +1203 -0
- package/src/lib/azure/.gen/providers/azapi/index.ts +11 -0
- package/src/lib/azure/.gen/providers/azapi/lazy-index.ts +51 -0
- package/src/lib/azure/.gen/providers/azapi/provider/index.ts +1121 -0
- package/src/lib/azure/.gen/providers/azapi/resource/index.ts +1516 -0
- package/src/lib/azure/.gen/providers/azapi/resource-action/index.ts +935 -0
- package/src/lib/azure/.gen/providers/azapi/update-resource/index.ts +1042 -0
- package/src/lib/azure/.gen/versions.json +3 -0
- package/src/lib/azure/common/construct.ts +8 -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 +89 -2
- package/src/lib/azure/services/function/types.ts +20 -1
- 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 +5 -3
|
@@ -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
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommonAzureConstruct = void 0;
|
|
4
4
|
const provider_1 = require("@cdktf/provider-azurerm/lib/provider");
|
|
5
|
+
const provider_2 = require("../.gen/providers/azapi/provider");
|
|
5
6
|
const data_azurerm_client_config_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-client-config");
|
|
6
7
|
const cdktf_1 = require("cdktf");
|
|
7
8
|
const common_1 = require("../../common");
|
|
@@ -20,6 +21,8 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
20
21
|
keyVaultManager;
|
|
21
22
|
resourceGroupManager;
|
|
22
23
|
storageManager;
|
|
24
|
+
servicebusManager;
|
|
25
|
+
eventgridManager;
|
|
23
26
|
constructor(scope, id, props) {
|
|
24
27
|
super(scope, id);
|
|
25
28
|
this.props = props;
|
|
@@ -33,10 +36,13 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
33
36
|
this.keyVaultManager = new services_1.AzureKeyVaultManager();
|
|
34
37
|
this.resourceGroupManager = new services_1.AzureResourceGroupManager();
|
|
35
38
|
this.storageManager = new services_1.AzureStorageManager();
|
|
39
|
+
this.servicebusManager = new services_1.AzureServicebusManager();
|
|
40
|
+
this.eventgridManager = new services_1.AzureEventgridManager();
|
|
36
41
|
this.determineFullyQualifiedDomain();
|
|
37
42
|
this.determineRemoteBackend();
|
|
38
43
|
this.determineTenantId();
|
|
39
44
|
new provider_1.AzurermProvider(this, `${this.id}-provider`, this.props);
|
|
45
|
+
new provider_2.AzapiProvider(this, `${this.id}-azapi-provider`, this.props);
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
48
|
* @summary Determine the fully qualified domain name based on domainName & subDomain
|
|
@@ -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,7 +1,8 @@
|
|
|
1
1
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app';
|
|
2
2
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function';
|
|
3
|
+
import { Resource } from '../../.gen/providers/azapi/resource';
|
|
3
4
|
import { CommonAzureConstruct } from '../../common';
|
|
4
|
-
import { FunctionAppProps, FunctionProps } from './types';
|
|
5
|
+
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* @classdesc Provides operations on Azure Functions
|
|
7
8
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -13,7 +14,7 @@ import { FunctionAppProps, FunctionProps } from './types';
|
|
|
13
14
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
14
15
|
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
15
16
|
* super(parent, id, props)
|
|
16
|
-
* this.props
|
|
17
|
+
* this.props: props
|
|
17
18
|
* this.functionManager.createFunctionApp('MyFunctionApp', this, props)
|
|
18
19
|
* }
|
|
19
20
|
* }
|
|
@@ -36,4 +37,11 @@ export declare class AzureFunctionManager {
|
|
|
36
37
|
* @see [CDKTF Function Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/functionAppFunction.typescript.md}
|
|
37
38
|
*/
|
|
38
39
|
createFunction(id: string, scope: CommonAzureConstruct, props: FunctionProps): FunctionAppFunction;
|
|
40
|
+
/**
|
|
41
|
+
* @summary Method to create a new flex consumption function app
|
|
42
|
+
* @param id scoped id of the resource
|
|
43
|
+
* @param scope scope in which this resource is defined
|
|
44
|
+
* @param props flex consumption function app properties
|
|
45
|
+
*/
|
|
46
|
+
createFunctionAppFlexConsumption(id: string, scope: CommonAzureConstruct, props: FunctionAppFlexConsumptionProps): Resource;
|
|
39
47
|
}
|
|
@@ -4,6 +4,7 @@ exports.AzureFunctionManager = void 0;
|
|
|
4
4
|
const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
|
|
5
5
|
const linux_function_app_1 = require("@cdktf/provider-azurerm/lib/linux-function-app");
|
|
6
6
|
const function_app_function_1 = require("@cdktf/provider-azurerm/lib/function-app-function");
|
|
7
|
+
const resource_1 = require("../../.gen/providers/azapi/resource");
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
8
9
|
/**
|
|
9
10
|
* @classdesc Provides operations on Azure Functions
|
|
@@ -16,7 +17,7 @@ const utils_1 = require("../../utils");
|
|
|
16
17
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
17
18
|
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
18
19
|
* super(parent, id, props)
|
|
19
|
-
* this.props
|
|
20
|
+
* this.props: props
|
|
20
21
|
* this.functionManager.createFunctionApp('MyFunctionApp', this, props)
|
|
21
22
|
* }
|
|
22
23
|
* }
|
|
@@ -73,5 +74,77 @@ class AzureFunctionManager {
|
|
|
73
74
|
(0, utils_1.createAzureTfOutput)(`${id}-functionId`, scope, functionAppFunction.id);
|
|
74
75
|
return functionAppFunction;
|
|
75
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* @summary Method to create a new flex consumption function app
|
|
79
|
+
* @param id scoped id of the resource
|
|
80
|
+
* @param scope scope in which this resource is defined
|
|
81
|
+
* @param props flex consumption function app properties
|
|
82
|
+
*/
|
|
83
|
+
createFunctionAppFlexConsumption(id, scope, props) {
|
|
84
|
+
if (!props)
|
|
85
|
+
throw `Props undefined for ${id}`;
|
|
86
|
+
const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-fa-rg`, {
|
|
87
|
+
name: scope.props.resourceGroupName
|
|
88
|
+
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
89
|
+
: `${props.resourceGroupName}`,
|
|
90
|
+
});
|
|
91
|
+
if (!resourceGroup)
|
|
92
|
+
throw `Resource group undefined for ${id}`;
|
|
93
|
+
const functionApp = new resource_1.Resource(scope, `${id}-fa`, {
|
|
94
|
+
type: 'Microsoft.Web/sites@2023-12-01',
|
|
95
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
96
|
+
location: resourceGroup.location,
|
|
97
|
+
parentId: resourceGroup.id,
|
|
98
|
+
body: {
|
|
99
|
+
kind: props.kind || 'functionapp,linux',
|
|
100
|
+
properties: {
|
|
101
|
+
serverFarmId: props.appServicePlanId,
|
|
102
|
+
httpsOnly: props.httpsOnly || true,
|
|
103
|
+
functionAppConfig: {
|
|
104
|
+
deployment: {
|
|
105
|
+
storage: {
|
|
106
|
+
type: props.deploymentStorageType || 'blobContainer',
|
|
107
|
+
value: `${props.blobEndpoint}${props.containerName}`,
|
|
108
|
+
authentication: {
|
|
109
|
+
type: props.deploymentAuthenticationType || 'StorageAccountConnectionString',
|
|
110
|
+
storageAccountConnectionStringName: props.storageAccountConnectionStringName || 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
runtime: {
|
|
115
|
+
name: props.runtime || 'node',
|
|
116
|
+
version: props.runtimeVersion || '20',
|
|
117
|
+
},
|
|
118
|
+
scaleAndConcurrency: {
|
|
119
|
+
instanceMemoryMB: props.instanceMemory || 2048,
|
|
120
|
+
maximumInstanceCount: props.maximumInstanceCount || 40,
|
|
121
|
+
triggers: {},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
siteConfig: {
|
|
125
|
+
appSettings: props.appSettings.concat([
|
|
126
|
+
{
|
|
127
|
+
name: 'FUNCTIONS_EXTENSION_VERSION',
|
|
128
|
+
value: '~4',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'AzureWebJobsStorage',
|
|
132
|
+
value: props.storageConnectionString,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
136
|
+
value: props.storageConnectionString,
|
|
137
|
+
},
|
|
138
|
+
]),
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
identity: [{ type: 'SystemAssigned' }],
|
|
143
|
+
ignoreMissingProperty: true,
|
|
144
|
+
ignoreCasing: true,
|
|
145
|
+
schemaValidationEnabled: false,
|
|
146
|
+
});
|
|
147
|
+
return functionApp;
|
|
148
|
+
}
|
|
76
149
|
}
|
|
77
150
|
exports.AzureFunctionManager = AzureFunctionManager;
|
|
@@ -4,3 +4,21 @@ export interface FunctionAppProps extends LinuxFunctionAppConfig {
|
|
|
4
4
|
}
|
|
5
5
|
export interface FunctionProps extends FunctionAppFunctionConfig {
|
|
6
6
|
}
|
|
7
|
+
export interface FunctionAppFlexConsumptionProps {
|
|
8
|
+
appServicePlanId: string;
|
|
9
|
+
appSettings: any;
|
|
10
|
+
blobEndpoint: string;
|
|
11
|
+
containerName: string;
|
|
12
|
+
deploymentAuthenticationType?: string;
|
|
13
|
+
deploymentStorageType?: string;
|
|
14
|
+
httpsOnly?: string;
|
|
15
|
+
instanceMemory?: number;
|
|
16
|
+
kind?: string;
|
|
17
|
+
maximumInstanceCount?: number;
|
|
18
|
+
name: string;
|
|
19
|
+
resourceGroupName: string;
|
|
20
|
+
runtime?: string;
|
|
21
|
+
runtimeVersion?: string;
|
|
22
|
+
storageAccountConnectionStringName?: string;
|
|
23
|
+
storageConnectionString: string;
|
|
24
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -76,13 +76,14 @@ class AzureStorageManager {
|
|
|
76
76
|
if (!resourceGroup)
|
|
77
77
|
throw `Resource group undefined for ${id}`;
|
|
78
78
|
const storageAccount = new data_azurerm_storage_account_1.DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
79
|
-
name: `${props.storageAccountName}-${scope.props.stage}
|
|
79
|
+
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
80
80
|
resourceGroupName: resourceGroup.name,
|
|
81
81
|
});
|
|
82
82
|
const storageContainer = new storage_container_1.StorageContainer(scope, `${id}-sc`, {
|
|
83
83
|
...props,
|
|
84
84
|
name: `${props.name}-${scope.props.stage}`,
|
|
85
|
-
storageAccountName:
|
|
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,
|
|
86
87
|
});
|
|
87
88
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerName`, scope, storageContainer.name);
|
|
88
89
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId);
|
|
@@ -112,7 +113,8 @@ class AzureStorageManager {
|
|
|
112
113
|
});
|
|
113
114
|
const storageContainer = new data_azurerm_storage_container_1.DataAzurermStorageContainer(scope, `${id}-sc`, {
|
|
114
115
|
name: `${props.storageContainerName}-${scope.props.stage}`,
|
|
115
|
-
storageAccountName:
|
|
116
|
+
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.
|
|
117
|
+
storageAccountId: storageAccount.id,
|
|
116
118
|
});
|
|
117
119
|
const storageBlob = new storage_blob_1.StorageBlob(scope, `${id}-sb`, {
|
|
118
120
|
...props,
|
package/package.json
CHANGED