@gradientedge/cdk-utils 10.0.0 → 10.2.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/common/constants.d.ts +3 -2
- package/dist/src/lib/azure/common/constants.js +2 -1
- package/dist/src/lib/azure/common/construct.d.ts +26 -12
- package/dist/src/lib/azure/common/construct.js +31 -45
- package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
- package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
- package/dist/src/lib/azure/common/stack.d.ts +18 -32
- package/dist/src/lib/azure/common/stack.js +77 -74
- package/dist/src/lib/azure/common/tagging.d.ts +29 -8
- package/dist/src/lib/azure/common/tagging.js +72 -26
- package/dist/src/lib/azure/common/types.d.ts +19 -4
- package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
- package/dist/src/lib/azure/services/api-management/main.js +100 -121
- package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
- package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
- package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
- package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
- package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
- package/dist/src/lib/azure/services/app-service/main.js +37 -49
- package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
- package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
- package/dist/src/lib/azure/services/application-insights/main.js +20 -26
- package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
- package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
- package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
- package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
- package/dist/src/lib/azure/services/dns/main.js +33 -51
- package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
- package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
- package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
- package/dist/src/lib/azure/services/function/main.d.ts +15 -15
- package/dist/src/lib/azure/services/function/main.js +54 -59
- package/dist/src/lib/azure/services/function/types.d.ts +18 -6
- package/dist/src/lib/azure/services/index.d.ts +1 -1
- package/dist/src/lib/azure/services/index.js +1 -1
- package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
- package/dist/src/lib/azure/services/key-vault/main.js +29 -28
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
- package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
- package/dist/src/lib/azure/services/monitor/main.js +10 -15
- package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
- package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
- package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
- package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
- package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
- package/dist/src/lib/azure/services/redis/main.js +24 -26
- package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
- package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
- package/dist/src/lib/azure/services/resource-group/main.js +9 -14
- package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
- package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
- package/dist/src/lib/azure/services/servicebus/main.js +47 -70
- package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
- package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
- package/dist/src/lib/azure/services/storage/main.js +70 -88
- package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
- package/dist/src/lib/azure/types/index.d.ts +2 -1
- package/dist/src/lib/azure/utils/index.d.ts +19 -3
- package/dist/src/lib/azure/utils/index.js +19 -13
- package/dist/src/lib/cloudflare/common/stack.js +1 -1
- package/package.json +28 -27
- package/src/lib/azure/common/constants.ts +2 -1
- package/src/lib/azure/common/construct.ts +32 -48
- package/src/lib/azure/common/resource-name-formatter.ts +10 -6
- package/src/lib/azure/common/stack.ts +78 -78
- package/src/lib/azure/common/tagging.ts +78 -29
- package/src/lib/azure/common/types.ts +21 -4
- package/src/lib/azure/services/api-management/main.ts +172 -169
- package/src/lib/azure/services/api-management/types.ts +39 -16
- package/src/lib/azure/services/app-configuration/main.ts +33 -31
- package/src/lib/azure/services/app-configuration/types.ts +2 -2
- package/src/lib/azure/services/app-service/main.ts +61 -62
- package/src/lib/azure/services/app-service/types.ts +4 -4
- package/src/lib/azure/services/application-insights/main.ts +29 -30
- package/src/lib/azure/services/application-insights/types.ts +2 -5
- package/src/lib/azure/services/cosmosdb/main.ts +78 -77
- package/src/lib/azure/services/cosmosdb/types.ts +10 -6
- package/src/lib/azure/services/dns/main.ts +65 -72
- package/src/lib/azure/services/dns/types.ts +9 -9
- package/src/lib/azure/services/eventgrid/main.ts +120 -122
- package/src/lib/azure/services/eventgrid/types.ts +13 -8
- package/src/lib/azure/services/function/main.ts +75 -72
- package/src/lib/azure/services/function/types.ts +21 -6
- package/src/lib/azure/services/index.ts +1 -1
- package/src/lib/azure/services/key-vault/main.ts +38 -32
- package/src/lib/azure/services/key-vault/types.ts +4 -2
- package/src/lib/azure/services/monitor/main.ts +17 -21
- package/src/lib/azure/services/monitor/types.ts +2 -2
- package/src/lib/azure/services/operational-insights/main.ts +61 -0
- package/src/lib/azure/services/operational-insights/types.ts +3 -0
- package/src/lib/azure/services/redis/main.ts +30 -30
- package/src/lib/azure/services/redis/types.ts +2 -2
- package/src/lib/azure/services/resource-group/main.ts +20 -20
- package/src/lib/azure/services/resource-group/types.ts +2 -2
- package/src/lib/azure/services/servicebus/main.ts +103 -94
- package/src/lib/azure/services/servicebus/types.ts +17 -11
- package/src/lib/azure/services/storage/main.ts +113 -114
- package/src/lib/azure/services/storage/types.ts +16 -8
- package/src/lib/azure/types/index.ts +2 -1
- package/src/lib/azure/utils/index.ts +20 -22
- package/src/lib/cloudflare/common/stack.ts +1 -1
- package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
- package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
- package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
- package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
- package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
- /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FunctionAppFlexConsumption } from '@cdktf/provider-azurerm/lib/function-app-flex-consumption/index.js'
|
|
3
|
-
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function/index.js'
|
|
4
|
-
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app/index.js'
|
|
1
|
+
import { ManagedServiceIdentityType, WebApp, WebAppFunction } from '@pulumi/azure-native/web/index.js'
|
|
5
2
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
6
|
-
import { createAzureTfOutput } from '../../utils/index.js'
|
|
7
3
|
import { FunctionAppFlexConsumptionProps, FunctionAppProps, FunctionProps } from './types.js'
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
|
-
* @classdesc Provides operations on Azure Functions
|
|
6
|
+
* @classdesc Provides operations on Azure Functions using Pulumi
|
|
11
7
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
12
8
|
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
13
9
|
* @example
|
|
14
|
-
* ```
|
|
10
|
+
* ```typescript
|
|
15
11
|
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
16
12
|
*
|
|
17
13
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
18
|
-
* constructor(
|
|
19
|
-
* super(
|
|
20
|
-
* this.props
|
|
14
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(name, props)
|
|
16
|
+
* this.props = props
|
|
21
17
|
* this.functionManager.createFunctionApp('MyFunctionApp', this, props)
|
|
22
18
|
* }
|
|
23
19
|
* }
|
|
@@ -25,60 +21,70 @@ import { FunctionAppFlexConsumptionProps, FunctionAppProps, FunctionProps } from
|
|
|
25
21
|
*/
|
|
26
22
|
export class AzureFunctionManager {
|
|
27
23
|
/**
|
|
28
|
-
* @summary Method to create a new function app
|
|
24
|
+
* @summary Method to create a new Linux function app
|
|
29
25
|
* @param id scoped id of the resource
|
|
30
26
|
* @param scope scope in which this resource is defined
|
|
31
27
|
* @param props function app properties
|
|
32
|
-
* @see [
|
|
28
|
+
* @see [Pulumi Azure Native Function App]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
|
|
33
29
|
*/
|
|
34
30
|
public createFunctionApp(id: string, scope: CommonAzureConstruct, props: FunctionAppProps) {
|
|
35
31
|
if (!props) throw `Props undefined for ${id}`
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
33
|
+
// Get resource group name
|
|
34
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
35
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
36
|
+
: props.resourceGroupName
|
|
42
37
|
|
|
43
|
-
if (!
|
|
38
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
return new WebApp(
|
|
41
|
+
`${id}-fa`,
|
|
42
|
+
{
|
|
43
|
+
...props,
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
|
|
45
|
+
resourceGroupName: resourceGroupName,
|
|
46
|
+
location: props.location ?? scope.props.location,
|
|
47
|
+
kind: props.kind ?? 'functionapp,linux',
|
|
48
|
+
identity: props.identity ?? {
|
|
49
|
+
type: ManagedServiceIdentityType.SystemAssigned,
|
|
50
|
+
},
|
|
51
|
+
tags: props.tags ?? {
|
|
52
|
+
environment: scope.props.stage,
|
|
53
|
+
},
|
|
51
54
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
createAzureTfOutput(`${id}-functionAppName`, scope, functionApp.name)
|
|
55
|
-
createAzureTfOutput(`${id}-functionAppFriendlyUniqueId`, scope, functionApp.friendlyUniqueId)
|
|
56
|
-
createAzureTfOutput(`${id}-functionAppId`, scope, functionApp.id)
|
|
57
|
-
|
|
58
|
-
return functionApp
|
|
55
|
+
{ parent: scope }
|
|
56
|
+
)
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
/**
|
|
62
|
-
* @summary Method to create a new function
|
|
60
|
+
* @summary Method to create a new function within a function app
|
|
63
61
|
* @param id scoped id of the resource
|
|
64
62
|
* @param scope scope in which this resource is defined
|
|
65
63
|
* @param props function properties
|
|
66
|
-
* @see [
|
|
64
|
+
* @see [Pulumi Azure Native Function Envelope]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webappfunction/}
|
|
65
|
+
* @note In Pulumi, individual functions are typically deployed via code deployment rather than as separate infrastructure resources.
|
|
66
|
+
* This method is provided for API compatibility but may require additional setup.
|
|
67
67
|
*/
|
|
68
68
|
public createFunction(id: string, scope: CommonAzureConstruct, props: FunctionProps) {
|
|
69
69
|
if (!props) throw `Props undefined for ${id}`
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
createAzureTfOutput(`${id}-functionName`, scope, functionAppFunction.name)
|
|
78
|
-
createAzureTfOutput(`${id}-functionFriendlyUniqueId`, scope, functionAppFunction.friendlyUniqueId)
|
|
79
|
-
createAzureTfOutput(`${id}-functionId`, scope, functionAppFunction.id)
|
|
71
|
+
// Get resource group name
|
|
72
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
73
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
74
|
+
: ''
|
|
80
75
|
|
|
81
|
-
return
|
|
76
|
+
return new WebAppFunction(
|
|
77
|
+
`${id}-fc`,
|
|
78
|
+
{
|
|
79
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
|
|
80
|
+
resourceGroupName: resourceGroupName,
|
|
81
|
+
functionAppId: props.functionAppId,
|
|
82
|
+
config: props.configJson,
|
|
83
|
+
isDisabled: props.enabled !== undefined ? !props.enabled : false,
|
|
84
|
+
testData: props.testData,
|
|
85
|
+
} as any,
|
|
86
|
+
{ parent: scope }
|
|
87
|
+
)
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
/**
|
|
@@ -86,6 +92,7 @@ export class AzureFunctionManager {
|
|
|
86
92
|
* @param id scoped id of the resource
|
|
87
93
|
* @param scope scope in which this resource is defined
|
|
88
94
|
* @param props flex consumption function app properties
|
|
95
|
+
* @see [Pulumi Azure Native Function App (Flex Consumption)]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
|
|
89
96
|
*/
|
|
90
97
|
public createFunctionAppFlexConsumption(
|
|
91
98
|
id: string,
|
|
@@ -94,37 +101,33 @@ export class AzureFunctionManager {
|
|
|
94
101
|
) {
|
|
95
102
|
if (!props) throw `Props undefined for ${id}`
|
|
96
103
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})
|
|
104
|
+
// Get resource group name
|
|
105
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
106
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
107
|
+
: props.resourceGroupName
|
|
102
108
|
|
|
103
|
-
if (!
|
|
109
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
return new WebApp(
|
|
112
|
+
`${id}-fc`,
|
|
113
|
+
{
|
|
114
|
+
...props,
|
|
115
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
|
|
116
|
+
location: props.location ?? scope.props.location,
|
|
117
|
+
resourceGroupName: resourceGroupName,
|
|
118
|
+
kind: props.kind ?? 'functionapp,linux',
|
|
119
|
+
identity: props.identity ?? {
|
|
120
|
+
type: ManagedServiceIdentityType.SystemAssigned,
|
|
121
|
+
},
|
|
122
|
+
siteConfig: props.siteConfig ?? {
|
|
123
|
+
http20Enabled: true,
|
|
124
|
+
linuxFxVersion: `${props.runtimeName ?? 'node'}|${props.runtimeVersion ?? '22'}`,
|
|
125
|
+
},
|
|
126
|
+
tags: props.tags ?? {
|
|
127
|
+
environment: scope.props.stage,
|
|
128
|
+
},
|
|
119
129
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
tags: props.tags ?? {
|
|
124
|
-
environment: scope.props.stage,
|
|
125
|
-
},
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
return functionApp
|
|
130
|
+
{ parent: scope }
|
|
131
|
+
)
|
|
129
132
|
}
|
|
130
133
|
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FunctionAppFunctionConfig } from '@cdktf/provider-azurerm/lib/function-app-function/index.js'
|
|
3
|
-
import { FunctionAppFlexConsumptionConfig } from '@cdktf/provider-azurerm/lib/function-app-flex-consumption/index.js'
|
|
1
|
+
import { WebAppArgs } from '@pulumi/azure-native/web/index.js'
|
|
4
2
|
|
|
5
|
-
export interface FunctionAppProps extends
|
|
3
|
+
export interface FunctionAppProps extends WebAppArgs {
|
|
4
|
+
name?: string
|
|
5
|
+
}
|
|
6
6
|
|
|
7
|
-
export interface FunctionProps
|
|
7
|
+
export interface FunctionProps {
|
|
8
|
+
name: string
|
|
9
|
+
functionAppId: string
|
|
10
|
+
language?: string
|
|
11
|
+
configJson?: any
|
|
12
|
+
testData?: string
|
|
13
|
+
enabled?: boolean
|
|
14
|
+
}
|
|
8
15
|
|
|
9
|
-
export interface FunctionAppFlexConsumptionProps extends
|
|
16
|
+
export interface FunctionAppFlexConsumptionProps extends WebAppArgs {
|
|
17
|
+
name?: string
|
|
18
|
+
runtimeName?: string
|
|
19
|
+
runtimeVersion?: string
|
|
20
|
+
storageAuthenticationType?: string
|
|
21
|
+
storageContainerType?: string
|
|
22
|
+
maximumInstanceCount?: number
|
|
23
|
+
instanceMemoryInMb?: number
|
|
24
|
+
}
|
|
@@ -7,7 +7,7 @@ export * from './dns/index.js'
|
|
|
7
7
|
export * from './eventgrid/index.js'
|
|
8
8
|
export * from './function/index.js'
|
|
9
9
|
export * from './key-vault/index.js'
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './operational-insights/index.js'
|
|
11
11
|
export * from './monitor/index.js'
|
|
12
12
|
export * from './redis/index.js'
|
|
13
13
|
export * from './resource-group/index.js'
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KeyVault } from '@cdktf/provider-azurerm/lib/key-vault/index.js'
|
|
1
|
+
import { SkuFamily, SkuName, Vault } from '@pulumi/azure-native/keyvault/index.js'
|
|
3
2
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
4
|
-
import { createAzureTfOutput } from '../../utils/index.js'
|
|
5
3
|
import { KeyVaultProps } from './types.js'
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
* @classdesc Provides operations on Azure Key Vault
|
|
6
|
+
* @classdesc Provides operations on Azure Key Vault using Pulumi
|
|
9
7
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
10
8
|
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
11
9
|
* @example
|
|
12
|
-
* ```
|
|
10
|
+
* ```typescript
|
|
13
11
|
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
14
12
|
*
|
|
15
13
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
16
|
-
* constructor(
|
|
17
|
-
* super(
|
|
14
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(name, props)
|
|
18
16
|
* this.props = props
|
|
19
17
|
* this.keyVaultManager.createKeyVault('MyKeyVault', this, props)
|
|
20
18
|
* }
|
|
@@ -27,37 +25,45 @@ export class AzureKeyVaultManager {
|
|
|
27
25
|
* @param id scoped id of the resource
|
|
28
26
|
* @param scope scope in which this resource is defined
|
|
29
27
|
* @param props key vault properties
|
|
30
|
-
* @see [
|
|
28
|
+
* @see [Pulumi Azure Native Key Vault]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/keyvault/vault/}
|
|
31
29
|
*/
|
|
32
30
|
public createKeyVault(id: string, scope: CommonAzureConstruct, props: KeyVaultProps) {
|
|
33
31
|
if (!props) throw `Props undefined for ${id}`
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
33
|
+
// Get resource group name
|
|
34
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
35
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
36
|
+
: props.resourceGroupName
|
|
40
37
|
|
|
41
|
-
if (!
|
|
38
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
return new Vault(
|
|
41
|
+
`${id}-kv`,
|
|
42
|
+
{
|
|
43
|
+
...props,
|
|
44
|
+
vaultName: scope.resourceNameFormatter.format(
|
|
45
|
+
props.vaultName?.toString(),
|
|
46
|
+
scope.props.resourceNameOptions?.keyVault
|
|
47
|
+
),
|
|
48
|
+
location: props.location ?? scope.props.location,
|
|
49
|
+
resourceGroupName: resourceGroupName,
|
|
50
|
+
properties: {
|
|
51
|
+
...(props.properties as any),
|
|
52
|
+
sku: (props.properties as any)?.sku ?? {
|
|
53
|
+
family: SkuFamily.A,
|
|
54
|
+
name: SkuName.Standard,
|
|
55
|
+
},
|
|
56
|
+
tenantId: (props.properties as any)?.tenantId ?? scope.props.tenantId ?? '',
|
|
57
|
+
enableRbacAuthorization: (props.properties as any)?.enableRbacAuthorization ?? true,
|
|
58
|
+
enableSoftDelete: (props.properties as any)?.enableSoftDelete ?? true,
|
|
59
|
+
softDeleteRetentionInDays: (props.properties as any)?.softDeleteRetentionInDays ?? 90,
|
|
60
|
+
enablePurgeProtection: (props.properties as any)?.enablePurgeProtection ?? true,
|
|
61
|
+
},
|
|
62
|
+
tags: props.tags ?? {
|
|
63
|
+
environment: scope.props.stage,
|
|
64
|
+
},
|
|
54
65
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
createAzureTfOutput(`${id}-keyVaultName`, scope, keyVault.name)
|
|
58
|
-
createAzureTfOutput(`${id}-keyVaultFriendlyUniqueId`, scope, keyVault.friendlyUniqueId)
|
|
59
|
-
createAzureTfOutput(`${id}-keyVaultId`, scope, keyVault.id)
|
|
60
|
-
|
|
61
|
-
return keyVault
|
|
66
|
+
{ parent: scope }
|
|
67
|
+
)
|
|
62
68
|
}
|
|
63
69
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VaultArgs } from '@pulumi/azure-native/keyvault/index.js'
|
|
2
2
|
|
|
3
|
-
export interface KeyVaultProps extends
|
|
3
|
+
export interface KeyVaultProps extends VaultArgs {
|
|
4
|
+
name?: string
|
|
5
|
+
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DiagnosticSetting } from '@pulumi/azure-native/monitor/index.js'
|
|
2
2
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
|
-
import { createAzureTfOutput } from '../../utils/index.js'
|
|
4
3
|
import { MonitorDiagnosticSettingProps } from './types.js'
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* @classdesc Provides operations on Azure
|
|
6
|
+
* @classdesc Provides operations on Azure Monitor using Pulumi
|
|
8
7
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
9
8
|
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
10
9
|
* @example
|
|
11
|
-
* ```
|
|
10
|
+
* ```typescript
|
|
12
11
|
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
12
|
*
|
|
14
13
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
-
* constructor(
|
|
16
|
-
* super(
|
|
14
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(name, props)
|
|
17
16
|
* this.props = props
|
|
18
|
-
* this.monitorManager.
|
|
17
|
+
* this.monitorManager.createMonitorDiagnosticSettings('MyMonitor', this, props)
|
|
19
18
|
* }
|
|
20
19
|
* }
|
|
21
20
|
* ```
|
|
@@ -26,7 +25,7 @@ export class AzureMonitorManager {
|
|
|
26
25
|
* @param id scoped id of the resource
|
|
27
26
|
* @param scope scope in which this resource is defined
|
|
28
27
|
* @param props monitor diagnostics settings properties
|
|
29
|
-
* @see [
|
|
28
|
+
* @see [Pulumi Azure Native Monitor Diagnostic Settings]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/}
|
|
30
29
|
*/
|
|
31
30
|
public createMonitorDiagnosticSettings(
|
|
32
31
|
id: string,
|
|
@@ -35,19 +34,16 @@ export class AzureMonitorManager {
|
|
|
35
34
|
) {
|
|
36
35
|
if (!props) throw `Props undefined for ${id}`
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
return new DiagnosticSetting(
|
|
38
|
+
`${id}-ds`,
|
|
39
|
+
{
|
|
40
|
+
...props,
|
|
41
|
+
name: scope.resourceNameFormatter.format(
|
|
42
|
+
props.name?.toString(),
|
|
43
|
+
scope.props.resourceNameOptions?.monitorDiagnosticSetting
|
|
44
|
+
),
|
|
45
|
+
},
|
|
46
|
+
{ parent: scope }
|
|
48
47
|
)
|
|
49
|
-
createAzureTfOutput(`${id}-monitorDiagnosticSettingId`, scope, monitorDiagnosticSetting.id)
|
|
50
|
-
|
|
51
|
-
return monitorDiagnosticSetting
|
|
52
48
|
}
|
|
53
49
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DiagnosticSettingArgs } from '@pulumi/azure-native/monitor/index.js'
|
|
2
2
|
|
|
3
|
-
export interface MonitorDiagnosticSettingProps extends
|
|
3
|
+
export interface MonitorDiagnosticSettingProps extends DiagnosticSettingArgs {}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Workspace, WorkspaceSkuNameEnum } from '@pulumi/azure-native/operationalinsights/index.js'
|
|
2
|
+
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
|
+
import { WorkspaceProps } from './types.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @classdesc Provides operations on Azure Log Analytics Workspace using Pulumi
|
|
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
|
+
* ```typescript
|
|
11
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
12
|
+
*
|
|
13
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
14
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(name, props)
|
|
16
|
+
* this.props = props
|
|
17
|
+
* this.logAnalyticsWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class AzureOperationalInsightsManager {
|
|
23
|
+
/**
|
|
24
|
+
* @summary Method to create a new log analytics workspace
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props log analytics workspace properties
|
|
28
|
+
* @see [Pulumi Azure Native Operational Insights Workspace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/operationalinsights/workspace/}
|
|
29
|
+
*/
|
|
30
|
+
public createWorkspace(id: string, scope: CommonAzureConstruct, props: WorkspaceProps) {
|
|
31
|
+
if (!props) throw `Props undefined for ${id}`
|
|
32
|
+
|
|
33
|
+
// Get resource group name
|
|
34
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
35
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
36
|
+
: props.resourceGroupName
|
|
37
|
+
|
|
38
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
39
|
+
|
|
40
|
+
return new Workspace(
|
|
41
|
+
`${id}-lw`,
|
|
42
|
+
{
|
|
43
|
+
...props,
|
|
44
|
+
workspaceName: scope.resourceNameFormatter.format(
|
|
45
|
+
props.workspaceName?.toString(),
|
|
46
|
+
scope.props.resourceNameOptions?.logAnalyticsWorkspace
|
|
47
|
+
),
|
|
48
|
+
location: props.location ?? scope.props.location,
|
|
49
|
+
resourceGroupName: resourceGroupName,
|
|
50
|
+
sku: props.sku ?? {
|
|
51
|
+
name: WorkspaceSkuNameEnum.PerGB2018,
|
|
52
|
+
},
|
|
53
|
+
retentionInDays: props.retentionInDays ?? 30,
|
|
54
|
+
tags: props.tags ?? {
|
|
55
|
+
environment: scope.props.stage,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{ parent: scope }
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ManagedRedis } from '@cdktf/provider-azurerm/lib/managed-redis/index.js'
|
|
1
|
+
import { Redis, SkuFamily, SkuName } from '@pulumi/azure-native/redis/index.js'
|
|
3
2
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
4
|
-
import { createAzureTfOutput } from '../../utils/index.js'
|
|
5
3
|
import { ManagedRedisProps } from './types.js'
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
* @classdesc Provides operations on Azure Redis
|
|
6
|
+
* @classdesc Provides operations on Azure Redis using Pulumi
|
|
9
7
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
10
8
|
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
11
9
|
* @example
|
|
12
|
-
* ```
|
|
10
|
+
* ```typescript
|
|
13
11
|
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
14
12
|
*
|
|
15
13
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
16
|
-
* constructor(
|
|
17
|
-
* super(
|
|
14
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
15
|
+
* super(name, props)
|
|
18
16
|
* this.props = props
|
|
19
|
-
* this.redisManager.
|
|
17
|
+
* this.redisManager.createManagedRedis('MyManagedRedis', this, props)
|
|
20
18
|
* }
|
|
21
19
|
* }
|
|
22
20
|
* ```
|
|
23
21
|
*/
|
|
24
22
|
export class AzureRedisManager {
|
|
25
23
|
/**
|
|
26
|
-
* @summary Method to create a new redis cache
|
|
24
|
+
* @summary Method to create a new managed redis cache
|
|
27
25
|
* @param id scoped id of the resource
|
|
28
26
|
* @param scope scope in which this resource is defined
|
|
29
27
|
* @param props redis cache properties
|
|
30
|
-
* @see [
|
|
28
|
+
* @see [Pulumi Azure Native Redis]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/cache/redis/}
|
|
31
29
|
*/
|
|
32
30
|
public createManagedRedis(id: string, scope: CommonAzureConstruct, props: ManagedRedisProps) {
|
|
33
31
|
if (!props) throw `Props undefined for ${id}`
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
33
|
+
// Get resource group name
|
|
34
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
35
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
36
|
+
: props.resourceGroupName
|
|
40
37
|
|
|
41
|
-
if (!
|
|
38
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
return new Redis(
|
|
41
|
+
`${id}-rc`,
|
|
42
|
+
{
|
|
43
|
+
...props,
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.managedRedis),
|
|
45
|
+
location: props.location ?? scope.props.location,
|
|
46
|
+
resourceGroupName: resourceGroupName,
|
|
47
|
+
sku: props.sku ?? {
|
|
48
|
+
name: SkuName.Basic,
|
|
49
|
+
family: SkuFamily.C,
|
|
50
|
+
capacity: 0,
|
|
51
|
+
},
|
|
52
|
+
tags: props.tags ?? {
|
|
53
|
+
environment: scope.props.stage,
|
|
54
|
+
},
|
|
50
55
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
createAzureTfOutput(`${id}-managedRedisName`, scope, managedRedis.name)
|
|
54
|
-
createAzureTfOutput(`${id}-managedRedisFriendlyUniqueId`, scope, managedRedis.friendlyUniqueId)
|
|
55
|
-
createAzureTfOutput(`${id}-managedRedisId`, scope, managedRedis.id)
|
|
56
|
-
|
|
57
|
-
return managedRedis
|
|
56
|
+
{ parent: scope }
|
|
57
|
+
)
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RedisArgs } from '@pulumi/azure-native/redis/index.js'
|
|
2
2
|
|
|
3
|
-
export interface ManagedRedisProps extends
|
|
3
|
+
export interface ManagedRedisProps extends RedisArgs {}
|