@scaleway/sdk-rdb 1.0.1

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.
@@ -0,0 +1,1057 @@
1
+ import { API as API$1, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
+ import { DATABASE_BACKUP_TRANSIENT_STATUSES, INSTANCE_TRANSIENT_STATUSES, READ_REPLICA_TRANSIENT_STATUSES, INSTANCE_LOG_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, unmarshalListDatabaseBackupsResponse, marshalCreateDatabaseBackupRequest, unmarshalDatabaseBackup, marshalUpdateDatabaseBackupRequest, marshalRestoreDatabaseBackupRequest, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, marshalPrepareInstanceLogsRequest, unmarshalPrepareInstanceLogsResponse, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalMigrateEndpointRequest, unmarshalMaintenance } from "./marshalling.gen.js";
4
+ const jsonContentHeaders = {
5
+ "Content-Type": "application/json; charset=utf-8"
6
+ };
7
+ class API extends API$1 {
8
+ /** Lists the available regions of the API. */
9
+ static LOCALITIES = [
10
+ "fr-par",
11
+ "nl-ams",
12
+ "pl-waw"
13
+ ];
14
+ pageOfListDatabaseEngines = (request = {}) => this.client.fetch(
15
+ {
16
+ method: "GET",
17
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/database-engines`,
18
+ urlParams: urlParams(
19
+ ["name", request.name],
20
+ ["page", request.page],
21
+ [
22
+ "page_size",
23
+ request.pageSize ?? this.client.settings.defaultPageSize
24
+ ],
25
+ ["version", request.version]
26
+ )
27
+ },
28
+ unmarshalListDatabaseEnginesResponse
29
+ );
30
+ /**
31
+ * List available database engines. List the PostgreSQL and MySQL database engines available at Scaleway.
32
+ *
33
+ * @param request - The request {@link ListDatabaseEnginesRequest}
34
+ * @returns A Promise of ListDatabaseEnginesResponse
35
+ */
36
+ listDatabaseEngines = (request = {}) => enrichForPagination("engines", this.pageOfListDatabaseEngines, request);
37
+ pageOfListNodeTypes = (request) => this.client.fetch(
38
+ {
39
+ method: "GET",
40
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
41
+ urlParams: urlParams(
42
+ ["include_disabled_types", request.includeDisabledTypes],
43
+ ["page", request.page],
44
+ [
45
+ "page_size",
46
+ request.pageSize ?? this.client.settings.defaultPageSize
47
+ ]
48
+ )
49
+ },
50
+ unmarshalListNodeTypesResponse
51
+ );
52
+ /**
53
+ * List available node types. List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
54
+ *
55
+ * @param request - The request {@link ListNodeTypesRequest}
56
+ * @returns A Promise of ListNodeTypesResponse
57
+ */
58
+ listNodeTypes = (request) => enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
59
+ pageOfListDatabaseBackups = (request = {}) => this.client.fetch(
60
+ {
61
+ method: "GET",
62
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups`,
63
+ urlParams: urlParams(
64
+ ["instance_id", request.instanceId],
65
+ ["name", request.name],
66
+ ["order_by", request.orderBy],
67
+ ["organization_id", request.organizationId],
68
+ ["page", request.page],
69
+ [
70
+ "page_size",
71
+ request.pageSize ?? this.client.settings.defaultPageSize
72
+ ],
73
+ ["project_id", request.projectId]
74
+ )
75
+ },
76
+ unmarshalListDatabaseBackupsResponse
77
+ );
78
+ /**
79
+ * List database backups. List all backups in a specified region, for a given Scaleway Organization or Scaleway Project. By default, the backups listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.
80
+ *
81
+ * @param request - The request {@link ListDatabaseBackupsRequest}
82
+ * @returns A Promise of ListDatabaseBackupsResponse
83
+ */
84
+ listDatabaseBackups = (request = {}) => enrichForPagination(
85
+ "databaseBackups",
86
+ this.pageOfListDatabaseBackups,
87
+ request
88
+ );
89
+ /**
90
+ * Create a database backup. Create a new backup. You must set the `instance_id`, `database_name`, `name` and `expires_at` parameters.
91
+ *
92
+ * @param request - The request {@link CreateDatabaseBackupRequest}
93
+ * @returns A Promise of DatabaseBackup
94
+ */
95
+ createDatabaseBackup = (request) => this.client.fetch(
96
+ {
97
+ body: JSON.stringify(
98
+ marshalCreateDatabaseBackupRequest(request, this.client.settings)
99
+ ),
100
+ headers: jsonContentHeaders,
101
+ method: "POST",
102
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups`
103
+ },
104
+ unmarshalDatabaseBackup
105
+ );
106
+ /**
107
+ * Get a database backup. Retrieve information about a given backup, specified by its database backup ID and region. Full details about the backup, like size, URL and expiration date, are returned in the response.
108
+ *
109
+ * @param request - The request {@link GetDatabaseBackupRequest}
110
+ * @returns A Promise of DatabaseBackup
111
+ */
112
+ getDatabaseBackup = (request) => this.client.fetch(
113
+ {
114
+ method: "GET",
115
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${validatePathParam("databaseBackupId", request.databaseBackupId)}`
116
+ },
117
+ unmarshalDatabaseBackup
118
+ );
119
+ /**
120
+ * Waits for {@link DatabaseBackup} to be in a final state.
121
+ *
122
+ * @param request - The request {@link GetDatabaseBackupRequest}
123
+ * @param options - The waiting options
124
+ * @returns A Promise of DatabaseBackup
125
+ */
126
+ waitForDatabaseBackup = (request, options) => waitForResource(
127
+ options?.stop ?? ((res) => Promise.resolve(
128
+ !DATABASE_BACKUP_TRANSIENT_STATUSES.includes(res.status)
129
+ )),
130
+ this.getDatabaseBackup,
131
+ request,
132
+ options
133
+ );
134
+ /**
135
+ * Update a database backup. Update the parameters of a backup, including name and expiration date.
136
+ *
137
+ * @param request - The request {@link UpdateDatabaseBackupRequest}
138
+ * @returns A Promise of DatabaseBackup
139
+ */
140
+ updateDatabaseBackup = (request) => this.client.fetch(
141
+ {
142
+ body: JSON.stringify(
143
+ marshalUpdateDatabaseBackupRequest(request, this.client.settings)
144
+ ),
145
+ headers: jsonContentHeaders,
146
+ method: "PATCH",
147
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${validatePathParam("databaseBackupId", request.databaseBackupId)}`
148
+ },
149
+ unmarshalDatabaseBackup
150
+ );
151
+ /**
152
+ * Delete a database backup. Delete a backup, specified by its database backup ID and region. Deleting a backup is permanent, and cannot be undone.
153
+ *
154
+ * @param request - The request {@link DeleteDatabaseBackupRequest}
155
+ * @returns A Promise of DatabaseBackup
156
+ */
157
+ deleteDatabaseBackup = (request) => this.client.fetch(
158
+ {
159
+ method: "DELETE",
160
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${validatePathParam("databaseBackupId", request.databaseBackupId)}`
161
+ },
162
+ unmarshalDatabaseBackup
163
+ );
164
+ /**
165
+ * Restore a database backup. Launch the process of restoring database backup. You must specify the `instance_id` of the Database Instance of destination, where the backup will be restored. Note that large database backups can take up to several hours to restore.
166
+ *
167
+ * @param request - The request {@link RestoreDatabaseBackupRequest}
168
+ * @returns A Promise of DatabaseBackup
169
+ */
170
+ restoreDatabaseBackup = (request) => this.client.fetch(
171
+ {
172
+ body: JSON.stringify(
173
+ marshalRestoreDatabaseBackupRequest(request, this.client.settings)
174
+ ),
175
+ headers: jsonContentHeaders,
176
+ method: "POST",
177
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${validatePathParam("databaseBackupId", request.databaseBackupId)}/restore`
178
+ },
179
+ unmarshalDatabaseBackup
180
+ );
181
+ /**
182
+ * Export a database backup. Export a backup, specified by the `database_backup_id` and the `region` parameters. The download URL is returned in the response.
183
+ *
184
+ * @param request - The request {@link ExportDatabaseBackupRequest}
185
+ * @returns A Promise of DatabaseBackup
186
+ */
187
+ exportDatabaseBackup = (request) => this.client.fetch(
188
+ {
189
+ body: "{}",
190
+ headers: jsonContentHeaders,
191
+ method: "POST",
192
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${validatePathParam("databaseBackupId", request.databaseBackupId)}/export`
193
+ },
194
+ unmarshalDatabaseBackup
195
+ );
196
+ /**
197
+ * Upgrade a Database Instance. Upgrade your current Database Instance specifications like node type, high availability, volume, or the database engine version. Note that upon upgrade the `enable_ha` parameter can only be set to `true`.
198
+ *
199
+ * @param request - The request {@link UpgradeInstanceRequest}
200
+ * @returns A Promise of Instance
201
+ */
202
+ upgradeInstance = (request) => this.client.fetch(
203
+ {
204
+ body: JSON.stringify(
205
+ marshalUpgradeInstanceRequest(request, this.client.settings)
206
+ ),
207
+ headers: jsonContentHeaders,
208
+ method: "POST",
209
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/upgrade`
210
+ },
211
+ unmarshalInstance
212
+ );
213
+ pageOfListInstances = (request = {}) => this.client.fetch(
214
+ {
215
+ method: "GET",
216
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`,
217
+ urlParams: urlParams(
218
+ ["name", request.name],
219
+ ["order_by", request.orderBy],
220
+ ["organization_id", request.organizationId],
221
+ ["page", request.page],
222
+ [
223
+ "page_size",
224
+ request.pageSize ?? this.client.settings.defaultPageSize
225
+ ],
226
+ ["project_id", request.projectId],
227
+ ["tags", request.tags]
228
+ )
229
+ },
230
+ unmarshalListInstancesResponse
231
+ );
232
+ /**
233
+ * List Database Instances. List all Database Instances in the specified region, for a given Scaleway Organization or Scaleway Project. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter.
234
+ *
235
+ * @param request - The request {@link ListInstancesRequest}
236
+ * @returns A Promise of ListInstancesResponse
237
+ */
238
+ listInstances = (request = {}) => enrichForPagination("instances", this.pageOfListInstances, request);
239
+ /**
240
+ * Get a Database Instance. Retrieve information about a given Database Instance, specified by the `region` and `instance_id` parameters. Its full details, including name, status, IP address and port, are returned in the response object.
241
+ *
242
+ * @param request - The request {@link GetInstanceRequest}
243
+ * @returns A Promise of Instance
244
+ */
245
+ getInstance = (request) => this.client.fetch(
246
+ {
247
+ method: "GET",
248
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}`
249
+ },
250
+ unmarshalInstance
251
+ );
252
+ /**
253
+ * Waits for {@link Instance} to be in a final state.
254
+ *
255
+ * @param request - The request {@link GetInstanceRequest}
256
+ * @param options - The waiting options
257
+ * @returns A Promise of Instance
258
+ */
259
+ waitForInstance = (request, options) => waitForResource(
260
+ options?.stop ?? ((res) => Promise.resolve(
261
+ !INSTANCE_TRANSIENT_STATUSES.includes(res.status)
262
+ )),
263
+ this.getInstance,
264
+ request,
265
+ options
266
+ );
267
+ /**
268
+ * Create a Database Instance. Create a new Database Instance. You must set the `engine`, `user_name`, `password` and `node_type` parameters. Optionally, you can specify the volume type and size.
269
+ *
270
+ * @param request - The request {@link CreateInstanceRequest}
271
+ * @returns A Promise of Instance
272
+ */
273
+ createInstance = (request) => this.client.fetch(
274
+ {
275
+ body: JSON.stringify(
276
+ marshalCreateInstanceRequest(request, this.client.settings)
277
+ ),
278
+ headers: jsonContentHeaders,
279
+ method: "POST",
280
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`
281
+ },
282
+ unmarshalInstance
283
+ );
284
+ /**
285
+ * Update a Database Instance. Update the parameters of a Database Instance, including name, tags and backup schedule details.
286
+ *
287
+ * @param request - The request {@link UpdateInstanceRequest}
288
+ * @returns A Promise of Instance
289
+ */
290
+ updateInstance = (request) => this.client.fetch(
291
+ {
292
+ body: JSON.stringify(
293
+ marshalUpdateInstanceRequest(request, this.client.settings)
294
+ ),
295
+ headers: jsonContentHeaders,
296
+ method: "PATCH",
297
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}`
298
+ },
299
+ unmarshalInstance
300
+ );
301
+ /**
302
+ * Delete a Database Instance. Delete a given Database Instance, specified by the `region` and `instance_id` parameters. Deleting a Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost.
303
+ *
304
+ * @param request - The request {@link DeleteInstanceRequest}
305
+ * @returns A Promise of Instance
306
+ */
307
+ deleteInstance = (request) => this.client.fetch(
308
+ {
309
+ method: "DELETE",
310
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}`
311
+ },
312
+ unmarshalInstance
313
+ );
314
+ /**
315
+ * Clone a Database Instance. Clone a given Database Instance, specified by the `region` and `instance_id` parameters. The clone feature allows you to create a new Database Instance from an existing one. The clone includes all existing databases, users and permissions. You can create a clone on a Database Instance bigger than your current one.
316
+ *
317
+ * @param request - The request {@link CloneInstanceRequest}
318
+ * @returns A Promise of Instance
319
+ */
320
+ cloneInstance = (request) => this.client.fetch(
321
+ {
322
+ body: JSON.stringify(
323
+ marshalCloneInstanceRequest(request, this.client.settings)
324
+ ),
325
+ headers: jsonContentHeaders,
326
+ method: "POST",
327
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/clone`
328
+ },
329
+ unmarshalInstance
330
+ );
331
+ /**
332
+ * Restart Database Instance. Restart a given Database Instance, specified by the `region` and `instance_id` parameters. The status of the Database Instance returned in the response.
333
+ *
334
+ * @param request - The request {@link RestartInstanceRequest}
335
+ * @returns A Promise of Instance
336
+ */
337
+ restartInstance = (request) => this.client.fetch(
338
+ {
339
+ body: "{}",
340
+ headers: jsonContentHeaders,
341
+ method: "POST",
342
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/restart`
343
+ },
344
+ unmarshalInstance
345
+ );
346
+ /**
347
+ * Get the TLS certificate of a Database Instance. Retrieve information about the TLS certificate of a given Database Instance. Details like name and content are returned in the response.
348
+ *
349
+ * @param request - The request {@link GetInstanceCertificateRequest}
350
+ * @returns A Promise of Blob
351
+ */
352
+ getInstanceCertificate = (request) => this.client.fetch({
353
+ method: "GET",
354
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/certificate`,
355
+ urlParams: urlParams(["dl", 1]),
356
+ responseType: "blob"
357
+ });
358
+ /**
359
+ * Renew the TLS certificate of a Database Instance. Renew a TLS for a Database Instance. Renewing a certificate means that you will not be able to connect to your Database Instance using the previous certificate. You will also need to download and update the new certificate for all database clients.
360
+ *
361
+ * @param request - The request {@link RenewInstanceCertificateRequest}
362
+ */
363
+ renewInstanceCertificate = (request) => this.client.fetch({
364
+ body: "{}",
365
+ headers: jsonContentHeaders,
366
+ method: "POST",
367
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/renew-certificate`
368
+ });
369
+ /**
370
+ * Get Database Instance metrics. Retrieve the time series metrics of a given Database Instance. You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`.
371
+ *
372
+ * @param request - The request {@link GetInstanceMetricsRequest}
373
+ * @returns A Promise of InstanceMetrics
374
+ */
375
+ getInstanceMetrics = (request) => this.client.fetch(
376
+ {
377
+ method: "GET",
378
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/metrics`,
379
+ urlParams: urlParams(
380
+ ["end_date", request.endDate],
381
+ ["metric_name", request.metricName],
382
+ ["start_date", request.startDate]
383
+ )
384
+ },
385
+ unmarshalInstanceMetrics
386
+ );
387
+ /**
388
+ * Create a Read Replica. Create a new Read Replica of a Database Instance. You must specify the `region` and the `instance_id`. You can only create a maximum of 3 Read Replicas per Database Instance.
389
+ *
390
+ * @param request - The request {@link CreateReadReplicaRequest}
391
+ * @returns A Promise of ReadReplica
392
+ */
393
+ createReadReplica = (request) => this.client.fetch(
394
+ {
395
+ body: JSON.stringify(
396
+ marshalCreateReadReplicaRequest(request, this.client.settings)
397
+ ),
398
+ headers: jsonContentHeaders,
399
+ method: "POST",
400
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas`
401
+ },
402
+ unmarshalReadReplica
403
+ );
404
+ /**
405
+ * Get a Read Replica. Retrieve information about a Database Instance Read Replica. Full details about the Read Replica, like `endpoints`, `status` and `region` are returned in the response.
406
+ *
407
+ * @param request - The request {@link GetReadReplicaRequest}
408
+ * @returns A Promise of ReadReplica
409
+ */
410
+ getReadReplica = (request) => this.client.fetch(
411
+ {
412
+ method: "GET",
413
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam("readReplicaId", request.readReplicaId)}`
414
+ },
415
+ unmarshalReadReplica
416
+ );
417
+ /**
418
+ * Waits for {@link ReadReplica} to be in a final state.
419
+ *
420
+ * @param request - The request {@link GetReadReplicaRequest}
421
+ * @param options - The waiting options
422
+ * @returns A Promise of ReadReplica
423
+ */
424
+ waitForReadReplica = (request, options) => waitForResource(
425
+ options?.stop ?? ((res) => Promise.resolve(
426
+ !READ_REPLICA_TRANSIENT_STATUSES.includes(res.status)
427
+ )),
428
+ this.getReadReplica,
429
+ request,
430
+ options
431
+ );
432
+ /**
433
+ * Delete a Read Replica. Delete a Read Replica of a Database Instance. You must specify the `region` and `read_replica_id` parameters of the Read Replica you want to delete.
434
+ *
435
+ * @param request - The request {@link DeleteReadReplicaRequest}
436
+ * @returns A Promise of ReadReplica
437
+ */
438
+ deleteReadReplica = (request) => this.client.fetch(
439
+ {
440
+ method: "DELETE",
441
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam("readReplicaId", request.readReplicaId)}`
442
+ },
443
+ unmarshalReadReplica
444
+ );
445
+ /**
446
+ * Resync a Read Replica. When you resync a Read Replica, first it is reset, then its data is resynchronized from the primary node. Your Read Replica remains unavailable during the resync process. The duration of this process is proportional to the size of your Database Instance.
447
+ The configured endpoints do not change.
448
+ *
449
+ * @param request - The request {@link ResetReadReplicaRequest}
450
+ * @returns A Promise of ReadReplica
451
+ */
452
+ resetReadReplica = (request) => this.client.fetch(
453
+ {
454
+ body: "{}",
455
+ headers: jsonContentHeaders,
456
+ method: "POST",
457
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam("readReplicaId", request.readReplicaId)}/reset`
458
+ },
459
+ unmarshalReadReplica
460
+ );
461
+ /**
462
+ * Promote a Read Replica. Promote a Read Replica to Database Instance automatically.
463
+ *
464
+ * @param request - The request {@link PromoteReadReplicaRequest}
465
+ * @returns A Promise of Instance
466
+ */
467
+ promoteReadReplica = (request) => this.client.fetch(
468
+ {
469
+ body: "{}",
470
+ headers: jsonContentHeaders,
471
+ method: "POST",
472
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam("readReplicaId", request.readReplicaId)}/promote`
473
+ },
474
+ unmarshalInstance
475
+ );
476
+ /**
477
+ * Create an endpoint for a Read Replica. Create a new endpoint for a Read Replica. Read Replicas can have at most one direct access and one Private Network endpoint.
478
+ *
479
+ * @param request - The request {@link CreateReadReplicaEndpointRequest}
480
+ * @returns A Promise of ReadReplica
481
+ */
482
+ createReadReplicaEndpoint = (request) => this.client.fetch(
483
+ {
484
+ body: JSON.stringify(
485
+ marshalCreateReadReplicaEndpointRequest(
486
+ request,
487
+ this.client.settings
488
+ )
489
+ ),
490
+ headers: jsonContentHeaders,
491
+ method: "POST",
492
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam("readReplicaId", request.readReplicaId)}/endpoints`
493
+ },
494
+ unmarshalReadReplica
495
+ );
496
+ /**
497
+ * Prepare logs of a Database Instance. Prepare your Database Instance logs. You can define the `start_date` and `end_date` parameters for your query. The download URL is returned in the response. Logs are recorded from 00h00 to 23h59 and then aggregated in a `.log` file once a day. Therefore, even if you specify a timeframe from which you want to get the logs, you will receive logs from the full 24 hours.
498
+ *
499
+ * @param request - The request {@link PrepareInstanceLogsRequest}
500
+ * @returns A Promise of PrepareInstanceLogsResponse
501
+ */
502
+ prepareInstanceLogs = (request) => this.client.fetch(
503
+ {
504
+ body: JSON.stringify(
505
+ marshalPrepareInstanceLogsRequest(request, this.client.settings)
506
+ ),
507
+ headers: jsonContentHeaders,
508
+ method: "POST",
509
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/prepare-logs`
510
+ },
511
+ unmarshalPrepareInstanceLogsResponse
512
+ );
513
+ /**
514
+ * List available logs of a Database Instance. List the available logs of a Database Instance. By default, the logs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
515
+ *
516
+ * @param request - The request {@link ListInstanceLogsRequest}
517
+ * @returns A Promise of ListInstanceLogsResponse
518
+ */
519
+ listInstanceLogs = (request) => this.client.fetch(
520
+ {
521
+ method: "GET",
522
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/logs`,
523
+ urlParams: urlParams(["order_by", request.orderBy])
524
+ },
525
+ unmarshalListInstanceLogsResponse
526
+ );
527
+ /**
528
+ * Get given logs of a Database Instance. Retrieve information about the logs of a Database Instance. Specify the `instance_log_id` and `region` in your request to get information such as `download_url`, `status`, `expires_at` and `created_at` about your logs in the response.
529
+ *
530
+ * @param request - The request {@link GetInstanceLogRequest}
531
+ * @returns A Promise of InstanceLog
532
+ */
533
+ getInstanceLog = (request) => this.client.fetch(
534
+ {
535
+ method: "GET",
536
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/logs/${validatePathParam("instanceLogId", request.instanceLogId)}`
537
+ },
538
+ unmarshalInstanceLog
539
+ );
540
+ /**
541
+ * Waits for {@link InstanceLog} to be in a final state.
542
+ *
543
+ * @param request - The request {@link GetInstanceLogRequest}
544
+ * @param options - The waiting options
545
+ * @returns A Promise of InstanceLog
546
+ */
547
+ waitForInstanceLog = (request, options) => waitForResource(
548
+ options?.stop ?? ((res) => Promise.resolve(
549
+ !INSTANCE_LOG_TRANSIENT_STATUSES.includes(res.status)
550
+ )),
551
+ this.getInstanceLog,
552
+ request,
553
+ options
554
+ );
555
+ /**
556
+ * Purge remote Database Instance logs. Purge a given remote log from a Database Instance. You can specify the `log_name` of the log you wish to clean from your Database Instance.
557
+ *
558
+ * @param request - The request {@link PurgeInstanceLogsRequest}
559
+ */
560
+ purgeInstanceLogs = (request) => this.client.fetch({
561
+ body: JSON.stringify(
562
+ marshalPurgeInstanceLogsRequest(request, this.client.settings)
563
+ ),
564
+ headers: jsonContentHeaders,
565
+ method: "POST",
566
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/purge-logs`
567
+ });
568
+ /**
569
+ * List remote Database Instance logs details. List remote log details. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
570
+ *
571
+ * @param request - The request {@link ListInstanceLogsDetailsRequest}
572
+ * @returns A Promise of ListInstanceLogsDetailsResponse
573
+ */
574
+ listInstanceLogsDetails = (request) => this.client.fetch(
575
+ {
576
+ method: "GET",
577
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/logs-details`
578
+ },
579
+ unmarshalListInstanceLogsDetailsResponse
580
+ );
581
+ /**
582
+ * Add Database Instance advanced settings. Add an advanced setting to a Database Instance. You must set the `name` and the `value` of each setting.
583
+ *
584
+ * @param request - The request {@link AddInstanceSettingsRequest}
585
+ * @returns A Promise of AddInstanceSettingsResponse
586
+ */
587
+ addInstanceSettings = (request) => this.client.fetch(
588
+ {
589
+ body: JSON.stringify(
590
+ marshalAddInstanceSettingsRequest(request, this.client.settings)
591
+ ),
592
+ headers: jsonContentHeaders,
593
+ method: "POST",
594
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/settings`
595
+ },
596
+ unmarshalAddInstanceSettingsResponse
597
+ );
598
+ /**
599
+ * Delete Database Instance advanced settings. Delete an advanced setting in a Database Instance. You must specify the names of the settings you want to delete in the request.
600
+ *
601
+ * @param request - The request {@link DeleteInstanceSettingsRequest}
602
+ * @returns A Promise of DeleteInstanceSettingsResponse
603
+ */
604
+ deleteInstanceSettings = (request) => this.client.fetch(
605
+ {
606
+ body: JSON.stringify(
607
+ marshalDeleteInstanceSettingsRequest(request, this.client.settings)
608
+ ),
609
+ headers: jsonContentHeaders,
610
+ method: "DELETE",
611
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/settings`
612
+ },
613
+ unmarshalDeleteInstanceSettingsResponse
614
+ );
615
+ /**
616
+ * Set Database Instance advanced settings. Update an advanced setting for a Database Instance. Settings added upon database engine initialization can only be defined once, and cannot, therefore, be updated.
617
+ *
618
+ * @param request - The request {@link SetInstanceSettingsRequest}
619
+ * @returns A Promise of SetInstanceSettingsResponse
620
+ */
621
+ setInstanceSettings = (request) => this.client.fetch(
622
+ {
623
+ body: JSON.stringify(
624
+ marshalSetInstanceSettingsRequest(request, this.client.settings)
625
+ ),
626
+ headers: jsonContentHeaders,
627
+ method: "PUT",
628
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/settings`
629
+ },
630
+ unmarshalSetInstanceSettingsResponse
631
+ );
632
+ pageOfListInstanceACLRules = (request) => this.client.fetch(
633
+ {
634
+ method: "GET",
635
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/acls`,
636
+ urlParams: urlParams(
637
+ ["page", request.page],
638
+ [
639
+ "page_size",
640
+ request.pageSize ?? this.client.settings.defaultPageSize
641
+ ]
642
+ )
643
+ },
644
+ unmarshalListInstanceACLRulesResponse
645
+ );
646
+ /**
647
+ * List ACL rules of a Database Instance. List the ACL rules for a given Database Instance. The response is an array of ACL objects, each one representing an ACL that denies, allows or redirects traffic based on certain conditions.
648
+ *
649
+ * @param request - The request {@link ListInstanceACLRulesRequest}
650
+ * @returns A Promise of ListInstanceACLRulesResponse
651
+ */
652
+ listInstanceACLRules = (request) => enrichForPagination("rules", this.pageOfListInstanceACLRules, request);
653
+ /**
654
+ * Add an ACL rule to a Database Instance. Add an additional ACL rule to a Database Instance.
655
+ *
656
+ * @param request - The request {@link AddInstanceACLRulesRequest}
657
+ * @returns A Promise of AddInstanceACLRulesResponse
658
+ */
659
+ addInstanceACLRules = (request) => this.client.fetch(
660
+ {
661
+ body: JSON.stringify(
662
+ marshalAddInstanceACLRulesRequest(request, this.client.settings)
663
+ ),
664
+ headers: jsonContentHeaders,
665
+ method: "POST",
666
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/acls`
667
+ },
668
+ unmarshalAddInstanceACLRulesResponse
669
+ );
670
+ /**
671
+ * Set ACL rules for a Database Instance. Replace all the ACL rules of a Database Instance.
672
+ *
673
+ * @param request - The request {@link SetInstanceACLRulesRequest}
674
+ * @returns A Promise of SetInstanceACLRulesResponse
675
+ */
676
+ setInstanceACLRules = (request) => this.client.fetch(
677
+ {
678
+ body: JSON.stringify(
679
+ marshalSetInstanceACLRulesRequest(request, this.client.settings)
680
+ ),
681
+ headers: jsonContentHeaders,
682
+ method: "PUT",
683
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/acls`
684
+ },
685
+ unmarshalSetInstanceACLRulesResponse
686
+ );
687
+ /**
688
+ * Delete ACL rules of a Database Instance. Delete one or more ACL rules of a Database Instance.
689
+ *
690
+ * @param request - The request {@link DeleteInstanceACLRulesRequest}
691
+ * @returns A Promise of DeleteInstanceACLRulesResponse
692
+ */
693
+ deleteInstanceACLRules = (request) => this.client.fetch(
694
+ {
695
+ body: JSON.stringify(
696
+ marshalDeleteInstanceACLRulesRequest(request, this.client.settings)
697
+ ),
698
+ headers: jsonContentHeaders,
699
+ method: "DELETE",
700
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/acls`
701
+ },
702
+ unmarshalDeleteInstanceACLRulesResponse
703
+ );
704
+ pageOfListUsers = (request) => this.client.fetch(
705
+ {
706
+ method: "GET",
707
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/users`,
708
+ urlParams: urlParams(
709
+ ["name", request.name],
710
+ ["order_by", request.orderBy],
711
+ ["page", request.page],
712
+ [
713
+ "page_size",
714
+ request.pageSize ?? this.client.settings.defaultPageSize
715
+ ]
716
+ )
717
+ },
718
+ unmarshalListUsersResponse
719
+ );
720
+ /**
721
+ * List users of a Database Instance. List all users of a given Database Instance. By default, the users returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
722
+ *
723
+ * @param request - The request {@link ListUsersRequest}
724
+ * @returns A Promise of ListUsersResponse
725
+ */
726
+ listUsers = (request) => enrichForPagination("users", this.pageOfListUsers, request);
727
+ /**
728
+ * Create a user for a Database Instance. Create a new user for a Database Instance. You must define the `name`, `password` and `is_admin` parameters.
729
+ *
730
+ * @param request - The request {@link CreateUserRequest}
731
+ * @returns A Promise of User
732
+ */
733
+ createUser = (request) => this.client.fetch(
734
+ {
735
+ body: JSON.stringify(
736
+ marshalCreateUserRequest(request, this.client.settings)
737
+ ),
738
+ headers: jsonContentHeaders,
739
+ method: "POST",
740
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/users`
741
+ },
742
+ unmarshalUser
743
+ );
744
+ /**
745
+ * Update a user on a Database Instance. Update the parameters of a user on a Database Instance. You can update the `password` and `is_admin` parameters, but you cannot change the name of the user.
746
+ *
747
+ * @param request - The request {@link UpdateUserRequest}
748
+ * @returns A Promise of User
749
+ */
750
+ updateUser = (request) => this.client.fetch(
751
+ {
752
+ body: JSON.stringify(
753
+ marshalUpdateUserRequest(request, this.client.settings)
754
+ ),
755
+ headers: jsonContentHeaders,
756
+ method: "PATCH",
757
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/users/${validatePathParam("name", request.name)}`
758
+ },
759
+ unmarshalUser
760
+ );
761
+ /**
762
+ * Delete a user on a Database Instance. Delete a given user on a Database Instance. You must specify, in the endpoint, the `region`, `instance_id` and `name` parameters of the user you want to delete.
763
+ *
764
+ * @param request - The request {@link DeleteUserRequest}
765
+ */
766
+ deleteUser = (request) => this.client.fetch({
767
+ method: "DELETE",
768
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/users/${validatePathParam("name", request.name)}`
769
+ });
770
+ pageOfListDatabases = (request) => this.client.fetch(
771
+ {
772
+ method: "GET",
773
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/databases`,
774
+ urlParams: urlParams(
775
+ ["managed", request.managed],
776
+ ["name", request.name],
777
+ ["order_by", request.orderBy],
778
+ ["owner", request.owner],
779
+ ["page", request.page],
780
+ [
781
+ "page_size",
782
+ request.pageSize ?? this.client.settings.defaultPageSize
783
+ ]
784
+ )
785
+ },
786
+ unmarshalListDatabasesResponse
787
+ );
788
+ /**
789
+ * List databases in a Database Instance. List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`.
790
+ *
791
+ * @param request - The request {@link ListDatabasesRequest}
792
+ * @returns A Promise of ListDatabasesResponse
793
+ */
794
+ listDatabases = (request) => enrichForPagination("databases", this.pageOfListDatabases, request);
795
+ /**
796
+ * Create a database in a Database Instance. Create a new database. You must define the `name` parameter in the request.
797
+ *
798
+ * @param request - The request {@link CreateDatabaseRequest}
799
+ * @returns A Promise of Database
800
+ */
801
+ createDatabase = (request) => this.client.fetch(
802
+ {
803
+ body: JSON.stringify(
804
+ marshalCreateDatabaseRequest(request, this.client.settings)
805
+ ),
806
+ headers: jsonContentHeaders,
807
+ method: "POST",
808
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/databases`
809
+ },
810
+ unmarshalDatabase
811
+ );
812
+ /**
813
+ * Delete a database in a Database Instance. Delete a given database on a Database Instance. You must specify, in the endpoint, the `region`, `instance_id` and `name` parameters of the database you want to delete.
814
+ *
815
+ * @param request - The request {@link DeleteDatabaseRequest}
816
+ */
817
+ deleteDatabase = (request) => this.client.fetch({
818
+ method: "DELETE",
819
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/databases/${validatePathParam("name", request.name)}`
820
+ });
821
+ pageOfListPrivileges = (request) => this.client.fetch(
822
+ {
823
+ method: "GET",
824
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/privileges`,
825
+ urlParams: urlParams(
826
+ ["database_name", request.databaseName],
827
+ ["order_by", request.orderBy],
828
+ ["page", request.page],
829
+ [
830
+ "page_size",
831
+ request.pageSize ?? this.client.settings.defaultPageSize
832
+ ],
833
+ ["user_name", request.userName]
834
+ )
835
+ },
836
+ unmarshalListPrivilegesResponse
837
+ );
838
+ /**
839
+ * List user privileges for a database. List privileges of a user on a database. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `database_name` and `user_name`.
840
+ *
841
+ * @param request - The request {@link ListPrivilegesRequest}
842
+ * @returns A Promise of ListPrivilegesResponse
843
+ */
844
+ listPrivileges = (request) => enrichForPagination("privileges", this.pageOfListPrivileges, request);
845
+ /**
846
+ * Set user privileges for a database. Set the privileges of a user on a database. You must define `database_name`, `user_name` and `permission` in the request body.
847
+ *
848
+ * @param request - The request {@link SetPrivilegeRequest}
849
+ * @returns A Promise of Privilege
850
+ */
851
+ setPrivilege = (request) => this.client.fetch(
852
+ {
853
+ body: JSON.stringify(
854
+ marshalSetPrivilegeRequest(request, this.client.settings)
855
+ ),
856
+ headers: jsonContentHeaders,
857
+ method: "PUT",
858
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/privileges`
859
+ },
860
+ unmarshalPrivilege
861
+ );
862
+ pageOfListSnapshots = (request = {}) => this.client.fetch(
863
+ {
864
+ method: "GET",
865
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots`,
866
+ urlParams: urlParams(
867
+ ["instance_id", request.instanceId],
868
+ ["name", request.name],
869
+ ["order_by", request.orderBy],
870
+ ["organization_id", request.organizationId],
871
+ ["page", request.page],
872
+ [
873
+ "page_size",
874
+ request.pageSize ?? this.client.settings.defaultPageSize
875
+ ],
876
+ ["project_id", request.projectId]
877
+ )
878
+ },
879
+ unmarshalListSnapshotsResponse
880
+ );
881
+ /**
882
+ * List snapshots. List snapshots. You can include the `instance_id` or `project_id` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
883
+ *
884
+ * @param request - The request {@link ListSnapshotsRequest}
885
+ * @returns A Promise of ListSnapshotsResponse
886
+ */
887
+ listSnapshots = (request = {}) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
888
+ /**
889
+ * Get a Database Instance snapshot. Retrieve information about a given snapshot, specified by its `snapshot_id` and `region`. Full details about the snapshot, like size and expiration date, are returned in the response.
890
+ *
891
+ * @param request - The request {@link GetSnapshotRequest}
892
+ * @returns A Promise of Snapshot
893
+ */
894
+ getSnapshot = (request) => this.client.fetch(
895
+ {
896
+ method: "GET",
897
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
898
+ },
899
+ unmarshalSnapshot
900
+ );
901
+ /**
902
+ * Waits for {@link Snapshot} to be in a final state.
903
+ *
904
+ * @param request - The request {@link GetSnapshotRequest}
905
+ * @param options - The waiting options
906
+ * @returns A Promise of Snapshot
907
+ */
908
+ waitForSnapshot = (request, options) => waitForResource(
909
+ options?.stop ?? ((res) => Promise.resolve(
910
+ !SNAPSHOT_TRANSIENT_STATUSES.includes(res.status)
911
+ )),
912
+ this.getSnapshot,
913
+ request,
914
+ options
915
+ );
916
+ /**
917
+ * Create a Database Instance snapshot. Create a new snapshot of a Database Instance. You must define the `name` parameter in the request.
918
+ *
919
+ * @param request - The request {@link CreateSnapshotRequest}
920
+ * @returns A Promise of Snapshot
921
+ */
922
+ createSnapshot = (request) => this.client.fetch(
923
+ {
924
+ body: JSON.stringify(
925
+ marshalCreateSnapshotRequest(request, this.client.settings)
926
+ ),
927
+ headers: jsonContentHeaders,
928
+ method: "POST",
929
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/snapshots`
930
+ },
931
+ unmarshalSnapshot
932
+ );
933
+ /**
934
+ * Update a Database Instance snapshot. Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.
935
+ *
936
+ * @param request - The request {@link UpdateSnapshotRequest}
937
+ * @returns A Promise of Snapshot
938
+ */
939
+ updateSnapshot = (request) => this.client.fetch(
940
+ {
941
+ body: JSON.stringify(
942
+ marshalUpdateSnapshotRequest(request, this.client.settings)
943
+ ),
944
+ headers: jsonContentHeaders,
945
+ method: "PATCH",
946
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
947
+ },
948
+ unmarshalSnapshot
949
+ );
950
+ /**
951
+ * Delete a Database Instance snapshot. Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the `region` and `snapshot_id` parameters of the snapshot you want to delete.
952
+ *
953
+ * @param request - The request {@link DeleteSnapshotRequest}
954
+ * @returns A Promise of Snapshot
955
+ */
956
+ deleteSnapshot = (request) => this.client.fetch(
957
+ {
958
+ method: "DELETE",
959
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
960
+ },
961
+ unmarshalSnapshot
962
+ );
963
+ /**
964
+ * Create a new Database Instance from a snapshot. Restore a snapshot. When you restore a snapshot, a new Instance is created and billed to your account. Note that is possible to select a larger node type for your new Database Instance. However, the Block volume size will be the same as the size of the restored snapshot. All Instance settings will be restored if you chose a node type with the same or more memory size than the initial Instance. Settings will be reset to the default if your node type has less memory.
965
+ *
966
+ * @param request - The request {@link CreateInstanceFromSnapshotRequest}
967
+ * @returns A Promise of Instance
968
+ */
969
+ createInstanceFromSnapshot = (request) => this.client.fetch(
970
+ {
971
+ body: JSON.stringify(
972
+ marshalCreateInstanceFromSnapshotRequest(
973
+ request,
974
+ this.client.settings
975
+ )
976
+ ),
977
+ headers: jsonContentHeaders,
978
+ method: "POST",
979
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/create-instance`
980
+ },
981
+ unmarshalInstance
982
+ );
983
+ /**
984
+ * Create a new Database Instance endpoint. Create a new endpoint for a Database Instance. You can add `load_balancer` and `private_network` specifications to the body of the request.
985
+ *
986
+ * @param request - The request {@link CreateEndpointRequest}
987
+ * @returns A Promise of Endpoint
988
+ */
989
+ createEndpoint = (request) => this.client.fetch(
990
+ {
991
+ body: JSON.stringify(
992
+ marshalCreateEndpointRequest(request, this.client.settings)
993
+ ),
994
+ headers: jsonContentHeaders,
995
+ method: "POST",
996
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/endpoints`
997
+ },
998
+ unmarshalEndpoint
999
+ );
1000
+ /**
1001
+ * Delete a Database Instance endpoint. Delete the endpoint of a Database Instance. You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint.
1002
+ *
1003
+ * @param request - The request {@link DeleteEndpointRequest}
1004
+ */
1005
+ deleteEndpoint = (request) => this.client.fetch({
1006
+ method: "DELETE",
1007
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
1008
+ });
1009
+ /**
1010
+ * Get a Database Instance endpoint. Retrieve information about a Database Instance endpoint. Full details about the endpoint, like `ip`, `port`, `private_network` and `load_balancer` specifications are returned in the response.
1011
+ *
1012
+ * @param request - The request {@link GetEndpointRequest}
1013
+ * @returns A Promise of Endpoint
1014
+ */
1015
+ getEndpoint = (request) => this.client.fetch(
1016
+ {
1017
+ method: "GET",
1018
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
1019
+ },
1020
+ unmarshalEndpoint
1021
+ );
1022
+ /**
1023
+ * Migrate an existing instance endpoint to another instance.
1024
+ *
1025
+ * @param request - The request {@link MigrateEndpointRequest}
1026
+ * @returns A Promise of Endpoint
1027
+ */
1028
+ migrateEndpoint = (request) => this.client.fetch(
1029
+ {
1030
+ body: JSON.stringify(
1031
+ marshalMigrateEndpointRequest(request, this.client.settings)
1032
+ ),
1033
+ headers: jsonContentHeaders,
1034
+ method: "POST",
1035
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}/migrate`
1036
+ },
1037
+ unmarshalEndpoint
1038
+ );
1039
+ /**
1040
+ * Apply Database Instance maintenance. Apply maintenance tasks to your Database Instance. This will trigger pending maintenance tasks to start in your Database Instance and can generate service interruption. Maintenance tasks can be applied between `starts_at` and `stops_at` times, and are run directly by Scaleway at `forced_at` timestamp.
1041
+ *
1042
+ * @param request - The request {@link ApplyInstanceMaintenanceRequest}
1043
+ * @returns A Promise of Maintenance
1044
+ */
1045
+ applyInstanceMaintenance = (request) => this.client.fetch(
1046
+ {
1047
+ body: "{}",
1048
+ headers: jsonContentHeaders,
1049
+ method: "POST",
1050
+ path: `/rdb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam("instanceId", request.instanceId)}/apply-maintenance`
1051
+ },
1052
+ unmarshalMaintenance
1053
+ );
1054
+ }
1055
+ export {
1056
+ API
1057
+ };