@scaleway/sdk-audit-trail 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,45 @@
1
- import { isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
1
+ import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ const unmarshalExportJobS3 = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'ExportJobS3' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ bucket: data.bucket,
10
+ prefix: data.prefix,
11
+ projectId: data.project_id,
12
+ region: data.region
13
+ };
14
+ };
15
+ const unmarshalExportJobStatus = (data) => {
16
+ if (!isJSONObject(data)) {
17
+ throw new TypeError(
18
+ `Unmarshalling the type 'ExportJobStatus' failed as data isn't a dictionary.`
19
+ );
20
+ }
21
+ return {
22
+ code: data.code,
23
+ message: data.message
24
+ };
25
+ };
26
+ const unmarshalExportJob = (data) => {
27
+ if (!isJSONObject(data)) {
28
+ throw new TypeError(
29
+ `Unmarshalling the type 'ExportJob' failed as data isn't a dictionary.`
30
+ );
31
+ }
32
+ return {
33
+ createdAt: unmarshalDate(data.created_at),
34
+ id: data.id,
35
+ lastRunAt: unmarshalDate(data.last_run_at),
36
+ lastStatus: data.last_status ? unmarshalExportJobStatus(data.last_status) : void 0,
37
+ name: data.name,
38
+ organizationId: data.organization_id,
39
+ s3: data.s3 ? unmarshalExportJobS3(data.s3) : void 0,
40
+ tags: data.tags
41
+ };
42
+ };
2
43
  const unmarshalAccountOrganizationInfo = (data) => {
3
44
  if (!isJSONObject(data)) {
4
45
  throw new TypeError(
@@ -7,6 +48,16 @@ const unmarshalAccountOrganizationInfo = (data) => {
7
48
  }
8
49
  return {};
9
50
  };
51
+ const unmarshalAccountProjectInfo = (data) => {
52
+ if (!isJSONObject(data)) {
53
+ throw new TypeError(
54
+ `Unmarshalling the type 'AccountProjectInfo' failed as data isn't a dictionary.`
55
+ );
56
+ }
57
+ return {
58
+ description: data.description
59
+ };
60
+ };
10
61
  const unmarshalAccountUserInfo = (data) => {
11
62
  if (!isJSONObject(data)) {
12
63
  throw new TypeError(
@@ -18,6 +69,38 @@ const unmarshalAccountUserInfo = (data) => {
18
69
  phoneNumber: data.phone_number
19
70
  };
20
71
  };
72
+ const unmarshalAppleSiliconServerInfo = (data) => {
73
+ if (!isJSONObject(data)) {
74
+ throw new TypeError(
75
+ `Unmarshalling the type 'AppleSiliconServerInfo' failed as data isn't a dictionary.`
76
+ );
77
+ }
78
+ return {
79
+ id: data.id,
80
+ name: data.name
81
+ };
82
+ };
83
+ const unmarshalBaremetalServerInfo = (data) => {
84
+ if (!isJSONObject(data)) {
85
+ throw new TypeError(
86
+ `Unmarshalling the type 'BaremetalServerInfo' failed as data isn't a dictionary.`
87
+ );
88
+ }
89
+ return {
90
+ description: data.description,
91
+ tags: data.tags
92
+ };
93
+ };
94
+ const unmarshalBaremetalSettingInfo = (data) => {
95
+ if (!isJSONObject(data)) {
96
+ throw new TypeError(
97
+ `Unmarshalling the type 'BaremetalSettingInfo' failed as data isn't a dictionary.`
98
+ );
99
+ }
100
+ return {
101
+ type: data.type
102
+ };
103
+ };
21
104
  const unmarshalInstanceServerInfo = (data) => {
22
105
  if (!isJSONObject(data)) {
23
106
  throw new TypeError(
@@ -28,6 +111,16 @@ const unmarshalInstanceServerInfo = (data) => {
28
111
  name: data.name
29
112
  };
30
113
  };
114
+ const unmarshalIpamIpInfo = (data) => {
115
+ if (!isJSONObject(data)) {
116
+ throw new TypeError(
117
+ `Unmarshalling the type 'IpamIpInfo' failed as data isn't a dictionary.`
118
+ );
119
+ }
120
+ return {
121
+ address: data.address
122
+ };
123
+ };
31
124
  const unmarshalKeyManagerKeyInfo = (data) => {
32
125
  if (!isJSONObject(data)) {
33
126
  throw new TypeError(
@@ -74,35 +167,100 @@ const unmarshalKubernetesPoolInfo = (data) => {
74
167
  name: data.name
75
168
  };
76
169
  };
77
- const unmarshalSecretManagerSecretInfo = (data) => {
170
+ const unmarshalLoadBalancerAclInfo = (data) => {
78
171
  if (!isJSONObject(data)) {
79
172
  throw new TypeError(
80
- `Unmarshalling the type 'SecretManagerSecretInfo' failed as data isn't a dictionary.`
173
+ `Unmarshalling the type 'LoadBalancerAclInfo' failed as data isn't a dictionary.`
81
174
  );
82
175
  }
83
176
  return {
84
- keyId: data.key_id,
85
- path: data.path
177
+ frontendId: data.frontend_id
86
178
  };
87
179
  };
88
- const unmarshalSecretManagerSecretVersionInfo = (data) => {
180
+ const unmarshalLoadBalancerBackendInfo = (data) => {
89
181
  if (!isJSONObject(data)) {
90
182
  throw new TypeError(
91
- `Unmarshalling the type 'SecretManagerSecretVersionInfo' failed as data isn't a dictionary.`
183
+ `Unmarshalling the type 'LoadBalancerBackendInfo' failed as data isn't a dictionary.`
92
184
  );
93
185
  }
94
186
  return {
95
- revision: data.revision
187
+ lbId: data.lb_id,
188
+ name: data.name
96
189
  };
97
190
  };
98
- const unmarshalEventPrincipal = (data) => {
191
+ const unmarshalLoadBalancerCertificateInfo = (data) => {
99
192
  if (!isJSONObject(data)) {
100
193
  throw new TypeError(
101
- `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`
194
+ `Unmarshalling the type 'LoadBalancerCertificateInfo' failed as data isn't a dictionary.`
102
195
  );
103
196
  }
104
197
  return {
105
- id: data.id
198
+ lbId: data.lb_id,
199
+ name: data.name
200
+ };
201
+ };
202
+ const unmarshalLoadBalancerFrontendInfo = (data) => {
203
+ if (!isJSONObject(data)) {
204
+ throw new TypeError(
205
+ `Unmarshalling the type 'LoadBalancerFrontendInfo' failed as data isn't a dictionary.`
206
+ );
207
+ }
208
+ return {
209
+ lbId: data.lb_id,
210
+ name: data.name
211
+ };
212
+ };
213
+ const unmarshalLoadBalancerIpInfo = (data) => {
214
+ if (!isJSONObject(data)) {
215
+ throw new TypeError(
216
+ `Unmarshalling the type 'LoadBalancerIpInfo' failed as data isn't a dictionary.`
217
+ );
218
+ }
219
+ return {
220
+ ipAddress: data.ip_address,
221
+ lbId: data.lb_id
222
+ };
223
+ };
224
+ const unmarshalLoadBalancerLbInfo = (data) => {
225
+ if (!isJSONObject(data)) {
226
+ throw new TypeError(
227
+ `Unmarshalling the type 'LoadBalancerLbInfo' failed as data isn't a dictionary.`
228
+ );
229
+ }
230
+ return {
231
+ name: data.name
232
+ };
233
+ };
234
+ const unmarshalLoadBalancerRouteInfo = (data) => {
235
+ if (!isJSONObject(data)) {
236
+ throw new TypeError(
237
+ `Unmarshalling the type 'LoadBalancerRouteInfo' failed as data isn't a dictionary.`
238
+ );
239
+ }
240
+ return {
241
+ backendId: data.backend_id,
242
+ frontendId: data.frontend_id
243
+ };
244
+ };
245
+ const unmarshalSecretManagerSecretInfo = (data) => {
246
+ if (!isJSONObject(data)) {
247
+ throw new TypeError(
248
+ `Unmarshalling the type 'SecretManagerSecretInfo' failed as data isn't a dictionary.`
249
+ );
250
+ }
251
+ return {
252
+ keyId: data.key_id,
253
+ path: data.path
254
+ };
255
+ };
256
+ const unmarshalSecretManagerSecretVersionInfo = (data) => {
257
+ if (!isJSONObject(data)) {
258
+ throw new TypeError(
259
+ `Unmarshalling the type 'SecretManagerSecretVersionInfo' failed as data isn't a dictionary.`
260
+ );
261
+ }
262
+ return {
263
+ revision: data.revision
106
264
  };
107
265
  };
108
266
  const unmarshalResource = (data) => {
@@ -113,17 +271,31 @@ const unmarshalResource = (data) => {
113
271
  }
114
272
  return {
115
273
  accountOrganizationInfo: data.account_organization_info ? unmarshalAccountOrganizationInfo(data.account_organization_info) : void 0,
274
+ accountProjectInfo: data.account_project_info ? unmarshalAccountProjectInfo(data.account_project_info) : void 0,
116
275
  accountUserInfo: data.account_user_info ? unmarshalAccountUserInfo(data.account_user_info) : void 0,
276
+ appleSiliconServerInfo: data.apple_silicon_server_info ? unmarshalAppleSiliconServerInfo(data.apple_silicon_server_info) : void 0,
277
+ baremetalServerInfo: data.baremetal_server_info ? unmarshalBaremetalServerInfo(data.baremetal_server_info) : void 0,
278
+ baremetalSettingInfo: data.baremetal_setting_info ? unmarshalBaremetalSettingInfo(data.baremetal_setting_info) : void 0,
117
279
  createdAt: unmarshalDate(data.created_at),
118
280
  deletedAt: unmarshalDate(data.deleted_at),
119
281
  id: data.id,
120
282
  instanceServerInfo: data.instance_server_info ? unmarshalInstanceServerInfo(data.instance_server_info) : void 0,
283
+ ipamIpInfo: data.ipam_ip_info ? unmarshalIpamIpInfo(data.ipam_ip_info) : void 0,
121
284
  keyManagerKeyInfo: data.key_manager_key_info ? unmarshalKeyManagerKeyInfo(data.key_manager_key_info) : void 0,
122
285
  keymKeyInfo: data.keym_key_info ? unmarshalKeyManagerKeyInfo(data.keym_key_info) : void 0,
123
286
  kubeAclInfo: data.kube_acl_info ? unmarshalKubernetesACLInfo(data.kube_acl_info) : void 0,
124
287
  kubeClusterInfo: data.kube_cluster_info ? unmarshalKubernetesClusterInfo(data.kube_cluster_info) : void 0,
125
288
  kubeNodeInfo: data.kube_node_info ? unmarshalKubernetesNodeInfo(data.kube_node_info) : void 0,
126
289
  kubePoolInfo: data.kube_pool_info ? unmarshalKubernetesPoolInfo(data.kube_pool_info) : void 0,
290
+ loadBalancerAclInfo: data.load_balancer_acl_info ? unmarshalLoadBalancerAclInfo(data.load_balancer_acl_info) : void 0,
291
+ loadBalancerBackendInfo: data.load_balancer_backend_info ? unmarshalLoadBalancerBackendInfo(data.load_balancer_backend_info) : void 0,
292
+ loadBalancerCertificateInfo: data.load_balancer_certificate_info ? unmarshalLoadBalancerCertificateInfo(
293
+ data.load_balancer_certificate_info
294
+ ) : void 0,
295
+ loadBalancerFrontendInfo: data.load_balancer_frontend_info ? unmarshalLoadBalancerFrontendInfo(data.load_balancer_frontend_info) : void 0,
296
+ loadBalancerIpInfo: data.load_balancer_ip_info ? unmarshalLoadBalancerIpInfo(data.load_balancer_ip_info) : void 0,
297
+ loadBalancerLbInfo: data.load_balancer_lb_info ? unmarshalLoadBalancerLbInfo(data.load_balancer_lb_info) : void 0,
298
+ loadBalancerRouteInfo: data.load_balancer_route_info ? unmarshalLoadBalancerRouteInfo(data.load_balancer_route_info) : void 0,
127
299
  name: data.name,
128
300
  secmSecretInfo: data.secm_secret_info ? unmarshalSecretManagerSecretInfo(data.secm_secret_info) : void 0,
129
301
  secmSecretVersionInfo: data.secm_secret_version_info ? unmarshalSecretManagerSecretVersionInfo(data.secm_secret_version_info) : void 0,
@@ -135,6 +307,48 @@ const unmarshalResource = (data) => {
135
307
  updatedAt: unmarshalDate(data.updated_at)
136
308
  };
137
309
  };
310
+ const unmarshalAuthenticationEvent = (data) => {
311
+ if (!isJSONObject(data)) {
312
+ throw new TypeError(
313
+ `Unmarshalling the type 'AuthenticationEvent' failed as data isn't a dictionary.`
314
+ );
315
+ }
316
+ return {
317
+ countryCode: data.country_code ? data.country_code : void 0,
318
+ failureReason: data.failure_reason ? data.failure_reason : void 0,
319
+ id: data.id,
320
+ method: data.method,
321
+ mfaType: data.mfa_type ? data.mfa_type : void 0,
322
+ organizationId: data.organization_id,
323
+ origin: data.origin,
324
+ recordedAt: unmarshalDate(data.recorded_at),
325
+ resources: unmarshalArrayOfObject(data.resources, unmarshalResource),
326
+ result: data.result,
327
+ sourceIp: data.source_ip,
328
+ userAgent: data.user_agent
329
+ };
330
+ };
331
+ const unmarshalListAuthenticationEventsResponse = (data) => {
332
+ if (!isJSONObject(data)) {
333
+ throw new TypeError(
334
+ `Unmarshalling the type 'ListAuthenticationEventsResponse' failed as data isn't a dictionary.`
335
+ );
336
+ }
337
+ return {
338
+ events: unmarshalArrayOfObject(data.events, unmarshalAuthenticationEvent),
339
+ nextPageToken: data.next_page_token
340
+ };
341
+ };
342
+ const unmarshalEventPrincipal = (data) => {
343
+ if (!isJSONObject(data)) {
344
+ throw new TypeError(
345
+ `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`
346
+ );
347
+ }
348
+ return {
349
+ id: data.id
350
+ };
351
+ };
138
352
  const unmarshalEvent = (data) => {
139
353
  if (!isJSONObject(data)) {
140
354
  throw new TypeError(
@@ -152,7 +366,6 @@ const unmarshalEvent = (data) => {
152
366
  recordedAt: unmarshalDate(data.recorded_at),
153
367
  requestBody: data.request_body,
154
368
  requestId: data.request_id,
155
- resource: data.resource ? unmarshalResource(data.resource) : void 0,
156
369
  resources: unmarshalArrayOfObject(data.resources, unmarshalResource),
157
370
  serviceName: data.service_name,
158
371
  sourceIp: data.source_ip,
@@ -160,6 +373,51 @@ const unmarshalEvent = (data) => {
160
373
  userAgent: data.user_agent
161
374
  };
162
375
  };
376
+ const unmarshalSystemEvent = (data) => {
377
+ if (!isJSONObject(data)) {
378
+ throw new TypeError(
379
+ `Unmarshalling the type 'SystemEvent' failed as data isn't a dictionary.`
380
+ );
381
+ }
382
+ return {
383
+ id: data.id,
384
+ kind: data.kind,
385
+ locality: data.locality,
386
+ organizationId: data.organization_id,
387
+ productName: data.product_name,
388
+ projectId: data.project_id,
389
+ recordedAt: unmarshalDate(data.recorded_at),
390
+ resources: unmarshalArrayOfObject(data.resources, unmarshalResource),
391
+ source: data.source,
392
+ systemName: data.system_name
393
+ };
394
+ };
395
+ const unmarshalListCombinedEventsResponseCombinedEvent = (data) => {
396
+ if (!isJSONObject(data)) {
397
+ throw new TypeError(
398
+ `Unmarshalling the type 'ListCombinedEventsResponseCombinedEvent' failed as data isn't a dictionary.`
399
+ );
400
+ }
401
+ return {
402
+ api: data.api ? unmarshalEvent(data.api) : void 0,
403
+ auth: data.auth ? unmarshalAuthenticationEvent(data.auth) : void 0,
404
+ system: data.system ? unmarshalSystemEvent(data.system) : void 0
405
+ };
406
+ };
407
+ const unmarshalListCombinedEventsResponse = (data) => {
408
+ if (!isJSONObject(data)) {
409
+ throw new TypeError(
410
+ `Unmarshalling the type 'ListCombinedEventsResponse' failed as data isn't a dictionary.`
411
+ );
412
+ }
413
+ return {
414
+ events: unmarshalArrayOfObject(
415
+ data.events,
416
+ unmarshalListCombinedEventsResponseCombinedEvent
417
+ ),
418
+ nextPageToken: data.next_page_token
419
+ };
420
+ };
163
421
  const unmarshalListEventsResponse = (data) => {
164
422
  if (!isJSONObject(data)) {
165
423
  throw new TypeError(
@@ -171,6 +429,17 @@ const unmarshalListEventsResponse = (data) => {
171
429
  nextPageToken: data.next_page_token
172
430
  };
173
431
  };
432
+ const unmarshalListExportJobsResponse = (data) => {
433
+ if (!isJSONObject(data)) {
434
+ throw new TypeError(
435
+ `Unmarshalling the type 'ListExportJobsResponse' failed as data isn't a dictionary.`
436
+ );
437
+ }
438
+ return {
439
+ exportJobs: unmarshalArrayOfObject(data.export_jobs, unmarshalExportJob),
440
+ totalCount: data.total_count
441
+ };
442
+ };
174
443
  const unmarshalProductService = (data) => {
175
444
  if (!isJSONObject(data)) {
176
445
  throw new TypeError(
@@ -205,9 +474,31 @@ const unmarshalListProductsResponse = (data) => {
205
474
  totalCount: data.total_count
206
475
  };
207
476
  };
477
+ const marshalExportJobS3 = (request, defaults) => ({
478
+ bucket: request.bucket,
479
+ prefix: request.prefix,
480
+ project_id: request.projectId,
481
+ region: request.region
482
+ });
483
+ const marshalCreateExportJobRequest = (request, defaults) => ({
484
+ name: request.name,
485
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
486
+ tags: request.tags,
487
+ ...resolveOneOf([
488
+ {
489
+ param: "s3",
490
+ value: request.s3 !== void 0 ? marshalExportJobS3(request.s3) : void 0
491
+ }
492
+ ])
493
+ });
208
494
  export {
495
+ marshalCreateExportJobRequest,
209
496
  unmarshalEvent,
497
+ unmarshalExportJob,
498
+ unmarshalListAuthenticationEventsResponse,
499
+ unmarshalListCombinedEventsResponse,
210
500
  unmarshalListEventsResponse,
501
+ unmarshalListExportJobsResponse,
211
502
  unmarshalListProductsResponse,
212
503
  unmarshalResource
213
504
  };