@scaleway/sdk-rdb 2.7.4 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,589 +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
- version: data.version
272
- };
273
- };
274
- const unmarshalDatabaseEngine = (data) => {
275
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`);
276
- return {
277
- logoUrl: data.logo_url,
278
- name: data.name,
279
- region: data.region,
280
- versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion)
281
- };
282
- };
283
- const unmarshalListDatabaseEnginesResponse = (data) => {
284
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`);
285
- return {
286
- engines: unmarshalArrayOfObject(data.engines, unmarshalDatabaseEngine),
287
- totalCount: data.total_count
288
- };
289
- };
290
- const unmarshalListDatabasesResponse = (data) => {
291
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`);
292
- return {
293
- databases: unmarshalArrayOfObject(data.databases, unmarshalDatabase),
294
- totalCount: data.total_count
295
- };
296
- };
297
- const unmarshalListInstanceACLRulesResponse = (data) => {
298
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`);
299
- return {
300
- rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
301
- totalCount: data.total_count
302
- };
303
- };
304
- const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = (data) => {
305
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`);
306
- return {
307
- logName: data.log_name,
308
- size: data.size
309
- };
310
- };
311
- const unmarshalListInstanceLogsDetailsResponse = (data) => {
312
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`);
313
- return { details: unmarshalArrayOfObject(data.details, unmarshalListInstanceLogsDetailsResponseInstanceLogDetail) };
314
- };
315
- const unmarshalListInstanceLogsResponse = (data) => {
316
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`);
317
- return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
318
- };
319
- const unmarshalListInstancesResponse = (data) => {
320
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`);
321
- return {
322
- instances: unmarshalArrayOfObject(data.instances, unmarshalInstance),
323
- totalCount: data.total_count
324
- };
325
- };
326
- const unmarshalNodeTypeVolumeConstraintSizes = (data) => {
327
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
328
- return {
329
- maxSize: data.max_size,
330
- minSize: data.min_size
331
- };
332
- };
333
- const unmarshalNodeTypeVolumeType = (data) => {
334
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`);
335
- return {
336
- chunkSize: data.chunk_size,
337
- class: data.class,
338
- description: data.description,
339
- maxSize: data.max_size,
340
- minSize: data.min_size,
341
- type: data.type
342
- };
343
- };
344
- const unmarshalNodeType = (data) => {
345
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
346
- return {
347
- availableVolumeTypes: unmarshalArrayOfObject(data.available_volume_types, unmarshalNodeTypeVolumeType),
348
- beta: data.beta,
349
- description: data.description,
350
- disabled: data.disabled,
351
- generation: data.generation,
352
- instanceRange: data.instance_range,
353
- isBssdCompatible: data.is_bssd_compatible,
354
- isHaRequired: data.is_ha_required,
355
- memory: data.memory,
356
- name: data.name,
357
- region: data.region,
358
- stockStatus: data.stock_status,
359
- vcpus: data.vcpus,
360
- volumeConstraint: data.volume_constraint ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) : void 0
361
- };
362
- };
363
- const unmarshalListNodeTypesResponse = (data) => {
364
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
365
- return {
366
- nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
367
- totalCount: data.total_count
368
- };
369
- };
370
- const unmarshalListPrivilegesResponse = (data) => {
371
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`);
372
- return {
373
- privileges: unmarshalArrayOfObject(data.privileges, unmarshalPrivilege),
374
- totalCount: data.total_count
375
- };
376
- };
377
- const unmarshalListSnapshotsResponse = (data) => {
378
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
379
- return {
380
- snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
381
- totalCount: data.total_count
382
- };
383
- };
384
- const unmarshalListUsersResponse = (data) => {
385
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
386
- return {
387
- totalCount: data.total_count,
388
- users: unmarshalArrayOfObject(data.users, unmarshalUser)
389
- };
390
- };
391
- const unmarshalPrepareInstanceLogsResponse = (data) => {
392
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PrepareInstanceLogsResponse' failed as data isn't a dictionary.`);
393
- return { instanceLogs: unmarshalArrayOfObject(data.instance_logs, unmarshalInstanceLog) };
394
- };
395
- const unmarshalSetInstanceACLRulesResponse = (data) => {
396
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`);
397
- return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
398
- };
399
- const unmarshalSetInstanceSettingsResponse = (data) => {
400
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`);
401
- return { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting) };
402
- };
403
- const marshalACLRuleRequest = (request, defaults) => ({
404
- description: request.description,
405
- ip: request.ip
406
- });
407
- const marshalAddInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
408
- const marshalInstanceSetting = (request, defaults) => ({
409
- name: request.name,
410
- value: request.value
411
- });
412
- const marshalAddInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
413
- const marshalCloneInstanceRequest = (request, defaults) => ({
414
- name: request.name,
415
- node_type: request.nodeType
416
- });
417
- const marshalCreateDatabaseBackupRequest = (request, defaults) => ({
418
- database_name: request.databaseName,
419
- expires_at: request.expiresAt,
420
- instance_id: request.instanceId,
421
- name: request.name || randomName("bkp")
422
- });
423
- const marshalCreateDatabaseRequest = (request, defaults) => ({ name: request.name });
424
- const marshalEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
425
- const marshalEndpointSpecLoadBalancer = (request, defaults) => ({});
426
- const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
427
- private_network_id: request.privateNetworkId,
428
- ...resolveOneOf([{
429
- param: "service_ip",
430
- value: request.serviceIp
431
- }, {
432
- param: "ipam_config",
433
- value: request.ipamConfig !== void 0 ? marshalEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
434
- }])
435
- });
436
- const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
437
- param: "load_balancer",
438
- value: request.loadBalancer !== void 0 ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) : void 0
439
- }, {
440
- param: "private_network",
441
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
442
- }]) });
443
- const marshalCreateEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec !== void 0 ? marshalEndpointSpec(request.endpointSpec, defaults) : void 0 });
444
- const marshalCreateInstanceFromSnapshotRequest = (request, defaults) => ({
445
- instance_name: request.instanceName,
446
- is_ha_cluster: request.isHaCluster,
447
- node_type: request.nodeType
448
- });
449
- const marshalEncryptionAtRest = (request, defaults) => ({ enabled: request.enabled });
450
- const marshalCreateInstanceRequest = (request, defaults) => ({
451
- backup_same_region: request.backupSameRegion,
452
- disable_backup: request.disableBackup,
453
- encryption: request.encryption !== void 0 ? marshalEncryptionAtRest(request.encryption, defaults) : void 0,
454
- engine: request.engine,
455
- init_endpoints: request.initEndpoints !== void 0 ? request.initEndpoints.map((elt) => marshalEndpointSpec(elt, defaults)) : void 0,
456
- init_settings: request.initSettings !== void 0 ? request.initSettings.map((elt) => marshalInstanceSetting(elt, defaults)) : void 0,
457
- is_ha_cluster: request.isHaCluster,
458
- name: request.name || randomName("ins"),
459
- node_type: request.nodeType,
460
- password: request.password,
461
- tags: request.tags,
462
- user_name: request.userName,
463
- volume_size: request.volumeSize,
464
- volume_type: request.volumeType,
465
- ...resolveOneOf([{
466
- default: defaults.defaultProjectId,
467
- param: "project_id",
468
- value: request.projectId
469
- }, {
470
- default: defaults.defaultOrganizationId,
471
- param: "organization_id",
472
- value: request.organizationId
473
- }])
474
- });
475
- const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = (request, defaults) => ({});
476
- const marshalReadReplicaEndpointSpecDirectAccess = (request, defaults) => ({});
477
- const marshalReadReplicaEndpointSpecPrivateNetwork = (request, defaults) => ({
478
- private_network_id: request.privateNetworkId,
479
- ...resolveOneOf([{
480
- param: "service_ip",
481
- value: request.serviceIp
482
- }, {
483
- param: "ipam_config",
484
- value: request.ipamConfig !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig(request.ipamConfig, defaults) : void 0
485
- }])
486
- });
487
- const marshalReadReplicaEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
488
- param: "direct_access",
489
- value: request.directAccess !== void 0 ? marshalReadReplicaEndpointSpecDirectAccess(request.directAccess, defaults) : void 0
490
- }, {
491
- param: "private_network",
492
- value: request.privateNetwork !== void 0 ? marshalReadReplicaEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
493
- }]) });
494
- const marshalCreateReadReplicaEndpointRequest = (request, defaults) => ({ endpoint_spec: request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) });
495
- const marshalCreateReadReplicaRequest = (request, defaults) => ({
496
- endpoint_spec: request.endpointSpec !== void 0 ? request.endpointSpec.map((elt) => marshalReadReplicaEndpointSpec(elt, defaults)) : void 0,
497
- instance_id: request.instanceId,
498
- same_zone: request.sameZone
499
- });
500
- const marshalCreateSnapshotRequest = (request, defaults) => ({
501
- expires_at: request.expiresAt,
502
- name: request.name || randomName("snp")
503
- });
504
- const marshalCreateUserRequest = (request, defaults) => ({
505
- is_admin: request.isAdmin,
506
- name: request.name,
507
- password: request.password
508
- });
509
- const marshalDeleteInstanceACLRulesRequest = (request, defaults) => ({ acl_rule_ips: request.aclRuleIps });
510
- const marshalDeleteInstanceSettingsRequest = (request, defaults) => ({ setting_names: request.settingNames });
511
- const marshalMigrateEndpointRequest = (request, defaults) => ({ instance_id: request.instanceId });
512
- const marshalPrepareInstanceLogsRequest = (request, defaults) => ({
513
- end_date: request.endDate,
514
- start_date: request.startDate
515
- });
516
- const marshalPurgeInstanceLogsRequest = (request, defaults) => ({ log_name: request.logName });
517
- const marshalRestoreDatabaseBackupRequest = (request, defaults) => ({
518
- database_name: request.databaseName,
519
- instance_id: request.instanceId
520
- });
521
- const marshalSetInstanceACLRulesRequest = (request, defaults) => ({ rules: request.rules.map((elt) => marshalACLRuleRequest(elt, defaults)) });
522
- const marshalSetInstanceSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalInstanceSetting(elt, defaults)) });
523
- const marshalSetPrivilegeRequest = (request, defaults) => ({
524
- database_name: request.databaseName,
525
- permission: request.permission,
526
- user_name: request.userName
527
- });
528
- const marshalUpdateDatabaseBackupRequest = (request, defaults) => ({
529
- expires_at: request.expiresAt,
530
- name: request.name
531
- });
532
- const marshalLogsPolicy = (request, defaults) => ({
533
- max_age_retention: request.maxAgeRetention,
534
- total_disk_retention: request.totalDiskRetention
535
- });
536
- const marshalUpdateInstanceRequest = (request, defaults) => ({
537
- backup_same_region: request.backupSameRegion,
538
- backup_schedule_frequency: request.backupScheduleFrequency,
539
- backup_schedule_retention: request.backupScheduleRetention,
540
- backup_schedule_start_hour: request.backupScheduleStartHour,
541
- is_backup_schedule_disabled: request.isBackupScheduleDisabled,
542
- logs_policy: request.logsPolicy !== void 0 ? marshalLogsPolicy(request.logsPolicy, defaults) : void 0,
543
- name: request.name,
544
- tags: request.tags
545
- });
546
- const marshalUpdateSnapshotRequest = (request, defaults) => ({
547
- expires_at: request.expiresAt,
548
- name: request.name
549
- });
550
- const marshalUpdateUserRequest = (request, defaults) => ({
551
- is_admin: request.isAdmin,
552
- password: request.password
553
- });
554
- const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = (request, defaults) => ({
555
- upgradable_version_id: request.upgradableVersionId,
556
- with_endpoints: request.withEndpoints
557
- });
558
- const marshalUpgradeInstanceRequest = (request, defaults) => ({ ...resolveOneOf([
559
- {
560
- param: "node_type",
561
- value: request.nodeType
562
- },
563
- {
564
- param: "enable_ha",
565
- value: request.enableHa
566
- },
567
- {
568
- param: "volume_size",
569
- value: request.volumeSize
570
- },
571
- {
572
- param: "volume_type",
573
- value: request.volumeType
574
- },
575
- {
576
- param: "upgradable_version_id",
577
- value: request.upgradableVersionId
578
- },
579
- {
580
- param: "major_upgrade_workflow",
581
- value: request.majorUpgradeWorkflow !== void 0 ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow(request.majorUpgradeWorkflow, defaults) : void 0
582
- },
583
- {
584
- param: "enable_encryption",
585
- value: request.enableEncryption
586
- }
587
- ]) });
588
- //#endregion
589
- 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 };