@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,4 +1,5 @@
|
|
|
1
1
|
import { AzurermProvider } from '@cdktf/provider-azurerm/lib/provider'
|
|
2
|
+
import { AzapiProvider } from '../.gen/providers/azapi/provider'
|
|
2
3
|
import { DataAzurermClientConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-client-config'
|
|
3
4
|
import { AzurermBackend, TerraformStack } from 'cdktf'
|
|
4
5
|
import { Construct } from 'constructs'
|
|
@@ -13,6 +14,8 @@ import {
|
|
|
13
14
|
AzureApplicationInsightsManager,
|
|
14
15
|
AzureAppConfigurationManager,
|
|
15
16
|
AzureCosmosDbManager,
|
|
17
|
+
AzureServicebusManager,
|
|
18
|
+
AzureEventgridManager,
|
|
16
19
|
} from '../services'
|
|
17
20
|
import { CommonAzureStackProps } from './types'
|
|
18
21
|
import { AzureRemoteBackend } from './constants'
|
|
@@ -31,6 +34,8 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
31
34
|
keyVaultManager: AzureKeyVaultManager
|
|
32
35
|
resourceGroupManager: AzureResourceGroupManager
|
|
33
36
|
storageManager: AzureStorageManager
|
|
37
|
+
servicebusManager: AzureServicebusManager
|
|
38
|
+
eventgridManager: AzureEventgridManager
|
|
34
39
|
|
|
35
40
|
constructor(scope: Construct, id: string, props: CommonAzureStackProps) {
|
|
36
41
|
super(scope, id)
|
|
@@ -46,11 +51,14 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
46
51
|
this.keyVaultManager = new AzureKeyVaultManager()
|
|
47
52
|
this.resourceGroupManager = new AzureResourceGroupManager()
|
|
48
53
|
this.storageManager = new AzureStorageManager()
|
|
54
|
+
this.servicebusManager = new AzureServicebusManager()
|
|
55
|
+
this.eventgridManager = new AzureEventgridManager()
|
|
49
56
|
|
|
50
57
|
this.determineFullyQualifiedDomain()
|
|
51
58
|
this.determineRemoteBackend()
|
|
52
59
|
this.determineTenantId()
|
|
53
60
|
new AzurermProvider(this, `${this.id}-provider`, this.props)
|
|
61
|
+
new AzapiProvider(this, `${this.id}-azapi-provider`, this.props)
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -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,9 +1,10 @@
|
|
|
1
1
|
import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
|
|
2
2
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
|
|
3
3
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
|
|
4
|
+
import { Resource } from '../../.gen/providers/azapi/resource'
|
|
4
5
|
import { CommonAzureConstruct } from '../../common'
|
|
5
6
|
import { createAzureTfOutput } from '../../utils'
|
|
6
|
-
import { FunctionAppProps, FunctionProps } from './types'
|
|
7
|
+
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @classdesc Provides operations on Azure Functions
|
|
@@ -16,7 +17,7 @@ import { FunctionAppProps, FunctionProps } from './types'
|
|
|
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
|
* }
|
|
@@ -79,4 +80,90 @@ export class AzureFunctionManager {
|
|
|
79
80
|
|
|
80
81
|
return functionAppFunction
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @summary Method to create a new flex consumption function app
|
|
86
|
+
* @param id scoped id of the resource
|
|
87
|
+
* @param scope scope in which this resource is defined
|
|
88
|
+
* @param props flex consumption function app properties
|
|
89
|
+
*/
|
|
90
|
+
public createFunctionAppFlexConsumption(
|
|
91
|
+
id: string,
|
|
92
|
+
scope: CommonAzureConstruct,
|
|
93
|
+
props: FunctionAppFlexConsumptionProps
|
|
94
|
+
) {
|
|
95
|
+
if (!props) throw `Props undefined for ${id}`
|
|
96
|
+
|
|
97
|
+
const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-fa-rg`, {
|
|
98
|
+
name: scope.props.resourceGroupName
|
|
99
|
+
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
100
|
+
: `${props.resourceGroupName}`,
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
104
|
+
|
|
105
|
+
const functionApp = new Resource(scope, `${id}-fa`, {
|
|
106
|
+
type: 'Microsoft.Web/sites@2023-12-01',
|
|
107
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
108
|
+
location: resourceGroup.location,
|
|
109
|
+
parentId: resourceGroup.id,
|
|
110
|
+
|
|
111
|
+
body: {
|
|
112
|
+
kind: props.kind || 'functionapp,linux',
|
|
113
|
+
|
|
114
|
+
properties: {
|
|
115
|
+
serverFarmId: props.appServicePlanId,
|
|
116
|
+
httpsOnly: props.httpsOnly || true,
|
|
117
|
+
|
|
118
|
+
functionAppConfig: {
|
|
119
|
+
deployment: {
|
|
120
|
+
storage: {
|
|
121
|
+
type: props.deploymentStorageType || 'blobContainer',
|
|
122
|
+
value: `${props.blobEndpoint}${props.containerName}`,
|
|
123
|
+
authentication: {
|
|
124
|
+
type: props.deploymentAuthenticationType || 'StorageAccountConnectionString',
|
|
125
|
+
storageAccountConnectionStringName:
|
|
126
|
+
props.storageAccountConnectionStringName || 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
runtime: {
|
|
131
|
+
name: props.runtime || 'node',
|
|
132
|
+
version: props.runtimeVersion || '20',
|
|
133
|
+
},
|
|
134
|
+
scaleAndConcurrency: {
|
|
135
|
+
instanceMemoryMB: props.instanceMemory || 2048,
|
|
136
|
+
maximumInstanceCount: props.maximumInstanceCount || 40,
|
|
137
|
+
triggers: {},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
siteConfig: {
|
|
142
|
+
appSettings: props.appSettings.concat([
|
|
143
|
+
{
|
|
144
|
+
name: 'FUNCTIONS_EXTENSION_VERSION',
|
|
145
|
+
value: '~4',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'AzureWebJobsStorage',
|
|
149
|
+
value: props.storageConnectionString,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
|
|
153
|
+
value: props.storageConnectionString,
|
|
154
|
+
},
|
|
155
|
+
]),
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
identity: [{ type: 'SystemAssigned' }],
|
|
161
|
+
|
|
162
|
+
ignoreMissingProperty: true,
|
|
163
|
+
ignoreCasing: true,
|
|
164
|
+
schemaValidationEnabled: false,
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
return functionApp
|
|
168
|
+
}
|
|
82
169
|
}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { LinuxFunctionAppConfig } from '@cdktf/provider-azurerm/lib/linux-function-app'
|
|
2
2
|
import { FunctionAppFunctionConfig } from '@cdktf/provider-azurerm/lib/function-app-function'
|
|
3
|
-
import {
|
|
3
|
+
import { ResourceConfig } from '../../.gen/providers/azapi/resource'
|
|
4
4
|
|
|
5
5
|
export interface FunctionAppProps extends LinuxFunctionAppConfig {}
|
|
6
6
|
|
|
7
7
|
export interface FunctionProps extends FunctionAppFunctionConfig {}
|
|
8
|
+
|
|
9
|
+
export interface FunctionAppFlexConsumptionProps {
|
|
10
|
+
appServicePlanId: string
|
|
11
|
+
appSettings: any
|
|
12
|
+
blobEndpoint: string
|
|
13
|
+
containerName: string
|
|
14
|
+
deploymentAuthenticationType?: string
|
|
15
|
+
deploymentStorageType?: string
|
|
16
|
+
httpsOnly?: string
|
|
17
|
+
instanceMemory?: number
|
|
18
|
+
kind?: string
|
|
19
|
+
maximumInstanceCount?: number
|
|
20
|
+
name: string
|
|
21
|
+
resourceGroupName: string
|
|
22
|
+
runtime?: string
|
|
23
|
+
runtimeVersion?: string
|
|
24
|
+
storageAccountConnectionStringName?: string
|
|
25
|
+
storageConnectionString: string
|
|
26
|
+
}
|
|
@@ -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 {}
|
|
@@ -81,14 +81,15 @@ export class AzureStorageManager {
|
|
|
81
81
|
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
82
82
|
|
|
83
83
|
const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
84
|
-
name: `${props.storageAccountName}-${scope.props.stage}
|
|
84
|
+
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
85
85
|
resourceGroupName: resourceGroup.name,
|
|
86
86
|
})
|
|
87
87
|
|
|
88
88
|
const storageContainer = new StorageContainer(scope, `${id}-sc`, {
|
|
89
89
|
...props,
|
|
90
90
|
name: `${props.name}-${scope.props.stage}`,
|
|
91
|
-
storageAccountName:
|
|
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,
|
|
92
93
|
})
|
|
93
94
|
|
|
94
95
|
createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
|
|
@@ -123,7 +124,8 @@ export class AzureStorageManager {
|
|
|
123
124
|
|
|
124
125
|
const storageContainer = new DataAzurermStorageContainer(scope, `${id}-sc`, {
|
|
125
126
|
name: `${props.storageContainerName}-${scope.props.stage}`,
|
|
126
|
-
storageAccountName:
|
|
127
|
+
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.
|
|
128
|
+
storageAccountId: storageAccount.id,
|
|
127
129
|
})
|
|
128
130
|
|
|
129
131
|
const storageBlob = new StorageBlob(scope, `${id}-sb`, {
|