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