@stacksjs/ts-cloud 0.9.3 → 0.10.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/aws/index.js +1 -269
- package/dist/bin/chunk-08c0pzkb.js +1 -0
- package/dist/bin/chunk-12210qvj.js +1 -0
- package/dist/bin/chunk-1v6bt68w.js +6 -0
- package/dist/bin/chunk-35ttwn26.js +70 -0
- package/dist/bin/chunk-3r3be05z.js +1 -0
- package/dist/bin/chunk-41yqpdv7.js +2 -0
- package/dist/bin/chunk-5rv31chh.js +1 -0
- package/dist/bin/chunk-6eat8ezk.js +2 -0
- package/dist/bin/chunk-6gktf2m2.js +1 -0
- package/dist/bin/chunk-6zjy949y.js +141 -0
- package/dist/bin/chunk-7wzdaqh6.js +2 -0
- package/dist/bin/chunk-80ar3aty.js +1 -0
- package/dist/bin/chunk-8rwhsp5b.js +2 -0
- package/dist/bin/chunk-936vp7dx.js +44 -0
- package/dist/bin/chunk-9px3rg4a.js +4 -0
- package/dist/bin/chunk-anm3ae6z.js +7364 -0
- package/dist/bin/{chunk-ynjvbphf.js → chunk-axvr7dwa.js} +6 -6
- package/dist/bin/chunk-b0hj9m5e.js +2 -0
- package/dist/bin/{chunk-mh0kdzqp.js → chunk-b2ymh8k0.js} +1 -1
- package/dist/bin/chunk-b35989e3.js +50 -0
- package/dist/bin/chunk-c2b6nk0q.js +37 -0
- package/dist/bin/chunk-ckxpgwxw.js +3 -0
- package/dist/bin/chunk-d6zzgvtn.js +92 -0
- package/dist/bin/chunk-da8zpf82.js +1 -0
- package/dist/bin/chunk-ddmjjstg.js +1 -0
- package/dist/bin/chunk-dhhz4zyj.js +1 -0
- package/dist/bin/chunk-dj9a67c3.js +9 -0
- package/dist/bin/chunk-ds1z880f.js +1 -0
- package/dist/bin/chunk-dvkj4k6h.js +111 -0
- package/dist/bin/chunk-eh40fpvj.js +1 -0
- package/dist/bin/chunk-ey9fagrr.js +6 -0
- package/dist/bin/chunk-ezftw2q4.js +1 -0
- package/dist/bin/chunk-g6a4n3rh.js +1 -0
- package/dist/bin/chunk-g90nqfgv.js +585 -0
- package/dist/bin/chunk-gs40j75w.js +1 -0
- package/dist/bin/chunk-jjjts1vt.js +1 -0
- package/dist/bin/{chunk-ry030a6b.js → chunk-jnsbzqzz.js} +30 -30
- package/dist/bin/chunk-jnx4jgw8.js +1 -0
- package/dist/bin/chunk-jt1tndm2.js +3 -0
- package/dist/bin/chunk-kybdb0ws.js +2 -0
- package/dist/bin/chunk-m3nqw76h.js +3 -0
- package/dist/bin/chunk-mn6j22zn.js +6 -0
- package/dist/bin/chunk-nb0yjkv5.js +2 -0
- package/dist/bin/chunk-pjpa4x52.js +2 -0
- package/dist/bin/chunk-pkgkfe6s.js +2 -0
- package/dist/bin/chunk-pnz5hk8n.js +60 -0
- package/dist/bin/chunk-q46zr2tv.js +1 -0
- package/dist/bin/chunk-qtdngvs8.js +1 -0
- package/dist/bin/chunk-sbejksrh.js +2 -0
- package/dist/bin/chunk-svyd4v6c.js +34 -0
- package/dist/bin/chunk-tna7ay8d.js +1 -0
- package/dist/bin/chunk-tp4c2mv1.js +1 -0
- package/dist/bin/chunk-w5d6tr2x.js +1 -0
- package/dist/bin/chunk-wewcjam5.js +1 -0
- package/dist/bin/chunk-xv4bscrm.js +1 -0
- package/dist/bin/chunk-y9eyc5pw.js +1 -0
- package/dist/bin/chunk-y9f8649w.js +512 -0
- package/dist/bin/cli.js +428 -418
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/chunk-06jk7ba9.js +7355 -0
- package/dist/chunk-0e16qt6k.js +5 -0
- package/dist/chunk-13hxhzaz.js +34 -0
- package/dist/chunk-2p89vt3b.js +2 -0
- package/dist/chunk-77t2ctwn.js +2 -0
- package/dist/chunk-88z37ey4.js +114 -0
- package/dist/chunk-8c4715hz.js +2 -0
- package/dist/chunk-9a22225r.js +60 -0
- package/dist/chunk-as6by62d.js +1 -0
- package/dist/chunk-cd0zpxhf.js +44 -0
- package/dist/chunk-cp54a0qn.js +6 -0
- package/dist/chunk-d67xbk4v.js +141 -0
- package/dist/chunk-dckz9xve.js +2 -0
- package/dist/chunk-e1666vjv.js +2 -0
- package/dist/chunk-hhdx5k96.js +442 -0
- package/dist/chunk-kv2ztkp4.js +1617 -0
- package/dist/chunk-nrz6zypg.js +1 -0
- package/dist/chunk-q816js1y.js +1 -0
- package/dist/chunk-qh9ep11z.js +704 -0
- package/dist/chunk-rg720cqg.js +1 -0
- package/dist/chunk-snak8s7m.js +92 -0
- package/dist/chunk-vq737g82.js +1 -0
- package/dist/chunk-xd6w0c11.js +50 -0
- package/dist/chunk-xtwjt370.js +37 -0
- package/dist/chunk-y26yh5zp.js +1 -0
- package/dist/chunk-zmxffmmq.js +4 -0
- package/dist/deploy/attach-credentials.d.ts +4 -8
- package/dist/deploy/index.js +1 -168
- package/dist/dns/cloudflare.d.ts +27 -0
- package/dist/dns/godaddy.d.ts +18 -1
- package/dist/dns/index.d.ts +2 -0
- package/dist/dns/index.js +1 -41
- package/dist/dns/zone-migration.d.ts +92 -0
- package/dist/dns/zone-migration.test.d.ts +1 -0
- package/dist/drivers/hetzner/driver.d.ts +8 -1
- package/dist/drivers/index.js +1 -154
- package/dist/drivers/shared/compute-provision.d.ts +14 -2
- package/dist/drivers/shared/db-provision.d.ts +3 -2
- package/dist/drivers/shared/mail-provision.d.ts +116 -0
- package/dist/drivers/shared/mail-provision.test.d.ts +1 -0
- package/dist/drivers/shared/managed-services-probe.d.ts +47 -0
- package/dist/drivers/shared/managed-services-probe.test.d.ts +1 -0
- package/dist/drivers/shared/package-manager.d.ts +1 -0
- package/dist/drivers/shared/remote-failure.d.ts +21 -0
- package/dist/drivers/shared/remote-failure.test.d.ts +1 -0
- package/dist/drivers/shared/sqlite-shared-path.d.ts +50 -0
- package/dist/drivers/shared/sqlite-shared-path.test.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +100 -6129
- package/dist/operations/plan.d.ts +136 -0
- package/dist/operations/plan.test.d.ts +1 -0
- package/dist/operations/server-rename.d.ts +84 -0
- package/dist/operations/server-rename.test.d.ts +1 -0
- package/dist/operations/site-move.d.ts +263 -0
- package/dist/operations/site-move.test.d.ts +1 -0
- package/dist/protection/index.js +1 -89
- package/dist/push/index.js +1 -509
- package/dist/spend/index.js +1 -173
- package/dist/ui/404.html +1 -1
- package/dist/ui/accept-invitation.html +1 -1
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +5 -5
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +2 -2
- package/dist/ui/data/backups.html +80 -80
- package/dist/ui/data/services.html +78 -78
- package/dist/ui/data/volumes.html +50 -50
- package/dist/ui/index.html +50 -50
- package/dist/ui/infrastructure/topology.html +118 -118
- package/dist/ui/integrations.html +1 -1
- package/dist/ui/operations/alerts.html +47 -47
- package/dist/ui/operations/configuration.html +5 -5
- package/dist/ui/operations/jobs.html +76 -76
- package/dist/ui/operations/maintenance.html +6 -6
- package/dist/ui/operations/observability.html +82 -82
- package/dist/ui/operations/previews.html +5 -5
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +6 -6
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +54 -54
- package/dist/ui/operations/workloads.html +104 -104
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +56 -56
- package/dist/ui/server/activity.html +1 -1
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +106 -106
- package/dist/ui/server/deployments.html +50 -50
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +76 -76
- package/dist/ui/server/fleet.html +34 -34
- package/dist/ui/server/logs.html +24 -24
- package/dist/ui/server/metrics.html +112 -112
- package/dist/ui/server/security.html +1 -1
- package/dist/ui/server/services.html +27 -27
- package/dist/ui/server/sites.html +120 -120
- package/dist/ui/server/ssh-keys.html +51 -51
- package/dist/ui/server/team.html +144 -144
- package/dist/ui/server/terminal.html +15 -15
- package/dist/ui/serverless/alarms.html +52 -52
- package/dist/ui/serverless/assets.html +27 -27
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +36 -36
- package/dist/ui/serverless/deployments.html +27 -27
- package/dist/ui/serverless/firewall.html +1 -1
- package/dist/ui/serverless/functions.html +40 -40
- package/dist/ui/serverless/logs.html +24 -24
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +47 -47
- package/dist/ui/serverless/secrets.html +52 -52
- package/dist/ui/serverless/traces.html +6 -6
- package/dist/ui/serverless.html +54 -54
- package/dist/ui-src/src/charts.ts +17499 -12662
- package/dist/ui-src/src/topology.ts +2 -2
- package/package.json +3 -3
- package/dist/bin/chunk-09nwf2gy.js +0 -34
- package/dist/bin/chunk-14cwr6eh.js +0 -70
- package/dist/bin/chunk-271gk1n2.js +0 -6
- package/dist/bin/chunk-38pq971s.js +0 -2
- package/dist/bin/chunk-3gykfyq4.js +0 -37
- package/dist/bin/chunk-3r4fb59r.js +0 -3
- package/dist/bin/chunk-41x17hw1.js +0 -1
- package/dist/bin/chunk-4vrqm9h0.js +0 -2
- package/dist/bin/chunk-57y1zxbf.js +0 -3
- package/dist/bin/chunk-598yf4bs.js +0 -1
- package/dist/bin/chunk-8v7ddyvf.js +0 -1
- package/dist/bin/chunk-92mea34a.js +0 -1
- package/dist/bin/chunk-9pvsff8g.js +0 -1
- package/dist/bin/chunk-9v39615t.js +0 -1
- package/dist/bin/chunk-avm7tnwe.js +0 -1
- package/dist/bin/chunk-ax9mr6wm.js +0 -44
- package/dist/bin/chunk-axhnkn5g.js +0 -2
- package/dist/bin/chunk-b5gd39s8.js +0 -512
- package/dist/bin/chunk-b9qbp8j1.js +0 -1
- package/dist/bin/chunk-bz828v8q.js +0 -3
- package/dist/bin/chunk-c1vcdgvr.js +0 -1
- package/dist/bin/chunk-ctd2vg9w.js +0 -2
- package/dist/bin/chunk-dbgffky8.js +0 -1
- package/dist/bin/chunk-dwr30vbv.js +0 -1
- package/dist/bin/chunk-e3xrwh9z.js +0 -1
- package/dist/bin/chunk-fhc6ntvd.js +0 -2
- package/dist/bin/chunk-fpm59y25.js +0 -6
- package/dist/bin/chunk-fvbxvq6b.js +0 -1
- package/dist/bin/chunk-fy8j3y8p.js +0 -92
- package/dist/bin/chunk-fz21b57w.js +0 -1
- package/dist/bin/chunk-gavvf0pg.js +0 -141
- package/dist/bin/chunk-ggn7ax8p.js +0 -4
- package/dist/bin/chunk-gpe2prkm.js +0 -1
- package/dist/bin/chunk-gqf6jsmy.js +0 -1
- package/dist/bin/chunk-h5pa5men.js +0 -2
- package/dist/bin/chunk-hm08xdxf.js +0 -2
- package/dist/bin/chunk-hzgz13nf.js +0 -1
- package/dist/bin/chunk-hzqw8xm5.js +0 -111
- package/dist/bin/chunk-j703btc5.js +0 -50
- package/dist/bin/chunk-jpjamjey.js +0 -6935
- package/dist/bin/chunk-m2zwtapr.js +0 -1
- package/dist/bin/chunk-m669wtgr.js +0 -1
- package/dist/bin/chunk-mr0atd2s.js +0 -2
- package/dist/bin/chunk-ngcyftm2.js +0 -1
- package/dist/bin/chunk-p66ptpmr.js +0 -2
- package/dist/bin/chunk-p8q9bq9g.js +0 -1
- package/dist/bin/chunk-r3kv0vm9.js +0 -6
- package/dist/bin/chunk-r9hjwcj9.js +0 -6
- package/dist/bin/chunk-rtczra13.js +0 -1
- package/dist/bin/chunk-rytk89az.js +0 -60
- package/dist/bin/chunk-sgyffpgm.js +0 -581
- package/dist/bin/chunk-vek8a0w6.js +0 -1
- package/dist/bin/chunk-waayf9ay.js +0 -2
- package/dist/bin/chunk-yv9sth30.js +0 -1
- package/dist/chunk-01d86gt1.js +0 -1324
- package/dist/chunk-050r7ycy.js +0 -46516
- package/dist/chunk-1c8dbv57.js +0 -7278
- package/dist/chunk-29rse4p1.js +0 -12203
- package/dist/chunk-32e7ya18.js +0 -642
- package/dist/chunk-4cjrg98a.js +0 -597
- package/dist/chunk-50jpda9q.js +0 -371
- package/dist/chunk-6a1t7fnq.js +0 -12121
- package/dist/chunk-728jvrr0.js +0 -1701
- package/dist/chunk-7m60qnc8.js +0 -1762
- package/dist/chunk-aa2dkn7b.js +0 -205
- package/dist/chunk-d48vtdj4.js +0 -433
- package/dist/chunk-f55nkpvb.js +0 -8
- package/dist/chunk-fgk8cqew.js +0 -152
- package/dist/chunk-he9a874b.js +0 -769
- package/dist/chunk-k2yyatfw.js +0 -10
- package/dist/chunk-k4px0bnv.js +0 -23
- package/dist/chunk-nsgqsmrh.js +0 -1779
- package/dist/chunk-q0st3se8.js +0 -42033
- package/dist/chunk-qr803fye.js +0 -2122
- package/dist/chunk-rds0sy87.js +0 -1771
- package/dist/chunk-ttz2ra5j.js +0 -12
- package/dist/chunk-v0bahtg2.js +0 -4
- package/dist/chunk-va2yd85b.js +0 -200
- package/dist/chunk-x9s0cqfx.js +0 -13
- package/dist/chunk-zqtpg06c.js +0 -1752
package/dist/chunk-4cjrg98a.js
DELETED
|
@@ -1,597 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AWSClient
|
|
3
|
-
} from "./chunk-zqtpg06c.js";
|
|
4
|
-
|
|
5
|
-
// src/aws/cloudformation.ts
|
|
6
|
-
class CloudFormationClient {
|
|
7
|
-
client;
|
|
8
|
-
region;
|
|
9
|
-
constructor(region = "us-east-1", profile) {
|
|
10
|
-
this.region = region;
|
|
11
|
-
this.client = new AWSClient(undefined, { profile });
|
|
12
|
-
}
|
|
13
|
-
async createStack(options) {
|
|
14
|
-
const params = {
|
|
15
|
-
Action: "CreateStack",
|
|
16
|
-
StackName: options.stackName,
|
|
17
|
-
Version: "2010-05-15"
|
|
18
|
-
};
|
|
19
|
-
if (options.templateBody) {
|
|
20
|
-
params.TemplateBody = options.templateBody;
|
|
21
|
-
} else if (options.templateUrl) {
|
|
22
|
-
params.TemplateURL = options.templateUrl;
|
|
23
|
-
} else {
|
|
24
|
-
throw new Error("Either templateBody or templateUrl must be provided");
|
|
25
|
-
}
|
|
26
|
-
if (options.parameters) {
|
|
27
|
-
options.parameters.forEach((param, index) => {
|
|
28
|
-
params[`Parameters.member.${index + 1}.ParameterKey`] = param.ParameterKey;
|
|
29
|
-
params[`Parameters.member.${index + 1}.ParameterValue`] = param.ParameterValue;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (options.capabilities) {
|
|
33
|
-
options.capabilities.forEach((cap, index) => {
|
|
34
|
-
params[`Capabilities.member.${index + 1}`] = cap;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (options.roleArn) {
|
|
38
|
-
params.RoleARN = options.roleArn;
|
|
39
|
-
}
|
|
40
|
-
if (options.tags) {
|
|
41
|
-
options.tags.forEach((tag, index) => {
|
|
42
|
-
params[`Tags.member.${index + 1}.Key`] = tag.Key;
|
|
43
|
-
params[`Tags.member.${index + 1}.Value`] = tag.Value;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (options.timeoutInMinutes) {
|
|
47
|
-
params.TimeoutInMinutes = options.timeoutInMinutes;
|
|
48
|
-
}
|
|
49
|
-
if (options.onFailure) {
|
|
50
|
-
params.OnFailure = options.onFailure;
|
|
51
|
-
}
|
|
52
|
-
const result = await this.client.request({
|
|
53
|
-
service: "cloudformation",
|
|
54
|
-
region: this.region,
|
|
55
|
-
method: "POST",
|
|
56
|
-
path: "/",
|
|
57
|
-
body: new URLSearchParams(params).toString()
|
|
58
|
-
});
|
|
59
|
-
return { StackId: result.StackId || result.CreateStackResult?.StackId };
|
|
60
|
-
}
|
|
61
|
-
async updateStack(options) {
|
|
62
|
-
const params = {
|
|
63
|
-
Action: "UpdateStack",
|
|
64
|
-
StackName: options.stackName,
|
|
65
|
-
Version: "2010-05-15"
|
|
66
|
-
};
|
|
67
|
-
if (options.templateBody) {
|
|
68
|
-
params.TemplateBody = options.templateBody;
|
|
69
|
-
} else if (options.templateUrl) {
|
|
70
|
-
params.TemplateURL = options.templateUrl;
|
|
71
|
-
}
|
|
72
|
-
if (options.parameters) {
|
|
73
|
-
options.parameters.forEach((param, index) => {
|
|
74
|
-
params[`Parameters.member.${index + 1}.ParameterKey`] = param.ParameterKey;
|
|
75
|
-
if (param.UsePreviousValue) {
|
|
76
|
-
params[`Parameters.member.${index + 1}.UsePreviousValue`] = "true";
|
|
77
|
-
} else {
|
|
78
|
-
params[`Parameters.member.${index + 1}.ParameterValue`] = param.ParameterValue;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (options.capabilities) {
|
|
83
|
-
options.capabilities.forEach((cap, index) => {
|
|
84
|
-
params[`Capabilities.member.${index + 1}`] = cap;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (options.roleArn) {
|
|
88
|
-
params.RoleARN = options.roleArn;
|
|
89
|
-
}
|
|
90
|
-
if (options.tags) {
|
|
91
|
-
options.tags.forEach((tag, index) => {
|
|
92
|
-
params[`Tags.member.${index + 1}.Key`] = tag.Key;
|
|
93
|
-
params[`Tags.member.${index + 1}.Value`] = tag.Value;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
const result = await this.client.request({
|
|
97
|
-
service: "cloudformation",
|
|
98
|
-
region: this.region,
|
|
99
|
-
method: "POST",
|
|
100
|
-
path: "/",
|
|
101
|
-
body: new URLSearchParams(params).toString()
|
|
102
|
-
});
|
|
103
|
-
return { StackId: result.StackId || result.UpdateStackResult?.StackId };
|
|
104
|
-
}
|
|
105
|
-
async deleteStack(stackName, roleArn, retainResources) {
|
|
106
|
-
const params = {
|
|
107
|
-
Action: "DeleteStack",
|
|
108
|
-
StackName: stackName,
|
|
109
|
-
Version: "2010-05-15"
|
|
110
|
-
};
|
|
111
|
-
if (roleArn) {
|
|
112
|
-
params.RoleARN = roleArn;
|
|
113
|
-
}
|
|
114
|
-
if (retainResources && retainResources.length > 0) {
|
|
115
|
-
retainResources.forEach((resource, index) => {
|
|
116
|
-
params[`RetainResources.member.${index + 1}`] = resource;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
await this.client.request({
|
|
120
|
-
service: "cloudformation",
|
|
121
|
-
region: this.region,
|
|
122
|
-
method: "POST",
|
|
123
|
-
path: "/",
|
|
124
|
-
body: new URLSearchParams(params).toString()
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
async describeStacks(options = {}) {
|
|
128
|
-
const params = {
|
|
129
|
-
Action: "DescribeStacks",
|
|
130
|
-
Version: "2010-05-15"
|
|
131
|
-
};
|
|
132
|
-
if (options.stackName) {
|
|
133
|
-
params.StackName = options.stackName;
|
|
134
|
-
}
|
|
135
|
-
const result = await this.client.request({
|
|
136
|
-
service: "cloudformation",
|
|
137
|
-
region: this.region,
|
|
138
|
-
method: "POST",
|
|
139
|
-
path: "/",
|
|
140
|
-
body: new URLSearchParams(params).toString()
|
|
141
|
-
});
|
|
142
|
-
const stacks = this.parseStacksResponse(result);
|
|
143
|
-
return { Stacks: stacks };
|
|
144
|
-
}
|
|
145
|
-
async describeStackEvents(stackName) {
|
|
146
|
-
const params = {
|
|
147
|
-
Action: "DescribeStackEvents",
|
|
148
|
-
StackName: stackName,
|
|
149
|
-
Version: "2010-05-15"
|
|
150
|
-
};
|
|
151
|
-
const result = await this.client.request({
|
|
152
|
-
service: "cloudformation",
|
|
153
|
-
region: this.region,
|
|
154
|
-
method: "POST",
|
|
155
|
-
path: "/",
|
|
156
|
-
body: new URLSearchParams(params).toString()
|
|
157
|
-
});
|
|
158
|
-
return { StackEvents: this.parseStackEvents(result) };
|
|
159
|
-
}
|
|
160
|
-
async listStackResources(stackName) {
|
|
161
|
-
const params = {
|
|
162
|
-
Action: "ListStackResources",
|
|
163
|
-
StackName: stackName,
|
|
164
|
-
Version: "2010-05-15"
|
|
165
|
-
};
|
|
166
|
-
const result = await this.client.request({
|
|
167
|
-
service: "cloudformation",
|
|
168
|
-
region: this.region,
|
|
169
|
-
method: "POST",
|
|
170
|
-
path: "/",
|
|
171
|
-
body: new URLSearchParams(params).toString()
|
|
172
|
-
});
|
|
173
|
-
const member = result?.ListStackResourcesResult?.StackResourceSummaries?.member;
|
|
174
|
-
let resources = [];
|
|
175
|
-
if (member) {
|
|
176
|
-
resources = Array.isArray(member) ? member : [member];
|
|
177
|
-
}
|
|
178
|
-
return { StackResourceSummaries: resources };
|
|
179
|
-
}
|
|
180
|
-
async waitForStack(stackName, waitType) {
|
|
181
|
-
const targetStatuses = {
|
|
182
|
-
"stack-create-complete": ["CREATE_COMPLETE"],
|
|
183
|
-
"stack-update-complete": ["UPDATE_COMPLETE"],
|
|
184
|
-
"stack-delete-complete": ["DELETE_COMPLETE"]
|
|
185
|
-
};
|
|
186
|
-
const failureStatuses = [
|
|
187
|
-
"CREATE_FAILED",
|
|
188
|
-
"ROLLBACK_FAILED",
|
|
189
|
-
"ROLLBACK_COMPLETE",
|
|
190
|
-
"UPDATE_ROLLBACK_FAILED",
|
|
191
|
-
"UPDATE_ROLLBACK_COMPLETE"
|
|
192
|
-
];
|
|
193
|
-
const targets = targetStatuses[waitType];
|
|
194
|
-
const maxAttempts = 360;
|
|
195
|
-
let attempts = 0;
|
|
196
|
-
while (attempts < maxAttempts) {
|
|
197
|
-
try {
|
|
198
|
-
const result = await this.describeStacks({ stackName });
|
|
199
|
-
if (result.Stacks.length === 0) {
|
|
200
|
-
if (waitType === "stack-delete-complete") {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (attempts % 10 === 0) {
|
|
204
|
-
console.log(`[waitForStack] Attempt ${attempts}: Stack not visible yet`);
|
|
205
|
-
}
|
|
206
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
207
|
-
attempts++;
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
const stack = result.Stacks[0];
|
|
211
|
-
if (attempts % 10 === 0) {
|
|
212
|
-
console.log(`[waitForStack] Attempt ${attempts}: Status = ${stack.StackStatus}${stack.StackStatusReason ? ` (${stack.StackStatusReason})` : ""}`);
|
|
213
|
-
}
|
|
214
|
-
if (targets.includes(stack.StackStatus)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if ((waitType === "stack-create-complete" || waitType === "stack-update-complete") && (stack.StackStatus === "DELETE_IN_PROGRESS" || stack.StackStatus === "DELETE_COMPLETE")) {
|
|
218
|
-
console.log(`[waitForStack] Stack is being deleted (creation/update failed)`);
|
|
219
|
-
let failedEventReason = "";
|
|
220
|
-
try {
|
|
221
|
-
const eventsResult = await this.describeStackEvents(stackName);
|
|
222
|
-
console.log("[waitForStack] Stack events (most recent first):");
|
|
223
|
-
for (const event of eventsResult.StackEvents.slice(0, 15)) {
|
|
224
|
-
if (event.ResourceStatus.includes("FAILED") || event.ResourceStatusReason) {
|
|
225
|
-
console.log(` ${event.LogicalResourceId}: ${event.ResourceStatus} - ${event.ResourceStatusReason || "No reason provided"}`);
|
|
226
|
-
if (event.ResourceStatus.includes("FAILED") && event.ResourceStatusReason && !failedEventReason) {
|
|
227
|
-
failedEventReason = event.ResourceStatusReason;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
} catch {}
|
|
232
|
-
const errorReason = failedEventReason || stack.StackStatusReason || "Check CloudFormation console for details.";
|
|
233
|
-
throw new Error(`Stack creation/update failed - stack is being deleted. Reason: ${errorReason}`);
|
|
234
|
-
}
|
|
235
|
-
if (stack.StackStatus === "DELETE_FAILED" && waitType === "stack-delete-complete") {
|
|
236
|
-
const error = new Error(`Stack deletion failed - may have resources that need to be retained`);
|
|
237
|
-
error.code = "DELETE_FAILED";
|
|
238
|
-
error.stackStatus = stack.StackStatus;
|
|
239
|
-
error.statusReason = stack.StackStatusReason;
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
if (failureStatuses.includes(stack.StackStatus)) {
|
|
243
|
-
throw new Error(`Stack reached failure status: ${stack.StackStatus}`);
|
|
244
|
-
}
|
|
245
|
-
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
246
|
-
attempts++;
|
|
247
|
-
} catch (error) {
|
|
248
|
-
if (waitType === "stack-delete-complete" && error.message?.includes("does not exist")) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (waitType === "stack-create-complete" && error.message?.includes("does not exist")) {
|
|
252
|
-
if (attempts % 10 === 0) {
|
|
253
|
-
console.log(`[waitForStack] Attempt ${attempts}: Stack does not exist (error), retrying...`);
|
|
254
|
-
}
|
|
255
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
256
|
-
attempts++;
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
console.log(`[waitForStack] Unexpected error: ${error.message}`);
|
|
260
|
-
throw error;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
console.log(`[waitForStack] Timeout after ${attempts} attempts`);
|
|
264
|
-
throw new Error(`Timeout waiting for stack to reach ${waitType}`);
|
|
265
|
-
}
|
|
266
|
-
async validateTemplate(templateBody) {
|
|
267
|
-
const params = {
|
|
268
|
-
Action: "ValidateTemplate",
|
|
269
|
-
TemplateBody: templateBody,
|
|
270
|
-
Version: "2010-05-15"
|
|
271
|
-
};
|
|
272
|
-
return await this.client.request({
|
|
273
|
-
service: "cloudformation",
|
|
274
|
-
region: this.region,
|
|
275
|
-
method: "POST",
|
|
276
|
-
path: "/",
|
|
277
|
-
body: new URLSearchParams(params).toString()
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
async listStacks(statusFilter) {
|
|
281
|
-
const params = {
|
|
282
|
-
Action: "ListStacks",
|
|
283
|
-
Version: "2010-05-15"
|
|
284
|
-
};
|
|
285
|
-
if (statusFilter) {
|
|
286
|
-
statusFilter.forEach((status, index) => {
|
|
287
|
-
params[`StackStatusFilter.member.${index + 1}`] = status;
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
const result = await this.client.request({
|
|
291
|
-
service: "cloudformation",
|
|
292
|
-
region: this.region,
|
|
293
|
-
method: "POST",
|
|
294
|
-
path: "/",
|
|
295
|
-
body: new URLSearchParams(params).toString()
|
|
296
|
-
});
|
|
297
|
-
const response = result.ListStacksResponse || result;
|
|
298
|
-
const summariesResult = response.ListStacksResult || response;
|
|
299
|
-
const members = summariesResult.StackSummaries?.member || summariesResult.StackSummaries || [];
|
|
300
|
-
const items = Array.isArray(members) ? members : members ? [members] : [];
|
|
301
|
-
return {
|
|
302
|
-
StackSummaries: items.map((s) => ({
|
|
303
|
-
StackId: s.StackId || "",
|
|
304
|
-
StackName: s.StackName || "",
|
|
305
|
-
TemplateDescription: s.TemplateDescription,
|
|
306
|
-
CreationTime: s.CreationTime || "",
|
|
307
|
-
LastUpdatedTime: s.LastUpdatedTime,
|
|
308
|
-
DeletionTime: s.DeletionTime,
|
|
309
|
-
StackStatus: s.StackStatus || ""
|
|
310
|
-
}))
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
async createChangeSet(options) {
|
|
314
|
-
const params = {
|
|
315
|
-
Action: "CreateChangeSet",
|
|
316
|
-
StackName: options.stackName,
|
|
317
|
-
ChangeSetName: options.changeSetName,
|
|
318
|
-
Version: "2010-05-15"
|
|
319
|
-
};
|
|
320
|
-
if (options.templateBody) {
|
|
321
|
-
params.TemplateBody = options.templateBody;
|
|
322
|
-
} else if (options.templateUrl) {
|
|
323
|
-
params.TemplateURL = options.templateUrl;
|
|
324
|
-
}
|
|
325
|
-
if (options.parameters) {
|
|
326
|
-
options.parameters.forEach((param, index) => {
|
|
327
|
-
params[`Parameters.member.${index + 1}.ParameterKey`] = param.ParameterKey;
|
|
328
|
-
params[`Parameters.member.${index + 1}.ParameterValue`] = param.ParameterValue;
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
if (options.capabilities) {
|
|
332
|
-
options.capabilities.forEach((cap, index) => {
|
|
333
|
-
params[`Capabilities.member.${index + 1}`] = cap;
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
if (options.changeSetType) {
|
|
337
|
-
params.ChangeSetType = options.changeSetType;
|
|
338
|
-
}
|
|
339
|
-
const result = await this.client.request({
|
|
340
|
-
service: "cloudformation",
|
|
341
|
-
region: this.region,
|
|
342
|
-
method: "POST",
|
|
343
|
-
path: "/",
|
|
344
|
-
body: new URLSearchParams(params).toString()
|
|
345
|
-
});
|
|
346
|
-
return { Id: result.Id, StackId: result.StackId };
|
|
347
|
-
}
|
|
348
|
-
async describeChangeSet(stackName, changeSetName) {
|
|
349
|
-
const params = {
|
|
350
|
-
Action: "DescribeChangeSet",
|
|
351
|
-
StackName: stackName,
|
|
352
|
-
ChangeSetName: changeSetName,
|
|
353
|
-
Version: "2010-05-15"
|
|
354
|
-
};
|
|
355
|
-
return await this.client.request({
|
|
356
|
-
service: "cloudformation",
|
|
357
|
-
region: this.region,
|
|
358
|
-
method: "POST",
|
|
359
|
-
path: "/",
|
|
360
|
-
body: new URLSearchParams(params).toString()
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
async executeChangeSet(stackName, changeSetName) {
|
|
364
|
-
const params = {
|
|
365
|
-
Action: "ExecuteChangeSet",
|
|
366
|
-
StackName: stackName,
|
|
367
|
-
ChangeSetName: changeSetName,
|
|
368
|
-
Version: "2010-05-15"
|
|
369
|
-
};
|
|
370
|
-
await this.client.request({
|
|
371
|
-
service: "cloudformation",
|
|
372
|
-
region: this.region,
|
|
373
|
-
method: "POST",
|
|
374
|
-
path: "/",
|
|
375
|
-
body: new URLSearchParams(params).toString()
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
async deleteChangeSet(stackName, changeSetName) {
|
|
379
|
-
const params = {
|
|
380
|
-
Action: "DeleteChangeSet",
|
|
381
|
-
StackName: stackName,
|
|
382
|
-
ChangeSetName: changeSetName,
|
|
383
|
-
Version: "2010-05-15"
|
|
384
|
-
};
|
|
385
|
-
await this.client.request({
|
|
386
|
-
service: "cloudformation",
|
|
387
|
-
region: this.region,
|
|
388
|
-
method: "POST",
|
|
389
|
-
path: "/",
|
|
390
|
-
body: new URLSearchParams(params).toString()
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
async getStackOutputs(stackName) {
|
|
394
|
-
const result = await this.describeStacks({ stackName });
|
|
395
|
-
if (!result.Stacks || result.Stacks.length === 0) {
|
|
396
|
-
throw new Error(`Stack ${stackName} not found`);
|
|
397
|
-
}
|
|
398
|
-
const stack = result.Stacks[0];
|
|
399
|
-
const outputs = {};
|
|
400
|
-
if (stack.Outputs) {
|
|
401
|
-
for (const output of stack.Outputs) {
|
|
402
|
-
outputs[output.OutputKey] = output.OutputValue;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return outputs;
|
|
406
|
-
}
|
|
407
|
-
async getTemplate(stackName) {
|
|
408
|
-
const params = {
|
|
409
|
-
Action: "GetTemplate",
|
|
410
|
-
StackName: stackName,
|
|
411
|
-
Version: "2010-05-15"
|
|
412
|
-
};
|
|
413
|
-
const result = await this.client.request({
|
|
414
|
-
service: "cloudformation",
|
|
415
|
-
region: this.region,
|
|
416
|
-
method: "POST",
|
|
417
|
-
path: "/",
|
|
418
|
-
body: new URLSearchParams(params).toString()
|
|
419
|
-
});
|
|
420
|
-
const templateBody = result?.GetTemplateResult?.TemplateBody || result?.TemplateBody || "";
|
|
421
|
-
return { TemplateBody: templateBody };
|
|
422
|
-
}
|
|
423
|
-
parseStacksResponse(result) {
|
|
424
|
-
const stacks = [];
|
|
425
|
-
let stackData = result?.DescribeStacksResult?.Stacks?.member || result?.Stacks?.member || result?.Stacks || result;
|
|
426
|
-
if (stackData && !Array.isArray(stackData)) {
|
|
427
|
-
stackData = [stackData];
|
|
428
|
-
}
|
|
429
|
-
if (Array.isArray(stackData)) {
|
|
430
|
-
for (const s of stackData) {
|
|
431
|
-
if (s.StackId || s.StackName) {
|
|
432
|
-
let outputs;
|
|
433
|
-
if (s.Outputs?.member) {
|
|
434
|
-
const outputData = Array.isArray(s.Outputs.member) ? s.Outputs.member : [s.Outputs.member];
|
|
435
|
-
outputs = outputData.map((o) => ({
|
|
436
|
-
OutputKey: o.OutputKey,
|
|
437
|
-
OutputValue: o.OutputValue,
|
|
438
|
-
Description: o.Description,
|
|
439
|
-
ExportName: o.ExportName
|
|
440
|
-
}));
|
|
441
|
-
}
|
|
442
|
-
stacks.push({
|
|
443
|
-
StackId: s.StackId,
|
|
444
|
-
StackName: s.StackName,
|
|
445
|
-
StackStatus: s.StackStatus,
|
|
446
|
-
CreationTime: s.CreationTime,
|
|
447
|
-
LastUpdatedTime: s.LastUpdatedTime,
|
|
448
|
-
StackStatusReason: s.StackStatusReason,
|
|
449
|
-
Outputs: outputs
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
} else if (result.StackId) {
|
|
454
|
-
stacks.push({
|
|
455
|
-
StackId: result.StackId,
|
|
456
|
-
StackName: result.StackName,
|
|
457
|
-
StackStatus: result.StackStatus,
|
|
458
|
-
CreationTime: result.CreationTime,
|
|
459
|
-
LastUpdatedTime: result.LastUpdatedTime
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
return stacks;
|
|
463
|
-
}
|
|
464
|
-
parseStackEvents(result) {
|
|
465
|
-
const events = [];
|
|
466
|
-
let eventData = result?.DescribeStackEventsResult?.StackEvents?.member || result?.StackEvents?.member || result?.StackEvents || [];
|
|
467
|
-
if (eventData && !Array.isArray(eventData)) {
|
|
468
|
-
eventData = [eventData];
|
|
469
|
-
}
|
|
470
|
-
for (const e of eventData) {
|
|
471
|
-
if (e.LogicalResourceId) {
|
|
472
|
-
events.push({
|
|
473
|
-
Timestamp: e.Timestamp,
|
|
474
|
-
ResourceType: e.ResourceType,
|
|
475
|
-
LogicalResourceId: e.LogicalResourceId,
|
|
476
|
-
ResourceStatus: e.ResourceStatus,
|
|
477
|
-
ResourceStatusReason: e.ResourceStatusReason
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return events;
|
|
482
|
-
}
|
|
483
|
-
async waitForStackWithProgress(stackName, waitType, onProgress) {
|
|
484
|
-
const targetStatuses = {
|
|
485
|
-
"stack-create-complete": ["CREATE_COMPLETE"],
|
|
486
|
-
"stack-update-complete": ["UPDATE_COMPLETE"],
|
|
487
|
-
"stack-delete-complete": ["DELETE_COMPLETE"]
|
|
488
|
-
};
|
|
489
|
-
const failureStatuses = [
|
|
490
|
-
"CREATE_FAILED",
|
|
491
|
-
"ROLLBACK_FAILED",
|
|
492
|
-
"ROLLBACK_COMPLETE",
|
|
493
|
-
"UPDATE_ROLLBACK_FAILED",
|
|
494
|
-
"UPDATE_ROLLBACK_COMPLETE"
|
|
495
|
-
];
|
|
496
|
-
const targets = targetStatuses[waitType];
|
|
497
|
-
const maxAttempts = 360;
|
|
498
|
-
let attempts = 0;
|
|
499
|
-
const seenEvents = new Set;
|
|
500
|
-
while (attempts < maxAttempts) {
|
|
501
|
-
try {
|
|
502
|
-
if (onProgress) {
|
|
503
|
-
try {
|
|
504
|
-
const eventsResult = await this.describeStackEvents(stackName);
|
|
505
|
-
const events = [...eventsResult.StackEvents || []].reverse();
|
|
506
|
-
for (const event of events) {
|
|
507
|
-
const eventKey = `${event.LogicalResourceId}-${event.ResourceStatus}-${event.Timestamp}`;
|
|
508
|
-
if (!seenEvents.has(eventKey)) {
|
|
509
|
-
seenEvents.add(eventKey);
|
|
510
|
-
onProgress({
|
|
511
|
-
resourceId: event.LogicalResourceId,
|
|
512
|
-
resourceType: event.ResourceType,
|
|
513
|
-
status: event.ResourceStatus,
|
|
514
|
-
reason: event.ResourceStatusReason,
|
|
515
|
-
timestamp: event.Timestamp
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
} catch {}
|
|
520
|
-
}
|
|
521
|
-
const result = await this.describeStacks({ stackName });
|
|
522
|
-
if (result.Stacks.length === 0) {
|
|
523
|
-
if (waitType === "stack-delete-complete") {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
527
|
-
attempts++;
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
const stack = result.Stacks[0];
|
|
531
|
-
if (targets.includes(stack.StackStatus)) {
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (stack.StackStatus === "DELETE_FAILED" && waitType === "stack-delete-complete") {
|
|
535
|
-
const error = new Error(`Stack deletion failed - may have resources that need to be retained`);
|
|
536
|
-
error.code = "DELETE_FAILED";
|
|
537
|
-
error.stackStatus = stack.StackStatus;
|
|
538
|
-
error.statusReason = stack.StackStatusReason;
|
|
539
|
-
throw error;
|
|
540
|
-
}
|
|
541
|
-
if (failureStatuses.includes(stack.StackStatus)) {
|
|
542
|
-
throw new Error(`Stack reached failure status: ${stack.StackStatus}`);
|
|
543
|
-
}
|
|
544
|
-
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
545
|
-
attempts++;
|
|
546
|
-
} catch (error) {
|
|
547
|
-
if (waitType === "stack-delete-complete" && error.message?.includes("does not exist")) {
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
if (waitType === "stack-create-complete" && error.message?.includes("does not exist")) {
|
|
551
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
552
|
-
attempts++;
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
throw error;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
throw new Error(`Timeout waiting for stack to reach ${waitType}`);
|
|
559
|
-
}
|
|
560
|
-
async waitForStackComplete(stackName, maxAttempts = 120, delayMs = 5000) {
|
|
561
|
-
const successStatuses = ["CREATE_COMPLETE", "UPDATE_COMPLETE", "DELETE_COMPLETE"];
|
|
562
|
-
const failureStatuses = [
|
|
563
|
-
"CREATE_FAILED",
|
|
564
|
-
"UPDATE_FAILED",
|
|
565
|
-
"DELETE_FAILED",
|
|
566
|
-
"ROLLBACK_COMPLETE",
|
|
567
|
-
"ROLLBACK_FAILED",
|
|
568
|
-
"UPDATE_ROLLBACK_COMPLETE",
|
|
569
|
-
"UPDATE_ROLLBACK_FAILED"
|
|
570
|
-
];
|
|
571
|
-
for (let i = 0;i < maxAttempts; i++) {
|
|
572
|
-
try {
|
|
573
|
-
const result = await this.describeStacks({ stackName });
|
|
574
|
-
if (result.Stacks.length === 0) {
|
|
575
|
-
return { success: true, status: "DELETE_COMPLETE" };
|
|
576
|
-
}
|
|
577
|
-
const stack = result.Stacks[0];
|
|
578
|
-
const status = stack.StackStatus;
|
|
579
|
-
if (successStatuses.includes(status)) {
|
|
580
|
-
return { success: true, status };
|
|
581
|
-
}
|
|
582
|
-
if (failureStatuses.includes(status)) {
|
|
583
|
-
return { success: false, status, reason: stack.StackStatusReason };
|
|
584
|
-
}
|
|
585
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
586
|
-
} catch (error) {
|
|
587
|
-
if (error.message?.includes("does not exist")) {
|
|
588
|
-
return { success: true, status: "DELETE_COMPLETE" };
|
|
589
|
-
}
|
|
590
|
-
throw error;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
return { success: false, status: "TIMEOUT", reason: "Timeout waiting for stack operation" };
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
export { CloudFormationClient };
|