@scaleway/sdk-rdb 1.2.0 → 2.1.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.
@@ -1,923 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalEndpointDirectAccessDetails = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'EndpointDirectAccessDetails' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {};
12
- };
13
- const unmarshalEndpointLoadBalancerDetails = (data) => {
14
- if (!sdkClient.isJSONObject(data)) {
15
- throw new TypeError(
16
- `Unmarshalling the type 'EndpointLoadBalancerDetails' failed as data isn't a dictionary.`
17
- );
18
- }
19
- return {};
20
- };
21
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
22
- if (!sdkClient.isJSONObject(data)) {
23
- throw new TypeError(
24
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
25
- );
26
- }
27
- return {
28
- privateNetworkId: data.private_network_id,
29
- provisioningMode: data.provisioning_mode,
30
- serviceIp: data.service_ip,
31
- zone: data.zone
32
- };
33
- };
34
- const unmarshalEndpoint = (data) => {
35
- if (!sdkClient.isJSONObject(data)) {
36
- throw new TypeError(
37
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
38
- );
39
- }
40
- return {
41
- directAccess: data.direct_access ? unmarshalEndpointDirectAccessDetails(data.direct_access) : void 0,
42
- hostname: data.hostname,
43
- id: data.id,
44
- ip: data.ip,
45
- loadBalancer: data.load_balancer ? unmarshalEndpointLoadBalancerDetails(data.load_balancer) : void 0,
46
- name: data.name,
47
- port: data.port,
48
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0
49
- };
50
- };
51
- const unmarshalMaintenance = (data) => {
52
- if (!sdkClient.isJSONObject(data)) {
53
- throw new TypeError(
54
- `Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`
55
- );
56
- }
57
- return {
58
- closedAt: sdkClient.unmarshalDate(data.closed_at),
59
- forcedAt: sdkClient.unmarshalDate(data.forced_at),
60
- isApplicable: data.is_applicable,
61
- reason: data.reason,
62
- startsAt: sdkClient.unmarshalDate(data.starts_at),
63
- status: data.status,
64
- stopsAt: sdkClient.unmarshalDate(data.stops_at)
65
- };
66
- };
67
- const unmarshalReadReplica = (data) => {
68
- if (!sdkClient.isJSONObject(data)) {
69
- throw new TypeError(
70
- `Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`
71
- );
72
- }
73
- return {
74
- endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
75
- id: data.id,
76
- instanceId: data.instance_id,
77
- region: data.region,
78
- sameZone: data.same_zone,
79
- status: data.status
80
- };
81
- };
82
- const unmarshalDatabaseBackup = (data) => {
83
- if (!sdkClient.isJSONObject(data)) {
84
- throw new TypeError(
85
- `Unmarshalling the type 'DatabaseBackup' failed as data isn't a dictionary.`
86
- );
87
- }
88
- return {
89
- createdAt: sdkClient.unmarshalDate(data.created_at),
90
- databaseName: data.database_name,
91
- downloadUrl: data.download_url,
92
- downloadUrlExpiresAt: sdkClient.unmarshalDate(data.download_url_expires_at),
93
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
94
- id: data.id,
95
- instanceId: data.instance_id,
96
- instanceName: data.instance_name,
97
- name: data.name,
98
- region: data.region,
99
- sameRegion: data.same_region,
100
- size: data.size,
101
- status: data.status,
102
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
103
- };
104
- };
105
- const unmarshalDatabase = (data) => {
106
- if (!sdkClient.isJSONObject(data)) {
107
- throw new TypeError(
108
- `Unmarshalling the type 'Database' failed as data isn't a dictionary.`
109
- );
110
- }
111
- return {
112
- managed: data.managed,
113
- name: data.name,
114
- owner: data.owner,
115
- size: data.size
116
- };
117
- };
118
- const unmarshalInstanceLog = (data) => {
119
- if (!sdkClient.isJSONObject(data)) {
120
- throw new TypeError(
121
- `Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`
122
- );
123
- }
124
- return {
125
- createdAt: sdkClient.unmarshalDate(data.created_at),
126
- downloadUrl: data.download_url,
127
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
128
- id: data.id,
129
- nodeName: data.node_name,
130
- region: data.region,
131
- status: data.status
132
- };
133
- };
134
- const unmarshalBackupSchedule = (data) => {
135
- if (!sdkClient.isJSONObject(data)) {
136
- throw new TypeError(
137
- `Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`
138
- );
139
- }
140
- return {
141
- disabled: data.disabled,
142
- frequency: data.frequency,
143
- nextRunAt: sdkClient.unmarshalDate(data.next_run_at),
144
- retention: data.retention
145
- };
146
- };
147
- const unmarshalEncryptionAtRest = (data) => {
148
- if (!sdkClient.isJSONObject(data)) {
149
- throw new TypeError(
150
- `Unmarshalling the type 'EncryptionAtRest' failed as data isn't a dictionary.`
151
- );
152
- }
153
- return {
154
- enabled: data.enabled
155
- };
156
- };
157
- const unmarshalInstanceSetting = (data) => {
158
- if (!sdkClient.isJSONObject(data)) {
159
- throw new TypeError(
160
- `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`
161
- );
162
- }
163
- return {
164
- name: data.name,
165
- value: data.value
166
- };
167
- };
168
- const unmarshalLogsPolicy = (data) => {
169
- if (!sdkClient.isJSONObject(data)) {
170
- throw new TypeError(
171
- `Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary.`
172
- );
173
- }
174
- return {
175
- maxAgeRetention: data.max_age_retention,
176
- totalDiskRetention: data.total_disk_retention
177
- };
178
- };
179
- const unmarshalUpgradableVersion = (data) => {
180
- if (!sdkClient.isJSONObject(data)) {
181
- throw new TypeError(
182
- `Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`
183
- );
184
- }
185
- return {
186
- id: data.id,
187
- minorVersion: data.minor_version,
188
- name: data.name,
189
- version: data.version
190
- };
191
- };
192
- const unmarshalVolume = (data) => {
193
- if (!sdkClient.isJSONObject(data)) {
194
- throw new TypeError(
195
- `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
196
- );
197
- }
198
- return {
199
- class: data.class,
200
- size: data.size,
201
- type: data.type
202
- };
203
- };
204
- const unmarshalInstance = (data) => {
205
- if (!sdkClient.isJSONObject(data)) {
206
- throw new TypeError(
207
- `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`
208
- );
209
- }
210
- return {
211
- backupSameRegion: data.backup_same_region,
212
- backupSchedule: data.backup_schedule ? unmarshalBackupSchedule(data.backup_schedule) : void 0,
213
- createdAt: sdkClient.unmarshalDate(data.created_at),
214
- encryption: data.encryption ? unmarshalEncryptionAtRest(data.encryption) : void 0,
215
- endpoint: data.endpoint ? unmarshalEndpoint(data.endpoint) : void 0,
216
- endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
217
- engine: data.engine,
218
- id: data.id,
219
- initSettings: sdkClient.unmarshalArrayOfObject(
220
- data.init_settings,
221
- unmarshalInstanceSetting
222
- ),
223
- isHaCluster: data.is_ha_cluster,
224
- logsPolicy: data.logs_policy ? unmarshalLogsPolicy(data.logs_policy) : void 0,
225
- maintenances: sdkClient.unmarshalArrayOfObject(
226
- data.maintenances,
227
- unmarshalMaintenance
228
- ),
229
- name: data.name,
230
- nodeType: data.node_type,
231
- organizationId: data.organization_id,
232
- projectId: data.project_id,
233
- readReplicas: sdkClient.unmarshalArrayOfObject(
234
- data.read_replicas,
235
- unmarshalReadReplica
236
- ),
237
- region: data.region,
238
- settings: sdkClient.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
239
- status: data.status,
240
- tags: data.tags,
241
- upgradableVersion: sdkClient.unmarshalArrayOfObject(
242
- data.upgradable_version,
243
- unmarshalUpgradableVersion
244
- ),
245
- volume: data.volume ? unmarshalVolume(data.volume) : void 0
246
- };
247
- };
248
- const unmarshalPrivilege = (data) => {
249
- if (!sdkClient.isJSONObject(data)) {
250
- throw new TypeError(
251
- `Unmarshalling the type 'Privilege' failed as data isn't a dictionary.`
252
- );
253
- }
254
- return {
255
- databaseName: data.database_name,
256
- permission: data.permission,
257
- userName: data.user_name
258
- };
259
- };
260
- const unmarshalSnapshotVolumeType = (data) => {
261
- if (!sdkClient.isJSONObject(data)) {
262
- throw new TypeError(
263
- `Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`
264
- );
265
- }
266
- return {
267
- class: data.class,
268
- type: data.type
269
- };
270
- };
271
- const unmarshalSnapshot = (data) => {
272
- if (!sdkClient.isJSONObject(data)) {
273
- throw new TypeError(
274
- `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
275
- );
276
- }
277
- return {
278
- createdAt: sdkClient.unmarshalDate(data.created_at),
279
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
280
- id: data.id,
281
- instanceId: data.instance_id,
282
- instanceName: data.instance_name,
283
- name: data.name,
284
- nodeType: data.node_type,
285
- region: data.region,
286
- size: data.size,
287
- status: data.status,
288
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
289
- volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
290
- };
291
- };
292
- const unmarshalUser = (data) => {
293
- if (!sdkClient.isJSONObject(data)) {
294
- throw new TypeError(
295
- `Unmarshalling the type 'User' failed as data isn't a dictionary.`
296
- );
297
- }
298
- return {
299
- isAdmin: data.is_admin,
300
- name: data.name
301
- };
302
- };
303
- const unmarshalACLRule = (data) => {
304
- if (!sdkClient.isJSONObject(data)) {
305
- throw new TypeError(
306
- `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`
307
- );
308
- }
309
- return {
310
- action: data.action,
311
- description: data.description,
312
- direction: data.direction,
313
- ip: data.ip,
314
- port: data.port,
315
- protocol: data.protocol
316
- };
317
- };
318
- const unmarshalAddInstanceACLRulesResponse = (data) => {
319
- if (!sdkClient.isJSONObject(data)) {
320
- throw new TypeError(
321
- `Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary.`
322
- );
323
- }
324
- return {
325
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
326
- };
327
- };
328
- const unmarshalAddInstanceSettingsResponse = (data) => {
329
- if (!sdkClient.isJSONObject(data)) {
330
- throw new TypeError(
331
- `Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary.`
332
- );
333
- }
334
- return {
335
- settings: sdkClient.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting)
336
- };
337
- };
338
- const unmarshalDeleteInstanceACLRulesResponse = (data) => {
339
- if (!sdkClient.isJSONObject(data)) {
340
- throw new TypeError(
341
- `Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary.`
342
- );
343
- }
344
- return {
345
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
346
- };
347
- };
348
- const unmarshalDeleteInstanceSettingsResponse = (data) => {
349
- if (!sdkClient.isJSONObject(data)) {
350
- throw new TypeError(
351
- `Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary.`
352
- );
353
- }
354
- return {
355
- settings: sdkClient.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting)
356
- };
357
- };
358
- const unmarshalInstanceMetrics = (data) => {
359
- if (!sdkClient.isJSONObject(data)) {
360
- throw new TypeError(
361
- `Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary.`
362
- );
363
- }
364
- return {
365
- timeseries: sdkClient.unmarshalArrayOfObject(data.timeseries, sdkClient.unmarshalTimeSeries)
366
- };
367
- };
368
- const unmarshalListDatabaseBackupsResponse = (data) => {
369
- if (!sdkClient.isJSONObject(data)) {
370
- throw new TypeError(
371
- `Unmarshalling the type 'ListDatabaseBackupsResponse' failed as data isn't a dictionary.`
372
- );
373
- }
374
- return {
375
- databaseBackups: sdkClient.unmarshalArrayOfObject(
376
- data.database_backups,
377
- unmarshalDatabaseBackup
378
- ),
379
- totalCount: data.total_count
380
- };
381
- };
382
- const unmarshalEngineSetting = (data) => {
383
- if (!sdkClient.isJSONObject(data)) {
384
- throw new TypeError(
385
- `Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`
386
- );
387
- }
388
- return {
389
- defaultValue: data.default_value,
390
- description: data.description,
391
- floatMax: data.float_max,
392
- floatMin: data.float_min,
393
- hotConfigurable: data.hot_configurable,
394
- intMax: data.int_max,
395
- intMin: data.int_min,
396
- name: data.name,
397
- propertyType: data.property_type,
398
- stringConstraint: data.string_constraint,
399
- unit: data.unit
400
- };
401
- };
402
- const unmarshalEngineVersion = (data) => {
403
- if (!sdkClient.isJSONObject(data)) {
404
- throw new TypeError(
405
- `Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`
406
- );
407
- }
408
- return {
409
- availableInitSettings: sdkClient.unmarshalArrayOfObject(
410
- data.available_init_settings,
411
- unmarshalEngineSetting
412
- ),
413
- availableSettings: sdkClient.unmarshalArrayOfObject(
414
- data.available_settings,
415
- unmarshalEngineSetting
416
- ),
417
- beta: data.beta,
418
- disabled: data.disabled,
419
- endOfLife: sdkClient.unmarshalDate(data.end_of_life),
420
- name: data.name,
421
- version: data.version
422
- };
423
- };
424
- const unmarshalDatabaseEngine = (data) => {
425
- if (!sdkClient.isJSONObject(data)) {
426
- throw new TypeError(
427
- `Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`
428
- );
429
- }
430
- return {
431
- logoUrl: data.logo_url,
432
- name: data.name,
433
- region: data.region,
434
- versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalEngineVersion)
435
- };
436
- };
437
- const unmarshalListDatabaseEnginesResponse = (data) => {
438
- if (!sdkClient.isJSONObject(data)) {
439
- throw new TypeError(
440
- `Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`
441
- );
442
- }
443
- return {
444
- engines: sdkClient.unmarshalArrayOfObject(data.engines, unmarshalDatabaseEngine),
445
- totalCount: data.total_count
446
- };
447
- };
448
- const unmarshalListDatabasesResponse = (data) => {
449
- if (!sdkClient.isJSONObject(data)) {
450
- throw new TypeError(
451
- `Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`
452
- );
453
- }
454
- return {
455
- databases: sdkClient.unmarshalArrayOfObject(data.databases, unmarshalDatabase),
456
- totalCount: data.total_count
457
- };
458
- };
459
- const unmarshalListInstanceACLRulesResponse = (data) => {
460
- if (!sdkClient.isJSONObject(data)) {
461
- throw new TypeError(
462
- `Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`
463
- );
464
- }
465
- return {
466
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule),
467
- totalCount: data.total_count
468
- };
469
- };
470
- const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = (data) => {
471
- if (!sdkClient.isJSONObject(data)) {
472
- throw new TypeError(
473
- `Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`
474
- );
475
- }
476
- return {
477
- logName: data.log_name,
478
- size: data.size
479
- };
480
- };
481
- const unmarshalListInstanceLogsDetailsResponse = (data) => {
482
- if (!sdkClient.isJSONObject(data)) {
483
- throw new TypeError(
484
- `Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`
485
- );
486
- }
487
- return {
488
- details: sdkClient.unmarshalArrayOfObject(
489
- data.details,
490
- unmarshalListInstanceLogsDetailsResponseInstanceLogDetail
491
- )
492
- };
493
- };
494
- const unmarshalListInstanceLogsResponse = (data) => {
495
- if (!sdkClient.isJSONObject(data)) {
496
- throw new TypeError(
497
- `Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`
498
- );
499
- }
500
- return {
501
- instanceLogs: sdkClient.unmarshalArrayOfObject(
502
- data.instance_logs,
503
- unmarshalInstanceLog
504
- )
505
- };
506
- };
507
- const unmarshalListInstancesResponse = (data) => {
508
- if (!sdkClient.isJSONObject(data)) {
509
- throw new TypeError(
510
- `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`
511
- );
512
- }
513
- return {
514
- instances: sdkClient.unmarshalArrayOfObject(data.instances, unmarshalInstance),
515
- totalCount: data.total_count
516
- };
517
- };
518
- const unmarshalNodeTypeVolumeConstraintSizes = (data) => {
519
- if (!sdkClient.isJSONObject(data)) {
520
- throw new TypeError(
521
- `Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`
522
- );
523
- }
524
- return {
525
- maxSize: data.max_size,
526
- minSize: data.min_size
527
- };
528
- };
529
- const unmarshalNodeTypeVolumeType = (data) => {
530
- if (!sdkClient.isJSONObject(data)) {
531
- throw new TypeError(
532
- `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
533
- );
534
- }
535
- return {
536
- chunkSize: data.chunk_size,
537
- class: data.class,
538
- description: data.description,
539
- maxSize: data.max_size,
540
- minSize: data.min_size,
541
- type: data.type
542
- };
543
- };
544
- const unmarshalNodeType = (data) => {
545
- if (!sdkClient.isJSONObject(data)) {
546
- throw new TypeError(
547
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
548
- );
549
- }
550
- return {
551
- availableVolumeTypes: sdkClient.unmarshalArrayOfObject(
552
- data.available_volume_types,
553
- unmarshalNodeTypeVolumeType
554
- ),
555
- beta: data.beta,
556
- description: data.description,
557
- disabled: data.disabled,
558
- generation: data.generation,
559
- instanceRange: data.instance_range,
560
- isBssdCompatible: data.is_bssd_compatible,
561
- isHaRequired: data.is_ha_required,
562
- memory: data.memory,
563
- name: data.name,
564
- region: data.region,
565
- stockStatus: data.stock_status,
566
- vcpus: data.vcpus,
567
- volumeConstraint: data.volume_constraint ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) : void 0
568
- };
569
- };
570
- const unmarshalListNodeTypesResponse = (data) => {
571
- if (!sdkClient.isJSONObject(data)) {
572
- throw new TypeError(
573
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
574
- );
575
- }
576
- return {
577
- nodeTypes: sdkClient.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
578
- totalCount: data.total_count
579
- };
580
- };
581
- const unmarshalListPrivilegesResponse = (data) => {
582
- if (!sdkClient.isJSONObject(data)) {
583
- throw new TypeError(
584
- `Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`
585
- );
586
- }
587
- return {
588
- privileges: sdkClient.unmarshalArrayOfObject(data.privileges, unmarshalPrivilege),
589
- totalCount: data.total_count
590
- };
591
- };
592
- const unmarshalListSnapshotsResponse = (data) => {
593
- if (!sdkClient.isJSONObject(data)) {
594
- throw new TypeError(
595
- `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
596
- );
597
- }
598
- return {
599
- snapshots: sdkClient.unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
600
- totalCount: data.total_count
601
- };
602
- };
603
- const unmarshalListUsersResponse = (data) => {
604
- if (!sdkClient.isJSONObject(data)) {
605
- throw new TypeError(
606
- `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
607
- );
608
- }
609
- return {
610
- totalCount: data.total_count,
611
- users: sdkClient.unmarshalArrayOfObject(data.users, unmarshalUser)
612
- };
613
- };
614
- const unmarshalPrepareInstanceLogsResponse = (data) => {
615
- if (!sdkClient.isJSONObject(data)) {
616
- throw new TypeError(
617
- `Unmarshalling the type 'PrepareInstanceLogsResponse' failed as data isn't a dictionary.`
618
- );
619
- }
620
- return {
621
- instanceLogs: sdkClient.unmarshalArrayOfObject(
622
- data.instance_logs,
623
- unmarshalInstanceLog
624
- )
625
- };
626
- };
627
- const unmarshalSetInstanceACLRulesResponse = (data) => {
628
- if (!sdkClient.isJSONObject(data)) {
629
- throw new TypeError(
630
- `Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`
631
- );
632
- }
633
- return {
634
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
635
- };
636
- };
637
- const unmarshalSetInstanceSettingsResponse = (data) => {
638
- if (!sdkClient.isJSONObject(data)) {
639
- throw new TypeError(
640
- `Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`
641
- );
642
- }
643
- return {
644
- settings: sdkClient.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting)
645
- };
646
- };
647
- const marshalACLRuleRequest = (request, defaults) => ({
648
- description: request.description,
649
- ip: request.ip
650
- });
651
- const marshalAddInstanceACLRulesRequest = (request, defaults) => ({
652
- rules: request.rules.map((elt) => marshalACLRuleRequest(elt))
653
- });
654
- const marshalInstanceSetting = (request, defaults) => ({
655
- name: request.name,
656
- value: request.value
657
- });
658
- const marshalAddInstanceSettingsRequest = (request, defaults) => ({
659
- settings: request.settings.map((elt) => marshalInstanceSetting(elt))
660
- });
661
- const marshalCloneInstanceRequest = (request, defaults) => ({
662
- name: request.name,
663
- node_type: request.nodeType
664
- });
665
- const marshalCreateDatabaseBackupRequest = (request, defaults) => ({
666
- database_name: request.databaseName,
667
- expires_at: request.expiresAt,
668
- instance_id: request.instanceId,
669
- name: request.name || randomName("bkp")
670
- });
671
- const marshalCreateDatabaseRequest = (request, defaults) => ({
672
- name: request.name
673
- });
674
- const marshalEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
675
- const marshalEndpointSpecLoadBalancer = (request, defaults) => ({});
676
- const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
677
- private_network_id: request.privateNetworkId,
678
- ...sdkClient.resolveOneOf([
679
- { param: "service_ip", value: request.serviceIp },
680
- {
681
- param: "ipam_config",
682
- value: request.ipamConfig !== void 0 ? marshalEndpointSpecPrivateNetworkIpamConfig(
683
- request.ipamConfig
684
- ) : void 0
685
- }
686
- ])
687
- });
688
- const marshalEndpointSpec = (request, defaults) => ({
689
- ...sdkClient.resolveOneOf([
690
- {
691
- param: "load_balancer",
692
- value: request.loadBalancer !== void 0 ? marshalEndpointSpecLoadBalancer(request.loadBalancer) : void 0
693
- },
694
- {
695
- param: "private_network",
696
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork) : void 0
697
- }
698
- ])
699
- });
700
- const marshalCreateEndpointRequest = (request, defaults) => ({
701
- endpoint_spec: request.endpointSpec !== void 0 ? marshalEndpointSpec(request.endpointSpec) : void 0
702
- });
703
- const marshalCreateInstanceFromSnapshotRequest = (request, defaults) => ({
704
- instance_name: request.instanceName,
705
- is_ha_cluster: request.isHaCluster,
706
- node_type: request.nodeType
707
- });
708
- const marshalEncryptionAtRest = (request, defaults) => ({
709
- enabled: request.enabled
710
- });
711
- const marshalCreateInstanceRequest = (request, defaults) => ({
712
- backup_same_region: request.backupSameRegion,
713
- disable_backup: request.disableBackup,
714
- encryption: request.encryption !== void 0 ? marshalEncryptionAtRest(request.encryption) : void 0,
715
- engine: request.engine,
716
- init_endpoints: request.initEndpoints !== void 0 ? request.initEndpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
717
- init_settings: request.initSettings !== void 0 ? request.initSettings.map((elt) => marshalInstanceSetting(elt)) : void 0,
718
- is_ha_cluster: request.isHaCluster,
719
- name: request.name || randomName("ins"),
720
- node_type: request.nodeType,
721
- password: request.password,
722
- tags: request.tags,
723
- user_name: request.userName,
724
- volume_size: request.volumeSize,
725
- volume_type: request.volumeType,
726
- ...sdkClient.resolveOneOf([
727
- {
728
- default: defaults.defaultProjectId,
729
- param: "project_id",
730
- value: request.projectId
731
- },
732
- {
733
- default: defaults.defaultOrganizationId,
734
- param: "organization_id",
735
- value: request.organizationId
736
- }
737
- ])
738
- });
739
- const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
740
- const marshalReadReplicaEndpointSpecDirectAccess = (request, defaults) => ({});
741
- const marshalReadReplicaEndpointSpecPrivateNetwork = (request, defaults) => ({
742
- private_network_id: request.privateNetworkId,
743
- ...sdkClient.resolveOneOf([
744
- { param: "service_ip", value: request.serviceIp },
745
- {
746
- param: "ipam_config",
747
- value: request.ipamConfig !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig(
748
- request.ipamConfig
749
- ) : void 0
750
- }
751
- ])
752
- });
753
- const marshalReadReplicaEndpointSpec = (request, defaults) => ({
754
- ...sdkClient.resolveOneOf([
755
- {
756
- param: "direct_access",
757
- value: request.directAccess !== void 0 ? marshalReadReplicaEndpointSpecDirectAccess(
758
- request.directAccess
759
- ) : void 0
760
- },
761
- {
762
- param: "private_network",
763
- value: request.privateNetwork !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetwork(
764
- request.privateNetwork
765
- ) : void 0
766
- }
767
- ])
768
- });
769
- const marshalCreateReadReplicaEndpointRequest = (request, defaults) => ({
770
- endpoint_spec: request.endpointSpec.map(
771
- (elt) => marshalReadReplicaEndpointSpec(elt)
772
- )
773
- });
774
- const marshalCreateReadReplicaRequest = (request, defaults) => ({
775
- endpoint_spec: request.endpointSpec !== void 0 ? request.endpointSpec.map(
776
- (elt) => marshalReadReplicaEndpointSpec(elt)
777
- ) : void 0,
778
- instance_id: request.instanceId,
779
- same_zone: request.sameZone
780
- });
781
- const marshalCreateSnapshotRequest = (request, defaults) => ({
782
- expires_at: request.expiresAt,
783
- name: request.name || randomName("snp")
784
- });
785
- const marshalCreateUserRequest = (request, defaults) => ({
786
- is_admin: request.isAdmin,
787
- name: request.name,
788
- password: request.password
789
- });
790
- const marshalDeleteInstanceACLRulesRequest = (request, defaults) => ({
791
- acl_rule_ips: request.aclRuleIps
792
- });
793
- const marshalDeleteInstanceSettingsRequest = (request, defaults) => ({
794
- setting_names: request.settingNames
795
- });
796
- const marshalMigrateEndpointRequest = (request, defaults) => ({
797
- instance_id: request.instanceId
798
- });
799
- const marshalPrepareInstanceLogsRequest = (request, defaults) => ({
800
- end_date: request.endDate,
801
- start_date: request.startDate
802
- });
803
- const marshalPurgeInstanceLogsRequest = (request, defaults) => ({
804
- log_name: request.logName
805
- });
806
- const marshalRestoreDatabaseBackupRequest = (request, defaults) => ({
807
- database_name: request.databaseName,
808
- instance_id: request.instanceId
809
- });
810
- const marshalSetInstanceACLRulesRequest = (request, defaults) => ({
811
- rules: request.rules.map((elt) => marshalACLRuleRequest(elt))
812
- });
813
- const marshalSetInstanceSettingsRequest = (request, defaults) => ({
814
- settings: request.settings.map((elt) => marshalInstanceSetting(elt))
815
- });
816
- const marshalSetPrivilegeRequest = (request, defaults) => ({
817
- database_name: request.databaseName,
818
- permission: request.permission,
819
- user_name: request.userName
820
- });
821
- const marshalUpdateDatabaseBackupRequest = (request, defaults) => ({
822
- expires_at: request.expiresAt,
823
- name: request.name
824
- });
825
- const marshalLogsPolicy = (request, defaults) => ({
826
- max_age_retention: request.maxAgeRetention,
827
- total_disk_retention: request.totalDiskRetention
828
- });
829
- const marshalUpdateInstanceRequest = (request, defaults) => ({
830
- backup_same_region: request.backupSameRegion,
831
- backup_schedule_frequency: request.backupScheduleFrequency,
832
- backup_schedule_retention: request.backupScheduleRetention,
833
- backup_schedule_start_hour: request.backupScheduleStartHour,
834
- is_backup_schedule_disabled: request.isBackupScheduleDisabled,
835
- logs_policy: request.logsPolicy !== void 0 ? marshalLogsPolicy(request.logsPolicy) : void 0,
836
- name: request.name,
837
- tags: request.tags
838
- });
839
- const marshalUpdateSnapshotRequest = (request, defaults) => ({
840
- expires_at: request.expiresAt,
841
- name: request.name
842
- });
843
- const marshalUpdateUserRequest = (request, defaults) => ({
844
- is_admin: request.isAdmin,
845
- password: request.password
846
- });
847
- const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = (request, defaults) => ({
848
- upgradable_version_id: request.upgradableVersionId,
849
- with_endpoints: request.withEndpoints
850
- });
851
- const marshalUpgradeInstanceRequest = (request, defaults) => ({
852
- ...sdkClient.resolveOneOf([
853
- { param: "node_type", value: request.nodeType },
854
- { param: "enable_ha", value: request.enableHa },
855
- { param: "volume_size", value: request.volumeSize },
856
- { param: "volume_type", value: request.volumeType },
857
- { param: "upgradable_version_id", value: request.upgradableVersionId },
858
- {
859
- param: "major_upgrade_workflow",
860
- value: request.majorUpgradeWorkflow !== void 0 ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow(
861
- request.majorUpgradeWorkflow
862
- ) : void 0
863
- },
864
- { param: "enable_encryption", value: request.enableEncryption }
865
- ])
866
- });
867
- exports.marshalAddInstanceACLRulesRequest = marshalAddInstanceACLRulesRequest;
868
- exports.marshalAddInstanceSettingsRequest = marshalAddInstanceSettingsRequest;
869
- exports.marshalCloneInstanceRequest = marshalCloneInstanceRequest;
870
- exports.marshalCreateDatabaseBackupRequest = marshalCreateDatabaseBackupRequest;
871
- exports.marshalCreateDatabaseRequest = marshalCreateDatabaseRequest;
872
- exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
873
- exports.marshalCreateInstanceFromSnapshotRequest = marshalCreateInstanceFromSnapshotRequest;
874
- exports.marshalCreateInstanceRequest = marshalCreateInstanceRequest;
875
- exports.marshalCreateReadReplicaEndpointRequest = marshalCreateReadReplicaEndpointRequest;
876
- exports.marshalCreateReadReplicaRequest = marshalCreateReadReplicaRequest;
877
- exports.marshalCreateSnapshotRequest = marshalCreateSnapshotRequest;
878
- exports.marshalCreateUserRequest = marshalCreateUserRequest;
879
- exports.marshalDeleteInstanceACLRulesRequest = marshalDeleteInstanceACLRulesRequest;
880
- exports.marshalDeleteInstanceSettingsRequest = marshalDeleteInstanceSettingsRequest;
881
- exports.marshalMigrateEndpointRequest = marshalMigrateEndpointRequest;
882
- exports.marshalPrepareInstanceLogsRequest = marshalPrepareInstanceLogsRequest;
883
- exports.marshalPurgeInstanceLogsRequest = marshalPurgeInstanceLogsRequest;
884
- exports.marshalRestoreDatabaseBackupRequest = marshalRestoreDatabaseBackupRequest;
885
- exports.marshalSetInstanceACLRulesRequest = marshalSetInstanceACLRulesRequest;
886
- exports.marshalSetInstanceSettingsRequest = marshalSetInstanceSettingsRequest;
887
- exports.marshalSetPrivilegeRequest = marshalSetPrivilegeRequest;
888
- exports.marshalUpdateDatabaseBackupRequest = marshalUpdateDatabaseBackupRequest;
889
- exports.marshalUpdateInstanceRequest = marshalUpdateInstanceRequest;
890
- exports.marshalUpdateSnapshotRequest = marshalUpdateSnapshotRequest;
891
- exports.marshalUpdateUserRequest = marshalUpdateUserRequest;
892
- exports.marshalUpgradeInstanceRequest = marshalUpgradeInstanceRequest;
893
- exports.unmarshalACLRule = unmarshalACLRule;
894
- exports.unmarshalAddInstanceACLRulesResponse = unmarshalAddInstanceACLRulesResponse;
895
- exports.unmarshalAddInstanceSettingsResponse = unmarshalAddInstanceSettingsResponse;
896
- exports.unmarshalBackupSchedule = unmarshalBackupSchedule;
897
- exports.unmarshalDatabase = unmarshalDatabase;
898
- exports.unmarshalDatabaseBackup = unmarshalDatabaseBackup;
899
- exports.unmarshalDeleteInstanceACLRulesResponse = unmarshalDeleteInstanceACLRulesResponse;
900
- exports.unmarshalDeleteInstanceSettingsResponse = unmarshalDeleteInstanceSettingsResponse;
901
- exports.unmarshalEndpoint = unmarshalEndpoint;
902
- exports.unmarshalInstance = unmarshalInstance;
903
- exports.unmarshalInstanceLog = unmarshalInstanceLog;
904
- exports.unmarshalInstanceMetrics = unmarshalInstanceMetrics;
905
- exports.unmarshalListDatabaseBackupsResponse = unmarshalListDatabaseBackupsResponse;
906
- exports.unmarshalListDatabaseEnginesResponse = unmarshalListDatabaseEnginesResponse;
907
- exports.unmarshalListDatabasesResponse = unmarshalListDatabasesResponse;
908
- exports.unmarshalListInstanceACLRulesResponse = unmarshalListInstanceACLRulesResponse;
909
- exports.unmarshalListInstanceLogsDetailsResponse = unmarshalListInstanceLogsDetailsResponse;
910
- exports.unmarshalListInstanceLogsResponse = unmarshalListInstanceLogsResponse;
911
- exports.unmarshalListInstancesResponse = unmarshalListInstancesResponse;
912
- exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
913
- exports.unmarshalListPrivilegesResponse = unmarshalListPrivilegesResponse;
914
- exports.unmarshalListSnapshotsResponse = unmarshalListSnapshotsResponse;
915
- exports.unmarshalListUsersResponse = unmarshalListUsersResponse;
916
- exports.unmarshalMaintenance = unmarshalMaintenance;
917
- exports.unmarshalPrepareInstanceLogsResponse = unmarshalPrepareInstanceLogsResponse;
918
- exports.unmarshalPrivilege = unmarshalPrivilege;
919
- exports.unmarshalReadReplica = unmarshalReadReplica;
920
- exports.unmarshalSetInstanceACLRulesResponse = unmarshalSetInstanceACLRulesResponse;
921
- exports.unmarshalSetInstanceSettingsResponse = unmarshalSetInstanceSettingsResponse;
922
- exports.unmarshalSnapshot = unmarshalSnapshot;
923
- exports.unmarshalUser = unmarshalUser;