@scaleway/sdk-rdb 2.9.0 → 2.11.0

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,597 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries } from "@scaleway/sdk-client";
2
+ import randomName from "@scaleway/random-name";
3
+ //#region src/v1/marshalling.gen.ts
4
+ const unmarshalEndpointDirectAccessDetails = (data) => {
5
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointDirectAccessDetails' failed as data isn't a dictionary.`);
6
+ return {};
7
+ };
8
+ const unmarshalEndpointLoadBalancerDetails = (data) => {
9
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointLoadBalancerDetails' failed as data isn't a dictionary.`);
10
+ return {};
11
+ };
12
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
13
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`);
14
+ return {
15
+ privateNetworkId: data.private_network_id,
16
+ provisioningMode: data.provisioning_mode,
17
+ serviceIp: data.service_ip,
18
+ zone: data.zone
19
+ };
20
+ };
21
+ const unmarshalEndpoint = (data) => {
22
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
23
+ return {
24
+ directAccess: data.direct_access ? unmarshalEndpointDirectAccessDetails(data.direct_access) : void 0,
25
+ hostname: data.hostname,
26
+ id: data.id,
27
+ ip: data.ip,
28
+ loadBalancer: data.load_balancer ? unmarshalEndpointLoadBalancerDetails(data.load_balancer) : void 0,
29
+ name: data.name,
30
+ port: data.port,
31
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0
32
+ };
33
+ };
34
+ const unmarshalMaintenance = (data) => {
35
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`);
36
+ return {
37
+ closedAt: unmarshalDate(data.closed_at),
38
+ forcedAt: unmarshalDate(data.forced_at),
39
+ isApplicable: data.is_applicable,
40
+ reason: data.reason,
41
+ startsAt: unmarshalDate(data.starts_at),
42
+ status: data.status,
43
+ stopsAt: unmarshalDate(data.stops_at)
44
+ };
45
+ };
46
+ const unmarshalReadReplica = (data) => {
47
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`);
48
+ return {
49
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
50
+ id: data.id,
51
+ instanceId: data.instance_id,
52
+ region: data.region,
53
+ sameZone: data.same_zone,
54
+ status: data.status
55
+ };
56
+ };
57
+ const unmarshalDatabaseBackup = (data) => {
58
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DatabaseBackup' failed as data isn't a dictionary.`);
59
+ return {
60
+ createdAt: unmarshalDate(data.created_at),
61
+ databaseName: data.database_name,
62
+ downloadUrl: data.download_url,
63
+ downloadUrlExpiresAt: unmarshalDate(data.download_url_expires_at),
64
+ expiresAt: unmarshalDate(data.expires_at),
65
+ id: data.id,
66
+ instanceId: data.instance_id,
67
+ instanceName: data.instance_name,
68
+ name: data.name,
69
+ region: data.region,
70
+ sameRegion: data.same_region,
71
+ size: data.size,
72
+ status: data.status,
73
+ updatedAt: unmarshalDate(data.updated_at)
74
+ };
75
+ };
76
+ const unmarshalDatabase = (data) => {
77
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Database' failed as data isn't a dictionary.`);
78
+ return {
79
+ managed: data.managed,
80
+ name: data.name,
81
+ owner: data.owner,
82
+ size: data.size
83
+ };
84
+ };
85
+ const unmarshalInstanceLog = (data) => {
86
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`);
87
+ return {
88
+ createdAt: unmarshalDate(data.created_at),
89
+ downloadUrl: data.download_url,
90
+ expiresAt: unmarshalDate(data.expires_at),
91
+ id: data.id,
92
+ nodeName: data.node_name,
93
+ region: data.region,
94
+ status: data.status
95
+ };
96
+ };
97
+ const unmarshalBackupSchedule = (data) => {
98
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`);
99
+ return {
100
+ disabled: data.disabled,
101
+ frequency: data.frequency,
102
+ nextRunAt: unmarshalDate(data.next_run_at),
103
+ retention: data.retention
104
+ };
105
+ };
106
+ const unmarshalEncryptionAtRest = (data) => {
107
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EncryptionAtRest' failed as data isn't a dictionary.`);
108
+ return { enabled: data.enabled };
109
+ };
110
+ const unmarshalInstanceSetting = (data) => {
111
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`);
112
+ return {
113
+ name: data.name,
114
+ value: data.value
115
+ };
116
+ };
117
+ const unmarshalLogsPolicy = (data) => {
118
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary.`);
119
+ return {
120
+ maxAgeRetention: data.max_age_retention,
121
+ totalDiskRetention: data.total_disk_retention
122
+ };
123
+ };
124
+ const unmarshalUpgradableVersion = (data) => {
125
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`);
126
+ return {
127
+ id: data.id,
128
+ minorVersion: data.minor_version,
129
+ name: data.name,
130
+ version: data.version
131
+ };
132
+ };
133
+ const unmarshalVolume = (data) => {
134
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
135
+ return {
136
+ class: data.class,
137
+ size: data.size,
138
+ type: data.type
139
+ };
140
+ };
141
+ const unmarshalInstance = (data) => {
142
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Instance' failed as data isn't a dictionary.`);
143
+ return {
144
+ backupSameRegion: data.backup_same_region,
145
+ backupSchedule: data.backup_schedule ? unmarshalBackupSchedule(data.backup_schedule) : void 0,
146
+ createdAt: unmarshalDate(data.created_at),
147
+ encryption: data.encryption ? unmarshalEncryptionAtRest(data.encryption) : void 0,
148
+ endpoint: data.endpoint ? unmarshalEndpoint(data.endpoint) : void 0,
149
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
150
+ engine: data.engine,
151
+ highAvailabilityMode: data.high_availability_mode,
152
+ id: data.id,
153
+ initSettings: unmarshalArrayOfObject(data.init_settings, unmarshalInstanceSetting),
154
+ isHaCluster: data.is_ha_cluster,
155
+ logsPolicy: data.logs_policy ? unmarshalLogsPolicy(data.logs_policy) : void 0,
156
+ maintenances: unmarshalArrayOfObject(data.maintenances, unmarshalMaintenance),
157
+ name: data.name,
158
+ nodeType: data.node_type,
159
+ organizationId: data.organization_id,
160
+ projectId: data.project_id,
161
+ readReplicas: unmarshalArrayOfObject(data.read_replicas, unmarshalReadReplica),
162
+ region: data.region,
163
+ settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
164
+ status: data.status,
165
+ tags: data.tags,
166
+ upgradableVersion: unmarshalArrayOfObject(data.upgradable_version, unmarshalUpgradableVersion),
167
+ volume: data.volume ? unmarshalVolume(data.volume) : void 0
168
+ };
169
+ };
170
+ const unmarshalPrivilege = (data) => {
171
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Privilege' failed as data isn't a dictionary.`);
172
+ return {
173
+ databaseName: data.database_name,
174
+ permission: data.permission,
175
+ userName: data.user_name
176
+ };
177
+ };
178
+ const unmarshalSnapshotVolumeType = (data) => {
179
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`);
180
+ return {
181
+ class: data.class,
182
+ type: data.type
183
+ };
184
+ };
185
+ const unmarshalSnapshot = (data) => {
186
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
187
+ return {
188
+ createdAt: unmarshalDate(data.created_at),
189
+ expiresAt: unmarshalDate(data.expires_at),
190
+ id: data.id,
191
+ instanceId: data.instance_id,
192
+ instanceName: data.instance_name,
193
+ name: data.name,
194
+ nodeType: data.node_type,
195
+ region: data.region,
196
+ size: data.size,
197
+ status: data.status,
198
+ updatedAt: unmarshalDate(data.updated_at),
199
+ volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
200
+ };
201
+ };
202
+ const unmarshalUser = (data) => {
203
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
204
+ return {
205
+ isAdmin: data.is_admin,
206
+ name: data.name
207
+ };
208
+ };
209
+ const unmarshalACLRule = (data) => {
210
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
211
+ return {
212
+ action: data.action,
213
+ description: data.description,
214
+ direction: data.direction,
215
+ ip: data.ip,
216
+ port: data.port,
217
+ protocol: data.protocol
218
+ };
219
+ };
220
+ const unmarshalAddInstanceACLRulesResponse = (data) => {
221
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary.`);
222
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
223
+ };
224
+ const unmarshalAddInstanceSettingsResponse = (data) => {
225
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary.`);
226
+ return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
227
+ };
228
+ const unmarshalDeleteInstanceACLRulesResponse = (data) => {
229
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary.`);
230
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
231
+ };
232
+ const unmarshalDeleteInstanceSettingsResponse = (data) => {
233
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary.`);
234
+ return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
235
+ };
236
+ const unmarshalInstanceMetrics = (data) => {
237
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary.`);
238
+ return { timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries) };
239
+ };
240
+ const unmarshalListDatabaseBackupsResponse = (data) => {
241
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabaseBackupsResponse' failed as data isn't a dictionary.`);
242
+ return {
243
+ databaseBackups: unmarshalArrayOfObject(data.database_backups, unmarshalDatabaseBackup),
244
+ totalCount: data.total_count
245
+ };
246
+ };
247
+ const unmarshalEngineSetting = (data) => {
248
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`);
249
+ return {
250
+ defaultValue: data.default_value,
251
+ description: data.description,
252
+ floatMax: data.float_max,
253
+ floatMin: data.float_min,
254
+ hotConfigurable: data.hot_configurable,
255
+ intMax: data.int_max,
256
+ intMin: data.int_min,
257
+ name: data.name,
258
+ propertyType: data.property_type,
259
+ stringConstraint: data.string_constraint,
260
+ unit: data.unit
261
+ };
262
+ };
263
+ const unmarshalEngineVersion = (data) => {
264
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`);
265
+ return {
266
+ availableInitSettings: unmarshalArrayOfObject(data.available_init_settings, unmarshalEngineSetting),
267
+ availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalEngineSetting),
268
+ beta: data.beta,
269
+ disabled: data.disabled,
270
+ endOfLife: unmarshalDate(data.end_of_life),
271
+ name: data.name,
272
+ releaseDate: unmarshalDate(data.release_date),
273
+ version: data.version
274
+ };
275
+ };
276
+ const unmarshalDatabaseEngine = (data) => {
277
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`);
278
+ return {
279
+ logoUrl: data.logo_url,
280
+ name: data.name,
281
+ region: data.region,
282
+ versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion)
283
+ };
284
+ };
285
+ const unmarshalListDatabaseEnginesResponse = (data) => {
286
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`);
287
+ return {
288
+ engines: unmarshalArrayOfObject(data.engines, unmarshalDatabaseEngine),
289
+ totalCount: data.total_count
290
+ };
291
+ };
292
+ const unmarshalListDatabasesResponse = (data) => {
293
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`);
294
+ return {
295
+ databases: unmarshalArrayOfObject(data.databases, unmarshalDatabase),
296
+ totalCount: data.total_count
297
+ };
298
+ };
299
+ const unmarshalListInstanceACLRulesResponse = (data) => {
300
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`);
301
+ return {
302
+ rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
303
+ totalCount: data.total_count
304
+ };
305
+ };
306
+ const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = (data) => {
307
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`);
308
+ return {
309
+ logName: data.log_name,
310
+ size: data.size
311
+ };
312
+ };
313
+ const unmarshalListInstanceLogsDetailsResponse = (data) => {
314
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`);
315
+ return { details: unmarshalArrayOfObject(data.details, unmarshalListInstanceLogsDetailsResponseInstanceLogDetail) };
316
+ };
317
+ const unmarshalListInstanceLogsResponse = (data) => {
318
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`);
319
+ return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
320
+ };
321
+ const unmarshalListInstancesResponse = (data) => {
322
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`);
323
+ return {
324
+ instances: unmarshalArrayOfObject(data.instances, unmarshalInstance),
325
+ totalCount: data.total_count
326
+ };
327
+ };
328
+ const unmarshalNodeTypeVolumeConstraintSizes = (data) => {
329
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
330
+ return {
331
+ maxSize: data.max_size,
332
+ minSize: data.min_size
333
+ };
334
+ };
335
+ const unmarshalNodeTypeVolumeType = (data) => {
336
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`);
337
+ return {
338
+ chunkSize: data.chunk_size,
339
+ class: data.class,
340
+ description: data.description,
341
+ maxSize: data.max_size,
342
+ minSize: data.min_size,
343
+ type: data.type
344
+ };
345
+ };
346
+ const unmarshalNodeType = (data) => {
347
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
348
+ return {
349
+ availableVolumeTypes: unmarshalArrayOfObject(data.available_volume_types, unmarshalNodeTypeVolumeType),
350
+ beta: data.beta,
351
+ description: data.description,
352
+ disabled: data.disabled,
353
+ generation: data.generation,
354
+ instanceRange: data.instance_range,
355
+ isBssdCompatible: data.is_bssd_compatible,
356
+ isHaRequired: data.is_ha_required,
357
+ memory: data.memory,
358
+ name: data.name,
359
+ region: data.region,
360
+ stockStatus: data.stock_status,
361
+ vcpus: data.vcpus,
362
+ volumeConstraint: data.volume_constraint ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) : void 0
363
+ };
364
+ };
365
+ const unmarshalListNodeTypesResponse = (data) => {
366
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
367
+ return {
368
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
369
+ totalCount: data.total_count
370
+ };
371
+ };
372
+ const unmarshalListPrivilegesResponse = (data) => {
373
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`);
374
+ return {
375
+ privileges: unmarshalArrayOfObject(data.privileges, unmarshalPrivilege),
376
+ totalCount: data.total_count
377
+ };
378
+ };
379
+ const unmarshalListSnapshotsResponse = (data) => {
380
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
381
+ return {
382
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
383
+ totalCount: data.total_count
384
+ };
385
+ };
386
+ const unmarshalListUsersResponse = (data) => {
387
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
388
+ return {
389
+ totalCount: data.total_count,
390
+ users: unmarshalArrayOfObject(data.users, unmarshalUser)
391
+ };
392
+ };
393
+ const unmarshalPrepareInstanceLogsResponse = (data) => {
394
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PrepareInstanceLogsResponse' failed as data isn't a dictionary.`);
395
+ return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
396
+ };
397
+ const unmarshalSetInstanceACLRulesResponse = (data) => {
398
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`);
399
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
400
+ };
401
+ const unmarshalSetInstanceSettingsResponse = (data) => {
402
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`);
403
+ return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
404
+ };
405
+ const marshalACLRuleRequest = (request, defaults) => ({
406
+ description: request.description,
407
+ ip: request.ip
408
+ });
409
+ const marshalAddInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
410
+ const marshalInstanceSetting = (request, defaults) => ({
411
+ name: request.name,
412
+ value: request.value
413
+ });
414
+ const marshalAddInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
415
+ const marshalCloneInstanceRequest = (request, defaults) => ({
416
+ name: request.name,
417
+ node_type: request.nodeType
418
+ });
419
+ const marshalCreateDatabaseBackupRequest = (request, defaults) => ({
420
+ database_name: request.databaseName,
421
+ expires_at: request.expiresAt,
422
+ instance_id: request.instanceId,
423
+ name: request.name || randomName("bkp")
424
+ });
425
+ const marshalCreateDatabaseRequest = (request, defaults) => ({ name: request.name });
426
+ const marshalEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
427
+ const marshalEndpointSpecLoadBalancer = (request, defaults) => ({});
428
+ const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
429
+ private_network_id: request.privateNetworkId,
430
+ ...resolveOneOf([{
431
+ param: "service_ip",
432
+ value: request.serviceIp
433
+ }, {
434
+ param: "ipam_config",
435
+ value: request.ipamConfig !== void 0 ? marshalEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
436
+ }])
437
+ });
438
+ const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
439
+ param: "load_balancer",
440
+ value: request.loadBalancer !== void 0 ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) : void 0
441
+ }, {
442
+ param: "private_network",
443
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
444
+ }]) });
445
+ const marshalCreateEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec !== void 0 ? marshalEndpointSpec(request.endpointSpec, defaults) : void 0 });
446
+ const marshalCreateInstanceFromSnapshotRequest = (request, defaults) => ({
447
+ high_availability_mode: request.highAvailabilityMode,
448
+ instance_name: request.instanceName,
449
+ is_ha_cluster: request.isHaCluster,
450
+ node_type: request.nodeType
451
+ });
452
+ const marshalEncryptionAtRest = (request, defaults) => ({ enabled: request.enabled });
453
+ const marshalCreateInstanceRequest = (request, defaults) => ({
454
+ backup_same_region: request.backupSameRegion,
455
+ disable_backup: request.disableBackup,
456
+ encryption: request.encryption !== void 0 ? marshalEncryptionAtRest(request.encryption, defaults) : void 0,
457
+ engine: request.engine,
458
+ high_availability_mode: request.highAvailabilityMode,
459
+ init_endpoints: request.initEndpoints !== void 0 ? request.initEndpoints.map((elt) => marshalEndpointSpec(elt, defaults)) : void 0,
460
+ init_settings: request.initSettings !== void 0 ? request.initSettings.map((elt) => marshalInstanceSetting(elt, defaults)) : void 0,
461
+ is_ha_cluster: request.isHaCluster,
462
+ name: request.name || randomName("ins"),
463
+ node_type: request.nodeType,
464
+ password: request.password,
465
+ tags: request.tags,
466
+ user_name: request.userName,
467
+ volume_size: request.volumeSize,
468
+ volume_type: request.volumeType,
469
+ ...resolveOneOf([{
470
+ default: defaults.defaultProjectId,
471
+ param: "project_id",
472
+ value: request.projectId
473
+ }, {
474
+ default: defaults.defaultOrganizationId,
475
+ param: "organization_id",
476
+ value: request.organizationId
477
+ }])
478
+ });
479
+ const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
480
+ const marshalReadReplicaEndpointSpecDirectAccess = (request, defaults) => ({});
481
+ const marshalReadReplicaEndpointSpecPrivateNetwork = (request, defaults) => ({
482
+ private_network_id: request.privateNetworkId,
483
+ ...resolveOneOf([{
484
+ param: "service_ip",
485
+ value: request.serviceIp
486
+ }, {
487
+ param: "ipam_config",
488
+ value: request.ipamConfig !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
489
+ }])
490
+ });
491
+ const marshalReadReplicaEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
492
+ param: "direct_access",
493
+ value: request.directAccess !== void 0 ? marshalReadReplicaEndpointSpecDirectAccess(request.directAccess, defaults) : void 0
494
+ }, {
495
+ param: "private_network",
496
+ value: request.privateNetwork !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
497
+ }]) });
498
+ const marshalCreateReadReplicaEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) });
499
+ const marshalCreateReadReplicaRequest = (request, defaults) => ({
500
+ endpoint_spec: request.endpointSpec !== void 0 ? request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) : void 0,
501
+ instance_id: request.instanceId,
502
+ same_zone: request.sameZone
503
+ });
504
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
505
+ expires_at: request.expiresAt,
506
+ name: request.name || randomName("snp")
507
+ });
508
+ const marshalCreateUserRequest = (request, defaults) => ({
509
+ is_admin: request.isAdmin,
510
+ name: request.name,
511
+ password: request.password
512
+ });
513
+ const marshalDeleteInstanceACLRulesRequest = (request, defaults) => ({ acl_rule_ips: request.aclRuleIps });
514
+ const marshalDeleteInstanceSettingsRequest = (request, defaults) => ({ setting_names: request.settingNames });
515
+ const marshalMigrateEndpointRequest = (request, defaults) => ({ instance_id: request.instanceId });
516
+ const marshalPrepareInstanceLogsRequest = (request, defaults) => ({
517
+ end_date: request.endDate,
518
+ start_date: request.startDate
519
+ });
520
+ const marshalPurgeInstanceLogsRequest = (request, defaults) => ({ log_name: request.logName });
521
+ const marshalRestoreDatabaseBackupRequest = (request, defaults) => ({
522
+ database_name: request.databaseName,
523
+ instance_id: request.instanceId
524
+ });
525
+ const marshalSetInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
526
+ const marshalSetInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
527
+ const marshalSetPrivilegeRequest = (request, defaults) => ({
528
+ database_name: request.databaseName,
529
+ permission: request.permission,
530
+ user_name: request.userName
531
+ });
532
+ const marshalUpdateDatabaseBackupRequest = (request, defaults) => ({
533
+ expires_at: request.expiresAt,
534
+ name: request.name
535
+ });
536
+ const marshalLogsPolicy = (request, defaults) => ({
537
+ max_age_retention: request.maxAgeRetention,
538
+ total_disk_retention: request.totalDiskRetention
539
+ });
540
+ const marshalUpdateInstanceRequest = (request, defaults) => ({
541
+ backup_same_region: request.backupSameRegion,
542
+ backup_schedule_frequency: request.backupScheduleFrequency,
543
+ backup_schedule_retention: request.backupScheduleRetention,
544
+ backup_schedule_start_hour: request.backupScheduleStartHour,
545
+ is_backup_schedule_disabled: request.isBackupScheduleDisabled,
546
+ logs_policy: request.logsPolicy !== void 0 ? marshalLogsPolicy(request.logsPolicy, defaults) : void 0,
547
+ name: request.name,
548
+ tags: request.tags
549
+ });
550
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
551
+ expires_at: request.expiresAt,
552
+ name: request.name
553
+ });
554
+ const marshalUpdateUserRequest = (request, defaults) => ({
555
+ is_admin: request.isAdmin,
556
+ password: request.password
557
+ });
558
+ const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = (request, defaults) => ({
559
+ upgradable_version_id: request.upgradableVersionId,
560
+ with_endpoints: request.withEndpoints
561
+ });
562
+ const marshalUpgradeInstanceRequest = (request, defaults) => ({ ...resolveOneOf([
563
+ {
564
+ param: "node_type",
565
+ value: request.nodeType
566
+ },
567
+ {
568
+ param: "enable_ha",
569
+ value: request.enableHa
570
+ },
571
+ {
572
+ param: "high_availability_mode",
573
+ value: request.highAvailabilityMode
574
+ },
575
+ {
576
+ param: "volume_size",
577
+ value: request.volumeSize
578
+ },
579
+ {
580
+ param: "volume_type",
581
+ value: request.volumeType
582
+ },
583
+ {
584
+ param: "upgradable_version_id",
585
+ value: request.upgradableVersionId
586
+ },
587
+ {
588
+ param: "major_upgrade_workflow",
589
+ value: request.majorUpgradeWorkflow !== void 0 ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow(request.majorUpgradeWorkflow, defaults) : void 0
590
+ },
591
+ {
592
+ param: "enable_encryption",
593
+ value: request.enableEncryption
594
+ }
595
+ ]) });
596
+ //#endregion
597
+ export { marshalAddInstanceACLRulesRequest, marshalAddInstanceSettingsRequest, marshalCloneInstanceRequest, marshalCreateDatabaseBackupRequest, marshalCreateDatabaseRequest, marshalCreateEndpointRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateInstanceRequest, marshalCreateReadReplicaEndpointRequest, marshalCreateReadReplicaRequest, marshalCreateSnapshotRequest, marshalCreateUserRequest, marshalDeleteInstanceACLRulesRequest, marshalDeleteInstanceSettingsRequest, marshalMigrateEndpointRequest, marshalPrepareInstanceLogsRequest, marshalPurgeInstanceLogsRequest, marshalRestoreDatabaseBackupRequest, marshalSetInstanceACLRulesRequest, marshalSetInstanceSettingsRequest, marshalSetPrivilegeRequest, marshalUpdateDatabaseBackupRequest, marshalUpdateInstanceRequest, marshalUpdateSnapshotRequest, marshalUpdateUserRequest, marshalUpgradeInstanceRequest, unmarshalACLRule, unmarshalAddInstanceACLRulesResponse, unmarshalAddInstanceSettingsResponse, unmarshalBackupSchedule, unmarshalDatabase, unmarshalDatabaseBackup, unmarshalDeleteInstanceACLRulesResponse, unmarshalDeleteInstanceSettingsResponse, unmarshalEndpoint, unmarshalInstance, unmarshalInstanceLog, unmarshalInstanceMetrics, unmarshalListDatabaseBackupsResponse, unmarshalListDatabaseEnginesResponse, unmarshalListDatabasesResponse, unmarshalListInstanceACLRulesResponse, unmarshalListInstanceLogsDetailsResponse, unmarshalListInstanceLogsResponse, unmarshalListInstancesResponse, unmarshalListNodeTypesResponse, unmarshalListPrivilegesResponse, unmarshalListSnapshotsResponse, unmarshalListUsersResponse, unmarshalMaintenance, unmarshalPrepareInstanceLogsResponse, unmarshalPrivilege, unmarshalReadReplica, unmarshalSetInstanceACLRulesResponse, unmarshalSetInstanceSettingsResponse, unmarshalSnapshot, unmarshalUser };