@scaleway/sdk-rdb 2.8.0 → 2.9.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.
@@ -1,590 +0,0 @@
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
- id: data.id,
152
- initSettings: unmarshalArrayOfObject(data.init_settings, unmarshalInstanceSetting),
153
- isHaCluster: data.is_ha_cluster,
154
- logsPolicy: data.logs_policy ? unmarshalLogsPolicy(data.logs_policy) : void 0,
155
- maintenances: unmarshalArrayOfObject(data.maintenances, unmarshalMaintenance),
156
- name: data.name,
157
- nodeType: data.node_type,
158
- organizationId: data.organization_id,
159
- projectId: data.project_id,
160
- readReplicas: unmarshalArrayOfObject(data.read_replicas, unmarshalReadReplica),
161
- region: data.region,
162
- settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
163
- status: data.status,
164
- tags: data.tags,
165
- upgradableVersion: unmarshalArrayOfObject(data.upgradable_version, unmarshalUpgradableVersion),
166
- volume: data.volume ? unmarshalVolume(data.volume) : void 0
167
- };
168
- };
169
- const unmarshalPrivilege = (data) => {
170
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Privilege' failed as data isn't a dictionary.`);
171
- return {
172
- databaseName: data.database_name,
173
- permission: data.permission,
174
- userName: data.user_name
175
- };
176
- };
177
- const unmarshalSnapshotVolumeType = (data) => {
178
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`);
179
- return {
180
- class: data.class,
181
- type: data.type
182
- };
183
- };
184
- const unmarshalSnapshot = (data) => {
185
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
186
- return {
187
- createdAt: unmarshalDate(data.created_at),
188
- expiresAt: unmarshalDate(data.expires_at),
189
- id: data.id,
190
- instanceId: data.instance_id,
191
- instanceName: data.instance_name,
192
- name: data.name,
193
- nodeType: data.node_type,
194
- region: data.region,
195
- size: data.size,
196
- status: data.status,
197
- updatedAt: unmarshalDate(data.updated_at),
198
- volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
199
- };
200
- };
201
- const unmarshalUser = (data) => {
202
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
203
- return {
204
- isAdmin: data.is_admin,
205
- name: data.name
206
- };
207
- };
208
- const unmarshalACLRule = (data) => {
209
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
210
- return {
211
- action: data.action,
212
- description: data.description,
213
- direction: data.direction,
214
- ip: data.ip,
215
- port: data.port,
216
- protocol: data.protocol
217
- };
218
- };
219
- const unmarshalAddInstanceACLRulesResponse = (data) => {
220
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary.`);
221
- return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
222
- };
223
- const unmarshalAddInstanceSettingsResponse = (data) => {
224
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary.`);
225
- return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
226
- };
227
- const unmarshalDeleteInstanceACLRulesResponse = (data) => {
228
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary.`);
229
- return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
230
- };
231
- const unmarshalDeleteInstanceSettingsResponse = (data) => {
232
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary.`);
233
- return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
234
- };
235
- const unmarshalInstanceMetrics = (data) => {
236
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary.`);
237
- return { timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries) };
238
- };
239
- const unmarshalListDatabaseBackupsResponse = (data) => {
240
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabaseBackupsResponse' failed as data isn't a dictionary.`);
241
- return {
242
- databaseBackups: unmarshalArrayOfObject(data.database_backups, unmarshalDatabaseBackup),
243
- totalCount: data.total_count
244
- };
245
- };
246
- const unmarshalEngineSetting = (data) => {
247
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`);
248
- return {
249
- defaultValue: data.default_value,
250
- description: data.description,
251
- floatMax: data.float_max,
252
- floatMin: data.float_min,
253
- hotConfigurable: data.hot_configurable,
254
- intMax: data.int_max,
255
- intMin: data.int_min,
256
- name: data.name,
257
- propertyType: data.property_type,
258
- stringConstraint: data.string_constraint,
259
- unit: data.unit
260
- };
261
- };
262
- const unmarshalEngineVersion = (data) => {
263
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`);
264
- return {
265
- availableInitSettings: unmarshalArrayOfObject(data.available_init_settings, unmarshalEngineSetting),
266
- availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalEngineSetting),
267
- beta: data.beta,
268
- disabled: data.disabled,
269
- endOfLife: unmarshalDate(data.end_of_life),
270
- name: data.name,
271
- releaseDate: unmarshalDate(data.release_date),
272
- version: data.version
273
- };
274
- };
275
- const unmarshalDatabaseEngine = (data) => {
276
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`);
277
- return {
278
- logoUrl: data.logo_url,
279
- name: data.name,
280
- region: data.region,
281
- versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion)
282
- };
283
- };
284
- const unmarshalListDatabaseEnginesResponse = (data) => {
285
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`);
286
- return {
287
- engines: unmarshalArrayOfObject(data.engines, unmarshalDatabaseEngine),
288
- totalCount: data.total_count
289
- };
290
- };
291
- const unmarshalListDatabasesResponse = (data) => {
292
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`);
293
- return {
294
- databases: unmarshalArrayOfObject(data.databases, unmarshalDatabase),
295
- totalCount: data.total_count
296
- };
297
- };
298
- const unmarshalListInstanceACLRulesResponse = (data) => {
299
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`);
300
- return {
301
- rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
302
- totalCount: data.total_count
303
- };
304
- };
305
- const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = (data) => {
306
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`);
307
- return {
308
- logName: data.log_name,
309
- size: data.size
310
- };
311
- };
312
- const unmarshalListInstanceLogsDetailsResponse = (data) => {
313
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`);
314
- return { details: unmarshalArrayOfObject(data.details, unmarshalListInstanceLogsDetailsResponseInstanceLogDetail) };
315
- };
316
- const unmarshalListInstanceLogsResponse = (data) => {
317
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`);
318
- return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
319
- };
320
- const unmarshalListInstancesResponse = (data) => {
321
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`);
322
- return {
323
- instances: unmarshalArrayOfObject(data.instances, unmarshalInstance),
324
- totalCount: data.total_count
325
- };
326
- };
327
- const unmarshalNodeTypeVolumeConstraintSizes = (data) => {
328
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
329
- return {
330
- maxSize: data.max_size,
331
- minSize: data.min_size
332
- };
333
- };
334
- const unmarshalNodeTypeVolumeType = (data) => {
335
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`);
336
- return {
337
- chunkSize: data.chunk_size,
338
- class: data.class,
339
- description: data.description,
340
- maxSize: data.max_size,
341
- minSize: data.min_size,
342
- type: data.type
343
- };
344
- };
345
- const unmarshalNodeType = (data) => {
346
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
347
- return {
348
- availableVolumeTypes: unmarshalArrayOfObject(data.available_volume_types, unmarshalNodeTypeVolumeType),
349
- beta: data.beta,
350
- description: data.description,
351
- disabled: data.disabled,
352
- generation: data.generation,
353
- instanceRange: data.instance_range,
354
- isBssdCompatible: data.is_bssd_compatible,
355
- isHaRequired: data.is_ha_required,
356
- memory: data.memory,
357
- name: data.name,
358
- region: data.region,
359
- stockStatus: data.stock_status,
360
- vcpus: data.vcpus,
361
- volumeConstraint: data.volume_constraint ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) : void 0
362
- };
363
- };
364
- const unmarshalListNodeTypesResponse = (data) => {
365
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
366
- return {
367
- nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
368
- totalCount: data.total_count
369
- };
370
- };
371
- const unmarshalListPrivilegesResponse = (data) => {
372
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`);
373
- return {
374
- privileges: unmarshalArrayOfObject(data.privileges, unmarshalPrivilege),
375
- totalCount: data.total_count
376
- };
377
- };
378
- const unmarshalListSnapshotsResponse = (data) => {
379
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
380
- return {
381
- snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
382
- totalCount: data.total_count
383
- };
384
- };
385
- const unmarshalListUsersResponse = (data) => {
386
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
387
- return {
388
- totalCount: data.total_count,
389
- users: unmarshalArrayOfObject(data.users, unmarshalUser)
390
- };
391
- };
392
- const unmarshalPrepareInstanceLogsResponse = (data) => {
393
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PrepareInstanceLogsResponse' failed as data isn't a dictionary.`);
394
- return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
395
- };
396
- const unmarshalSetInstanceACLRulesResponse = (data) => {
397
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`);
398
- return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
399
- };
400
- const unmarshalSetInstanceSettingsResponse = (data) => {
401
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`);
402
- return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
403
- };
404
- const marshalACLRuleRequest = (request, defaults) => ({
405
- description: request.description,
406
- ip: request.ip
407
- });
408
- const marshalAddInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
409
- const marshalInstanceSetting = (request, defaults) => ({
410
- name: request.name,
411
- value: request.value
412
- });
413
- const marshalAddInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
414
- const marshalCloneInstanceRequest = (request, defaults) => ({
415
- name: request.name,
416
- node_type: request.nodeType
417
- });
418
- const marshalCreateDatabaseBackupRequest = (request, defaults) => ({
419
- database_name: request.databaseName,
420
- expires_at: request.expiresAt,
421
- instance_id: request.instanceId,
422
- name: request.name || randomName("bkp")
423
- });
424
- const marshalCreateDatabaseRequest = (request, defaults) => ({ name: request.name });
425
- const marshalEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
426
- const marshalEndpointSpecLoadBalancer = (request, defaults) => ({});
427
- const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
428
- private_network_id: request.privateNetworkId,
429
- ...resolveOneOf([{
430
- param: "service_ip",
431
- value: request.serviceIp
432
- }, {
433
- param: "ipam_config",
434
- value: request.ipamConfig !== void 0 ? marshalEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
435
- }])
436
- });
437
- const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
438
- param: "load_balancer",
439
- value: request.loadBalancer !== void 0 ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) : void 0
440
- }, {
441
- param: "private_network",
442
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
443
- }]) });
444
- const marshalCreateEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec !== void 0 ? marshalEndpointSpec(request.endpointSpec, defaults) : void 0 });
445
- const marshalCreateInstanceFromSnapshotRequest = (request, defaults) => ({
446
- instance_name: request.instanceName,
447
- is_ha_cluster: request.isHaCluster,
448
- node_type: request.nodeType
449
- });
450
- const marshalEncryptionAtRest = (request, defaults) => ({ enabled: request.enabled });
451
- const marshalCreateInstanceRequest = (request, defaults) => ({
452
- backup_same_region: request.backupSameRegion,
453
- disable_backup: request.disableBackup,
454
- encryption: request.encryption !== void 0 ? marshalEncryptionAtRest(request.encryption, defaults) : void 0,
455
- engine: request.engine,
456
- init_endpoints: request.initEndpoints !== void 0 ? request.initEndpoints.map((elt) => marshalEndpointSpec(elt, defaults)) : void 0,
457
- init_settings: request.initSettings !== void 0 ? request.initSettings.map((elt) => marshalInstanceSetting(elt, defaults)) : void 0,
458
- is_ha_cluster: request.isHaCluster,
459
- name: request.name || randomName("ins"),
460
- node_type: request.nodeType,
461
- password: request.password,
462
- tags: request.tags,
463
- user_name: request.userName,
464
- volume_size: request.volumeSize,
465
- volume_type: request.volumeType,
466
- ...resolveOneOf([{
467
- default: defaults.defaultProjectId,
468
- param: "project_id",
469
- value: request.projectId
470
- }, {
471
- default: defaults.defaultOrganizationId,
472
- param: "organization_id",
473
- value: request.organizationId
474
- }])
475
- });
476
- const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
477
- const marshalReadReplicaEndpointSpecDirectAccess = (request, defaults) => ({});
478
- const marshalReadReplicaEndpointSpecPrivateNetwork = (request, defaults) => ({
479
- private_network_id: request.privateNetworkId,
480
- ...resolveOneOf([{
481
- param: "service_ip",
482
- value: request.serviceIp
483
- }, {
484
- param: "ipam_config",
485
- value: request.ipamConfig !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
486
- }])
487
- });
488
- const marshalReadReplicaEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
489
- param: "direct_access",
490
- value: request.directAccess !== void 0 ? marshalReadReplicaEndpointSpecDirectAccess(request.directAccess, defaults) : void 0
491
- }, {
492
- param: "private_network",
493
- value: request.privateNetwork !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
494
- }]) });
495
- const marshalCreateReadReplicaEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) });
496
- const marshalCreateReadReplicaRequest = (request, defaults) => ({
497
- endpoint_spec: request.endpointSpec !== void 0 ? request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) : void 0,
498
- instance_id: request.instanceId,
499
- same_zone: request.sameZone
500
- });
501
- const marshalCreateSnapshotRequest = (request, defaults) => ({
502
- expires_at: request.expiresAt,
503
- name: request.name || randomName("snp")
504
- });
505
- const marshalCreateUserRequest = (request, defaults) => ({
506
- is_admin: request.isAdmin,
507
- name: request.name,
508
- password: request.password
509
- });
510
- const marshalDeleteInstanceACLRulesRequest = (request, defaults) => ({ acl_rule_ips: request.aclRuleIps });
511
- const marshalDeleteInstanceSettingsRequest = (request, defaults) => ({ setting_names: request.settingNames });
512
- const marshalMigrateEndpointRequest = (request, defaults) => ({ instance_id: request.instanceId });
513
- const marshalPrepareInstanceLogsRequest = (request, defaults) => ({
514
- end_date: request.endDate,
515
- start_date: request.startDate
516
- });
517
- const marshalPurgeInstanceLogsRequest = (request, defaults) => ({ log_name: request.logName });
518
- const marshalRestoreDatabaseBackupRequest = (request, defaults) => ({
519
- database_name: request.databaseName,
520
- instance_id: request.instanceId
521
- });
522
- const marshalSetInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
523
- const marshalSetInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
524
- const marshalSetPrivilegeRequest = (request, defaults) => ({
525
- database_name: request.databaseName,
526
- permission: request.permission,
527
- user_name: request.userName
528
- });
529
- const marshalUpdateDatabaseBackupRequest = (request, defaults) => ({
530
- expires_at: request.expiresAt,
531
- name: request.name
532
- });
533
- const marshalLogsPolicy = (request, defaults) => ({
534
- max_age_retention: request.maxAgeRetention,
535
- total_disk_retention: request.totalDiskRetention
536
- });
537
- const marshalUpdateInstanceRequest = (request, defaults) => ({
538
- backup_same_region: request.backupSameRegion,
539
- backup_schedule_frequency: request.backupScheduleFrequency,
540
- backup_schedule_retention: request.backupScheduleRetention,
541
- backup_schedule_start_hour: request.backupScheduleStartHour,
542
- is_backup_schedule_disabled: request.isBackupScheduleDisabled,
543
- logs_policy: request.logsPolicy !== void 0 ? marshalLogsPolicy(request.logsPolicy, defaults) : void 0,
544
- name: request.name,
545
- tags: request.tags
546
- });
547
- const marshalUpdateSnapshotRequest = (request, defaults) => ({
548
- expires_at: request.expiresAt,
549
- name: request.name
550
- });
551
- const marshalUpdateUserRequest = (request, defaults) => ({
552
- is_admin: request.isAdmin,
553
- password: request.password
554
- });
555
- const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = (request, defaults) => ({
556
- upgradable_version_id: request.upgradableVersionId,
557
- with_endpoints: request.withEndpoints
558
- });
559
- const marshalUpgradeInstanceRequest = (request, defaults) => ({ ...resolveOneOf([
560
- {
561
- param: "node_type",
562
- value: request.nodeType
563
- },
564
- {
565
- param: "enable_ha",
566
- value: request.enableHa
567
- },
568
- {
569
- param: "volume_size",
570
- value: request.volumeSize
571
- },
572
- {
573
- param: "volume_type",
574
- value: request.volumeType
575
- },
576
- {
577
- param: "upgradable_version_id",
578
- value: request.upgradableVersionId
579
- },
580
- {
581
- param: "major_upgrade_workflow",
582
- value: request.majorUpgradeWorkflow !== void 0 ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow(request.majorUpgradeWorkflow, defaults) : void 0
583
- },
584
- {
585
- param: "enable_encryption",
586
- value: request.enableEncryption
587
- }
588
- ]) });
589
- //#endregion
590
- 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 };