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