@gradientedge/cdk-utils-azure 2.27.0 → 2.29.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/construct/event-handler/main.d.ts +11 -0
- package/dist/src/construct/event-handler/main.js +11 -0
- package/dist/src/construct/function-app/main.d.ts +7 -0
- package/dist/src/construct/function-app/main.js +7 -0
- package/dist/src/construct/rest-api/main.d.ts +5 -0
- package/dist/src/construct/rest-api/main.js +16 -0
- package/dist/src/construct/rest-api-function/main.d.ts +5 -0
- package/dist/src/construct/rest-api-function/main.js +5 -0
- package/dist/src/construct/rest-api-with-cache/main.d.ts +5 -0
- package/dist/src/construct/rest-api-with-cache/main.js +14 -1
- package/dist/src/construct/site-with-webapp/main.d.ts +5 -0
- package/dist/src/construct/site-with-webapp/main.js +6 -1
- package/dist/src/services/app-service/main.js +1 -1
- package/dist/src/services/authorisation/main.d.ts +5 -0
- package/dist/src/services/authorisation/main.js +5 -0
- package/dist/src/services/portal/renderer.d.ts +3 -3
- package/dist/src/services/portal/types.d.ts +22 -0
- package/package.json +3 -3
|
@@ -22,6 +22,11 @@ export declare class AzureEventHandler extends AzureFunctionApp {
|
|
|
22
22
|
eventGridEventSubscription: EventHandlerEventGridSubscription;
|
|
23
23
|
eventGridTopic: Topic | Output<GetTopicResult>;
|
|
24
24
|
serviceBus: EventHandlerServiceBus;
|
|
25
|
+
/**
|
|
26
|
+
* @summary Create a new AzureEventHandler
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param props the event handler properties
|
|
29
|
+
*/
|
|
25
30
|
constructor(id: string, props: AzureEventHandlerProps);
|
|
26
31
|
/**
|
|
27
32
|
* @summary Initialise and provision resources
|
|
@@ -59,6 +64,12 @@ export declare class AzureEventHandler extends AzureFunctionApp {
|
|
|
59
64
|
* @summary Method to enable Microsoft Defender malware scanning on the data storage account
|
|
60
65
|
*/
|
|
61
66
|
protected enableMalwareScanningOnDataStorageAccount(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @summary Override to extend the function app site config with service bus connection strings
|
|
69
|
+
*/
|
|
62
70
|
protected createFunctionAppSiteConfig(): void;
|
|
71
|
+
/**
|
|
72
|
+
* @summary Override to extend the dashboard variables with service bus and event grid specifics
|
|
73
|
+
*/
|
|
63
74
|
protected dashboardVariables(): Record<string, any>;
|
|
64
75
|
}
|
|
@@ -22,6 +22,11 @@ export class AzureEventHandler extends AzureFunctionApp {
|
|
|
22
22
|
eventGridEventSubscription;
|
|
23
23
|
eventGridTopic;
|
|
24
24
|
serviceBus;
|
|
25
|
+
/**
|
|
26
|
+
* @summary Create a new AzureEventHandler
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param props the event handler properties
|
|
29
|
+
*/
|
|
25
30
|
constructor(id, props) {
|
|
26
31
|
super(id, props);
|
|
27
32
|
this.props = props;
|
|
@@ -209,6 +214,9 @@ export class AzureEventHandler extends AzureFunctionApp {
|
|
|
209
214
|
},
|
|
210
215
|
});
|
|
211
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* @summary Override to extend the function app site config with service bus connection strings
|
|
219
|
+
*/
|
|
212
220
|
createFunctionAppSiteConfig() {
|
|
213
221
|
super.createFunctionAppSiteConfig();
|
|
214
222
|
this.appEnvironmentVariables = {
|
|
@@ -227,6 +235,9 @@ export class AzureEventHandler extends AzureFunctionApp {
|
|
|
227
235
|
},
|
|
228
236
|
];
|
|
229
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* @summary Override to extend the dashboard variables with service bus and event grid specifics
|
|
240
|
+
*/
|
|
230
241
|
dashboardVariables() {
|
|
231
242
|
const variables = super.dashboardVariables();
|
|
232
243
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as archive from '@pulumi/archive';
|
|
2
2
|
import { ConfigurationStore, GetConfigurationStoreResult } from '@pulumi/azure-native/appconfiguration/index.js';
|
|
3
3
|
import { GetComponentResult } from '@pulumi/azure-native/applicationinsights/index.js';
|
|
4
|
+
import { Vault } from '@pulumi/azure-native/keyvault/index.js';
|
|
4
5
|
import { Dashboard } from '@pulumi/azure-native/portal/index.js';
|
|
5
6
|
import { BlobContainer, StorageAccount } from '@pulumi/azure-native/storage/index.js';
|
|
6
7
|
import { AppServicePlan, WebApp } from '@pulumi/azure-native/web/index.js';
|
|
@@ -38,10 +39,16 @@ export declare class AzureFunctionApp extends CommonAzureConstruct {
|
|
|
38
39
|
appConfigPrefix?: string;
|
|
39
40
|
appConfigurationsParsedConfig: any;
|
|
40
41
|
appConfigurationsOriginalParsedConfig: any;
|
|
42
|
+
dataKeyVault: Vault;
|
|
41
43
|
dataStorageAccount: StorageAccount;
|
|
42
44
|
dataStorageContainer: BlobContainer;
|
|
43
45
|
applicationInsights: Output<GetComponentResult>;
|
|
44
46
|
functionDashboard: Dashboard;
|
|
47
|
+
/**
|
|
48
|
+
* @summary Create a new AzureFunctionApp
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param props the function app properties
|
|
51
|
+
*/
|
|
45
52
|
constructor(id: string, props: AzureFunctionAppProps);
|
|
46
53
|
/**
|
|
47
54
|
* @summary Initialise and provision resources
|
|
@@ -43,10 +43,16 @@ export class AzureFunctionApp extends CommonAzureConstruct {
|
|
|
43
43
|
appConfigPrefix;
|
|
44
44
|
appConfigurationsParsedConfig;
|
|
45
45
|
appConfigurationsOriginalParsedConfig;
|
|
46
|
+
dataKeyVault;
|
|
46
47
|
dataStorageAccount;
|
|
47
48
|
dataStorageContainer;
|
|
48
49
|
applicationInsights;
|
|
49
50
|
functionDashboard;
|
|
51
|
+
/**
|
|
52
|
+
* @summary Create a new AzureFunctionApp
|
|
53
|
+
* @param id scoped id of the resource
|
|
54
|
+
* @param props the function app properties
|
|
55
|
+
*/
|
|
50
56
|
constructor(id, props) {
|
|
51
57
|
super(id, props);
|
|
52
58
|
this.props = props;
|
|
@@ -211,6 +217,7 @@ export class AzureFunctionApp extends CommonAzureConstruct {
|
|
|
211
217
|
tenantId: this.props.tenantId ?? '',
|
|
212
218
|
},
|
|
213
219
|
}, { ignoreChanges: ['location'] });
|
|
220
|
+
this.dataKeyVault = keyVault;
|
|
214
221
|
this.monitorManager.createMonitorDiagnosticSettings(`${this.id}-${this.props.dataKeyVaultName}`, this, {
|
|
215
222
|
name: `${this.props.dataKeyVaultName}-keyvault`,
|
|
216
223
|
resourceUri: keyVault.id,
|
|
@@ -21,6 +21,11 @@ export declare class AzureRestApi extends CommonAzureConstruct {
|
|
|
21
21
|
props: AzureRestApiProps;
|
|
22
22
|
api: AzureApi;
|
|
23
23
|
applicationInsights: Output<GetComponentResult>;
|
|
24
|
+
/**
|
|
25
|
+
* @summary Create a new AzureRestApi
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param props the REST API properties
|
|
28
|
+
*/
|
|
24
29
|
constructor(id: string, props: AzureRestApiProps);
|
|
25
30
|
/**
|
|
26
31
|
* @summary Initialise and provision resources
|
|
@@ -24,6 +24,11 @@ export class AzureRestApi extends CommonAzureConstruct {
|
|
|
24
24
|
props;
|
|
25
25
|
api = {};
|
|
26
26
|
applicationInsights;
|
|
27
|
+
/**
|
|
28
|
+
* @summary Create a new AzureRestApi
|
|
29
|
+
* @param id scoped id of the resource
|
|
30
|
+
* @param props the REST API properties
|
|
31
|
+
*/
|
|
27
32
|
constructor(id, props) {
|
|
28
33
|
super(id, props);
|
|
29
34
|
this.props = props;
|
|
@@ -70,6 +75,9 @@ export class AzureRestApi extends CommonAzureConstruct {
|
|
|
70
75
|
*/
|
|
71
76
|
createApiManagement() {
|
|
72
77
|
if (this.props.apiManagement.useExistingApiManagement) {
|
|
78
|
+
/* Import existing APIM service outputs from another Pulumi stack.
|
|
79
|
+
The output keys (apiId, apiName, apiResourceGroupName) must match
|
|
80
|
+
the registerOutputs call at the bottom of this method. */
|
|
73
81
|
if (this.props.apiManagement.apiStackName) {
|
|
74
82
|
const apiStack = new pulumi.StackReference(this.props.apiManagement.apiStackName);
|
|
75
83
|
this.api.id = apiStack.getOutput('apiId');
|
|
@@ -98,6 +106,9 @@ export class AzureRestApi extends CommonAzureConstruct {
|
|
|
98
106
|
this.api.id = this.api.apim.id;
|
|
99
107
|
this.api.name = this.api.apim.name;
|
|
100
108
|
this.api.resourceGroupName = this.resourceGroup.name;
|
|
109
|
+
/* Retrieve the APIM managed identity to grant Key Vault certificate access.
|
|
110
|
+
The identity must be resolved separately as it's not available until
|
|
111
|
+
the APIM service is created. */
|
|
101
112
|
const apimIdentity = getApiManagementServiceOutput({
|
|
102
113
|
serviceName: this.api.apim.name,
|
|
103
114
|
resourceGroupName: this.resourceGroup.name,
|
|
@@ -111,6 +122,8 @@ export class AzureRestApi extends CommonAzureConstruct {
|
|
|
111
122
|
});
|
|
112
123
|
}
|
|
113
124
|
}
|
|
125
|
+
/* Register outputs for cross-stack consumption via StackReference.
|
|
126
|
+
These keys must match what consuming stacks expect in getOutput() calls. */
|
|
114
127
|
this.registerOutputs({
|
|
115
128
|
apiId: this.api.id,
|
|
116
129
|
apiName: this.api.name,
|
|
@@ -165,6 +178,9 @@ export class AzureRestApi extends CommonAzureConstruct {
|
|
|
165
178
|
allowTracing: false,
|
|
166
179
|
scope: '/apis',
|
|
167
180
|
});
|
|
181
|
+
/* Resolve the subscription's primary key through a double-async chain:
|
|
182
|
+
first resolve the APIM/resource group/subscription names, then fetch
|
|
183
|
+
the secrets from the Azure API to extract the primary key */
|
|
168
184
|
const subscriptionKey = pulumi
|
|
169
185
|
.all([this.api.apim.name, this.resourceGroup.name, apiManagementSubscription.name])
|
|
170
186
|
.apply(([serviceName, resourceGroupName, subscriptionName]) => listSubscriptionSecretsOutput({
|
|
@@ -19,6 +19,11 @@ import { AzureApiFunction, AzureRestApiFunctionProps } from './types.js';
|
|
|
19
19
|
export declare class AzureRestApiFunction extends AzureFunctionApp {
|
|
20
20
|
props: AzureRestApiFunctionProps;
|
|
21
21
|
api: AzureApiFunction;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Create a new AzureRestApiFunction
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param props the REST API function properties
|
|
26
|
+
*/
|
|
22
27
|
constructor(id: string, props: AzureRestApiFunctionProps);
|
|
23
28
|
/**
|
|
24
29
|
* @summary Initialise and provision resources
|
|
@@ -23,6 +23,11 @@ import { AzureFunctionApp } from '../function-app/index.js';
|
|
|
23
23
|
export class AzureRestApiFunction extends AzureFunctionApp {
|
|
24
24
|
props;
|
|
25
25
|
api = {};
|
|
26
|
+
/**
|
|
27
|
+
* @summary Create a new AzureRestApiFunction
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param props the REST API function properties
|
|
30
|
+
*/
|
|
26
31
|
constructor(id, props) {
|
|
27
32
|
super(id, props);
|
|
28
33
|
this.props = props;
|
|
@@ -18,6 +18,11 @@ import { AzureApiWithCache, AzureRestApiWithCacheProps } from './types.js';
|
|
|
18
18
|
export declare class AzureRestApiWithCache extends AzureRestApi {
|
|
19
19
|
props: AzureRestApiWithCacheProps;
|
|
20
20
|
api: AzureApiWithCache;
|
|
21
|
+
/**
|
|
22
|
+
* @summary Create a new AzureRestApiWithCache
|
|
23
|
+
* @param id scoped id of the resource
|
|
24
|
+
* @param props the REST API with cache properties
|
|
25
|
+
*/
|
|
21
26
|
constructor(id: string, props: AzureRestApiWithCacheProps);
|
|
22
27
|
/**
|
|
23
28
|
* @summary Initialise and provision resources
|
|
@@ -18,6 +18,11 @@ import { AzureRestApi } from '../rest-api/main.js';
|
|
|
18
18
|
*/
|
|
19
19
|
export class AzureRestApiWithCache extends AzureRestApi {
|
|
20
20
|
props;
|
|
21
|
+
/**
|
|
22
|
+
* @summary Create a new AzureRestApiWithCache
|
|
23
|
+
* @param id scoped id of the resource
|
|
24
|
+
* @param props the REST API with cache properties
|
|
25
|
+
*/
|
|
21
26
|
constructor(id, props) {
|
|
22
27
|
super(id, props);
|
|
23
28
|
this.props = props;
|
|
@@ -50,6 +55,11 @@ export class AzureRestApiWithCache extends AzureRestApi {
|
|
|
50
55
|
* @summary Method to create the Redis cache connection string secret in Key Vault
|
|
51
56
|
*/
|
|
52
57
|
createRedisCacheSecret() {
|
|
58
|
+
/* Resolve the Redis connection string through a double-async chain:
|
|
59
|
+
first resolve the cluster/database/resource group names, then fetch
|
|
60
|
+
the database keys from the Azure API to build the connection string.
|
|
61
|
+
Port 10000 is the Azure Redis Enterprise port (not the standard 6379).
|
|
62
|
+
ssl=True and abortConnect=False are StackExchange.Redis connection params. */
|
|
53
63
|
const connectionString = pulumi
|
|
54
64
|
.all([
|
|
55
65
|
this.api.redisCluster.hostName,
|
|
@@ -69,7 +79,10 @@ export class AzureRestApiWithCache extends AzureRestApi {
|
|
|
69
79
|
properties: {
|
|
70
80
|
value: connectionString,
|
|
71
81
|
},
|
|
72
|
-
},
|
|
82
|
+
},
|
|
83
|
+
/* The role assignment must complete before writing the secret,
|
|
84
|
+
as Key Vault requires the identity to have access first */
|
|
85
|
+
{ dependsOn: [this.api.redisCluster, this.api.redisDatabase, this.api.namedValueRoleAssignment] });
|
|
73
86
|
}
|
|
74
87
|
/**
|
|
75
88
|
* @summary Method to create the API Management named value for the Redis cache secret
|
|
@@ -21,6 +21,11 @@ export declare class SiteWithWebApp extends CommonAzureConstruct {
|
|
|
21
21
|
props: SiteWithWebAppProps;
|
|
22
22
|
applicationInsights: Output<GetComponentResult>;
|
|
23
23
|
site: Site;
|
|
24
|
+
/**
|
|
25
|
+
* @summary Create a new SiteWithWebApp
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param props the site with web app properties
|
|
28
|
+
*/
|
|
24
29
|
constructor(id: string, props: SiteWithWebAppProps);
|
|
25
30
|
/**
|
|
26
31
|
* @summary Initialise and provision resources
|
|
@@ -23,6 +23,11 @@ export class SiteWithWebApp extends CommonAzureConstruct {
|
|
|
23
23
|
props;
|
|
24
24
|
applicationInsights;
|
|
25
25
|
site = {};
|
|
26
|
+
/**
|
|
27
|
+
* @summary Create a new SiteWithWebApp
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param props the site with web app properties
|
|
30
|
+
*/
|
|
26
31
|
constructor(id, props) {
|
|
27
32
|
super(id, props);
|
|
28
33
|
this.props = props;
|
|
@@ -82,7 +87,7 @@ export class SiteWithWebApp extends CommonAzureConstruct {
|
|
|
82
87
|
createSiteStorageContainer() {
|
|
83
88
|
this.site.storageContainer = this.storageManager.createStorageContainer(`${this.id}-storage-deployment-container`, this, {
|
|
84
89
|
...this.props.site.storageContainer,
|
|
85
|
-
accountName: this.site.storageAccount.
|
|
90
|
+
accountName: this.site.storageAccount.name,
|
|
86
91
|
resourceGroupName: this.resourceGroup.name,
|
|
87
92
|
});
|
|
88
93
|
}
|
|
@@ -42,7 +42,7 @@ export class AzureAppServiceManager {
|
|
|
42
42
|
tier: 'FlexConsumption',
|
|
43
43
|
},
|
|
44
44
|
reserved: props.reserved ?? true,
|
|
45
|
-
zoneRedundant: props.zoneRedundant ??
|
|
45
|
+
zoneRedundant: props.zoneRedundant ?? false,
|
|
46
46
|
tags: {
|
|
47
47
|
environment: scope.props.stage,
|
|
48
48
|
...scope.props.defaultTags,
|
|
@@ -83,5 +83,10 @@ export declare class AzureAuthorisationManager {
|
|
|
83
83
|
* @param resourceOptions Optional settings to control resource behaviour
|
|
84
84
|
*/
|
|
85
85
|
grantRoleAssignmentToStorageTable(id: string, scope: CommonAzureConstruct, tableId: Input<string>, principalId: Input<string>, principalType: Input<PrincipalType>, roleDefinitionId: string, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/authorization/roleAssignment.js").RoleAssignment;
|
|
86
|
+
/**
|
|
87
|
+
* @summary Method to resolve the full role definition ID from a subscription and role definition
|
|
88
|
+
* @param scope scope in which this resource is defined
|
|
89
|
+
* @param roleDefinitionId the role definition identifier to resolve
|
|
90
|
+
*/
|
|
86
91
|
resolveRoleDefinitionId(scope: CommonAzureConstruct, roleDefinitionId: RoleDefinitionId): string;
|
|
87
92
|
}
|
|
@@ -123,6 +123,11 @@ export class AzureAuthorisationManager {
|
|
|
123
123
|
scope: tableId,
|
|
124
124
|
}, resourceOptions);
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* @summary Method to resolve the full role definition ID from a subscription and role definition
|
|
128
|
+
* @param scope scope in which this resource is defined
|
|
129
|
+
* @param roleDefinitionId the role definition identifier to resolve
|
|
130
|
+
*/
|
|
126
131
|
resolveRoleDefinitionId(scope, roleDefinitionId) {
|
|
127
132
|
if (!scope.props.subscriptionId)
|
|
128
133
|
throw Error('Subscription id undefined');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DashboardRenderer, MissingKeys, PaneTemplate, RenderParams } from './types.js';
|
|
2
2
|
/** @category Service */
|
|
3
3
|
export declare class AzureDashboardRenderer implements DashboardRenderer {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
readonly paneTemplatePath: string;
|
|
5
|
+
readonly outputDir: string;
|
|
6
6
|
constructor(basePath?: string, outputDir?: string);
|
|
7
|
-
|
|
7
|
+
protected getPaneId(id: string): PaneTemplate;
|
|
8
8
|
getMissingProperties(template: PaneTemplate, properties?: RenderParams['properties']): MissingKeys;
|
|
9
9
|
getMissingVariables(template: PaneTemplate, variables: RenderParams['variables']): MissingKeys;
|
|
10
10
|
render(params: RenderParams): string;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { DashboardArgs } from '@pulumi/azure-native/portal/index.js';
|
|
2
2
|
/** @category Interface */
|
|
3
|
+
export type PaneClient = {
|
|
4
|
+
name: string;
|
|
5
|
+
domain: string;
|
|
6
|
+
};
|
|
7
|
+
/** @category Interface */
|
|
8
|
+
export type PaneClientTemplate = {
|
|
9
|
+
rowTemplate: string;
|
|
10
|
+
prefix?: string;
|
|
11
|
+
separator?: string;
|
|
12
|
+
trailing?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
};
|
|
15
|
+
/** @category Interface */
|
|
3
16
|
export type PaneTemplate = {
|
|
4
17
|
dimensions: {
|
|
5
18
|
height: number;
|
|
@@ -34,7 +47,16 @@ export type RenderParams = {
|
|
|
34
47
|
};
|
|
35
48
|
/** @category Interface */
|
|
36
49
|
export interface DashboardRenderer {
|
|
50
|
+
/**
|
|
51
|
+
* @summary Render a dashboard template with the given parameters
|
|
52
|
+
* @param params the render parameters including panes, variables, and filters
|
|
53
|
+
*/
|
|
37
54
|
render(params: RenderParams): string;
|
|
55
|
+
/**
|
|
56
|
+
* @summary Render a dashboard template and write the output to a file
|
|
57
|
+
* @param filename the output file path
|
|
58
|
+
* @param params the render parameters including panes, variables, and filters
|
|
59
|
+
*/
|
|
38
60
|
renderToFile(filename: string, params: RenderParams): string;
|
|
39
61
|
}
|
|
40
62
|
/** @category Interface */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils-azure",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.0",
|
|
4
4
|
"description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"@pulumi/archive": "0.3.7",
|
|
18
18
|
"@pulumi/azure-native": "3.17.0",
|
|
19
19
|
"@pulumi/azuread": "6.9.0",
|
|
20
|
-
"@pulumi/pulumi": "3.
|
|
20
|
+
"@pulumi/pulumi": "3.232.0",
|
|
21
21
|
"@types/lodash": "4.17.24",
|
|
22
22
|
"app-root-path": "3.1.0",
|
|
23
23
|
"lodash": "4.18.1",
|
|
24
24
|
"uuid": "14.0.0",
|
|
25
25
|
"yaml": "2.8.3",
|
|
26
|
-
"@gradientedge/cdk-utils-common": "2.
|
|
26
|
+
"@gradientedge/cdk-utils-common": "2.2.0"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"gradientedge",
|