@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
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
import { DashboardRenderer, MissingKeys, PaneTemplate, RenderParams } from './types.js'
|
|
8
|
+
|
|
9
|
+
export class AzureDashboardRenderer implements DashboardRenderer {
|
|
10
|
+
private readonly paneTemplatePath: string
|
|
11
|
+
private readonly outputDir: string
|
|
12
|
+
|
|
13
|
+
constructor(basePath?: string, outputDir?: string) {
|
|
14
|
+
this.paneTemplatePath = basePath ?? path.join(appRoot.path, 'template', 'dashboard')
|
|
15
|
+
this.outputDir = outputDir ?? path.join(appRoot.path, '.artifacts')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private getPaneId(id: string): PaneTemplate {
|
|
19
|
+
const panePath = `${this.paneTemplatePath}/${id}.yaml`
|
|
20
|
+
const paneFileContent = fs.readFileSync(panePath, 'utf-8')
|
|
21
|
+
const paneTemplate = parse(paneFileContent)
|
|
22
|
+
return paneTemplate
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public getMissingProperties(template: PaneTemplate, properties: RenderParams['properties'] = []): MissingKeys {
|
|
26
|
+
const keys = Object.keys(template.properties).filter(key => !(key in properties))
|
|
27
|
+
return {
|
|
28
|
+
keys,
|
|
29
|
+
hasMissingKeys: keys.length !== 0,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public getMissingVariables(template: PaneTemplate, variables: RenderParams['variables']): MissingKeys {
|
|
34
|
+
const keys = Object.keys(template.variables).filter(key => !(key in variables))
|
|
35
|
+
return {
|
|
36
|
+
keys,
|
|
37
|
+
hasMissingKeys: keys.length !== 0,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public render(params: RenderParams): string {
|
|
42
|
+
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g
|
|
43
|
+
|
|
44
|
+
// if client is used instead of hosts
|
|
45
|
+
let partsIndex = 0
|
|
46
|
+
let yIndex = 0
|
|
47
|
+
const parts: Record<string, any> = {}
|
|
48
|
+
for (const pane of params.panes) {
|
|
49
|
+
try {
|
|
50
|
+
const paneTemplate = this.getPaneId(pane.id)
|
|
51
|
+
const compiled = _.template(paneTemplate.template)
|
|
52
|
+
|
|
53
|
+
function getValue(value: string | number): string | number {
|
|
54
|
+
try {
|
|
55
|
+
if (typeof value === 'number') {
|
|
56
|
+
return value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (value.includes(':')) {
|
|
60
|
+
const [property, formatter] = value.split(':')
|
|
61
|
+
const unformattedValue = _.get(params.properties, property)
|
|
62
|
+
if (formatter === 'host') {
|
|
63
|
+
const host = new URL(unformattedValue)
|
|
64
|
+
const port = host.protocol.startsWith('https') ? '443' : '80'
|
|
65
|
+
return `${host.host}:${port}`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return unformattedValue
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return value
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error('failed to process', value, 'with error', e)
|
|
74
|
+
|
|
75
|
+
return ''
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const missingVariables = this.getMissingVariables(paneTemplate, params.variables)
|
|
80
|
+
if (missingVariables.hasMissingKeys) {
|
|
81
|
+
throw new TemplateError(
|
|
82
|
+
`Failed to render pane ${pane.id}: Missing required variables [${missingVariables.keys.join(', ')}] for template substitution.`
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const paneProperties: Record<string, string | number | Array<string | number>> = {}
|
|
87
|
+
for (const [key, value] of Object.entries(pane.properties ?? {})) {
|
|
88
|
+
if (value === undefined || value === null) {
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let resolvedValue: string | number | Array<string | number> = ''
|
|
93
|
+
if (typeof value === 'string') {
|
|
94
|
+
resolvedValue = getValue(value)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
resolvedValue = value.map(v => getValue(v))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
paneProperties[key] = resolvedValue
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const properties = { ...params.properties, yIndex, ...paneProperties }
|
|
105
|
+
const missingProperties = this.getMissingProperties(paneTemplate, properties)
|
|
106
|
+
if (missingProperties.hasMissingKeys) {
|
|
107
|
+
throw new TemplateError(
|
|
108
|
+
`Failed to render pane ${pane.id}: Missing required properties [${missingProperties.keys.join(', ')}] for template substitution.`
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
const paneContent = compiled(properties)
|
|
112
|
+
const paneJSON = JSON.parse(paneContent)
|
|
113
|
+
const templateParts = paneJSON.parts
|
|
114
|
+
|
|
115
|
+
for (const part of templateParts) {
|
|
116
|
+
parts[`${partsIndex}`] = part
|
|
117
|
+
partsIndex++
|
|
118
|
+
}
|
|
119
|
+
yIndex += paneTemplate.dimensions.height
|
|
120
|
+
} catch (e) {
|
|
121
|
+
if (TemplateError.isInstance(e)) {
|
|
122
|
+
throw e
|
|
123
|
+
}
|
|
124
|
+
console.error('failed to render pane', pane.id, 'with error', e)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const dashboard = {
|
|
129
|
+
lenses: {
|
|
130
|
+
'0': {
|
|
131
|
+
order: 0,
|
|
132
|
+
parts,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
metadata: {
|
|
136
|
+
model: {
|
|
137
|
+
timeRange: {
|
|
138
|
+
value: {
|
|
139
|
+
relative: {
|
|
140
|
+
duration: 24,
|
|
141
|
+
timeUnit: 1,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
type: 'MsPortalFx.Composition.Configuration.ValueTypes.TimeRange',
|
|
145
|
+
},
|
|
146
|
+
filterLocale: {
|
|
147
|
+
value: params.filter?.locale ?? 'en-us',
|
|
148
|
+
},
|
|
149
|
+
filters: {
|
|
150
|
+
value: {
|
|
151
|
+
MsPortalFx_TimeRange: {
|
|
152
|
+
model: {
|
|
153
|
+
format: params.filter?.timeFormat ?? 'utc',
|
|
154
|
+
granularity: params.filter?.timeGranularity ?? 'auto',
|
|
155
|
+
relative: params.filter?.timeRelative ?? '4h',
|
|
156
|
+
},
|
|
157
|
+
displayCache: {
|
|
158
|
+
name: 'UTC Time',
|
|
159
|
+
value: 'Past 4 hours',
|
|
160
|
+
},
|
|
161
|
+
filteredPartIds: [],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return JSON.stringify(dashboard, null, 2)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
renderToFile(filename: string, params: RenderParams): string {
|
|
173
|
+
const templateOutput = this.render(params)
|
|
174
|
+
if (!fs.existsSync(this.outputDir)) {
|
|
175
|
+
fs.mkdirSync(this.outputDir, { recursive: true })
|
|
176
|
+
}
|
|
177
|
+
const filePath = path.join(this.outputDir, `${filename}.tftpl`)
|
|
178
|
+
fs.writeFileSync(filePath, templateOutput)
|
|
179
|
+
|
|
180
|
+
return filePath
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DashboardArgs } from '@pulumi/azure-native/portal/index.js'
|
|
2
|
+
|
|
3
|
+
export type PaneTemplate = {
|
|
4
|
+
dimensions: { height: number }
|
|
5
|
+
properties: Record<string, string>
|
|
6
|
+
variables: Record<string, string>
|
|
7
|
+
template: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type MissingKeys = {
|
|
11
|
+
keys: Array<string>
|
|
12
|
+
hasMissingKeys: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Pane = {
|
|
16
|
+
id: string
|
|
17
|
+
properties?: Record<string, string | number | Array<string | number>>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type Filter = {
|
|
21
|
+
locale?: string
|
|
22
|
+
timeFormat?: string
|
|
23
|
+
timeGranularity?: string
|
|
24
|
+
timeRelative?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type RenderParams = {
|
|
28
|
+
panes: Array<Pane>
|
|
29
|
+
variables: Record<string, any>
|
|
30
|
+
properties?: Record<string, any>
|
|
31
|
+
filter?: Filter
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DashboardRenderer {
|
|
35
|
+
render(params: RenderParams): string
|
|
36
|
+
renderToFile(filename: string, params: RenderParams): string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PortalDashboardProps extends DashboardArgs {
|
|
40
|
+
displayName: string
|
|
41
|
+
panes: Array<Pane>
|
|
42
|
+
variables: Record<string, string>
|
|
43
|
+
filter?: Filter
|
|
44
|
+
enabled?: boolean
|
|
45
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Redis, SkuFamily, SkuName } from '@pulumi/azure-native/redis/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
2
3
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
|
-
import {
|
|
4
|
+
import { RedisProps } from './types.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @classdesc Provides operations on Azure Redis using Pulumi
|
|
@@ -25,9 +26,15 @@ export class AzureRedisManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props redis cache properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Redis]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/cache/redis/}
|
|
29
31
|
*/
|
|
30
|
-
public createManagedRedis(
|
|
32
|
+
public createManagedRedis(
|
|
33
|
+
id: string,
|
|
34
|
+
scope: CommonAzureConstruct,
|
|
35
|
+
props: RedisProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
37
|
+
) {
|
|
31
38
|
if (!props) throw `Props undefined for ${id}`
|
|
32
39
|
|
|
33
40
|
// Get resource group name
|
|
@@ -53,7 +60,7 @@ export class AzureRedisManager {
|
|
|
53
60
|
environment: scope.props.stage,
|
|
54
61
|
},
|
|
55
62
|
},
|
|
56
|
-
{ parent: scope }
|
|
63
|
+
{ parent: scope, ...resourceOptions }
|
|
57
64
|
)
|
|
58
65
|
}
|
|
59
66
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ResourceGroup } from '@pulumi/azure-native/resources/index.js'
|
|
1
|
+
import { getResourceGroupOutput, ResourceGroup } from '@pulumi/azure-native/resources/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
2
3
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
3
4
|
import { ResourceGroupProps } from './types.js'
|
|
4
5
|
|
|
@@ -25,9 +26,15 @@ export class AzureResourceGroupManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props resource group properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Resource Group]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/resources/resourcegroup/}
|
|
29
31
|
*/
|
|
30
|
-
public createResourceGroup(
|
|
32
|
+
public createResourceGroup(
|
|
33
|
+
id: string,
|
|
34
|
+
scope: CommonAzureConstruct,
|
|
35
|
+
props: ResourceGroupProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
37
|
+
) {
|
|
31
38
|
if (!props) throw `Props undefined for ${id}`
|
|
32
39
|
|
|
33
40
|
return new ResourceGroup(
|
|
@@ -43,7 +50,31 @@ export class AzureResourceGroupManager {
|
|
|
43
50
|
environment: scope.props.stage,
|
|
44
51
|
},
|
|
45
52
|
},
|
|
46
|
-
{ parent: scope }
|
|
53
|
+
{ parent: scope, ...resourceOptions }
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @summary Method to resolve an existing resource group
|
|
59
|
+
* @param scope scope in which this resource is defined
|
|
60
|
+
* @param resourceGroupName the resource group name
|
|
61
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
62
|
+
*/
|
|
63
|
+
public resolveResourceGroup(
|
|
64
|
+
scope: CommonAzureConstruct,
|
|
65
|
+
resourceGroupName: string,
|
|
66
|
+
resourceOptions?: ResourceOptions
|
|
67
|
+
) {
|
|
68
|
+
if (!resourceGroupName) throw `Resource Group Name undefined`
|
|
69
|
+
|
|
70
|
+
return getResourceGroupOutput(
|
|
71
|
+
{
|
|
72
|
+
resourceGroupName: scope.resourceNameFormatter.format(
|
|
73
|
+
resourceGroupName?.toString(),
|
|
74
|
+
scope.props.resourceNameOptions?.resourceGroup
|
|
75
|
+
),
|
|
76
|
+
},
|
|
77
|
+
{ parent: scope, ...resourceOptions }
|
|
47
78
|
)
|
|
48
79
|
}
|
|
49
80
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DefenderForStorage } from '@pulumi/azure-native/security/index.js'
|
|
2
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
3
|
+
import { CommonAzureConstruct } from '../../common/index.js'
|
|
4
|
+
import { DefenderForStorageProps } from './types.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Azure Security Center using Pulumi
|
|
8
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
|
+
*
|
|
14
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
16
|
+
* super(name, props)
|
|
17
|
+
* this.props = props
|
|
18
|
+
* this.securityCenterManager.createDefenderForStorage('MyDefender', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class AzureSecurityCentermanager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new defender for storage account
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props defender for storage account properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
30
|
+
* @see [Pulumi Azure Native Defender For Storage]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/security/defenderforstorage/}
|
|
31
|
+
*/
|
|
32
|
+
public createDefenderForStorage(
|
|
33
|
+
id: string,
|
|
34
|
+
scope: CommonAzureConstruct,
|
|
35
|
+
props: DefenderForStorageProps,
|
|
36
|
+
resourceOptions?: ResourceOptions
|
|
37
|
+
) {
|
|
38
|
+
if (!props) throw `Props undefined for ${id}`
|
|
39
|
+
|
|
40
|
+
return new DefenderForStorage(`${id}`, props, { parent: scope, ...resourceOptions })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
Subscription,
|
|
8
8
|
Topic,
|
|
9
9
|
} from '@pulumi/azure-native/servicebus/index.js'
|
|
10
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
10
11
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
11
12
|
import {
|
|
12
13
|
ResolveServicebusQueueProps,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
ServiceBusNamespaceProps,
|
|
15
|
+
ServiceBusQueueProps,
|
|
16
|
+
ServiceBusSubscriptionProps,
|
|
17
|
+
ServiceBusTopicProps,
|
|
17
18
|
} from './types.js'
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -33,15 +34,21 @@ import {
|
|
|
33
34
|
* }
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
|
-
export class
|
|
37
|
+
export class AzureServiceBusManager {
|
|
37
38
|
/**
|
|
38
|
-
* @summary Method to create a new
|
|
39
|
+
* @summary Method to create a new service bus namespace
|
|
39
40
|
* @param id scoped id of the resource
|
|
40
41
|
* @param scope scope in which this resource is defined
|
|
41
|
-
* @param props
|
|
42
|
-
* @
|
|
42
|
+
* @param props service bus namespace properties
|
|
43
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
44
|
+
* @see [Pulumi Azure Native Service Bus Namespace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/namespace/}
|
|
43
45
|
*/
|
|
44
|
-
public
|
|
46
|
+
public createServiceBusNamespace(
|
|
47
|
+
id: string,
|
|
48
|
+
scope: CommonAzureConstruct,
|
|
49
|
+
props: ServiceBusNamespaceProps,
|
|
50
|
+
resourceOptions?: ResourceOptions
|
|
51
|
+
) {
|
|
45
52
|
if (!props) throw `Props undefined for ${id}`
|
|
46
53
|
|
|
47
54
|
// Get resource group name
|
|
@@ -71,18 +78,24 @@ export class AzureServicebusManager {
|
|
|
71
78
|
environment: scope.props.stage,
|
|
72
79
|
},
|
|
73
80
|
},
|
|
74
|
-
{ parent: scope }
|
|
81
|
+
{ parent: scope, ...resourceOptions }
|
|
75
82
|
)
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
/**
|
|
79
|
-
* @summary Method to create a new
|
|
86
|
+
* @summary Method to create a new service bus topic
|
|
80
87
|
* @param id scoped id of the resource
|
|
81
88
|
* @param scope scope in which this resource is defined
|
|
82
|
-
* @param props
|
|
83
|
-
* @
|
|
89
|
+
* @param props service bus topic properties
|
|
90
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
91
|
+
* @see [Pulumi Azure Native Service Bus Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/topic/}
|
|
84
92
|
*/
|
|
85
|
-
public
|
|
93
|
+
public createServiceBusTopic(
|
|
94
|
+
id: string,
|
|
95
|
+
scope: CommonAzureConstruct,
|
|
96
|
+
props: ServiceBusTopicProps,
|
|
97
|
+
resourceOptions?: ResourceOptions
|
|
98
|
+
) {
|
|
86
99
|
if (!props) throw `Props undefined for ${id}`
|
|
87
100
|
|
|
88
101
|
return new Topic(
|
|
@@ -96,18 +109,24 @@ export class AzureServicebusManager {
|
|
|
96
109
|
namespaceName: props.namespaceName,
|
|
97
110
|
resourceGroupName: props.resourceGroupName,
|
|
98
111
|
},
|
|
99
|
-
{ parent: scope }
|
|
112
|
+
{ parent: scope, ...resourceOptions }
|
|
100
113
|
)
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
/**
|
|
104
|
-
* @summary Method to create a new
|
|
117
|
+
* @summary Method to create a new service bus queue
|
|
105
118
|
* @param id scoped id of the resource
|
|
106
119
|
* @param scope scope in which this resource is defined
|
|
107
|
-
* @param props
|
|
108
|
-
* @
|
|
120
|
+
* @param props service bus queue properties
|
|
121
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
122
|
+
* @see [Pulumi Azure Native Service Bus Queue]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
109
123
|
*/
|
|
110
|
-
public
|
|
124
|
+
public createServiceBusQueue(
|
|
125
|
+
id: string,
|
|
126
|
+
scope: CommonAzureConstruct,
|
|
127
|
+
props: ServiceBusQueueProps,
|
|
128
|
+
resourceOptions?: ResourceOptions
|
|
129
|
+
) {
|
|
111
130
|
if (!props) throw `Props undefined for ${id}`
|
|
112
131
|
|
|
113
132
|
return new Queue(
|
|
@@ -125,18 +144,24 @@ export class AzureServicebusManager {
|
|
|
125
144
|
deadLetteringOnMessageExpiration: props.deadLetteringOnMessageExpiration ?? true,
|
|
126
145
|
defaultMessageTimeToLive: (props as any).defaultMessageTtl ?? 'P2D',
|
|
127
146
|
},
|
|
128
|
-
{ parent: scope }
|
|
147
|
+
{ parent: scope, ...resourceOptions }
|
|
129
148
|
)
|
|
130
149
|
}
|
|
131
150
|
|
|
132
151
|
/**
|
|
133
|
-
* @summary Method to create a new
|
|
152
|
+
* @summary Method to create a new service bus subscription
|
|
134
153
|
* @param id scoped id of the resource
|
|
135
154
|
* @param scope scope in which this resource is defined
|
|
136
|
-
* @param props
|
|
137
|
-
* @
|
|
155
|
+
* @param props service bus subscription properties
|
|
156
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
157
|
+
* @see [Pulumi Azure Native Service Bus Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/subscription/}
|
|
138
158
|
*/
|
|
139
|
-
public
|
|
159
|
+
public createServiceBusSubscription(
|
|
160
|
+
id: string,
|
|
161
|
+
scope: CommonAzureConstruct,
|
|
162
|
+
props: ServiceBusSubscriptionProps,
|
|
163
|
+
resourceOptions?: ResourceOptions
|
|
164
|
+
) {
|
|
140
165
|
if (!props) throw `Props undefined for ${id}`
|
|
141
166
|
|
|
142
167
|
return new Subscription(
|
|
@@ -149,18 +174,24 @@ export class AzureServicebusManager {
|
|
|
149
174
|
),
|
|
150
175
|
maxDeliveryCount: props.maxDeliveryCount ?? 1,
|
|
151
176
|
},
|
|
152
|
-
{ parent: scope }
|
|
177
|
+
{ parent: scope, ...resourceOptions }
|
|
153
178
|
)
|
|
154
179
|
}
|
|
155
180
|
|
|
156
181
|
/**
|
|
157
|
-
* @summary Method to resolve an existing
|
|
182
|
+
* @summary Method to resolve an existing service bus queue
|
|
158
183
|
* @param id scoped id of the resource
|
|
159
184
|
* @param scope scope in which this resource is defined
|
|
160
|
-
* @param props
|
|
161
|
-
* @
|
|
185
|
+
* @param props service bus queue properties for lookup
|
|
186
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
187
|
+
* @see [Pulumi Azure Native Service Bus Queue Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
162
188
|
*/
|
|
163
|
-
public
|
|
189
|
+
public resolveServiceBusQueue(
|
|
190
|
+
id: string,
|
|
191
|
+
scope: CommonAzureConstruct,
|
|
192
|
+
props: ResolveServicebusQueueProps,
|
|
193
|
+
resourceOptions?: ResourceOptions
|
|
194
|
+
) {
|
|
164
195
|
if (!props) throw `Props undefined for ${id}`
|
|
165
196
|
|
|
166
197
|
return getQueueOutput(
|
|
@@ -172,7 +203,7 @@ export class AzureServicebusManager {
|
|
|
172
203
|
namespaceName: props.namespaceName,
|
|
173
204
|
resourceGroupName: props.resourceGroupName,
|
|
174
205
|
},
|
|
175
|
-
{ parent: scope }
|
|
206
|
+
{ parent: scope, ...resourceOptions }
|
|
176
207
|
)
|
|
177
208
|
}
|
|
178
209
|
}
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
TopicArgs,
|
|
7
7
|
} from '@pulumi/azure-native/servicebus/index.js'
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface ServiceBusNamespaceProps extends NamespaceArgs {}
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface ServiceBusTopicProps extends TopicArgs {}
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface ServiceBusQueueProps extends QueueArgs {}
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface ServiceBusSubscriptionProps extends SubscriptionArgs {}
|
|
16
16
|
|
|
17
17
|
export interface ResolveServicebusQueueProps extends GetQueueOutputArgs {}
|