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