@gradientedge/cdk-utils 10.6.0 → 10.8.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/app/api-destined-function/src/lib/lambda.d.ts +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.d.ts.map +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.js +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.js.map +1 -0
- package/dist/app/api-destined-function/tsconfig.tsbuildinfo +1 -0
- package/dist/src/lib/aws/services/cloudwatch/main.d.ts +11 -11
- package/dist/src/lib/azure/common/constants.d.ts +74 -0
- package/dist/src/lib/azure/common/constants.js +77 -0
- package/dist/src/lib/azure/common/construct.d.ts +15 -3
- package/dist/src/lib/azure/common/construct.js +40 -4
- package/dist/src/lib/azure/common/stack.d.ts +3 -2
- package/dist/src/lib/azure/common/stack.js +25 -42
- package/dist/src/lib/azure/common/types.d.ts +13 -2
- package/dist/src/lib/azure/construct/event-handler/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/event-handler/index.js +2 -0
- package/dist/src/lib/azure/construct/event-handler/main.d.ts +20 -0
- package/dist/src/lib/azure/construct/event-handler/main.js +139 -0
- package/dist/src/lib/azure/construct/event-handler/types.d.ts +35 -0
- package/dist/src/lib/azure/construct/event-handler/types.js +1 -0
- package/dist/src/lib/azure/construct/function-app/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/function-app/index.js +2 -0
- package/dist/src/lib/azure/construct/function-app/main.d.ts +51 -0
- package/dist/src/lib/azure/construct/function-app/main.js +297 -0
- package/dist/src/lib/azure/construct/function-app/types.d.ts +33 -0
- package/dist/src/lib/azure/construct/function-app/types.js +1 -0
- package/dist/src/lib/azure/construct/index.d.ts +6 -0
- package/dist/src/lib/azure/construct/index.js +6 -0
- package/dist/src/lib/azure/construct/rest-api/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api/main.d.ts +20 -0
- package/dist/src/lib/azure/construct/rest-api/main.js +172 -0
- package/dist/src/lib/azure/construct/rest-api/types.d.ts +25 -0
- package/dist/src/lib/azure/construct/rest-api/types.js +1 -0
- package/dist/src/lib/azure/construct/rest-api-function/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api-function/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api-function/main.d.ts +19 -0
- package/dist/src/lib/azure/construct/rest-api-function/main.js +255 -0
- package/dist/src/lib/azure/construct/rest-api-function/types.d.ts +29 -0
- package/dist/src/lib/azure/construct/rest-api-function/types.js +1 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/main.d.ts +12 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/main.js +56 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/types.d.ts +13 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/types.js +1 -0
- package/dist/src/lib/azure/construct/site-with-webapp/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/site-with-webapp/index.js +2 -0
- package/dist/src/lib/azure/construct/site-with-webapp/main.d.ts +19 -0
- package/dist/src/lib/azure/construct/site-with-webapp/main.js +135 -0
- package/dist/src/lib/azure/construct/site-with-webapp/types.d.ts +30 -0
- package/dist/src/lib/azure/construct/site-with-webapp/types.js +1 -0
- package/dist/src/lib/azure/index.d.ts +1 -0
- package/dist/src/lib/azure/index.js +1 -0
- package/dist/src/lib/azure/services/api-management/main.d.ts +83 -5
- package/dist/src/lib/azure/services/api-management/main.js +114 -148
- package/dist/src/lib/azure/services/api-management/types.d.ts +22 -1
- package/dist/src/lib/azure/services/app-configuration/main.d.ts +13 -1
- package/dist/src/lib/azure/services/app-configuration/main.js +21 -2
- package/dist/src/lib/azure/services/app-service/main.d.ts +5 -2
- package/dist/src/lib/azure/services/app-service/main.js +12 -4
- package/dist/src/lib/azure/services/application-insights/main.d.ts +15 -4
- package/dist/src/lib/azure/services/application-insights/main.js +27 -6
- package/dist/src/lib/azure/services/application-insights/types.d.ts +4 -1
- package/dist/src/lib/azure/services/authorisation/constants.d.ts +13 -0
- package/dist/src/lib/azure/services/authorisation/constants.js +14 -0
- package/dist/src/lib/azure/services/authorisation/index.d.ts +3 -0
- package/dist/src/lib/azure/services/authorisation/index.js +3 -0
- package/dist/src/lib/azure/services/authorisation/main.d.ts +84 -0
- package/dist/src/lib/azure/services/authorisation/main.js +120 -0
- package/dist/src/lib/azure/services/authorisation/types.d.ts +3 -0
- package/dist/src/lib/azure/services/authorisation/types.js +1 -0
- package/dist/src/lib/azure/services/cosmosdb/constants.d.ts +8 -0
- package/dist/src/lib/azure/services/cosmosdb/constants.js +10 -0
- package/dist/src/lib/azure/services/cosmosdb/index.d.ts +1 -0
- package/dist/src/lib/azure/services/cosmosdb/index.js +1 -0
- package/dist/src/lib/azure/services/cosmosdb/main.d.ts +47 -5
- package/dist/src/lib/azure/services/cosmosdb/main.js +77 -8
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +3 -1
- package/dist/src/lib/azure/services/dns/main.d.ts +9 -4
- package/dist/src/lib/azure/services/dns/main.js +12 -8
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +12 -7
- package/dist/src/lib/azure/services/eventgrid/main.js +18 -19
- package/dist/src/lib/azure/services/function/main.d.ts +16 -3
- package/dist/src/lib/azure/services/function/main.js +122 -8
- package/dist/src/lib/azure/services/function/types.d.ts +3 -4
- package/dist/src/lib/azure/services/index.d.ts +3 -0
- package/dist/src/lib/azure/services/index.js +3 -0
- package/dist/src/lib/azure/services/key-vault/main.d.ts +22 -2
- package/dist/src/lib/azure/services/key-vault/main.js +28 -3
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
- package/dist/src/lib/azure/services/monitor/main.d.ts +3 -1
- package/dist/src/lib/azure/services/monitor/main.js +3 -2
- package/dist/src/lib/azure/services/operational-insights/main.d.ts +13 -2
- package/dist/src/lib/azure/services/operational-insights/main.js +17 -3
- package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -1
- package/dist/src/lib/azure/services/portal/error.d.ts +5 -0
- package/dist/src/lib/azure/services/portal/error.js +10 -0
- package/dist/src/lib/azure/services/portal/index.d.ts +4 -0
- package/dist/src/lib/azure/services/portal/index.js +4 -0
- package/dist/src/lib/azure/services/portal/main.d.ts +33 -0
- package/dist/src/lib/azure/services/portal/main.js +51 -0
- package/dist/src/lib/azure/services/portal/renderer.d.ts +11 -0
- package/dist/src/lib/azure/services/portal/renderer.js +156 -0
- package/dist/src/lib/azure/services/portal/types.d.ts +40 -0
- package/dist/src/lib/azure/services/portal/types.js +1 -0
- package/dist/src/lib/azure/services/redis/main.d.ts +4 -2
- package/dist/src/lib/azure/services/redis/main.js +3 -2
- package/dist/src/lib/azure/services/redis/types.d.ts +1 -1
- package/dist/src/lib/azure/services/resource-group/main.d.ts +10 -1
- package/dist/src/lib/azure/services/resource-group/main.js +17 -3
- package/dist/src/lib/azure/services/security-center/index.d.ts +2 -0
- package/dist/src/lib/azure/services/security-center/index.js +2 -0
- package/dist/src/lib/azure/services/security-center/main.d.ts +31 -0
- package/dist/src/lib/azure/services/security-center/main.js +33 -0
- package/dist/src/lib/azure/services/security-center/types.d.ts +3 -0
- package/dist/src/lib/azure/services/security-center/types.js +1 -0
- package/dist/src/lib/azure/services/servicebus/main.d.ts +28 -22
- package/dist/src/lib/azure/services/servicebus/main.js +31 -26
- package/dist/src/lib/azure/services/servicebus/types.d.ts +4 -4
- package/dist/src/lib/azure/services/storage/main.d.ts +26 -5
- package/dist/src/lib/azure/services/storage/main.js +51 -9
- package/dist/src/lib/azure/services/storage/types.d.ts +7 -2
- package/dist/src/lib/cloudflare/common/construct.js +1 -1
- package/dist/src/lib/cloudflare/common/stack.d.ts +2 -2
- package/dist/src/lib/cloudflare/common/stack.js +25 -25
- package/dist/src/lib/cloudflare/services/worker/main.js +8 -1
- package/dist/src/lib/cloudflare/services/worker/types.d.ts +1 -0
- package/package.json +26 -23
- package/src/lib/azure/common/constants.ts +83 -0
- package/src/lib/azure/common/construct.ts +50 -7
- package/src/lib/azure/common/stack.ts +26 -43
- package/src/lib/azure/common/types.ts +14 -2
- package/src/lib/azure/construct/event-handler/index.ts +2 -0
- package/src/lib/azure/construct/event-handler/main.ts +183 -0
- package/src/lib/azure/construct/event-handler/types.ts +49 -0
- package/src/lib/azure/construct/function-app/index.ts +2 -0
- package/src/lib/azure/construct/function-app/main.ts +410 -0
- package/src/lib/azure/construct/function-app/types.ts +45 -0
- package/src/lib/azure/construct/index.ts +6 -0
- package/src/lib/azure/construct/rest-api/index.ts +2 -0
- package/src/lib/azure/construct/rest-api/main.ts +205 -0
- package/src/lib/azure/construct/rest-api/types.ts +33 -0
- package/src/lib/azure/construct/rest-api-function/index.ts +2 -0
- package/src/lib/azure/construct/rest-api-function/main.ts +297 -0
- package/src/lib/azure/construct/rest-api-function/types.ts +39 -0
- package/src/lib/azure/construct/rest-api-with-cache/index.ts +2 -0
- package/src/lib/azure/construct/rest-api-with-cache/main.ts +75 -0
- package/src/lib/azure/construct/rest-api-with-cache/types.ts +15 -0
- package/src/lib/azure/construct/site-with-webapp/index.ts +2 -0
- package/src/lib/azure/construct/site-with-webapp/main.ts +160 -0
- package/src/lib/azure/construct/site-with-webapp/types.ts +33 -0
- package/src/lib/azure/index.ts +1 -0
- package/src/lib/azure/services/api-management/main.ts +168 -152
- package/src/lib/azure/services/api-management/types.ts +30 -1
- package/src/lib/azure/services/app-configuration/main.ts +29 -2
- package/src/lib/azure/services/app-service/main.ts +23 -4
- package/src/lib/azure/services/application-insights/main.ts +46 -7
- package/src/lib/azure/services/application-insights/types.ts +6 -2
- package/src/lib/azure/services/authorisation/constants.ts +13 -0
- package/src/lib/azure/services/authorisation/index.ts +3 -0
- package/src/lib/azure/services/authorisation/main.ts +202 -0
- package/src/lib/azure/services/authorisation/types.ts +3 -0
- package/src/lib/azure/services/cosmosdb/constants.ts +9 -0
- package/src/lib/azure/services/cosmosdb/index.ts +1 -0
- package/src/lib/azure/services/cosmosdb/main.ts +158 -8
- package/src/lib/azure/services/cosmosdb/types.ts +3 -0
- package/src/lib/azure/services/dns/main.ts +33 -8
- package/src/lib/azure/services/eventgrid/main.ts +41 -23
- package/src/lib/azure/services/function/main.ts +155 -9
- package/src/lib/azure/services/function/types.ts +3 -4
- package/src/lib/azure/services/index.ts +3 -0
- package/src/lib/azure/services/key-vault/main.ts +47 -4
- package/src/lib/azure/services/key-vault/types.ts +4 -4
- package/src/lib/azure/services/monitor/main.ts +5 -2
- package/src/lib/azure/services/operational-insights/main.ts +30 -4
- package/src/lib/azure/services/operational-insights/types.ts +3 -1
- package/src/lib/azure/services/portal/error.ts +12 -0
- package/src/lib/azure/services/portal/index.ts +4 -0
- package/src/lib/azure/services/portal/main.ts +81 -0
- package/src/lib/azure/services/portal/renderer.ts +182 -0
- package/src/lib/azure/services/portal/types.ts +45 -0
- package/src/lib/azure/services/redis/main.ts +10 -3
- package/src/lib/azure/services/redis/types.ts +1 -1
- package/src/lib/azure/services/resource-group/main.ts +34 -3
- package/src/lib/azure/services/security-center/index.ts +2 -0
- package/src/lib/azure/services/security-center/main.ts +42 -0
- package/src/lib/azure/services/security-center/types.ts +3 -0
- package/src/lib/azure/services/servicebus/main.ts +61 -30
- package/src/lib/azure/services/servicebus/types.ts +4 -4
- package/src/lib/azure/services/storage/main.ts +91 -9
- package/src/lib/azure/services/storage/types.ts +11 -2
- package/src/lib/cloudflare/common/construct.ts +1 -1
- package/src/lib/cloudflare/common/stack.ts +25 -25
- package/src/lib/cloudflare/services/worker/main.ts +10 -1
- package/src/lib/cloudflare/services/worker/types.ts +8 -1
- package/dist/lib/lambda.d.ts +0 -17
- package/dist/lib/lambda.d.ts.map +0 -1
- package/dist/lib/lambda.js +0 -28
- package/dist/lib/lambda.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Deployment, DeploymentMode, Resource } from '@pulumi/azure-native/resources/index.js'
|
|
1
2
|
import { ManagedServiceIdentityType, WebApp, WebAppFunction } from '@pulumi/azure-native/web/index.js'
|
|
2
|
-
import {
|
|
3
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
4
|
+
import { CommonAzureConstruct, CommonAzureStack } from '../../common/index.js'
|
|
3
5
|
import { FunctionAppFlexConsumptionProps, FunctionAppProps, FunctionProps } from './types.js'
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -25,9 +27,15 @@ export class AzureFunctionManager {
|
|
|
25
27
|
* @param id scoped id of the resource
|
|
26
28
|
* @param scope scope in which this resource is defined
|
|
27
29
|
* @param props function app properties
|
|
30
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
31
|
* @see [Pulumi Azure Native Function App]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
|
|
29
32
|
*/
|
|
30
|
-
public createFunctionApp(
|
|
33
|
+
public createFunctionApp(
|
|
34
|
+
id: string,
|
|
35
|
+
scope: CommonAzureConstruct,
|
|
36
|
+
props: FunctionAppProps,
|
|
37
|
+
resourceOptions?: ResourceOptions
|
|
38
|
+
) {
|
|
31
39
|
if (!props) throw `Props undefined for ${id}`
|
|
32
40
|
|
|
33
41
|
// Get resource group name
|
|
@@ -52,7 +60,7 @@ export class AzureFunctionManager {
|
|
|
52
60
|
environment: scope.props.stage,
|
|
53
61
|
},
|
|
54
62
|
},
|
|
55
|
-
{ parent: scope }
|
|
63
|
+
{ parent: scope, ...resourceOptions }
|
|
56
64
|
)
|
|
57
65
|
}
|
|
58
66
|
|
|
@@ -61,11 +69,17 @@ export class AzureFunctionManager {
|
|
|
61
69
|
* @param id scoped id of the resource
|
|
62
70
|
* @param scope scope in which this resource is defined
|
|
63
71
|
* @param props function properties
|
|
72
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
64
73
|
* @see [Pulumi Azure Native Function Envelope]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webappfunction/}
|
|
65
74
|
* @note In Pulumi, individual functions are typically deployed via code deployment rather than as separate infrastructure resources.
|
|
66
75
|
* This method is provided for API compatibility but may require additional setup.
|
|
67
76
|
*/
|
|
68
|
-
public createFunction(
|
|
77
|
+
public createFunction(
|
|
78
|
+
id: string,
|
|
79
|
+
scope: CommonAzureConstruct,
|
|
80
|
+
props: FunctionProps,
|
|
81
|
+
resourceOptions?: ResourceOptions
|
|
82
|
+
) {
|
|
69
83
|
if (!props) throw `Props undefined for ${id}`
|
|
70
84
|
|
|
71
85
|
// Get resource group name
|
|
@@ -83,7 +97,7 @@ export class AzureFunctionManager {
|
|
|
83
97
|
isDisabled: props.enabled !== undefined ? !props.enabled : false,
|
|
84
98
|
testData: props.testData,
|
|
85
99
|
} as any,
|
|
86
|
-
{ parent: scope }
|
|
100
|
+
{ parent: scope, ...resourceOptions }
|
|
87
101
|
)
|
|
88
102
|
}
|
|
89
103
|
|
|
@@ -92,12 +106,14 @@ export class AzureFunctionManager {
|
|
|
92
106
|
* @param id scoped id of the resource
|
|
93
107
|
* @param scope scope in which this resource is defined
|
|
94
108
|
* @param props flex consumption function app properties
|
|
109
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
95
110
|
* @see [Pulumi Azure Native Function App (Flex Consumption)]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
|
|
96
111
|
*/
|
|
97
112
|
public createFunctionAppFlexConsumption(
|
|
98
113
|
id: string,
|
|
99
114
|
scope: CommonAzureConstruct,
|
|
100
|
-
props: FunctionAppFlexConsumptionProps
|
|
115
|
+
props: FunctionAppFlexConsumptionProps,
|
|
116
|
+
resourceOptions?: ResourceOptions
|
|
101
117
|
) {
|
|
102
118
|
if (!props) throw `Props undefined for ${id}`
|
|
103
119
|
|
|
@@ -108,7 +124,7 @@ export class AzureFunctionManager {
|
|
|
108
124
|
|
|
109
125
|
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
110
126
|
|
|
111
|
-
|
|
127
|
+
const functionApp = new WebApp(
|
|
112
128
|
`${id}-fc`,
|
|
113
129
|
{
|
|
114
130
|
...props,
|
|
@@ -116,18 +132,148 @@ export class AzureFunctionManager {
|
|
|
116
132
|
location: props.location ?? scope.props.location,
|
|
117
133
|
resourceGroupName: resourceGroupName,
|
|
118
134
|
kind: props.kind ?? 'functionapp,linux',
|
|
135
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
119
136
|
identity: props.identity ?? {
|
|
120
137
|
type: ManagedServiceIdentityType.SystemAssigned,
|
|
121
138
|
},
|
|
139
|
+
functionAppConfig: props.functionAppConfig ?? {
|
|
140
|
+
runtime: {
|
|
141
|
+
...props.runtime,
|
|
142
|
+
name: props.runtime?.name ?? 'node',
|
|
143
|
+
version: props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME,
|
|
144
|
+
},
|
|
145
|
+
scaleAndConcurrency: {
|
|
146
|
+
...props.scaleAndConcurrency,
|
|
147
|
+
instanceMemoryMB: props.scaleAndConcurrency?.instanceMemoryMB ?? 4096,
|
|
148
|
+
maximumInstanceCount: props.scaleAndConcurrency?.maximumInstanceCount ?? 40,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
122
151
|
siteConfig: props.siteConfig ?? {
|
|
123
152
|
http20Enabled: true,
|
|
124
|
-
linuxFxVersion: `${props.
|
|
153
|
+
linuxFxVersion: `${props.runtime?.name ?? 'node'}|${props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME}`,
|
|
125
154
|
},
|
|
126
155
|
tags: props.tags ?? {
|
|
127
156
|
environment: scope.props.stage,
|
|
128
157
|
},
|
|
129
158
|
},
|
|
130
|
-
{ parent: scope }
|
|
159
|
+
{ parent: scope, ...resourceOptions }
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const functionAppConfig = props.functionAppConfig as Record<string, any> | undefined
|
|
163
|
+
|
|
164
|
+
new Deployment(
|
|
165
|
+
`${id}-deployment`,
|
|
166
|
+
{
|
|
167
|
+
resourceGroupName: resourceGroupName,
|
|
168
|
+
properties: {
|
|
169
|
+
mode: DeploymentMode.Incremental,
|
|
170
|
+
template: {
|
|
171
|
+
$schema: 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#',
|
|
172
|
+
contentVersion: '1.0.0.0',
|
|
173
|
+
resources: [
|
|
174
|
+
{
|
|
175
|
+
type: 'Microsoft.Web/sites',
|
|
176
|
+
apiVersion: '2024-04-01',
|
|
177
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
|
|
178
|
+
location: props.location ?? scope.props.location,
|
|
179
|
+
properties: {
|
|
180
|
+
functionAppConfig: {
|
|
181
|
+
...props.functionAppConfig,
|
|
182
|
+
runtime: {
|
|
183
|
+
...props.runtime,
|
|
184
|
+
name: props.runtime?.name ?? functionAppConfig?.runtime?.name ?? 'node',
|
|
185
|
+
version:
|
|
186
|
+
props.runtime?.version ??
|
|
187
|
+
functionAppConfig?.runtime?.version ??
|
|
188
|
+
CommonAzureStack.NODEJS_RUNTIME,
|
|
189
|
+
},
|
|
190
|
+
scaleAndConcurrency: {
|
|
191
|
+
...props.scaleAndConcurrency,
|
|
192
|
+
instanceMemoryMB:
|
|
193
|
+
props.scaleAndConcurrency?.instanceMemoryMB ??
|
|
194
|
+
functionAppConfig?.scaleAndConcurrency?.instanceMemoryMB ??
|
|
195
|
+
4096,
|
|
196
|
+
maximumInstanceCount:
|
|
197
|
+
props.scaleAndConcurrency?.maximumInstanceCount ??
|
|
198
|
+
functionAppConfig?.scaleAndConcurrency?.maximumInstanceCount ??
|
|
199
|
+
40,
|
|
200
|
+
},
|
|
201
|
+
siteUpdateStrategy: {
|
|
202
|
+
type: 'RollingUpdate',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{ parent: scope, ...resourceOptions }
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
return functionApp
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @summary Method to create a new flex consumption function app
|
|
219
|
+
* @param id scoped id of the resource
|
|
220
|
+
* @param scope scope in which this resource is defined
|
|
221
|
+
* @param props flex consumption function app properties
|
|
222
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
223
|
+
* @see [Pulumi Azure Native Function App (Flex Consumption)]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
|
|
224
|
+
*/
|
|
225
|
+
public createFunctionAppFlexConsumptionResource(
|
|
226
|
+
id: string,
|
|
227
|
+
scope: CommonAzureConstruct,
|
|
228
|
+
props: FunctionAppFlexConsumptionProps,
|
|
229
|
+
resourceOptions?: ResourceOptions
|
|
230
|
+
) {
|
|
231
|
+
if (!props) throw `Props undefined for ${id}`
|
|
232
|
+
|
|
233
|
+
// Get resource group name
|
|
234
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
235
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
236
|
+
: props.resourceGroupName
|
|
237
|
+
|
|
238
|
+
if (!resourceGroupName) throw `Resource group name undefined for ${id}`
|
|
239
|
+
|
|
240
|
+
return new Resource(
|
|
241
|
+
`${id}-fc`,
|
|
242
|
+
{
|
|
243
|
+
apiVersion: '2024-04-01',
|
|
244
|
+
identity: {
|
|
245
|
+
type: ManagedServiceIdentityType.SystemAssigned,
|
|
246
|
+
},
|
|
247
|
+
kind: props.kind ?? 'functionapp,linux',
|
|
248
|
+
location: props.location ?? scope.props.location,
|
|
249
|
+
parentResourcePath: '',
|
|
250
|
+
properties: {
|
|
251
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
252
|
+
serverFarmId: props.serverFarmId,
|
|
253
|
+
siteConfig: props.siteConfig,
|
|
254
|
+
functionAppConfig: {
|
|
255
|
+
...props.functionAppConfig,
|
|
256
|
+
runtime: {
|
|
257
|
+
...props.runtime,
|
|
258
|
+
name: props.runtime?.name ?? 'node',
|
|
259
|
+
version: props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME,
|
|
260
|
+
},
|
|
261
|
+
scaleAndConcurrency: {
|
|
262
|
+
...props.scaleAndConcurrency,
|
|
263
|
+
instanceMemoryMB: props.scaleAndConcurrency?.instanceMemoryMB ?? 4096,
|
|
264
|
+
maximumInstanceCount: props.scaleAndConcurrency?.maximumInstanceCount ?? 40,
|
|
265
|
+
},
|
|
266
|
+
siteUpdateStrategy: {
|
|
267
|
+
type: 'RollingUpdate',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
resourceGroupName: resourceGroupName,
|
|
272
|
+
resourceName: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
|
|
273
|
+
resourceProviderNamespace: 'Microsoft.Web',
|
|
274
|
+
resourceType: 'sites',
|
|
275
|
+
},
|
|
276
|
+
{ parent: scope, ...resourceOptions }
|
|
131
277
|
)
|
|
132
278
|
}
|
|
133
279
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { input } from '@pulumi/azure-native/types/index.js'
|
|
1
2
|
import { WebAppArgs } from '@pulumi/azure-native/web/index.js'
|
|
2
3
|
|
|
3
4
|
export interface FunctionAppProps extends WebAppArgs {
|
|
@@ -15,10 +16,8 @@ export interface FunctionProps {
|
|
|
15
16
|
|
|
16
17
|
export interface FunctionAppFlexConsumptionProps extends WebAppArgs {
|
|
17
18
|
name?: string
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
runtime?: input.web.FunctionsRuntimeArgs
|
|
20
|
+
scaleAndConcurrency?: input.web.FunctionsScaleAndConcurrencyArgs
|
|
20
21
|
storageAuthenticationType?: string
|
|
21
22
|
storageContainerType?: string
|
|
22
|
-
maximumInstanceCount?: number
|
|
23
|
-
instanceMemoryInMb?: number
|
|
24
23
|
}
|
|
@@ -2,14 +2,17 @@ export * from './api-management/index.js'
|
|
|
2
2
|
export * from './app-configuration/index.js'
|
|
3
3
|
export * from './app-service/index.js'
|
|
4
4
|
export * from './application-insights/index.js'
|
|
5
|
+
export * from './authorisation/index.js'
|
|
5
6
|
export * from './cosmosdb/index.js'
|
|
6
7
|
export * from './dns/index.js'
|
|
7
8
|
export * from './eventgrid/index.js'
|
|
8
9
|
export * from './function/index.js'
|
|
9
10
|
export * from './key-vault/index.js'
|
|
10
11
|
export * from './operational-insights/index.js'
|
|
12
|
+
export * from './portal/index.js'
|
|
11
13
|
export * from './monitor/index.js'
|
|
12
14
|
export * from './redis/index.js'
|
|
13
15
|
export * from './resource-group/index.js'
|
|
16
|
+
export * from './security-center/index.js'
|
|
14
17
|
export * from './servicebus/index.js'
|
|
15
18
|
export * from './storage/index.js'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SkuFamily, SkuName, Vault } from '@pulumi/azure-native/keyvault/index.js'
|
|
1
|
+
import { getVaultOutput, Secret, SkuFamily, SkuName, Vault } from '@pulumi/azure-native/keyvault/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
2
3
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
|
-
import { KeyVaultProps } from './types.js'
|
|
4
|
+
import { KeyVaultProps, SecretProps } from './types.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @classdesc Provides operations on Azure Key Vault using Pulumi
|
|
@@ -25,9 +26,15 @@ export class AzureKeyVaultManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props key vault properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Key Vault]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/keyvault/vault/}
|
|
29
31
|
*/
|
|
30
|
-
public createKeyVault(
|
|
32
|
+
public createKeyVault(
|
|
33
|
+
id: string,
|
|
34
|
+
scope: CommonAzureConstruct,
|
|
35
|
+
props: KeyVaultProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
37
|
+
) {
|
|
31
38
|
if (!props) throw `Props undefined for ${id}`
|
|
32
39
|
|
|
33
40
|
// Get resource group name
|
|
@@ -63,7 +70,43 @@ export class AzureKeyVaultManager {
|
|
|
63
70
|
environment: scope.props.stage,
|
|
64
71
|
},
|
|
65
72
|
},
|
|
66
|
-
{ parent: scope }
|
|
73
|
+
{ parent: scope, ...resourceOptions }
|
|
67
74
|
)
|
|
68
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @summary Method to create a new key vault secret
|
|
80
|
+
* @param id scoped id of the resource
|
|
81
|
+
* @param scope scope in which this resource is defined
|
|
82
|
+
* @param props key vault secret properties
|
|
83
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
84
|
+
* @see [Pulumi Azure Native Key Vault Secret]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/keyvault/secret/}
|
|
85
|
+
*/
|
|
86
|
+
public createKeyVaultSecret(
|
|
87
|
+
id: string,
|
|
88
|
+
scope: CommonAzureConstruct,
|
|
89
|
+
props: SecretProps,
|
|
90
|
+
resourceOptions?: ResourceOptions
|
|
91
|
+
) {
|
|
92
|
+
if (!props) throw `Props undefined for ${id}`
|
|
93
|
+
|
|
94
|
+
return new Secret(`${id}`, props, { parent: scope, ...resourceOptions })
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @summary Method to resolve an existing key vault
|
|
99
|
+
* @param scope scope in which this resource is defined
|
|
100
|
+
* @param vaultName the key vault name
|
|
101
|
+
* @param resourceGroupName the resource group name
|
|
102
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
103
|
+
*/
|
|
104
|
+
public resolveKeyVault(
|
|
105
|
+
scope: CommonAzureConstruct,
|
|
106
|
+
vaultName: string,
|
|
107
|
+
resourceGroupName: string,
|
|
108
|
+
resourceOptions?: ResourceOptions
|
|
109
|
+
) {
|
|
110
|
+
return getVaultOutput({ vaultName, resourceGroupName }, { parent: scope, ...resourceOptions })
|
|
111
|
+
}
|
|
69
112
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VaultArgs } from '@pulumi/azure-native/keyvault/index.js'
|
|
1
|
+
import { SecretArgs, VaultArgs } from '@pulumi/azure-native/keyvault/index.js'
|
|
2
2
|
|
|
3
|
-
export interface KeyVaultProps extends VaultArgs {
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
export interface KeyVaultProps extends VaultArgs {}
|
|
4
|
+
|
|
5
|
+
export interface SecretProps extends SecretArgs {}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DiagnosticSetting } from '@pulumi/azure-native/monitor/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
2
3
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
4
|
import { MonitorDiagnosticSettingProps } from './types.js'
|
|
4
5
|
|
|
@@ -25,12 +26,14 @@ export class AzureMonitorManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props monitor diagnostics settings properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Monitor Diagnostic Settings]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/}
|
|
29
31
|
*/
|
|
30
32
|
public createMonitorDiagnosticSettings(
|
|
31
33
|
id: string,
|
|
32
34
|
scope: CommonAzureConstruct,
|
|
33
|
-
props: MonitorDiagnosticSettingProps
|
|
35
|
+
props: MonitorDiagnosticSettingProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
34
37
|
) {
|
|
35
38
|
if (!props) throw `Props undefined for ${id}`
|
|
36
39
|
|
|
@@ -43,7 +46,7 @@ export class AzureMonitorManager {
|
|
|
43
46
|
scope.props.resourceNameOptions?.monitorDiagnosticSetting
|
|
44
47
|
),
|
|
45
48
|
},
|
|
46
|
-
{ parent: scope }
|
|
49
|
+
{ parent: scope, ...resourceOptions }
|
|
47
50
|
)
|
|
48
51
|
}
|
|
49
52
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Workspace, WorkspaceSkuNameEnum } from '@pulumi/azure-native/operationalinsights/index.js'
|
|
1
|
+
import { Table, Workspace, WorkspaceSkuNameEnum } from '@pulumi/azure-native/operationalinsights/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
2
3
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
|
-
import { WorkspaceProps } from './types.js'
|
|
4
|
+
import { WorkspaceProps, WorkspaceTableProps } from './types.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @classdesc Provides operations on Azure Log Analytics Workspace using Pulumi
|
|
@@ -25,9 +26,15 @@ export class AzureOperationalInsightsManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props log analytics workspace properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Operational Insights Workspace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/operationalinsights/workspace/}
|
|
29
31
|
*/
|
|
30
|
-
public createWorkspace(
|
|
32
|
+
public createWorkspace(
|
|
33
|
+
id: string,
|
|
34
|
+
scope: CommonAzureConstruct,
|
|
35
|
+
props: WorkspaceProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
37
|
+
) {
|
|
31
38
|
if (!props) throw `Props undefined for ${id}`
|
|
32
39
|
|
|
33
40
|
// Get resource group name
|
|
@@ -55,7 +62,26 @@ export class AzureOperationalInsightsManager {
|
|
|
55
62
|
environment: scope.props.stage,
|
|
56
63
|
},
|
|
57
64
|
},
|
|
58
|
-
{ parent: scope }
|
|
65
|
+
{ parent: scope, ...resourceOptions }
|
|
59
66
|
)
|
|
60
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @summary Method to create a new log analytics workspace table
|
|
71
|
+
* @param id scoped id of the resource
|
|
72
|
+
* @param scope scope in which this resource is defined
|
|
73
|
+
* @param props log analytics workspace table properties
|
|
74
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
75
|
+
* @see [Pulumi Azure Native Operational Insights Table]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/operationalinsights/table/}
|
|
76
|
+
*/
|
|
77
|
+
public createTable(
|
|
78
|
+
id: string,
|
|
79
|
+
scope: CommonAzureConstruct,
|
|
80
|
+
props: WorkspaceTableProps,
|
|
81
|
+
resourceOptions?: ResourceOptions
|
|
82
|
+
) {
|
|
83
|
+
if (!props) throw `Props undefined for ${id}`
|
|
84
|
+
|
|
85
|
+
return new Table(`${id}`, props, { parent: scope, ...resourceOptions })
|
|
86
|
+
}
|
|
61
87
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { WorkspaceArgs } from '@pulumi/azure-native/operationalinsights/index.js'
|
|
1
|
+
import { TableArgs, WorkspaceArgs } from '@pulumi/azure-native/operationalinsights/index.js'
|
|
2
2
|
|
|
3
3
|
export interface WorkspaceProps extends WorkspaceArgs {}
|
|
4
|
+
|
|
5
|
+
export interface WorkspaceTableProps extends TableArgs {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class TemplateError extends Error {
|
|
2
|
+
public readonly isTemplateError = true
|
|
3
|
+
|
|
4
|
+
constructor(message: string) {
|
|
5
|
+
super(message)
|
|
6
|
+
this.name = 'TemplateError'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static isInstance(error: unknown): error is TemplateError {
|
|
10
|
+
return error instanceof Object && 'isTemplateError' in error && error.isTemplateError === true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Dashboard } from '@pulumi/azure-native/portal/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import { CommonAzureConstruct } from '../../index.js'
|
|
5
|
+
import { AzureDashboardRenderer } from './renderer.js'
|
|
6
|
+
import { PortalDashboardProps } from './types.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @classdesc Provides operations on Azure Portal Dashboards using Pulumi
|
|
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
|
+
* ```typescript
|
|
14
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
15
|
+
*
|
|
16
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
17
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
18
|
+
* super(name, props)
|
|
19
|
+
* this.props = props
|
|
20
|
+
* this.azurePortalManager.createDashBoard('MyDashboard', this, props)
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class AzurePortalManager {
|
|
26
|
+
/**
|
|
27
|
+
* @summary Method to create a new portal dashboard
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param scope scope in which this resource is defined
|
|
30
|
+
* @param props the dashboard properties
|
|
31
|
+
* @param renderer An optional renderer to use
|
|
32
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
33
|
+
* @see [Pulumi Azure Native Portal Dashboard]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/portal/dashboard/}
|
|
34
|
+
*/
|
|
35
|
+
public createDashBoard(
|
|
36
|
+
id: string,
|
|
37
|
+
scope: CommonAzureConstruct,
|
|
38
|
+
props: PortalDashboardProps,
|
|
39
|
+
renderer?: AzureDashboardRenderer,
|
|
40
|
+
resourceOptions?: ResourceOptions
|
|
41
|
+
) {
|
|
42
|
+
if (!props) throw `Props undefined for ${id}`
|
|
43
|
+
|
|
44
|
+
const resourceGroup = scope.resourceGroupManager.resolveResourceGroup(
|
|
45
|
+
scope,
|
|
46
|
+
props.resourceGroupName.toString() ?? scope.props.resourceGroupName,
|
|
47
|
+
resourceOptions
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const dashboardName = scope.resourceNameFormatter.format(
|
|
51
|
+
props.dashboardName?.toString(),
|
|
52
|
+
scope.props.resourceNameOptions?.portalDashboard
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
const dashboardRenderer = renderer ?? new AzureDashboardRenderer()
|
|
56
|
+
const templateFile = dashboardRenderer.renderToFile(dashboardName, props)
|
|
57
|
+
const template = fs.readFileSync(templateFile, 'utf-8')
|
|
58
|
+
const content = Object.entries(props.variables).reduce(
|
|
59
|
+
(result, [key, value]) => result.replaceAll(`\${${key}}`, String(value)),
|
|
60
|
+
template
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return new Dashboard(
|
|
64
|
+
`${id}-dashboard`,
|
|
65
|
+
{
|
|
66
|
+
...props,
|
|
67
|
+
dashboardName: scope.resourceNameFormatter.format(
|
|
68
|
+
props.dashboardName?.toString(),
|
|
69
|
+
scope.props.resourceNameOptions?.portalDashboard
|
|
70
|
+
),
|
|
71
|
+
resourceGroupName: resourceGroup.name,
|
|
72
|
+
location: props.location ?? resourceGroup.location,
|
|
73
|
+
properties: JSON.parse(content),
|
|
74
|
+
tags: {
|
|
75
|
+
'hidden-title': `${props.location} - ${props.displayName}`,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{ ...resourceOptions, ignoreChanges: ['location'] }
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
}
|