@webda/azure 0.0.0-stage → 4.0.0-beta.14

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 (68) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +248 -2
  3. package/lib/auth.d.ts +36 -0
  4. package/lib/auth.d.ts.map +1 -0
  5. package/lib/auth.js +70 -0
  6. package/lib/auth.js.map +1 -0
  7. package/lib/deployers/arm.service.d.ts +177 -0
  8. package/lib/deployers/arm.service.d.ts.map +1 -0
  9. package/lib/deployers/arm.service.js +307 -0
  10. package/lib/deployers/arm.service.js.map +1 -0
  11. package/lib/deployers/containerapps.service.d.ts +186 -0
  12. package/lib/deployers/containerapps.service.d.ts.map +1 -0
  13. package/lib/deployers/containerapps.service.js +482 -0
  14. package/lib/deployers/containerapps.service.js.map +1 -0
  15. package/lib/deployers/functions-entrypoint.d.ts +60 -0
  16. package/lib/deployers/functions-entrypoint.d.ts.map +1 -0
  17. package/lib/deployers/functions-entrypoint.js +78 -0
  18. package/lib/deployers/functions-entrypoint.js.map +1 -0
  19. package/lib/deployers/functions.service.d.ts +96 -0
  20. package/lib/deployers/functions.service.d.ts.map +1 -0
  21. package/lib/deployers/functions.service.js +340 -0
  22. package/lib/deployers/functions.service.js.map +1 -0
  23. package/lib/deployers/functionspackager.service.d.ts +82 -0
  24. package/lib/deployers/functionspackager.service.d.ts.map +1 -0
  25. package/lib/deployers/functionspackager.service.js +157 -0
  26. package/lib/deployers/functionspackager.service.js.map +1 -0
  27. package/lib/index.d.ts +15 -0
  28. package/lib/index.d.ts.map +1 -0
  29. package/lib/index.js +18 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/services/azure-parameters.d.ts +56 -0
  32. package/lib/services/azure-parameters.d.ts.map +1 -0
  33. package/lib/services/azure-parameters.js +43 -0
  34. package/lib/services/azure-parameters.js.map +1 -0
  35. package/lib/services/blob.service.d.ts +196 -0
  36. package/lib/services/blob.service.d.ts.map +1 -0
  37. package/lib/services/blob.service.js +450 -0
  38. package/lib/services/blob.service.js.map +1 -0
  39. package/lib/services/contributors.d.ts +50 -0
  40. package/lib/services/contributors.d.ts.map +1 -0
  41. package/lib/services/contributors.js +2 -0
  42. package/lib/services/contributors.js.map +1 -0
  43. package/lib/services/cosmos.service.d.ts +253 -0
  44. package/lib/services/cosmos.service.d.ts.map +1 -0
  45. package/lib/services/cosmos.service.js +566 -0
  46. package/lib/services/cosmos.service.js.map +1 -0
  47. package/lib/services/functionserver.service.d.ts +51 -0
  48. package/lib/services/functionserver.service.d.ts.map +1 -0
  49. package/lib/services/functionserver.service.js +232 -0
  50. package/lib/services/functionserver.service.js.map +1 -0
  51. package/lib/services/keyvault.service.d.ts +106 -0
  52. package/lib/services/keyvault.service.d.ts.map +1 -0
  53. package/lib/services/keyvault.service.js +228 -0
  54. package/lib/services/keyvault.service.js.map +1 -0
  55. package/lib/services/monitorlogger.service.d.ts +117 -0
  56. package/lib/services/monitorlogger.service.d.ts.map +1 -0
  57. package/lib/services/monitorlogger.service.js +149 -0
  58. package/lib/services/monitorlogger.service.js.map +1 -0
  59. package/lib/services/servicebus.service.d.ts +224 -0
  60. package/lib/services/servicebus.service.d.ts.map +1 -0
  61. package/lib/services/servicebus.service.js +351 -0
  62. package/lib/services/servicebus.service.js.map +1 -0
  63. package/lib/template.d.ts +68 -0
  64. package/lib/template.d.ts.map +1 -0
  65. package/lib/template.js +74 -0
  66. package/lib/template.js.map +1 -0
  67. package/package.json +77 -3
  68. package/webda.module.json +1891 -0
@@ -0,0 +1,177 @@
1
+ import { SecretString } from "@webda/core";
2
+ import { ContainerDeployer, ContainerDeployerParameters } from "@webda/oci";
3
+ import { AzureServiceParameters } from "../services/azure-parameters.js";
4
+ import { AzureDeployerInfo, AzureRoleAssignment } from "../services/contributors.js";
5
+ import { AzureTemplate } from "../template.js";
6
+ /** Shared ARM and OCI parameters used by Azure deployment units. */
7
+ export declare class AzureArmDeployerParameters extends ContainerDeployerParameters implements AzureServiceParameters {
8
+ /**
9
+ * Tenant ID
10
+ */
11
+ tenantId?: string;
12
+ /**
13
+ * Client ID
14
+ */
15
+ clientId?: string;
16
+ /**
17
+ * Client secret
18
+ */
19
+ clientSecret?: string | SecretString;
20
+ /**
21
+ * Subscription ID
22
+ */
23
+ subscriptionId: string;
24
+ /**
25
+ * Endpoint
26
+ */
27
+ endpoint?: string;
28
+ /**
29
+ * Resource group
30
+ */
31
+ resourceGroup: string;
32
+ /**
33
+ * Location
34
+ */
35
+ location: string;
36
+ /**
37
+ * Create resource group
38
+ */
39
+ createResourceGroup: boolean;
40
+ /**
41
+ * Deployment name
42
+ */
43
+ deploymentName?: string;
44
+ /**
45
+ * Resource tags
46
+ */
47
+ resourceTags: Record<string, string>;
48
+ /**
49
+ * Custom resources
50
+ */
51
+ customResources: Record<string, any>[] | Record<string, Record<string, any>>;
52
+ /**
53
+ * Template output
54
+ */
55
+ templateOutput?: string;
56
+ /**
57
+ * Perform load.
58
+ * @override
59
+ */
60
+ load(params?: any): this;
61
+ }
62
+ /** Deployment results contain resource endpoints, never tokens or secret parameter values. */
63
+ export interface AzureDeployResult {
64
+ /**
65
+ * Image
66
+ */
67
+ image?: string;
68
+ /**
69
+ * Digest
70
+ */
71
+ digest?: string;
72
+ /**
73
+ * Fqdn
74
+ */
75
+ fqdn?: string;
76
+ /**
77
+ * Revision
78
+ */
79
+ revision?: string;
80
+ /**
81
+ * Outputs
82
+ */
83
+ outputs: Record<string, any>;
84
+ }
85
+ /** Shared template collection and ARM deployment. SDK clients are created only when deploying. */
86
+ export declare abstract class AzureArmDeployer<T extends AzureArmDeployerParameters = AzureArmDeployerParameters> extends ContainerDeployer<T, AzureDeployResult> implements AzureDeployerInfo {
87
+ /**
88
+ * Resources
89
+ */
90
+ resources: T;
91
+ /**
92
+ * Template
93
+ */
94
+ template: AzureTemplate;
95
+ /**
96
+ * Result
97
+ */
98
+ result?: AzureDeployResult;
99
+ /**
100
+ * Secret values
101
+ */
102
+ protected secretValues: Map<string, string | SecretString>;
103
+ /**
104
+ * Contributed env
105
+ */
106
+ protected contributedEnv: Record<string, string | {
107
+ secretRef: string;
108
+ }>;
109
+ /**
110
+ * Roles
111
+ */
112
+ protected roles: AzureRoleAssignment[];
113
+ /**
114
+ * Perform get resolved parameters.
115
+ * @override
116
+ */
117
+ getResolvedParameters(): T;
118
+ /**
119
+ * Resolve the deployment scope and reset template state.
120
+ */
121
+ protected prepare(): void;
122
+ /**
123
+ * Merge deployment tags with resource tags.
124
+ * @param tags - Resource-specific tags
125
+ * @returns The default tags result
126
+ */
127
+ getDefaultTags(tags?: Record<string, string>): Record<string, string>;
128
+ abstract getAppResourceId(): string;
129
+ /**
130
+ * Return the managed identity resource identifier.
131
+ * @returns The identity resource id result
132
+ */
133
+ protected getIdentityResourceId(): string;
134
+ /**
135
+ * Return the ARM expression for the application principal.
136
+ * @returns The app principal id result
137
+ */
138
+ abstract getAppPrincipalId(): string;
139
+ abstract generateTemplate(image?: string): AzureTemplate;
140
+ /**
141
+ * Add a secret without placing its value in the serializable template.
142
+ * @param value - Value to convert or protect
143
+ * @returns The secure parameter result
144
+ */
145
+ protected secureParameter(value: string | SecretString): string;
146
+ /**
147
+ * Merge service resources, environment and roles. Conflicting contributions are rejected.
148
+ */
149
+ Resources(): void;
150
+ /**
151
+ * Add a resource, rejecting conflicting declarations.
152
+ * @param resource - ARM resource declaration
153
+ */
154
+ protected addResource(resource: Record<string, any>): void;
155
+ /**
156
+ * Grant every contributed role to one application or job identity.
157
+ * @param principalId - ARM principal identifier expression
158
+ * @param identityResourceId - Resource providing the managed identity
159
+ */
160
+ protected grantRoles(principalId?: string, identityResourceId?: string): void;
161
+ /**
162
+ * Write a reviewable ARM template; this command never builds, pushes or deploys.
163
+ * @param output - Optional template output path
164
+ * @returns Generated ARM template
165
+ */
166
+ generate(output?: string): Promise<AzureTemplate>;
167
+ /** Save the current template with secure parameters left as references.
168
+ * @param output - Optional template output path
169
+ */
170
+ protected writeTemplate(output?: string): void;
171
+ /**
172
+ * Deploy the ARM template with secure parameter values.
173
+ * @returns Deployment outputs
174
+ */
175
+ sendTemplate(): Promise<Record<string, any>>;
176
+ }
177
+ //# sourceMappingURL=arm.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arm.service.d.ts","sources":["../../src/deployers/arm.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,YAAY,EAAuC,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAI5E,OAAO,EAAE,sBAAsB,EAAuB,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAoB,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAY,aAAa,EAAmC,MAAM,gBAAgB,CAAC;AAE1F,oEAAoE;AACpE,qBAAa,0BAA2B,SAAQ,2BAA4B,YAAW,sBAAsB;IAC3G;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC;;OAEG;IACH,cAAc,EAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,EAAG,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,SAAgB;IACxB;;OAEG;IACH,mBAAmB,UAAS;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAA8E;IAClH;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAM;IAClF;;OAEG;IACH,cAAc,CA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AC,qBAAqB,IAAI,MAAM,CAExC;IACD;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,IAAI,MAAM,CAAC;IACrC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAEzD;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,CAK9D;IAED;;OAEG;IACH,SAAS,IAAI,IAAI,CAmBhB;IAED;;;OAGG;IACH,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAWzD;IAED;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAClB,WAAW,SAA2B,EACtC,kBAAkB,SAA+B,GAChD,IAAI,CAsBN;IAED;;;;OAIG;IAEG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAItD;IAED;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAO7C;IAED;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CA0CjD;CACF"}
@@ -0,0 +1,307 @@
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
5
+ }
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
26
+ }
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
30
+ }
31
+ }
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ import { ResourceManagementClient } from "@azure/arm-resources";
36
+ import { DeploymentsClient } from "@azure/arm-resourcesdeployments";
37
+ import { Command, SecretString, useApplication, useCore, WebdaError } from "@webda/core";
38
+ import { ContainerDeployer, ContainerDeployerParameters } from "@webda/oci";
39
+ import { mkdirSync, writeFileSync } from "node:fs";
40
+ import { dirname, resolve } from "node:path";
41
+ import { AzureAuth } from "../auth.js";
42
+ import { loadAzureParameters } from "../services/azure-parameters.js";
43
+ import { armValue, createAzureTemplate, resourceId } from "../template.js";
44
+ /** Shared ARM and OCI parameters used by Azure deployment units. */
45
+ export class AzureArmDeployerParameters extends ContainerDeployerParameters {
46
+ constructor() {
47
+ super(...arguments);
48
+ /**
49
+ * Location
50
+ */
51
+ this.location = "westeurope";
52
+ /**
53
+ * Create resource group
54
+ */
55
+ this.createResourceGroup = false;
56
+ /**
57
+ * Resource tags
58
+ */
59
+ this.resourceTags = { "webda-deployment": "${deployment}", "webda-version": "${git.version}" };
60
+ /**
61
+ * Custom resources
62
+ */
63
+ this.customResources = [];
64
+ }
65
+ /**
66
+ * Perform load.
67
+ * @override
68
+ */
69
+ load(params = {}) {
70
+ super.load(params);
71
+ return loadAzureParameters(this);
72
+ }
73
+ }
74
+ /**
75
+ * Restore secret wrappers after deployment variable expansion serializes their masked values.
76
+ * @param original - Original parameters retaining secret wrappers
77
+ * @param resolved - Parameters after deployment variable expansion
78
+ * @returns The restore secrets result
79
+ */
80
+ function restoreSecrets(original, resolved) {
81
+ if (original instanceof SecretString)
82
+ return original;
83
+ if (original && typeof original === "object" && resolved && typeof resolved === "object") {
84
+ for (const key of Object.keys(original))
85
+ if (Object.prototype.hasOwnProperty.call(resolved, key))
86
+ resolved[key] = restoreSecrets(original[key], resolved[key]);
87
+ }
88
+ return resolved;
89
+ }
90
+ /** Shared template collection and ARM deployment. SDK clients are created only when deploying. */
91
+ let AzureArmDeployer = (() => {
92
+ var _a;
93
+ let _classSuper = ContainerDeployer;
94
+ let _instanceExtraInitializers = [];
95
+ let _generate_decorators;
96
+ return _a = class AzureArmDeployer extends _classSuper {
97
+ constructor() {
98
+ super(...arguments);
99
+ /**
100
+ * Resources
101
+ */
102
+ this.resources = __runInitializers(this, _instanceExtraInitializers);
103
+ /**
104
+ * Template
105
+ */
106
+ this.template = createAzureTemplate();
107
+ /**
108
+ * Secret values
109
+ */
110
+ this.secretValues = new Map();
111
+ /**
112
+ * Contributed env
113
+ */
114
+ this.contributedEnv = {};
115
+ /**
116
+ * Roles
117
+ */
118
+ this.roles = [];
119
+ }
120
+ /**
121
+ * Perform get resolved parameters.
122
+ * @override
123
+ */
124
+ getResolvedParameters() {
125
+ return restoreSecrets(this.parameters, super.getResolvedParameters());
126
+ }
127
+ /**
128
+ * Resolve the deployment scope and reset template state.
129
+ */
130
+ prepare() {
131
+ this.resources = this.getResolvedParameters();
132
+ if (!this.resources.resourceGroup || !this.resources.subscriptionId)
133
+ throw new WebdaError.BadRequest("Azure deployment requires resourceGroup and subscriptionId (or AZURE_SUBSCRIPTION_ID)");
134
+ this.template = createAzureTemplate();
135
+ this.secretValues.clear();
136
+ this.contributedEnv = {};
137
+ this.roles = [];
138
+ }
139
+ /**
140
+ * Merge deployment tags with resource tags.
141
+ * @param tags - Resource-specific tags
142
+ * @returns The default tags result
143
+ */
144
+ getDefaultTags(tags = {}) {
145
+ return { ...this.resources.resourceTags, ...tags };
146
+ }
147
+ /**
148
+ * Return the managed identity resource identifier.
149
+ * @returns The identity resource id result
150
+ */
151
+ getIdentityResourceId() {
152
+ return this.getAppResourceId();
153
+ }
154
+ /**
155
+ * Add a secret without placing its value in the serializable template.
156
+ * @param value - Value to convert or protect
157
+ * @returns The secure parameter result
158
+ */
159
+ secureParameter(value) {
160
+ const name = `secret${this.secretValues.size}`;
161
+ this.template.parameters[name] = { type: "secureString" };
162
+ this.secretValues.set(name, value);
163
+ return `[parameters('${name}')]`;
164
+ }
165
+ /**
166
+ * Merge service resources, environment and roles. Conflicting contributions are rejected.
167
+ */
168
+ Resources() {
169
+ for (const service of Object.values(useCore().getServices())) {
170
+ if (service === this || typeof service?.getAzureResources !== "function")
171
+ continue;
172
+ const contribution = service.getAzureResources(this);
173
+ for (const resource of contribution.resources ?? [])
174
+ this.addResource(resource);
175
+ for (const [name, value] of Object.entries(contribution.env ?? {})) {
176
+ if (name in this.contributedEnv && JSON.stringify(this.contributedEnv[name]) !== JSON.stringify(value))
177
+ throw new WebdaError.BadRequest(`Conflicting Azure environment contribution: ${name}`);
178
+ this.contributedEnv[name] = value;
179
+ }
180
+ for (const [name, value] of Object.entries(contribution.outputs ?? {})) {
181
+ if (name in this.template.outputs)
182
+ throw new WebdaError.BadRequest(`Conflicting Azure output: ${name}`);
183
+ this.template.outputs[name] = value;
184
+ }
185
+ this.roles.push(...(contribution.roleAssignments ?? []));
186
+ }
187
+ const custom = this.resources.customResources;
188
+ for (const resource of Array.isArray(custom) ? custom : Object.values(custom))
189
+ this.addResource(resource);
190
+ }
191
+ /**
192
+ * Add a resource, rejecting conflicting declarations.
193
+ * @param resource - ARM resource declaration
194
+ */
195
+ addResource(resource) {
196
+ if (resource.properties?.principalId === this.getAppPrincipalId()) {
197
+ resource.dependsOn = [...new Set([...(resource.dependsOn ?? []), this.getIdentityResourceId()])];
198
+ }
199
+ const previous = this.template.resources.find(item => item.type === resource.type && item.name === resource.name);
200
+ if (previous) {
201
+ if (JSON.stringify(previous) !== JSON.stringify(resource))
202
+ throw new WebdaError.BadRequest(`Conflicting Azure resource: ${resource.type}/${resource.name}`);
203
+ return;
204
+ }
205
+ this.template.resources.push(resource);
206
+ }
207
+ /**
208
+ * Grant every contributed role to one application or job identity.
209
+ * @param principalId - ARM principal identifier expression
210
+ * @param identityResourceId - Resource providing the managed identity
211
+ */
212
+ grantRoles(principalId = this.getAppPrincipalId(), identityResourceId = this.getIdentityResourceId()) {
213
+ for (const role of this.roles) {
214
+ const dependsOn = [identityResourceId];
215
+ // Explicit dependency when the scoped resource is created in this template.
216
+ for (const resource of this.template.resources) {
217
+ if (typeof resource.type !== "string" || typeof resource.name !== "string" || resource.name.startsWith("["))
218
+ continue;
219
+ const names = resource.name.split("/"), types = resource.type.split("/");
220
+ const absolute = `/subscriptions/${this.resources.subscriptionId}/resourceGroups/${this.resources.resourceGroup}/providers/${types[0]}/${names.map((name, index) => `${types[index + 1]}/${name}`).join("/")}`;
221
+ const id = resourceId(resource.type, ...names);
222
+ if (role.scope === id || role.scope === absolute)
223
+ dependsOn.push(id);
224
+ }
225
+ this.addResource({
226
+ type: "Microsoft.Authorization/roleAssignments",
227
+ apiVersion: "2022-04-01",
228
+ name: `[guid(${armValue(role.scope)}, ${armValue(role.roleDefinitionId)}, ${armValue(principalId)})]`,
229
+ scope: role.scope,
230
+ dependsOn,
231
+ properties: { roleDefinitionId: role.roleDefinitionId, principalId, principalType: "ServicePrincipal" }
232
+ });
233
+ }
234
+ }
235
+ /**
236
+ * Write a reviewable ARM template; this command never builds, pushes or deploys.
237
+ * @param output - Optional template output path
238
+ * @returns Generated ARM template
239
+ */
240
+ async generate(output) {
241
+ const template = this.generateTemplate();
242
+ this.writeTemplate(output);
243
+ return template;
244
+ }
245
+ /** Save the current template with secure parameters left as references.
246
+ * @param output - Optional template output path
247
+ */
248
+ writeTemplate(output) {
249
+ const target = output ?? this.resources.templateOutput;
250
+ if (target) {
251
+ const path = resolve(useApplication().applicationPath, target);
252
+ mkdirSync(dirname(path), { recursive: true });
253
+ writeFileSync(path, JSON.stringify(this.template, null, 2) + "\n");
254
+ }
255
+ }
256
+ /**
257
+ * Deploy the ARM template with secure parameter values.
258
+ * @returns Deployment outputs
259
+ */
260
+ async sendTemplate() {
261
+ const p = this.resources, credential = new AzureAuth(p).getCredential();
262
+ const name = p.deploymentName ?? `webda-${this.getName()}-${Date.now()}`;
263
+ const client = new DeploymentsClient(credential, p.subscriptionId);
264
+ this.log("INFO", "Deploying Azure resources", p.resourceGroup, name);
265
+ const parameters = Object.fromEntries([...this.secretValues].map(([key, value]) => [
266
+ key,
267
+ { value: value instanceof SecretString ? value.getValue() : value }
268
+ ]));
269
+ try {
270
+ if (p.createResourceGroup)
271
+ await new ResourceManagementClient(credential, p.subscriptionId).resourceGroups.createOrUpdate(p.resourceGroup, { location: p.location, tags: this.getDefaultTags() });
272
+ const deployment = await client.deployments
273
+ .createOrUpdate(p.resourceGroup, name, {
274
+ properties: { mode: "Incremental", template: this.template, parameters }
275
+ })
276
+ .pollUntilDone();
277
+ return deployment.properties?.outputs ?? {};
278
+ }
279
+ catch {
280
+ const failed = [];
281
+ try {
282
+ for await (const operation of client.deploymentOperations.list(p.resourceGroup, name)) {
283
+ if (operation.properties?.provisioningState === "Failed") {
284
+ // Status messages may echo secure parameters; report only Azure's structured error code.
285
+ const code = operation.properties.statusMessage?.error?.code;
286
+ if (typeof code === "string" && /^[A-Za-z0-9_.-]{1,100}$/.test(code))
287
+ failed.push(code);
288
+ }
289
+ }
290
+ }
291
+ catch {
292
+ /* Deployment diagnostics can be unavailable when authorization itself failed. */
293
+ }
294
+ throw new WebdaError.CodeError("AZURE_DEPLOYMENT_FAILED", `Azure deployment failed${failed.length ? ` (${[...new Set(failed)].join(", ")})` : ""}; inspect deployment operations in the Azure portal`);
295
+ }
296
+ }
297
+ },
298
+ (() => {
299
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
300
+ _generate_decorators = [Command("azure template", { description: "Generate an ARM template without deploying" })];
301
+ __esDecorate(_a, null, _generate_decorators, { kind: "method", name: "generate", static: false, private: false, access: { has: obj => "generate" in obj, get: obj => obj.generate }, metadata: _metadata }, null, _instanceExtraInitializers);
302
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
303
+ })(),
304
+ _a;
305
+ })();
306
+ export { AzureArmDeployer };
307
+ //# sourceMappingURL=arm.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arm.service.js","sources":["../../src/deployers/arm.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAA0B,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE9F,OAAO,EAAE,Q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