@gradientedge/cdk-utils-azure 1.0.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.
Files changed (176) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/common/constants.d.ts +83 -0
  3. package/dist/src/common/constants.js +87 -0
  4. package/dist/src/common/construct.d.ts +80 -0
  5. package/dist/src/common/construct.js +128 -0
  6. package/dist/src/common/index.d.ts +6 -0
  7. package/dist/src/common/index.js +6 -0
  8. package/dist/src/common/resource-name-formatter.d.ts +18 -0
  9. package/dist/src/common/resource-name-formatter.js +34 -0
  10. package/dist/src/common/stack.d.ts +46 -0
  11. package/dist/src/common/stack.js +120 -0
  12. package/dist/src/common/tagging.d.ts +29 -0
  13. package/dist/src/common/tagging.js +78 -0
  14. package/dist/src/common/types.d.ts +57 -0
  15. package/dist/src/common/types.js +1 -0
  16. package/dist/src/construct/event-handler/index.d.ts +2 -0
  17. package/dist/src/construct/event-handler/index.js +2 -0
  18. package/dist/src/construct/event-handler/main.d.ts +61 -0
  19. package/dist/src/construct/event-handler/main.js +180 -0
  20. package/dist/src/construct/event-handler/types.d.ts +35 -0
  21. package/dist/src/construct/event-handler/types.js +1 -0
  22. package/dist/src/construct/function-app/index.d.ts +2 -0
  23. package/dist/src/construct/function-app/index.js +2 -0
  24. package/dist/src/construct/function-app/main.d.ts +128 -0
  25. package/dist/src/construct/function-app/main.js +374 -0
  26. package/dist/src/construct/function-app/types.d.ts +33 -0
  27. package/dist/src/construct/function-app/types.js +1 -0
  28. package/dist/src/construct/index.d.ts +6 -0
  29. package/dist/src/construct/index.js +6 -0
  30. package/dist/src/construct/rest-api/index.d.ts +2 -0
  31. package/dist/src/construct/rest-api/index.js +2 -0
  32. package/dist/src/construct/rest-api/main.d.ts +64 -0
  33. package/dist/src/construct/rest-api/main.js +216 -0
  34. package/dist/src/construct/rest-api/types.d.ts +25 -0
  35. package/dist/src/construct/rest-api/types.js +1 -0
  36. package/dist/src/construct/rest-api-function/index.d.ts +2 -0
  37. package/dist/src/construct/rest-api-function/index.js +2 -0
  38. package/dist/src/construct/rest-api-function/main.d.ts +66 -0
  39. package/dist/src/construct/rest-api-function/main.js +302 -0
  40. package/dist/src/construct/rest-api-function/types.d.ts +29 -0
  41. package/dist/src/construct/rest-api-function/types.js +1 -0
  42. package/dist/src/construct/rest-api-with-cache/index.d.ts +2 -0
  43. package/dist/src/construct/rest-api-with-cache/index.js +2 -0
  44. package/dist/src/construct/rest-api-with-cache/main.d.ts +41 -0
  45. package/dist/src/construct/rest-api-with-cache/main.js +85 -0
  46. package/dist/src/construct/rest-api-with-cache/types.d.ts +13 -0
  47. package/dist/src/construct/rest-api-with-cache/types.js +1 -0
  48. package/dist/src/construct/site-with-webapp/index.d.ts +2 -0
  49. package/dist/src/construct/site-with-webapp/index.js +2 -0
  50. package/dist/src/construct/site-with-webapp/main.d.ts +60 -0
  51. package/dist/src/construct/site-with-webapp/main.js +176 -0
  52. package/dist/src/construct/site-with-webapp/types.d.ts +30 -0
  53. package/dist/src/construct/site-with-webapp/types.js +1 -0
  54. package/dist/src/index.d.ts +4 -0
  55. package/dist/src/index.js +4 -0
  56. package/dist/src/services/api-management/index.d.ts +2 -0
  57. package/dist/src/services/api-management/index.js +2 -0
  58. package/dist/src/services/api-management/main.d.ts +143 -0
  59. package/dist/src/services/api-management/main.js +244 -0
  60. package/dist/src/services/api-management/types.d.ts +72 -0
  61. package/dist/src/services/api-management/types.js +1 -0
  62. package/dist/src/services/app-configuration/index.d.ts +2 -0
  63. package/dist/src/services/app-configuration/index.js +2 -0
  64. package/dist/src/services/app-configuration/main.d.ts +41 -0
  65. package/dist/src/services/app-configuration/main.js +71 -0
  66. package/dist/src/services/app-configuration/types.d.ts +3 -0
  67. package/dist/src/services/app-configuration/types.js +1 -0
  68. package/dist/src/services/app-service/index.d.ts +2 -0
  69. package/dist/src/services/app-service/index.js +2 -0
  70. package/dist/src/services/app-service/main.d.ts +40 -0
  71. package/dist/src/services/app-service/main.js +90 -0
  72. package/dist/src/services/app-service/types.d.ts +6 -0
  73. package/dist/src/services/app-service/types.js +1 -0
  74. package/dist/src/services/application-insights/index.d.ts +2 -0
  75. package/dist/src/services/application-insights/index.js +2 -0
  76. package/dist/src/services/application-insights/main.d.ts +40 -0
  77. package/dist/src/services/application-insights/main.js +68 -0
  78. package/dist/src/services/application-insights/types.d.ts +6 -0
  79. package/dist/src/services/application-insights/types.js +1 -0
  80. package/dist/src/services/authorisation/constants.d.ts +13 -0
  81. package/dist/src/services/authorisation/constants.js +14 -0
  82. package/dist/src/services/authorisation/index.d.ts +3 -0
  83. package/dist/src/services/authorisation/index.js +3 -0
  84. package/dist/src/services/authorisation/main.d.ts +84 -0
  85. package/dist/src/services/authorisation/main.js +120 -0
  86. package/dist/src/services/authorisation/types.d.ts +3 -0
  87. package/dist/src/services/authorisation/types.js +1 -0
  88. package/dist/src/services/cosmosdb/constants.d.ts +8 -0
  89. package/dist/src/services/cosmosdb/constants.js +10 -0
  90. package/dist/src/services/cosmosdb/index.d.ts +3 -0
  91. package/dist/src/services/cosmosdb/index.js +3 -0
  92. package/dist/src/services/cosmosdb/main.d.ts +87 -0
  93. package/dist/src/services/cosmosdb/main.js +162 -0
  94. package/dist/src/services/cosmosdb/types.d.ts +9 -0
  95. package/dist/src/services/cosmosdb/types.js +1 -0
  96. package/dist/src/services/dns/index.d.ts +2 -0
  97. package/dist/src/services/dns/index.js +2 -0
  98. package/dist/src/services/dns/main.d.ts +58 -0
  99. package/dist/src/services/dns/main.js +107 -0
  100. package/dist/src/services/dns/types.d.ts +9 -0
  101. package/dist/src/services/dns/types.js +1 -0
  102. package/dist/src/services/eventgrid/index.d.ts +2 -0
  103. package/dist/src/services/eventgrid/index.js +2 -0
  104. package/dist/src/services/eventgrid/main.d.ts +69 -0
  105. package/dist/src/services/eventgrid/main.js +136 -0
  106. package/dist/src/services/eventgrid/types.d.ts +11 -0
  107. package/dist/src/services/eventgrid/types.js +1 -0
  108. package/dist/src/services/function/index.d.ts +2 -0
  109. package/dist/src/services/function/index.js +2 -0
  110. package/dist/src/services/function/main.d.ts +60 -0
  111. package/dist/src/services/function/main.js +223 -0
  112. package/dist/src/services/function/types.d.ts +20 -0
  113. package/dist/src/services/function/types.js +1 -0
  114. package/dist/src/services/index.d.ts +18 -0
  115. package/dist/src/services/index.js +18 -0
  116. package/dist/src/services/key-vault/index.d.ts +2 -0
  117. package/dist/src/services/key-vault/index.js +2 -0
  118. package/dist/src/services/key-vault/main.d.ts +49 -0
  119. package/dist/src/services/key-vault/main.js +83 -0
  120. package/dist/src/services/key-vault/types.d.ts +5 -0
  121. package/dist/src/services/key-vault/types.js +1 -0
  122. package/dist/src/services/monitor/index.d.ts +2 -0
  123. package/dist/src/services/monitor/index.js +2 -0
  124. package/dist/src/services/monitor/main.d.ts +31 -0
  125. package/dist/src/services/monitor/main.js +36 -0
  126. package/dist/src/services/monitor/types.d.ts +3 -0
  127. package/dist/src/services/monitor/types.js +1 -0
  128. package/dist/src/services/operational-insights/index.d.ts +2 -0
  129. package/dist/src/services/operational-insights/index.js +2 -0
  130. package/dist/src/services/operational-insights/main.d.ts +40 -0
  131. package/dist/src/services/operational-insights/main.js +64 -0
  132. package/dist/src/services/operational-insights/types.d.ts +5 -0
  133. package/dist/src/services/operational-insights/types.js +1 -0
  134. package/dist/src/services/portal/error.d.ts +5 -0
  135. package/dist/src/services/portal/error.js +10 -0
  136. package/dist/src/services/portal/index.d.ts +4 -0
  137. package/dist/src/services/portal/index.js +4 -0
  138. package/dist/src/services/portal/main.d.ts +33 -0
  139. package/dist/src/services/portal/main.js +51 -0
  140. package/dist/src/services/portal/renderer.d.ts +11 -0
  141. package/dist/src/services/portal/renderer.js +156 -0
  142. package/dist/src/services/portal/types.d.ts +40 -0
  143. package/dist/src/services/portal/types.js +1 -0
  144. package/dist/src/services/redis/index.d.ts +2 -0
  145. package/dist/src/services/redis/index.js +2 -0
  146. package/dist/src/services/redis/main.d.ts +31 -0
  147. package/dist/src/services/redis/main.js +52 -0
  148. package/dist/src/services/redis/types.d.ts +3 -0
  149. package/dist/src/services/redis/types.js +1 -0
  150. package/dist/src/services/resource-group/index.d.ts +2 -0
  151. package/dist/src/services/resource-group/index.js +2 -0
  152. package/dist/src/services/resource-group/main.d.ts +38 -0
  153. package/dist/src/services/resource-group/main.js +53 -0
  154. package/dist/src/services/resource-group/types.d.ts +3 -0
  155. package/dist/src/services/resource-group/types.js +1 -0
  156. package/dist/src/services/security-center/index.d.ts +2 -0
  157. package/dist/src/services/security-center/index.js +2 -0
  158. package/dist/src/services/security-center/main.d.ts +31 -0
  159. package/dist/src/services/security-center/main.js +33 -0
  160. package/dist/src/services/security-center/types.d.ts +3 -0
  161. package/dist/src/services/security-center/types.js +1 -0
  162. package/dist/src/services/servicebus/index.d.ts +2 -0
  163. package/dist/src/services/servicebus/index.js +2 -0
  164. package/dist/src/services/servicebus/main.d.ts +67 -0
  165. package/dist/src/services/servicebus/main.js +127 -0
  166. package/dist/src/services/servicebus/types.d.ts +11 -0
  167. package/dist/src/services/servicebus/types.js +1 -0
  168. package/dist/src/services/storage/index.d.ts +2 -0
  169. package/dist/src/services/storage/index.js +2 -0
  170. package/dist/src/services/storage/main.d.ts +88 -0
  171. package/dist/src/services/storage/main.js +173 -0
  172. package/dist/src/services/storage/types.d.ts +20 -0
  173. package/dist/src/services/storage/types.js +1 -0
  174. package/dist/src/types/index.d.ts +4 -0
  175. package/dist/src/types/index.js +1 -0
  176. package/package.json +41 -0
@@ -0,0 +1,10 @@
1
+ export class TemplateError extends Error {
2
+ isTemplateError = true;
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = 'TemplateError';
6
+ }
7
+ static isInstance(error) {
8
+ return error instanceof Object && 'isTemplateError' in error && error.isTemplateError === true;
9
+ }
10
+ }
@@ -0,0 +1,4 @@
1
+ export * from './error.js';
2
+ export * from './main.js';
3
+ export * from './renderer.js';
4
+ export * from './types.js';
@@ -0,0 +1,4 @@
1
+ export * from './error.js';
2
+ export * from './main.js';
3
+ export * from './renderer.js';
4
+ export * from './types.js';
@@ -0,0 +1,33 @@
1
+ import { ResourceOptions } from '@pulumi/pulumi';
2
+ import { CommonAzureConstruct } from '../../index.js';
3
+ import { AzureDashboardRenderer } from './renderer.js';
4
+ import { PortalDashboardProps } from './types.js';
5
+ /**
6
+ * @classdesc Provides operations on Azure Portal Dashboards 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.azurePortalManager.createDashBoard('MyDashboard', this, props)
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ export declare class AzurePortalManager {
23
+ /**
24
+ * @summary Method to create a new portal dashboard
25
+ * @param id scoped id of the resource
26
+ * @param scope scope in which this resource is defined
27
+ * @param props the dashboard properties
28
+ * @param renderer An optional renderer to use
29
+ * @param resourceOptions Optional settings to control resource behaviour
30
+ * @see [Pulumi Azure Native Portal Dashboard]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/portal/dashboard/}
31
+ */
32
+ createDashBoard(id: string, scope: CommonAzureConstruct, props: PortalDashboardProps, renderer?: AzureDashboardRenderer, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/portal/dashboard.js").Dashboard;
33
+ }
@@ -0,0 +1,51 @@
1
+ import { Dashboard } from '@pulumi/azure-native/portal/index.js';
2
+ import fs from 'fs';
3
+ import { AzureDashboardRenderer } from './renderer.js';
4
+ /**
5
+ * @classdesc Provides operations on Azure Portal Dashboards using Pulumi
6
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```typescript
10
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonAzureConstruct {
13
+ * constructor(name: string, props: CommonAzureStackProps) {
14
+ * super(name, props)
15
+ * this.props = props
16
+ * this.azurePortalManager.createDashBoard('MyDashboard', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export class AzurePortalManager {
22
+ /**
23
+ * @summary Method to create a new portal dashboard
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props the dashboard properties
27
+ * @param renderer An optional renderer to use
28
+ * @param resourceOptions Optional settings to control resource behaviour
29
+ * @see [Pulumi Azure Native Portal Dashboard]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/portal/dashboard/}
30
+ */
31
+ createDashBoard(id, scope, props, renderer, resourceOptions) {
32
+ if (!props)
33
+ throw `Props undefined for ${id}`;
34
+ const resourceGroup = scope.resourceGroupManager.resolveResourceGroup(scope, props.resourceGroupName.toString() ?? scope.props.resourceGroupName, resourceOptions);
35
+ const dashboardName = scope.resourceNameFormatter.format(props.dashboardName?.toString(), scope.props.resourceNameOptions?.portalDashboard);
36
+ const dashboardRenderer = renderer ?? new AzureDashboardRenderer();
37
+ const templateFile = dashboardRenderer.renderToFile(dashboardName, props);
38
+ const template = fs.readFileSync(templateFile, 'utf-8');
39
+ const content = Object.entries(props.variables).reduce((result, [key, value]) => result.replaceAll(`\${${key}}`, String(value)), template);
40
+ return new Dashboard(`${id}-dashboard`, {
41
+ ...props,
42
+ dashboardName: scope.resourceNameFormatter.format(props.dashboardName?.toString(), scope.props.resourceNameOptions?.portalDashboard),
43
+ resourceGroupName: resourceGroup.name,
44
+ location: props.location ?? resourceGroup.location,
45
+ properties: JSON.parse(content),
46
+ tags: {
47
+ 'hidden-title': `${props.location} - ${props.displayName}`,
48
+ },
49
+ }, { ...resourceOptions, ignoreChanges: ['location'] });
50
+ }
51
+ }
@@ -0,0 +1,11 @@
1
+ import { DashboardRenderer, MissingKeys, PaneTemplate, RenderParams } from './types.js';
2
+ export declare class AzureDashboardRenderer implements DashboardRenderer {
3
+ private readonly paneTemplatePath;
4
+ private readonly outputDir;
5
+ constructor(basePath?: string, outputDir?: string);
6
+ private getPaneId;
7
+ getMissingProperties(template: PaneTemplate, properties?: RenderParams['properties']): MissingKeys;
8
+ getMissingVariables(template: PaneTemplate, variables: RenderParams['variables']): MissingKeys;
9
+ render(params: RenderParams): string;
10
+ renderToFile(filename: string, params: RenderParams): string;
11
+ }
@@ -0,0 +1,156 @@
1
+ import appRoot from 'app-root-path';
2
+ import fs from 'fs';
3
+ import _ from 'lodash';
4
+ import path from 'path';
5
+ import { parse } from 'yaml';
6
+ import { TemplateError } from './error.js';
7
+ export class AzureDashboardRenderer {
8
+ paneTemplatePath;
9
+ outputDir;
10
+ constructor(basePath, outputDir) {
11
+ this.paneTemplatePath = basePath ?? path.join(appRoot.path, 'template', 'dashboard');
12
+ this.outputDir = outputDir ?? path.join(appRoot.path, '.artifacts');
13
+ }
14
+ getPaneId(id) {
15
+ const panePath = `${this.paneTemplatePath}/${id}.yaml`;
16
+ const paneFileContent = fs.readFileSync(panePath, 'utf-8');
17
+ const paneTemplate = parse(paneFileContent);
18
+ return paneTemplate;
19
+ }
20
+ getMissingProperties(template, properties = []) {
21
+ const keys = Object.keys(template.properties).filter(key => !(key in properties));
22
+ return {
23
+ keys,
24
+ hasMissingKeys: keys.length !== 0,
25
+ };
26
+ }
27
+ getMissingVariables(template, variables) {
28
+ const keys = Object.keys(template.variables).filter(key => !(key in variables));
29
+ return {
30
+ keys,
31
+ hasMissingKeys: keys.length !== 0,
32
+ };
33
+ }
34
+ render(params) {
35
+ _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
36
+ // if client is used instead of hosts
37
+ let partsIndex = 0;
38
+ let yIndex = 0;
39
+ const parts = {};
40
+ for (const pane of params.panes) {
41
+ try {
42
+ const paneTemplate = this.getPaneId(pane.id);
43
+ const compiled = _.template(paneTemplate.template);
44
+ function getValue(value) {
45
+ try {
46
+ if (typeof value === 'number') {
47
+ return value;
48
+ }
49
+ if (value.includes(':')) {
50
+ const [property, formatter] = value.split(':');
51
+ const unformattedValue = _.get(params.properties, property);
52
+ if (formatter === 'host') {
53
+ const host = new URL(unformattedValue);
54
+ const port = host.protocol.startsWith('https') ? '443' : '80';
55
+ return `${host.host}:${port}`;
56
+ }
57
+ return unformattedValue;
58
+ }
59
+ return value;
60
+ }
61
+ catch (e) {
62
+ console.error('failed to process', value, 'with error', e);
63
+ return '';
64
+ }
65
+ }
66
+ const missingVariables = this.getMissingVariables(paneTemplate, params.variables);
67
+ if (missingVariables.hasMissingKeys) {
68
+ throw new TemplateError(`Failed to render pane ${pane.id}: Missing required variables [${missingVariables.keys.join(', ')}] for template substitution.`);
69
+ }
70
+ const paneProperties = {};
71
+ for (const [key, value] of Object.entries(pane.properties ?? {})) {
72
+ if (value === undefined || value === null) {
73
+ continue;
74
+ }
75
+ let resolvedValue = '';
76
+ if (typeof value === 'string') {
77
+ resolvedValue = getValue(value);
78
+ }
79
+ if (Array.isArray(value)) {
80
+ resolvedValue = value.map(v => getValue(v));
81
+ }
82
+ paneProperties[key] = resolvedValue;
83
+ }
84
+ const properties = { ...params.properties, yIndex, ...paneProperties };
85
+ const missingProperties = this.getMissingProperties(paneTemplate, properties);
86
+ if (missingProperties.hasMissingKeys) {
87
+ throw new TemplateError(`Failed to render pane ${pane.id}: Missing required properties [${missingProperties.keys.join(', ')}] for template substitution.`);
88
+ }
89
+ const paneContent = compiled(properties);
90
+ const paneJSON = JSON.parse(paneContent);
91
+ const templateParts = paneJSON.parts;
92
+ for (const part of templateParts) {
93
+ parts[`${partsIndex}`] = part;
94
+ partsIndex++;
95
+ }
96
+ yIndex += paneTemplate.dimensions.height;
97
+ }
98
+ catch (e) {
99
+ if (TemplateError.isInstance(e)) {
100
+ throw e;
101
+ }
102
+ console.error('failed to render pane', pane.id, 'with error', e);
103
+ }
104
+ }
105
+ const dashboard = {
106
+ lenses: {
107
+ '0': {
108
+ order: 0,
109
+ parts,
110
+ },
111
+ },
112
+ metadata: {
113
+ model: {
114
+ timeRange: {
115
+ value: {
116
+ relative: {
117
+ duration: 24,
118
+ timeUnit: 1,
119
+ },
120
+ },
121
+ type: 'MsPortalFx.Composition.Configuration.ValueTypes.TimeRange',
122
+ },
123
+ filterLocale: {
124
+ value: params.filter?.locale ?? 'en-us',
125
+ },
126
+ filters: {
127
+ value: {
128
+ MsPortalFx_TimeRange: {
129
+ model: {
130
+ format: params.filter?.timeFormat ?? 'utc',
131
+ granularity: params.filter?.timeGranularity ?? 'auto',
132
+ relative: params.filter?.timeRelative ?? '4h',
133
+ },
134
+ displayCache: {
135
+ name: 'UTC Time',
136
+ value: 'Past 4 hours',
137
+ },
138
+ filteredPartIds: [],
139
+ },
140
+ },
141
+ },
142
+ },
143
+ },
144
+ };
145
+ return JSON.stringify(dashboard, null, 2);
146
+ }
147
+ renderToFile(filename, params) {
148
+ const templateOutput = this.render(params);
149
+ if (!fs.existsSync(this.outputDir)) {
150
+ fs.mkdirSync(this.outputDir, { recursive: true });
151
+ }
152
+ const filePath = path.join(this.outputDir, `${filename}.tftpl`);
153
+ fs.writeFileSync(filePath, templateOutput);
154
+ return filePath;
155
+ }
156
+ }
@@ -0,0 +1,40 @@
1
+ import { DashboardArgs } from '@pulumi/azure-native/portal/index.js';
2
+ export type PaneTemplate = {
3
+ dimensions: {
4
+ height: number;
5
+ };
6
+ properties: Record<string, string>;
7
+ variables: Record<string, string>;
8
+ template: string;
9
+ };
10
+ export type MissingKeys = {
11
+ keys: Array<string>;
12
+ hasMissingKeys: boolean;
13
+ };
14
+ export type Pane = {
15
+ id: string;
16
+ properties?: Record<string, string | number | Array<string | number>>;
17
+ };
18
+ export type Filter = {
19
+ locale?: string;
20
+ timeFormat?: string;
21
+ timeGranularity?: string;
22
+ timeRelative?: string;
23
+ };
24
+ export type RenderParams = {
25
+ panes: Array<Pane>;
26
+ variables: Record<string, any>;
27
+ properties?: Record<string, any>;
28
+ filter?: Filter;
29
+ };
30
+ export interface DashboardRenderer {
31
+ render(params: RenderParams): string;
32
+ renderToFile(filename: string, params: RenderParams): string;
33
+ }
34
+ export interface PortalDashboardProps extends DashboardArgs {
35
+ displayName: string;
36
+ panes: Array<Pane>;
37
+ variables: Record<string, string>;
38
+ filter?: Filter;
39
+ enabled?: boolean;
40
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,31 @@
1
+ import { ResourceOptions } from '@pulumi/pulumi';
2
+ import { CommonAzureConstruct } from '../../common/index.js';
3
+ import { RedisProps } from './types.js';
4
+ /**
5
+ * @classdesc Provides operations on Azure Redis using Pulumi
6
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```typescript
10
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonAzureConstruct {
13
+ * constructor(name: string, props: CommonAzureStackProps) {
14
+ * super(name, props)
15
+ * this.props = props
16
+ * this.redisManager.createManagedRedis('MyManagedRedis', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class AzureRedisManager {
22
+ /**
23
+ * @summary Method to create a new managed redis cache
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props redis cache properties
27
+ * @param resourceOptions Optional settings to control resource behaviour
28
+ * @see [Pulumi Azure Native Redis]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/cache/redis/}
29
+ */
30
+ createManagedRedis(id: string, scope: CommonAzureConstruct, props: RedisProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/redis/redis.js").Redis;
31
+ }
@@ -0,0 +1,52 @@
1
+ import { Redis, SkuFamily, SkuName } from '@pulumi/azure-native/redis/index.js';
2
+ /**
3
+ * @classdesc Provides operations on Azure Redis using Pulumi
4
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
5
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
6
+ * @example
7
+ * ```typescript
8
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
9
+ *
10
+ * class CustomConstruct extends CommonAzureConstruct {
11
+ * constructor(name: string, props: CommonAzureStackProps) {
12
+ * super(name, props)
13
+ * this.props = props
14
+ * this.redisManager.createManagedRedis('MyManagedRedis', this, props)
15
+ * }
16
+ * }
17
+ * ```
18
+ */
19
+ export class AzureRedisManager {
20
+ /**
21
+ * @summary Method to create a new managed redis cache
22
+ * @param id scoped id of the resource
23
+ * @param scope scope in which this resource is defined
24
+ * @param props redis cache properties
25
+ * @param resourceOptions Optional settings to control resource behaviour
26
+ * @see [Pulumi Azure Native Redis]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/cache/redis/}
27
+ */
28
+ createManagedRedis(id, scope, props, resourceOptions) {
29
+ if (!props)
30
+ throw `Props undefined for ${id}`;
31
+ // Get resource group name
32
+ const resourceGroupName = scope.props.resourceGroupName
33
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
+ : props.resourceGroupName;
35
+ if (!resourceGroupName)
36
+ throw `Resource group name undefined for ${id}`;
37
+ return new Redis(`${id}-rc`, {
38
+ ...props,
39
+ name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.managedRedis),
40
+ location: props.location ?? scope.props.location,
41
+ resourceGroupName: resourceGroupName,
42
+ sku: props.sku ?? {
43
+ name: SkuName.Basic,
44
+ family: SkuFamily.C,
45
+ capacity: 0,
46
+ },
47
+ tags: props.tags ?? {
48
+ environment: scope.props.stage,
49
+ },
50
+ }, { parent: scope, ...resourceOptions });
51
+ }
52
+ }
@@ -0,0 +1,3 @@
1
+ import { RedisArgs } from '@pulumi/azure-native/redis/index.js';
2
+ export interface RedisProps extends RedisArgs {
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,38 @@
1
+ import { ResourceOptions } from '@pulumi/pulumi';
2
+ import { CommonAzureConstruct } from '../../common/index.js';
3
+ import { ResourceGroupProps } from './types.js';
4
+ /**
5
+ * @classdesc Provides operations on Azure Resource Group using Pulumi
6
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```typescript
10
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonAzureConstruct {
13
+ * constructor(name: string, props: CommonAzureStackProps) {
14
+ * super(name, props)
15
+ * this.props = props
16
+ * this.resourceGroupManager.createResourceGroup('MyResourceGroup', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class AzureResourceGroupManager {
22
+ /**
23
+ * @summary Method to create a new resource group
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props resource group properties
27
+ * @param resourceOptions Optional settings to control resource behaviour
28
+ * @see [Pulumi Azure Native Resource Group]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/resources/resourcegroup/}
29
+ */
30
+ createResourceGroup(id: string, scope: CommonAzureConstruct, props: ResourceGroupProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/resources/resourceGroup.js").ResourceGroup;
31
+ /**
32
+ * @summary Method to resolve an existing resource group
33
+ * @param scope scope in which this resource is defined
34
+ * @param resourceGroupName the resource group name
35
+ * @param resourceOptions Optional settings to control resource behaviour
36
+ */
37
+ resolveResourceGroup(scope: CommonAzureConstruct, resourceGroupName: string, resourceOptions?: ResourceOptions): import("@pulumi/pulumi").Output<import("@pulumi/azure-native/resources/getResourceGroup.js").GetResourceGroupResult>;
38
+ }
@@ -0,0 +1,53 @@
1
+ import { getResourceGroupOutput, ResourceGroup } from '@pulumi/azure-native/resources/index.js';
2
+ /**
3
+ * @classdesc Provides operations on Azure Resource Group using Pulumi
4
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
5
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
6
+ * @example
7
+ * ```typescript
8
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
9
+ *
10
+ * class CustomConstruct extends CommonAzureConstruct {
11
+ * constructor(name: string, props: CommonAzureStackProps) {
12
+ * super(name, props)
13
+ * this.props = props
14
+ * this.resourceGroupManager.createResourceGroup('MyResourceGroup', this, props)
15
+ * }
16
+ * }
17
+ * ```
18
+ */
19
+ export class AzureResourceGroupManager {
20
+ /**
21
+ * @summary Method to create a new resource group
22
+ * @param id scoped id of the resource
23
+ * @param scope scope in which this resource is defined
24
+ * @param props resource group properties
25
+ * @param resourceOptions Optional settings to control resource behaviour
26
+ * @see [Pulumi Azure Native Resource Group]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/resources/resourcegroup/}
27
+ */
28
+ createResourceGroup(id, scope, props, resourceOptions) {
29
+ if (!props)
30
+ throw `Props undefined for ${id}`;
31
+ return new ResourceGroup(`${id}-rg`, {
32
+ ...props,
33
+ resourceGroupName: scope.resourceNameFormatter.format(props.resourceGroupName?.toString(), scope.props.resourceNameOptions?.resourceGroup),
34
+ location: props.location,
35
+ tags: props.tags ?? {
36
+ environment: scope.props.stage,
37
+ },
38
+ }, { parent: scope, ...resourceOptions });
39
+ }
40
+ /**
41
+ * @summary Method to resolve an existing resource group
42
+ * @param scope scope in which this resource is defined
43
+ * @param resourceGroupName the resource group name
44
+ * @param resourceOptions Optional settings to control resource behaviour
45
+ */
46
+ resolveResourceGroup(scope, resourceGroupName, resourceOptions) {
47
+ if (!resourceGroupName)
48
+ throw `Resource Group Name undefined`;
49
+ return getResourceGroupOutput({
50
+ resourceGroupName: scope.resourceNameFormatter.format(resourceGroupName?.toString(), scope.props.resourceNameOptions?.resourceGroup),
51
+ }, { parent: scope, ...resourceOptions });
52
+ }
53
+ }
@@ -0,0 +1,3 @@
1
+ import { ResourceGroupArgs } from '@pulumi/azure-native/resources/index.js';
2
+ export interface ResourceGroupProps extends ResourceGroupArgs {
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,31 @@
1
+ import { ResourceOptions } from '@pulumi/pulumi';
2
+ import { CommonAzureConstruct } from '../../common/index.js';
3
+ import { DefenderForStorageProps } from './types.js';
4
+ /**
5
+ * @classdesc Provides operations on Azure Security Center using Pulumi
6
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```typescript
10
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonAzureConstruct {
13
+ * constructor(name: string, props: CommonAzureStackProps) {
14
+ * super(name, props)
15
+ * this.props = props
16
+ * this.securityCenterManager.createDefenderForStorage('MyDefender', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class AzureSecurityCentermanager {
22
+ /**
23
+ * @summary Method to create a new defender for storage account
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props defender for storage account properties
27
+ * @param resourceOptions Optional settings to control resource behaviour
28
+ * @see [Pulumi Azure Native Defender For Storage]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/security/defenderforstorage/}
29
+ */
30
+ createDefenderForStorage(id: string, scope: CommonAzureConstruct, props: DefenderForStorageProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/security/defenderForStorage.js").DefenderForStorage;
31
+ }
@@ -0,0 +1,33 @@
1
+ import { DefenderForStorage } from '@pulumi/azure-native/security/index.js';
2
+ /**
3
+ * @classdesc Provides operations on Azure Security Center using Pulumi
4
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
5
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
6
+ * @example
7
+ * ```typescript
8
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
9
+ *
10
+ * class CustomConstruct extends CommonAzureConstruct {
11
+ * constructor(name: string, props: CommonAzureStackProps) {
12
+ * super(name, props)
13
+ * this.props = props
14
+ * this.securityCenterManager.createDefenderForStorage('MyDefender', this, props)
15
+ * }
16
+ * }
17
+ * ```
18
+ */
19
+ export class AzureSecurityCentermanager {
20
+ /**
21
+ * @summary Method to create a new defender for storage account
22
+ * @param id scoped id of the resource
23
+ * @param scope scope in which this resource is defined
24
+ * @param props defender for storage account properties
25
+ * @param resourceOptions Optional settings to control resource behaviour
26
+ * @see [Pulumi Azure Native Defender For Storage]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/security/defenderforstorage/}
27
+ */
28
+ createDefenderForStorage(id, scope, props, resourceOptions) {
29
+ if (!props)
30
+ throw `Props undefined for ${id}`;
31
+ return new DefenderForStorage(`${id}`, props, { parent: scope, ...resourceOptions });
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ import { DefenderForStorageArgs } from '@pulumi/azure-native/security/index.js';
2
+ export interface DefenderForStorageProps extends DefenderForStorageArgs {
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ export * from './types.js';