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