@stacksjs/ts-cloud 0.9.3 → 0.9.4

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 (143) hide show
  1. package/dist/aws/index.js +1 -269
  2. package/dist/bin/chunk-00kg80qg.js +1 -0
  3. package/dist/bin/{chunk-hzqw8xm5.js → chunk-1k5kszjp.js} +1 -1
  4. package/dist/bin/{chunk-9v39615t.js → chunk-21e0mavm.js} +1 -1
  5. package/dist/bin/{chunk-waayf9ay.js → chunk-2empps47.js} +1 -1
  6. package/dist/bin/{chunk-14cwr6eh.js → chunk-3vqfexc4.js} +1 -1
  7. package/dist/bin/chunk-5ectjq0b.js +1 -0
  8. package/dist/bin/{chunk-b5gd39s8.js → chunk-5erkxpt7.js} +4 -4
  9. package/dist/bin/{chunk-41x17hw1.js → chunk-5mrtzemj.js} +1 -1
  10. package/dist/bin/{chunk-p8q9bq9g.js → chunk-5n9fmabb.js} +1 -1
  11. package/dist/bin/{chunk-gqf6jsmy.js → chunk-9knpg30y.js} +1 -1
  12. package/dist/bin/{chunk-r3kv0vm9.js → chunk-ddk4rt4j.js} +1 -1
  13. package/dist/bin/{chunk-avm7tnwe.js → chunk-e0rkrq70.js} +1 -1
  14. package/dist/bin/{chunk-ry030a6b.js → chunk-etrb03mt.js} +1 -1
  15. package/dist/bin/{chunk-8v7ddyvf.js → chunk-k9t9wvms.js} +1 -1
  16. package/dist/bin/{chunk-92mea34a.js → chunk-m7dgskt1.js} +1 -1
  17. package/dist/bin/{chunk-3r4fb59r.js → chunk-mz0wbbsj.js} +1 -1
  18. package/dist/bin/{chunk-b9qbp8j1.js → chunk-qk9qgepa.js} +1 -1
  19. package/dist/bin/chunk-rxcvf10f.js +7364 -0
  20. package/dist/bin/{chunk-r9hjwcj9.js → chunk-tga3hhwk.js} +1 -1
  21. package/dist/bin/{chunk-ynjvbphf.js → chunk-tx0tqq2k.js} +1 -1
  22. package/dist/bin/{chunk-57y1zxbf.js → chunk-vm3q5gf2.js} +1 -1
  23. package/dist/bin/{chunk-bz828v8q.js → chunk-y7s5r8y6.js} +1 -1
  24. package/dist/bin/{chunk-sgyffpgm.js → chunk-zmegvjp8.js} +1 -1
  25. package/dist/bin/cli.js +14 -14
  26. package/dist/bin/dashboard-server.js +1 -1
  27. package/dist/chunk-0ccta6z6.js +6 -0
  28. package/dist/chunk-0k1cs6pp.js +1 -0
  29. package/dist/chunk-1egjn203.js +704 -0
  30. package/dist/chunk-2wx29qga.js +5 -0
  31. package/dist/chunk-5m5rqmv7.js +1 -0
  32. package/dist/chunk-8ea5022g.js +114 -0
  33. package/dist/chunk-8xqn3c0w.js +2 -0
  34. package/dist/chunk-b4esxhmw.js +2 -0
  35. package/dist/chunk-b8e5wzwn.js +44 -0
  36. package/dist/chunk-bggt4n6e.js +2 -0
  37. package/dist/chunk-cwkg37rs.js +37 -0
  38. package/dist/chunk-dskvqt67.js +7355 -0
  39. package/dist/chunk-gahsdmxf.js +1617 -0
  40. package/dist/chunk-gnv3r2jg.js +1 -0
  41. package/dist/chunk-hg3c48cp.js +34 -0
  42. package/dist/chunk-m5azeva3.js +2 -0
  43. package/dist/chunk-r3qf56b3.js +92 -0
  44. package/dist/chunk-sdqa9ghv.js +141 -0
  45. package/dist/chunk-svrvvcm7.js +1 -0
  46. package/dist/chunk-v0p3hpc3.js +60 -0
  47. package/dist/chunk-wdzjbecg.js +50 -0
  48. package/dist/chunk-ww8k3g7j.js +1 -0
  49. package/dist/chunk-xmqfc62w.js +1 -0
  50. package/dist/chunk-xrebj679.js +435 -0
  51. package/dist/chunk-xt3s24vr.js +2 -0
  52. package/dist/chunk-y21zk0pn.js +4 -0
  53. package/dist/deploy/index.js +1 -168
  54. package/dist/dns/index.js +1 -41
  55. package/dist/drivers/index.js +1 -154
  56. package/dist/index.js +100 -6129
  57. package/dist/protection/index.js +1 -89
  58. package/dist/push/index.js +1 -509
  59. package/dist/spend/index.js +1 -173
  60. package/dist/ui/404.html +1 -1
  61. package/dist/ui/accept-invitation.html +1 -1
  62. package/dist/ui/access-denied.html +1 -1
  63. package/dist/ui/account/automation.html +6 -6
  64. package/dist/ui/account/security.html +2 -2
  65. package/dist/ui/applications/compose.html +6 -6
  66. package/dist/ui/applications/new.html +2 -2
  67. package/dist/ui/data/backups.html +5 -5
  68. package/dist/ui/data/services.html +5 -5
  69. package/dist/ui/data/volumes.html +6 -6
  70. package/dist/ui/index.html +6 -6
  71. package/dist/ui/infrastructure/topology.html +5 -5
  72. package/dist/ui/integrations.html +1 -1
  73. package/dist/ui/operations/alerts.html +5 -5
  74. package/dist/ui/operations/configuration.html +5 -5
  75. package/dist/ui/operations/jobs.html +5 -5
  76. package/dist/ui/operations/maintenance.html +5 -5
  77. package/dist/ui/operations/observability.html +6 -6
  78. package/dist/ui/operations/previews.html +6 -6
  79. package/dist/ui/operations/queue.html +6 -6
  80. package/dist/ui/operations/regions.html +6 -6
  81. package/dist/ui/operations/releases.html +6 -6
  82. package/dist/ui/operations/spend.html +6 -6
  83. package/dist/ui/operations/workloads.html +6 -6
  84. package/dist/ui/security.html +1 -1
  85. package/dist/ui/server/actions.html +5 -5
  86. package/dist/ui/server/activity.html +1 -1
  87. package/dist/ui/server/capacity.html +6 -6
  88. package/dist/ui/server/database.html +6 -6
  89. package/dist/ui/server/deployments.html +6 -6
  90. package/dist/ui/server/diagnostics.html +2 -2
  91. package/dist/ui/server/firewall.html +6 -6
  92. package/dist/ui/server/fleet.html +6 -6
  93. package/dist/ui/server/logs.html +6 -6
  94. package/dist/ui/server/metrics.html +6 -6
  95. package/dist/ui/server/security.html +2 -2
  96. package/dist/ui/server/services.html +1 -1
  97. package/dist/ui/server/sites.html +6 -6
  98. package/dist/ui/server/ssh-keys.html +6 -6
  99. package/dist/ui/server/team.html +6 -6
  100. package/dist/ui/server/terminal.html +1 -1
  101. package/dist/ui/serverless/alarms.html +5 -5
  102. package/dist/ui/serverless/assets.html +2 -2
  103. package/dist/ui/serverless/cost.html +1 -1
  104. package/dist/ui/serverless/data.html +6 -6
  105. package/dist/ui/serverless/deployments.html +2 -2
  106. package/dist/ui/serverless/firewall.html +1 -1
  107. package/dist/ui/serverless/functions.html +6 -6
  108. package/dist/ui/serverless/logs.html +6 -6
  109. package/dist/ui/serverless/metrics.html +2 -2
  110. package/dist/ui/serverless/queues.html +6 -6
  111. package/dist/ui/serverless/secrets.html +6 -6
  112. package/dist/ui/serverless/traces.html +6 -6
  113. package/dist/ui/serverless.html +5 -5
  114. package/package.json +3 -3
  115. package/dist/bin/chunk-jpjamjey.js +0 -6935
  116. package/dist/bin/chunk-m2zwtapr.js +0 -1
  117. package/dist/bin/chunk-rtczra13.js +0 -1
  118. package/dist/chunk-01d86gt1.js +0 -1324
  119. package/dist/chunk-050r7ycy.js +0 -46516
  120. package/dist/chunk-1c8dbv57.js +0 -7278
  121. package/dist/chunk-29rse4p1.js +0 -12203
  122. package/dist/chunk-32e7ya18.js +0 -642
  123. package/dist/chunk-4cjrg98a.js +0 -597
  124. package/dist/chunk-50jpda9q.js +0 -371
  125. package/dist/chunk-6a1t7fnq.js +0 -12121
  126. package/dist/chunk-728jvrr0.js +0 -1701
  127. package/dist/chunk-7m60qnc8.js +0 -1762
  128. package/dist/chunk-aa2dkn7b.js +0 -205
  129. package/dist/chunk-d48vtdj4.js +0 -433
  130. package/dist/chunk-f55nkpvb.js +0 -8
  131. package/dist/chunk-fgk8cqew.js +0 -152
  132. package/dist/chunk-he9a874b.js +0 -769
  133. package/dist/chunk-k2yyatfw.js +0 -10
  134. package/dist/chunk-k4px0bnv.js +0 -23
  135. package/dist/chunk-nsgqsmrh.js +0 -1779
  136. package/dist/chunk-q0st3se8.js +0 -42033
  137. package/dist/chunk-qr803fye.js +0 -2122
  138. package/dist/chunk-rds0sy87.js +0 -1771
  139. package/dist/chunk-ttz2ra5j.js +0 -12
  140. package/dist/chunk-v0bahtg2.js +0 -4
  141. package/dist/chunk-va2yd85b.js +0 -200
  142. package/dist/chunk-x9s0cqfx.js +0 -13
  143. package/dist/chunk-zqtpg06c.js +0 -1752
@@ -1,769 +0,0 @@
1
- import {
2
- AWSClient,
3
- buildQueryParams
4
- } from "./chunk-zqtpg06c.js";
5
-
6
- // src/aws/rds.ts
7
- class RDSClient {
8
- client;
9
- region;
10
- constructor(region = "us-east-1") {
11
- this.region = region;
12
- this.client = new AWSClient;
13
- }
14
- async describeDBInstances(options) {
15
- const params = {
16
- Action: "DescribeDBInstances",
17
- Version: "2014-10-31"
18
- };
19
- if (options?.DBInstanceIdentifier) {
20
- params.DBInstanceIdentifier = options.DBInstanceIdentifier;
21
- }
22
- if (options?.MaxRecords) {
23
- params.MaxRecords = options.MaxRecords;
24
- }
25
- if (options?.Marker) {
26
- params.Marker = options.Marker;
27
- }
28
- if (options?.Filters) {
29
- options.Filters.forEach((filter, i) => {
30
- params[`Filters.Filter.${i + 1}.Name`] = filter.Name;
31
- filter.Values.forEach((value, j) => {
32
- params[`Filters.Filter.${i + 1}.Values.Value.${j + 1}`] = value;
33
- });
34
- });
35
- }
36
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
37
- const result = await this.client.request({
38
- service: "rds",
39
- region: this.region,
40
- method: "POST",
41
- path: "/",
42
- headers: {
43
- "Content-Type": "application/x-www-form-urlencoded"
44
- },
45
- body: queryString
46
- });
47
- const response = result.DescribeDBInstancesResult || result;
48
- let instances = response.DBInstances?.DBInstance || [];
49
- if (!Array.isArray(instances)) {
50
- instances = instances ? [instances] : [];
51
- }
52
- return {
53
- DBInstances: instances,
54
- Marker: response.Marker
55
- };
56
- }
57
- async describeDBInstance(dbInstanceIdentifier) {
58
- const result = await this.describeDBInstances({
59
- DBInstanceIdentifier: dbInstanceIdentifier
60
- });
61
- return result.DBInstances?.[0];
62
- }
63
- async describeDBClusters(options) {
64
- const params = {
65
- Action: "DescribeDBClusters",
66
- Version: "2014-10-31"
67
- };
68
- if (options?.DBClusterIdentifier) {
69
- params.DBClusterIdentifier = options.DBClusterIdentifier;
70
- }
71
- if (options?.MaxRecords) {
72
- params.MaxRecords = options.MaxRecords;
73
- }
74
- if (options?.Marker) {
75
- params.Marker = options.Marker;
76
- }
77
- if (options?.Filters) {
78
- options.Filters.forEach((filter, i) => {
79
- params[`Filters.Filter.${i + 1}.Name`] = filter.Name;
80
- filter.Values.forEach((value, j) => {
81
- params[`Filters.Filter.${i + 1}.Values.Value.${j + 1}`] = value;
82
- });
83
- });
84
- }
85
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
86
- const result = await this.client.request({
87
- service: "rds",
88
- region: this.region,
89
- method: "POST",
90
- path: "/",
91
- headers: {
92
- "Content-Type": "application/x-www-form-urlencoded"
93
- },
94
- body: queryString
95
- });
96
- const response = result.DescribeDBClustersResult || result;
97
- let clusters = response.DBClusters?.DBCluster || [];
98
- if (!Array.isArray(clusters)) {
99
- clusters = clusters ? [clusters] : [];
100
- }
101
- return {
102
- DBClusters: clusters,
103
- Marker: response.Marker
104
- };
105
- }
106
- async describeDBSnapshots(options) {
107
- const params = {
108
- Action: "DescribeDBSnapshots",
109
- Version: "2014-10-31"
110
- };
111
- if (options?.DBInstanceIdentifier) {
112
- params.DBInstanceIdentifier = options.DBInstanceIdentifier;
113
- }
114
- if (options?.DBSnapshotIdentifier) {
115
- params.DBSnapshotIdentifier = options.DBSnapshotIdentifier;
116
- }
117
- if (options?.SnapshotType) {
118
- params.SnapshotType = options.SnapshotType;
119
- }
120
- if (options?.MaxRecords) {
121
- params.MaxRecords = options.MaxRecords;
122
- }
123
- if (options?.Marker) {
124
- params.Marker = options.Marker;
125
- }
126
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
127
- const result = await this.client.request({
128
- service: "rds",
129
- region: this.region,
130
- method: "POST",
131
- path: "/",
132
- headers: {
133
- "Content-Type": "application/x-www-form-urlencoded"
134
- },
135
- body: queryString
136
- });
137
- const response = result.DescribeDBSnapshotsResult || result;
138
- let snapshots = response.DBSnapshots?.DBSnapshot || [];
139
- if (!Array.isArray(snapshots)) {
140
- snapshots = snapshots ? [snapshots] : [];
141
- }
142
- return {
143
- DBSnapshots: snapshots,
144
- Marker: response.Marker
145
- };
146
- }
147
- async describeDBSubnetGroups(options) {
148
- const params = {
149
- Action: "DescribeDBSubnetGroups",
150
- Version: "2014-10-31"
151
- };
152
- if (options?.DBSubnetGroupName) {
153
- params.DBSubnetGroupName = options.DBSubnetGroupName;
154
- }
155
- if (options?.MaxRecords) {
156
- params.MaxRecords = options.MaxRecords;
157
- }
158
- if (options?.Marker) {
159
- params.Marker = options.Marker;
160
- }
161
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
162
- const result = await this.client.request({
163
- service: "rds",
164
- region: this.region,
165
- method: "POST",
166
- path: "/",
167
- headers: {
168
- "Content-Type": "application/x-www-form-urlencoded"
169
- },
170
- body: queryString
171
- });
172
- const response = result.DescribeDBSubnetGroupsResult || result;
173
- let groups = response.DBSubnetGroups?.DBSubnetGroup || [];
174
- if (!Array.isArray(groups)) {
175
- groups = groups ? [groups] : [];
176
- }
177
- return {
178
- DBSubnetGroups: groups,
179
- Marker: response.Marker
180
- };
181
- }
182
- async createDBInstance(options) {
183
- const params = {
184
- Action: "CreateDBInstance",
185
- Version: "2014-10-31",
186
- DBInstanceIdentifier: options.DBInstanceIdentifier,
187
- DBInstanceClass: options.DBInstanceClass,
188
- Engine: options.Engine
189
- };
190
- if (options.DBClusterIdentifier)
191
- params.DBClusterIdentifier = options.DBClusterIdentifier;
192
- if (options.MasterUsername)
193
- params.MasterUsername = options.MasterUsername;
194
- if (options.MasterUserPassword)
195
- params.MasterUserPassword = options.MasterUserPassword;
196
- if (options.DBName)
197
- params.DBName = options.DBName;
198
- if (options.AllocatedStorage)
199
- params.AllocatedStorage = options.AllocatedStorage;
200
- if (options.DBSubnetGroupName)
201
- params.DBSubnetGroupName = options.DBSubnetGroupName;
202
- if (options.AvailabilityZone)
203
- params.AvailabilityZone = options.AvailabilityZone;
204
- if (options.PreferredMaintenanceWindow)
205
- params.PreferredMaintenanceWindow = options.PreferredMaintenanceWindow;
206
- if (options.PreferredBackupWindow)
207
- params.PreferredBackupWindow = options.PreferredBackupWindow;
208
- if (options.BackupRetentionPeriod !== undefined)
209
- params.BackupRetentionPeriod = options.BackupRetentionPeriod;
210
- if (options.MultiAZ !== undefined)
211
- params.MultiAZ = options.MultiAZ;
212
- if (options.EngineVersion)
213
- params.EngineVersion = options.EngineVersion;
214
- if (options.AutoMinorVersionUpgrade !== undefined)
215
- params.AutoMinorVersionUpgrade = options.AutoMinorVersionUpgrade;
216
- if (options.LicenseModel)
217
- params.LicenseModel = options.LicenseModel;
218
- if (options.PubliclyAccessible !== undefined)
219
- params.PubliclyAccessible = options.PubliclyAccessible;
220
- if (options.StorageType)
221
- params.StorageType = options.StorageType;
222
- if (options.StorageEncrypted !== undefined)
223
- params.StorageEncrypted = options.StorageEncrypted;
224
- if (options.KmsKeyId)
225
- params.KmsKeyId = options.KmsKeyId;
226
- if (options.DeletionProtection !== undefined)
227
- params.DeletionProtection = options.DeletionProtection;
228
- if (options.VpcSecurityGroupIds) {
229
- options.VpcSecurityGroupIds.forEach((id, i) => {
230
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${i + 1}`] = id;
231
- });
232
- }
233
- if (options.Tags) {
234
- options.Tags.forEach((tag, i) => {
235
- params[`Tags.Tag.${i + 1}.Key`] = tag.Key;
236
- params[`Tags.Tag.${i + 1}.Value`] = tag.Value;
237
- });
238
- }
239
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
240
- const result = await this.client.request({
241
- service: "rds",
242
- region: this.region,
243
- method: "POST",
244
- path: "/",
245
- headers: {
246
- "Content-Type": "application/x-www-form-urlencoded"
247
- },
248
- body: queryString
249
- });
250
- const response = result.CreateDBInstanceResult || result;
251
- return {
252
- DBInstance: response.DBInstance
253
- };
254
- }
255
- async createDBCluster(options) {
256
- const params = {
257
- Action: "CreateDBCluster",
258
- Version: "2014-10-31",
259
- DBClusterIdentifier: options.DBClusterIdentifier,
260
- Engine: options.Engine
261
- };
262
- if (options.EngineVersion)
263
- params.EngineVersion = options.EngineVersion;
264
- if (options.MasterUsername)
265
- params.MasterUsername = options.MasterUsername;
266
- if (options.MasterUserPassword)
267
- params.MasterUserPassword = options.MasterUserPassword;
268
- if (options.DatabaseName)
269
- params.DatabaseName = options.DatabaseName;
270
- if (options.DBSubnetGroupName)
271
- params.DBSubnetGroupName = options.DBSubnetGroupName;
272
- if (options.BackupRetentionPeriod !== undefined)
273
- params.BackupRetentionPeriod = options.BackupRetentionPeriod;
274
- if (options.StorageEncrypted !== undefined)
275
- params.StorageEncrypted = options.StorageEncrypted;
276
- if (options.KmsKeyId)
277
- params.KmsKeyId = options.KmsKeyId;
278
- if (options.DeletionProtection !== undefined)
279
- params.DeletionProtection = options.DeletionProtection;
280
- if (options.ServerlessV2ScalingConfiguration) {
281
- params["ServerlessV2ScalingConfiguration.MinCapacity"] = options.ServerlessV2ScalingConfiguration.MinCapacity;
282
- params["ServerlessV2ScalingConfiguration.MaxCapacity"] = options.ServerlessV2ScalingConfiguration.MaxCapacity;
283
- }
284
- options.VpcSecurityGroupIds?.forEach((id, index) => {
285
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${index + 1}`] = id;
286
- });
287
- const result = await this.client.request({
288
- service: "rds",
289
- region: this.region,
290
- method: "POST",
291
- path: "/",
292
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
293
- body: new URLSearchParams(buildQueryParams(params)).toString()
294
- });
295
- const response = result.CreateDBClusterResult || result;
296
- return { DBCluster: response.DBCluster };
297
- }
298
- async deleteDBInstance(options) {
299
- const params = {
300
- Action: "DeleteDBInstance",
301
- Version: "2014-10-31",
302
- DBInstanceIdentifier: options.DBInstanceIdentifier
303
- };
304
- if (options.SkipFinalSnapshot !== undefined) {
305
- params.SkipFinalSnapshot = options.SkipFinalSnapshot;
306
- }
307
- if (options.FinalDBSnapshotIdentifier) {
308
- params.FinalDBSnapshotIdentifier = options.FinalDBSnapshotIdentifier;
309
- }
310
- if (options.DeleteAutomatedBackups !== undefined) {
311
- params.DeleteAutomatedBackups = options.DeleteAutomatedBackups;
312
- }
313
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
314
- const result = await this.client.request({
315
- service: "rds",
316
- region: this.region,
317
- method: "POST",
318
- path: "/",
319
- headers: {
320
- "Content-Type": "application/x-www-form-urlencoded"
321
- },
322
- body: queryString
323
- });
324
- const response = result.DeleteDBInstanceResult || result;
325
- return {
326
- DBInstance: response.DBInstance
327
- };
328
- }
329
- async modifyDBInstance(options) {
330
- const params = {
331
- Action: "ModifyDBInstance",
332
- Version: "2014-10-31",
333
- DBInstanceIdentifier: options.DBInstanceIdentifier
334
- };
335
- if (options.DBInstanceClass)
336
- params.DBInstanceClass = options.DBInstanceClass;
337
- if (options.AllocatedStorage)
338
- params.AllocatedStorage = options.AllocatedStorage;
339
- if (options.MasterUserPassword)
340
- params.MasterUserPassword = options.MasterUserPassword;
341
- if (options.BackupRetentionPeriod !== undefined)
342
- params.BackupRetentionPeriod = options.BackupRetentionPeriod;
343
- if (options.PreferredBackupWindow)
344
- params.PreferredBackupWindow = options.PreferredBackupWindow;
345
- if (options.PreferredMaintenanceWindow)
346
- params.PreferredMaintenanceWindow = options.PreferredMaintenanceWindow;
347
- if (options.MultiAZ !== undefined)
348
- params.MultiAZ = options.MultiAZ;
349
- if (options.EngineVersion)
350
- params.EngineVersion = options.EngineVersion;
351
- if (options.AutoMinorVersionUpgrade !== undefined)
352
- params.AutoMinorVersionUpgrade = options.AutoMinorVersionUpgrade;
353
- if (options.PubliclyAccessible !== undefined)
354
- params.PubliclyAccessible = options.PubliclyAccessible;
355
- if (options.ApplyImmediately !== undefined)
356
- params.ApplyImmediately = options.ApplyImmediately;
357
- if (options.StorageType)
358
- params.StorageType = options.StorageType;
359
- if (options.DeletionProtection !== undefined)
360
- params.DeletionProtection = options.DeletionProtection;
361
- if (options.VpcSecurityGroupIds) {
362
- options.VpcSecurityGroupIds.forEach((id, i) => {
363
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${i + 1}`] = id;
364
- });
365
- }
366
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
367
- const result = await this.client.request({
368
- service: "rds",
369
- region: this.region,
370
- method: "POST",
371
- path: "/",
372
- headers: {
373
- "Content-Type": "application/x-www-form-urlencoded"
374
- },
375
- body: queryString
376
- });
377
- const response = result.ModifyDBInstanceResult || result;
378
- return {
379
- DBInstance: response.DBInstance
380
- };
381
- }
382
- async modifyDBCluster(options) {
383
- const params = {
384
- Action: "ModifyDBCluster",
385
- Version: "2014-10-31",
386
- DBClusterIdentifier: options.DBClusterIdentifier
387
- };
388
- if (options.ServerlessV2ScalingConfiguration) {
389
- params["ServerlessV2ScalingConfiguration.MinCapacity"] = options.ServerlessV2ScalingConfiguration.MinCapacity;
390
- params["ServerlessV2ScalingConfiguration.MaxCapacity"] = options.ServerlessV2ScalingConfiguration.MaxCapacity;
391
- }
392
- if (options.BackupRetentionPeriod !== undefined)
393
- params.BackupRetentionPeriod = options.BackupRetentionPeriod;
394
- if (options.EngineVersion)
395
- params.EngineVersion = options.EngineVersion;
396
- if (options.MasterUserPassword)
397
- params.MasterUserPassword = options.MasterUserPassword;
398
- if (options.DeletionProtection !== undefined)
399
- params.DeletionProtection = options.DeletionProtection;
400
- if (options.ApplyImmediately !== undefined)
401
- params.ApplyImmediately = options.ApplyImmediately;
402
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
403
- const result = await this.client.request({
404
- service: "rds",
405
- region: this.region,
406
- method: "POST",
407
- path: "/",
408
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
409
- body: queryString
410
- });
411
- const response = result.ModifyDBClusterResult || result;
412
- return { DBCluster: response.DBCluster };
413
- }
414
- async rebootDBCluster(dbClusterIdentifier) {
415
- const params = {
416
- Action: "FailoverDBCluster",
417
- Version: "2014-10-31",
418
- DBClusterIdentifier: dbClusterIdentifier
419
- };
420
- const result = await this.client.request({
421
- service: "rds",
422
- region: this.region,
423
- method: "POST",
424
- path: "/",
425
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
426
- body: new URLSearchParams(buildQueryParams(params)).toString()
427
- });
428
- const response = result.FailoverDBClusterResult || result;
429
- return { DBCluster: response.DBCluster };
430
- }
431
- async createDBClusterSnapshot(dbClusterIdentifier, snapshotIdentifier) {
432
- const params = {
433
- Action: "CreateDBClusterSnapshot",
434
- Version: "2014-10-31",
435
- DBClusterIdentifier: dbClusterIdentifier,
436
- DBClusterSnapshotIdentifier: snapshotIdentifier
437
- };
438
- return this.client.request({
439
- service: "rds",
440
- region: this.region,
441
- method: "POST",
442
- path: "/",
443
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
444
- body: new URLSearchParams(buildQueryParams(params)).toString()
445
- });
446
- }
447
- async describeDBClusterSnapshots(options = {}) {
448
- const params = {
449
- Action: "DescribeDBClusterSnapshots",
450
- Version: "2014-10-31",
451
- ...options
452
- };
453
- const result = await this.client.request({
454
- service: "rds",
455
- region: this.region,
456
- method: "POST",
457
- path: "/",
458
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
459
- body: new URLSearchParams(buildQueryParams(params)).toString()
460
- });
461
- const response = result.DescribeDBClusterSnapshotsResult || result;
462
- const snapshots = response.DBClusterSnapshots?.DBClusterSnapshot ?? response.DBClusterSnapshots ?? [];
463
- return { DBClusterSnapshots: Array.isArray(snapshots) ? snapshots : [snapshots] };
464
- }
465
- async deleteDBClusterSnapshot(snapshotIdentifier) {
466
- await this.client.request({
467
- service: "rds",
468
- region: this.region,
469
- method: "POST",
470
- path: "/",
471
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
472
- body: new URLSearchParams(buildQueryParams({
473
- Action: "DeleteDBClusterSnapshot",
474
- Version: "2014-10-31",
475
- DBClusterSnapshotIdentifier: snapshotIdentifier
476
- })).toString()
477
- });
478
- }
479
- async deleteDBCluster(dbClusterIdentifier, finalSnapshotIdentifier) {
480
- const params = {
481
- Action: "DeleteDBCluster",
482
- Version: "2014-10-31",
483
- DBClusterIdentifier: dbClusterIdentifier,
484
- SkipFinalSnapshot: !finalSnapshotIdentifier
485
- };
486
- if (finalSnapshotIdentifier)
487
- params.FinalDBSnapshotIdentifier = finalSnapshotIdentifier;
488
- const result = await this.client.request({
489
- service: "rds",
490
- region: this.region,
491
- method: "POST",
492
- path: "/",
493
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
494
- body: new URLSearchParams(buildQueryParams(params)).toString()
495
- });
496
- const response = result.DeleteDBClusterResult || result;
497
- return { DBCluster: response.DBCluster };
498
- }
499
- async restoreDBClusterToPointInTime(options) {
500
- const params = {
501
- Action: "RestoreDBClusterToPointInTime",
502
- Version: "2014-10-31",
503
- DBClusterIdentifier: options.DBClusterIdentifier,
504
- SourceDBClusterIdentifier: options.SourceDBClusterIdentifier
505
- };
506
- if (options.RestoreToTime)
507
- params.RestoreToTime = options.RestoreToTime.toISOString();
508
- if (options.UseLatestRestorableTime)
509
- params.UseLatestRestorableTime = true;
510
- if (options.DBSubnetGroupName)
511
- params.DBSubnetGroupName = options.DBSubnetGroupName;
512
- if (options.VpcSecurityGroupIds) {
513
- options.VpcSecurityGroupIds.forEach((id, i) => {
514
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${i + 1}`] = id;
515
- });
516
- }
517
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
518
- const result = await this.client.request({
519
- service: "rds",
520
- region: this.region,
521
- method: "POST",
522
- path: "/",
523
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
524
- body: queryString
525
- });
526
- const response = result.RestoreDBClusterToPointInTimeResult || result;
527
- return { DBCluster: response.DBCluster };
528
- }
529
- async restoreDBClusterFromSnapshot(options) {
530
- const params = {
531
- Action: "RestoreDBClusterFromSnapshot",
532
- Version: "2014-10-31",
533
- DBClusterIdentifier: options.DBClusterIdentifier,
534
- SnapshotIdentifier: options.SnapshotIdentifier,
535
- Engine: options.Engine
536
- };
537
- if (options.EngineVersion)
538
- params.EngineVersion = options.EngineVersion;
539
- if (options.DBSubnetGroupName)
540
- params.DBSubnetGroupName = options.DBSubnetGroupName;
541
- if (options.DeletionProtection !== undefined)
542
- params.DeletionProtection = options.DeletionProtection;
543
- options.VpcSecurityGroupIds?.forEach((id, index) => {
544
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${index + 1}`] = id;
545
- });
546
- if (options.ServerlessV2ScalingConfiguration) {
547
- params["ServerlessV2ScalingConfiguration.MinCapacity"] = options.ServerlessV2ScalingConfiguration.MinCapacity;
548
- params["ServerlessV2ScalingConfiguration.MaxCapacity"] = options.ServerlessV2ScalingConfiguration.MaxCapacity;
549
- }
550
- const result = await this.client.request({
551
- service: "rds",
552
- region: this.region,
553
- method: "POST",
554
- path: "/",
555
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
556
- body: new URLSearchParams(buildQueryParams(params)).toString()
557
- });
558
- const response = result.RestoreDBClusterFromSnapshotResult || result;
559
- return { DBCluster: response.DBCluster };
560
- }
561
- async startDBInstance(dbInstanceIdentifier) {
562
- const params = {
563
- Action: "StartDBInstance",
564
- Version: "2014-10-31",
565
- DBInstanceIdentifier: dbInstanceIdentifier
566
- };
567
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
568
- const result = await this.client.request({
569
- service: "rds",
570
- region: this.region,
571
- method: "POST",
572
- path: "/",
573
- headers: {
574
- "Content-Type": "application/x-www-form-urlencoded"
575
- },
576
- body: queryString
577
- });
578
- const response = result.StartDBInstanceResult || result;
579
- return {
580
- DBInstance: response.DBInstance
581
- };
582
- }
583
- async stopDBInstance(options) {
584
- const params = {
585
- Action: "StopDBInstance",
586
- Version: "2014-10-31",
587
- DBInstanceIdentifier: options.DBInstanceIdentifier
588
- };
589
- if (options.DBSnapshotIdentifier) {
590
- params.DBSnapshotIdentifier = options.DBSnapshotIdentifier;
591
- }
592
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
593
- const result = await this.client.request({
594
- service: "rds",
595
- region: this.region,
596
- method: "POST",
597
- path: "/",
598
- headers: {
599
- "Content-Type": "application/x-www-form-urlencoded"
600
- },
601
- body: queryString
602
- });
603
- const response = result.StopDBInstanceResult || result;
604
- return {
605
- DBInstance: response.DBInstance
606
- };
607
- }
608
- async rebootDBInstance(options) {
609
- const params = {
610
- Action: "RebootDBInstance",
611
- Version: "2014-10-31",
612
- DBInstanceIdentifier: options.DBInstanceIdentifier
613
- };
614
- if (options.ForceFailover !== undefined) {
615
- params.ForceFailover = options.ForceFailover;
616
- }
617
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
618
- const result = await this.client.request({
619
- service: "rds",
620
- region: this.region,
621
- method: "POST",
622
- path: "/",
623
- headers: {
624
- "Content-Type": "application/x-www-form-urlencoded"
625
- },
626
- body: queryString
627
- });
628
- const response = result.RebootDBInstanceResult || result;
629
- return {
630
- DBInstance: response.DBInstance
631
- };
632
- }
633
- async createDBSnapshot(options) {
634
- const params = {
635
- Action: "CreateDBSnapshot",
636
- Version: "2014-10-31",
637
- DBInstanceIdentifier: options.DBInstanceIdentifier,
638
- DBSnapshotIdentifier: options.DBSnapshotIdentifier
639
- };
640
- if (options.Tags) {
641
- options.Tags.forEach((tag, i) => {
642
- params[`Tags.Tag.${i + 1}.Key`] = tag.Key;
643
- params[`Tags.Tag.${i + 1}.Value`] = tag.Value;
644
- });
645
- }
646
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
647
- const result = await this.client.request({
648
- service: "rds",
649
- region: this.region,
650
- method: "POST",
651
- path: "/",
652
- headers: {
653
- "Content-Type": "application/x-www-form-urlencoded"
654
- },
655
- body: queryString
656
- });
657
- const response = result.CreateDBSnapshotResult || result;
658
- return {
659
- DBSnapshot: response.DBSnapshot
660
- };
661
- }
662
- async deleteDBSnapshot(dbSnapshotIdentifier) {
663
- const params = {
664
- Action: "DeleteDBSnapshot",
665
- Version: "2014-10-31",
666
- DBSnapshotIdentifier: dbSnapshotIdentifier
667
- };
668
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
669
- const result = await this.client.request({
670
- service: "rds",
671
- region: this.region,
672
- method: "POST",
673
- path: "/",
674
- headers: {
675
- "Content-Type": "application/x-www-form-urlencoded"
676
- },
677
- body: queryString
678
- });
679
- const response = result.DeleteDBSnapshotResult || result;
680
- return {
681
- DBSnapshot: response.DBSnapshot
682
- };
683
- }
684
- async restoreDBInstanceFromDBSnapshot(options) {
685
- const params = {
686
- Action: "RestoreDBInstanceFromDBSnapshot",
687
- Version: "2014-10-31",
688
- DBInstanceIdentifier: options.DBInstanceIdentifier,
689
- DBSnapshotIdentifier: options.DBSnapshotIdentifier
690
- };
691
- if (options.DBInstanceClass)
692
- params.DBInstanceClass = options.DBInstanceClass;
693
- if (options.Port)
694
- params.Port = options.Port;
695
- if (options.AvailabilityZone)
696
- params.AvailabilityZone = options.AvailabilityZone;
697
- if (options.DBSubnetGroupName)
698
- params.DBSubnetGroupName = options.DBSubnetGroupName;
699
- if (options.MultiAZ !== undefined)
700
- params.MultiAZ = options.MultiAZ;
701
- if (options.PubliclyAccessible !== undefined)
702
- params.PubliclyAccessible = options.PubliclyAccessible;
703
- if (options.AutoMinorVersionUpgrade !== undefined)
704
- params.AutoMinorVersionUpgrade = options.AutoMinorVersionUpgrade;
705
- if (options.StorageType)
706
- params.StorageType = options.StorageType;
707
- if (options.DeletionProtection !== undefined)
708
- params.DeletionProtection = options.DeletionProtection;
709
- if (options.VpcSecurityGroupIds) {
710
- options.VpcSecurityGroupIds.forEach((id, i) => {
711
- params[`VpcSecurityGroupIds.VpcSecurityGroupId.${i + 1}`] = id;
712
- });
713
- }
714
- if (options.Tags) {
715
- options.Tags.forEach((tag, i) => {
716
- params[`Tags.Tag.${i + 1}.Key`] = tag.Key;
717
- params[`Tags.Tag.${i + 1}.Value`] = tag.Value;
718
- });
719
- }
720
- const queryString = new URLSearchParams(buildQueryParams(params)).toString();
721
- const result = await this.client.request({
722
- service: "rds",
723
- region: this.region,
724
- method: "POST",
725
- path: "/",
726
- headers: {
727
- "Content-Type": "application/x-www-form-urlencoded"
728
- },
729
- body: queryString
730
- });
731
- const response = result.RestoreDBInstanceFromDBSnapshotResult || result;
732
- return {
733
- DBInstance: response.DBInstance
734
- };
735
- }
736
- async waitForDBInstanceAvailable(dbInstanceIdentifier, maxAttempts = 60, delayMs = 30000) {
737
- for (let i = 0;i < maxAttempts; i++) {
738
- const instance = await this.describeDBInstance(dbInstanceIdentifier);
739
- if (instance?.DBInstanceStatus === "available") {
740
- return instance;
741
- }
742
- if (["deleted", "failed", "incompatible-restore", "incompatible-parameters"].includes(instance?.DBInstanceStatus || "")) {
743
- throw new Error(`DB instance ${dbInstanceIdentifier} is in terminal state: ${instance?.DBInstanceStatus}`);
744
- }
745
- await new Promise((resolve) => setTimeout(resolve, delayMs));
746
- }
747
- throw new Error(`Timeout waiting for DB instance ${dbInstanceIdentifier} to become available`);
748
- }
749
- async waitForDBInstanceDeleted(dbInstanceIdentifier, maxAttempts = 60, delayMs = 30000) {
750
- for (let i = 0;i < maxAttempts; i++) {
751
- try {
752
- const instance = await this.describeDBInstance(dbInstanceIdentifier);
753
- if (instance?.DBInstanceStatus === "deleting") {
754
- await new Promise((resolve) => setTimeout(resolve, delayMs));
755
- continue;
756
- }
757
- throw new Error(`DB instance ${dbInstanceIdentifier} is in state: ${instance?.DBInstanceStatus}`);
758
- } catch (error) {
759
- if (error.code === "DBInstanceNotFound" || error.code === "DBInstanceNotFoundFault") {
760
- return;
761
- }
762
- throw error;
763
- }
764
- }
765
- throw new Error(`Timeout waiting for DB instance ${dbInstanceIdentifier} to be deleted`);
766
- }
767
- }
768
-
769
- export { RDSClient };