@scaleway/sdk 2.56.0 → 2.58.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.
Files changed (62) hide show
  1. package/dist/api/audit_trail/index.gen.cjs +4 -0
  2. package/dist/api/audit_trail/index.gen.d.ts +5 -0
  3. package/dist/api/audit_trail/index.gen.js +4 -0
  4. package/dist/api/audit_trail/v1alpha1/api.gen.cjs +59 -0
  5. package/dist/api/audit_trail/v1alpha1/api.gen.d.ts +30 -0
  6. package/dist/api/audit_trail/v1alpha1/api.gen.js +59 -0
  7. package/dist/api/audit_trail/v1alpha1/index.gen.cjs +6 -0
  8. package/dist/api/audit_trail/v1alpha1/index.gen.d.ts +3 -0
  9. package/dist/api/audit_trail/v1alpha1/index.gen.js +6 -0
  10. package/dist/api/audit_trail/v1alpha1/marshalling.gen.cjs +155 -0
  11. package/dist/api/audit_trail/v1alpha1/marshalling.gen.d.ts +5 -0
  12. package/dist/api/audit_trail/v1alpha1/marshalling.gen.js +155 -0
  13. package/dist/api/audit_trail/v1alpha1/types.gen.d.ts +161 -0
  14. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.cjs +19 -0
  15. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.d.ts +16 -0
  16. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.js +19 -0
  17. package/dist/api/billing/v2beta1/types.gen.d.ts +1 -1
  18. package/dist/api/edge_services/v1alpha1/types.gen.d.ts +5 -1
  19. package/dist/api/iam/v1alpha1/api.gen.cjs +9 -7
  20. package/dist/api/iam/v1alpha1/api.gen.d.ts +9 -7
  21. package/dist/api/iam/v1alpha1/api.gen.js +9 -7
  22. package/dist/api/iam/v1alpha1/types.gen.d.ts +2 -2
  23. package/dist/api/index.gen.d.ts +2 -1
  24. package/dist/api/instance/v1/api.gen.cjs +11 -0
  25. package/dist/api/instance/v1/api.gen.d.ts +2 -1
  26. package/dist/api/instance/v1/api.gen.js +12 -1
  27. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  28. package/dist/api/instance/v1/marshalling.gen.cjs +5 -1
  29. package/dist/api/instance/v1/marshalling.gen.d.ts +2 -1
  30. package/dist/api/instance/v1/marshalling.gen.js +5 -1
  31. package/dist/api/instance/v1/types.gen.d.ts +10 -5
  32. package/dist/api/ipam/v1/api.gen.cjs +1 -0
  33. package/dist/api/ipam/v1/api.gen.js +1 -0
  34. package/dist/api/ipam/v1/types.gen.d.ts +6 -1
  35. package/dist/api/jobs/v1alpha1/validation-rules.gen.cjs +6 -0
  36. package/dist/api/jobs/v1alpha1/validation-rules.gen.d.ts +6 -0
  37. package/dist/api/jobs/v1alpha1/validation-rules.gen.js +6 -0
  38. package/dist/api/k8s/v1/marshalling.gen.cjs +1 -2
  39. package/dist/api/k8s/v1/marshalling.gen.js +1 -2
  40. package/dist/api/k8s/v1/types.gen.d.ts +2 -7
  41. package/dist/api/mnq/v1beta1/api.gen.cjs +47 -42
  42. package/dist/api/mnq/v1beta1/api.gen.d.ts +51 -49
  43. package/dist/api/mnq/v1beta1/api.gen.js +47 -42
  44. package/dist/api/mnq/v1beta1/types.gen.d.ts +37 -32
  45. package/dist/api/rdb/v1/types.gen.d.ts +15 -3
  46. package/dist/api/tem/v1alpha1/types.gen.d.ts +1 -1
  47. package/dist/api/webhosting/v1/api.gen.cjs +41 -2
  48. package/dist/api/webhosting/v1/api.gen.d.ts +26 -2
  49. package/dist/api/webhosting/v1/api.gen.js +42 -3
  50. package/dist/api/webhosting/v1/index.gen.cjs +1 -0
  51. package/dist/api/webhosting/v1/index.gen.d.ts +2 -2
  52. package/dist/api/webhosting/v1/index.gen.js +2 -1
  53. package/dist/api/webhosting/v1/marshalling.gen.cjs +123 -50
  54. package/dist/api/webhosting/v1/marshalling.gen.d.ts +4 -1
  55. package/dist/api/webhosting/v1/marshalling.gen.js +124 -51
  56. package/dist/api/webhosting/v1/types.gen.d.ts +124 -60
  57. package/dist/index.cjs +46 -44
  58. package/dist/index.js +46 -44
  59. package/dist/scw/constants.cjs +1 -1
  60. package/dist/scw/constants.d.ts +2 -2
  61. package/dist/scw/constants.js +1 -1
  62. package/package.json +2 -2
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index_gen = require("./v1alpha1/index.gen.cjs");
4
+ exports.v1alpha1 = index_gen;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file is automatically generated from /scripts/generate.js PLEASE DO NOT
3
+ * EDIT HERE
4
+ */
5
+ export * as v1alpha1 from './v1alpha1/index.gen';
@@ -0,0 +1,4 @@
1
+ import * as index_gen from "./v1alpha1/index.gen.js";
2
+ export {
3
+ index_gen as v1alpha1
4
+ };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api = require("../../../scw/api.cjs");
4
+ const marshalling = require("../../../helpers/marshalling.cjs");
5
+ require("../../../vendor/base64/index.cjs");
6
+ const marshalling_gen = require("./marshalling.gen.cjs");
7
+ class API extends api.API {
8
+ /** Lists the available regions of the API. */
9
+ static LOCALITIES = ["fr-par", "nl-ams"];
10
+ /**
11
+ * List events. Retrieve the list of Audit Trail events for a Scaleway
12
+ * Organization and/or Project. You must specify the `organization_id` and
13
+ * optionally, the `project_id`.
14
+ *
15
+ * @param request - The request {@link ListEventsRequest}
16
+ * @returns A Promise of ListEventsResponse
17
+ */
18
+ listEvents = (request = {}) => this.client.fetch(
19
+ {
20
+ method: "GET",
21
+ path: `/audit-trail/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/events`,
22
+ urlParams: marshalling.urlParams(
23
+ ["method_name", request.methodName],
24
+ ["order_by", request.orderBy],
25
+ [
26
+ "organization_id",
27
+ request.organizationId ?? this.client.settings.defaultOrganizationId
28
+ ],
29
+ [
30
+ "page_size",
31
+ request.pageSize ?? this.client.settings.defaultPageSize
32
+ ],
33
+ ["page_token", request.pageToken],
34
+ ["product_name", request.productName],
35
+ ["project_id", request.projectId],
36
+ ["recorded_after", request.recordedAfter],
37
+ ["recorded_before", request.recordedBefore],
38
+ ["resource_type", request.resourceType],
39
+ ["status", request.status]
40
+ )
41
+ },
42
+ marshalling_gen.unmarshalListEventsResponse
43
+ );
44
+ /**
45
+ * Retrieve the list of Scaleway resources for which you have Audit Trail
46
+ * events.
47
+ *
48
+ * @param request - The request {@link ListProductsRequest}
49
+ * @returns A Promise of ListProductsResponse
50
+ */
51
+ listProducts = (request = {}) => this.client.fetch(
52
+ {
53
+ method: "GET",
54
+ path: `/audit-trail/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/products`
55
+ },
56
+ marshalling_gen.unmarshalListProductsResponse
57
+ );
58
+ }
59
+ exports.API = API;
@@ -0,0 +1,30 @@
1
+ import { API as ParentAPI } from '../../../bridge';
2
+ import type { Region } from '../../../bridge';
3
+ import type { ListEventsRequest, ListEventsResponse, ListProductsRequest, ListProductsResponse } from './types.gen';
4
+ /**
5
+ * Audit Trail API.
6
+ *
7
+ * This API allows you to ensure accountability and security by recording events
8
+ * and changes performed within your Scaleway Organization.
9
+ */
10
+ export declare class API extends ParentAPI {
11
+ /** Lists the available regions of the API. */
12
+ static readonly LOCALITIES: Region[];
13
+ /**
14
+ * List events. Retrieve the list of Audit Trail events for a Scaleway
15
+ * Organization and/or Project. You must specify the `organization_id` and
16
+ * optionally, the `project_id`.
17
+ *
18
+ * @param request - The request {@link ListEventsRequest}
19
+ * @returns A Promise of ListEventsResponse
20
+ */
21
+ listEvents: (request?: Readonly<ListEventsRequest>) => Promise<ListEventsResponse>;
22
+ /**
23
+ * Retrieve the list of Scaleway resources for which you have Audit Trail
24
+ * events.
25
+ *
26
+ * @param request - The request {@link ListProductsRequest}
27
+ * @returns A Promise of ListProductsResponse
28
+ */
29
+ listProducts: (request?: Readonly<ListProductsRequest>) => Promise<ListProductsResponse>;
30
+ }
@@ -0,0 +1,59 @@
1
+ import { API as API$1 } from "../../../scw/api.js";
2
+ import { validatePathParam, urlParams } from "../../../helpers/marshalling.js";
3
+ import "../../../vendor/base64/index.js";
4
+ import { unmarshalListEventsResponse, unmarshalListProductsResponse } from "./marshalling.gen.js";
5
+ class API extends API$1 {
6
+ /** Lists the available regions of the API. */
7
+ static LOCALITIES = ["fr-par", "nl-ams"];
8
+ /**
9
+ * List events. Retrieve the list of Audit Trail events for a Scaleway
10
+ * Organization and/or Project. You must specify the `organization_id` and
11
+ * optionally, the `project_id`.
12
+ *
13
+ * @param request - The request {@link ListEventsRequest}
14
+ * @returns A Promise of ListEventsResponse
15
+ */
16
+ listEvents = (request = {}) => this.client.fetch(
17
+ {
18
+ method: "GET",
19
+ path: `/audit-trail/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/events`,
20
+ urlParams: urlParams(
21
+ ["method_name", request.methodName],
22
+ ["order_by", request.orderBy],
23
+ [
24
+ "organization_id",
25
+ request.organizationId ?? this.client.settings.defaultOrganizationId
26
+ ],
27
+ [
28
+ "page_size",
29
+ request.pageSize ?? this.client.settings.defaultPageSize
30
+ ],
31
+ ["page_token", request.pageToken],
32
+ ["product_name", request.productName],
33
+ ["project_id", request.projectId],
34
+ ["recorded_after", request.recordedAfter],
35
+ ["recorded_before", request.recordedBefore],
36
+ ["resource_type", request.resourceType],
37
+ ["status", request.status]
38
+ )
39
+ },
40
+ unmarshalListEventsResponse
41
+ );
42
+ /**
43
+ * Retrieve the list of Scaleway resources for which you have Audit Trail
44
+ * events.
45
+ *
46
+ * @param request - The request {@link ListProductsRequest}
47
+ * @returns A Promise of ListProductsResponse
48
+ */
49
+ listProducts = (request = {}) => this.client.fetch(
50
+ {
51
+ method: "GET",
52
+ path: `/audit-trail/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/products`
53
+ },
54
+ unmarshalListProductsResponse
55
+ );
56
+ }
57
+ export {
58
+ API
59
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api_gen = require("./api.gen.cjs");
4
+ const validationRules_gen = require("./validation-rules.gen.cjs");
5
+ exports.API = api_gen.API;
6
+ exports.ValidationRules = validationRules_gen;
@@ -0,0 +1,3 @@
1
+ export { API } from './api.gen';
2
+ export type { Event, EventPrincipal, KubernetesACLInfo, KubernetesClusterInfo, KubernetesNodeInfo, KubernetesPoolInfo, ListEventsRequest, ListEventsRequestOrderBy, ListEventsResponse, ListProductsRequest, ListProductsResponse, Product, Resource, ResourceType, SecretManagerSecretInfo, SecretManagerSecretVersionInfo, } from './types.gen';
3
+ export * as ValidationRules from './validation-rules.gen';
@@ -0,0 +1,6 @@
1
+ import { API } from "./api.gen.js";
2
+ import * as validationRules_gen from "./validation-rules.gen.js";
3
+ export {
4
+ API,
5
+ validationRules_gen as ValidationRules
6
+ };
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const json = require("../../../helpers/json.cjs");
4
+ const marshalling = require("../../../helpers/marshalling.cjs");
5
+ require("../../../vendor/base64/index.cjs");
6
+ const unmarshalKubernetesACLInfo = (data) => {
7
+ if (!json.isJSONObject(data)) {
8
+ throw new TypeError(
9
+ `Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary.`
10
+ );
11
+ }
12
+ return {};
13
+ };
14
+ const unmarshalKubernetesClusterInfo = (data) => {
15
+ if (!json.isJSONObject(data)) {
16
+ throw new TypeError(
17
+ `Unmarshalling the type 'KubernetesClusterInfo' failed as data isn't a dictionary.`
18
+ );
19
+ }
20
+ return {};
21
+ };
22
+ const unmarshalKubernetesNodeInfo = (data) => {
23
+ if (!json.isJSONObject(data)) {
24
+ throw new TypeError(
25
+ `Unmarshalling the type 'KubernetesNodeInfo' failed as data isn't a dictionary.`
26
+ );
27
+ }
28
+ return {
29
+ id: data.id,
30
+ name: data.name
31
+ };
32
+ };
33
+ const unmarshalKubernetesPoolInfo = (data) => {
34
+ if (!json.isJSONObject(data)) {
35
+ throw new TypeError(
36
+ `Unmarshalling the type 'KubernetesPoolInfo' failed as data isn't a dictionary.`
37
+ );
38
+ }
39
+ return {
40
+ id: data.id,
41
+ name: data.name
42
+ };
43
+ };
44
+ const unmarshalSecretManagerSecretInfo = (data) => {
45
+ if (!json.isJSONObject(data)) {
46
+ throw new TypeError(
47
+ `Unmarshalling the type 'SecretManagerSecretInfo' failed as data isn't a dictionary.`
48
+ );
49
+ }
50
+ return {
51
+ path: data.path
52
+ };
53
+ };
54
+ const unmarshalSecretManagerSecretVersionInfo = (data) => {
55
+ if (!json.isJSONObject(data)) {
56
+ throw new TypeError(
57
+ `Unmarshalling the type 'SecretManagerSecretVersionInfo' failed as data isn't a dictionary.`
58
+ );
59
+ }
60
+ return {
61
+ revision: data.revision
62
+ };
63
+ };
64
+ const unmarshalEventPrincipal = (data) => {
65
+ if (!json.isJSONObject(data)) {
66
+ throw new TypeError(
67
+ `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`
68
+ );
69
+ }
70
+ return {
71
+ id: data.id
72
+ };
73
+ };
74
+ const unmarshalResource = (data) => {
75
+ if (!json.isJSONObject(data)) {
76
+ throw new TypeError(
77
+ `Unmarshalling the type 'Resource' failed as data isn't a dictionary.`
78
+ );
79
+ }
80
+ return {
81
+ createdAt: marshalling.unmarshalDate(data.created_at),
82
+ deletedAt: marshalling.unmarshalDate(data.deleted_at),
83
+ id: data.id,
84
+ kubeAclInfo: data.kube_acl_info ? unmarshalKubernetesACLInfo(data.kube_acl_info) : void 0,
85
+ kubeClusterInfo: data.kube_cluster_info ? unmarshalKubernetesClusterInfo(data.kube_cluster_info) : void 0,
86
+ kubeNodeInfo: data.kube_node_info ? unmarshalKubernetesNodeInfo(data.kube_node_info) : void 0,
87
+ kubePoolInfo: data.kube_pool_info ? unmarshalKubernetesPoolInfo(data.kube_pool_info) : void 0,
88
+ name: data.name,
89
+ secmSecretInfo: data.secm_secret_info ? unmarshalSecretManagerSecretInfo(data.secm_secret_info) : void 0,
90
+ secmSecretVersionInfo: data.secm_secret_version_info ? unmarshalSecretManagerSecretVersionInfo(data.secm_secret_version_info) : void 0,
91
+ type: data.type,
92
+ updatedAt: marshalling.unmarshalDate(data.updated_at)
93
+ };
94
+ };
95
+ const unmarshalEvent = (data) => {
96
+ if (!json.isJSONObject(data)) {
97
+ throw new TypeError(
98
+ `Unmarshalling the type 'Event' failed as data isn't a dictionary.`
99
+ );
100
+ }
101
+ return {
102
+ id: data.id,
103
+ locality: data.locality,
104
+ methodName: data.method_name,
105
+ organizationId: data.organization_id,
106
+ principal: data.principal ? unmarshalEventPrincipal(data.principal) : void 0,
107
+ productName: data.product_name,
108
+ projectId: data.project_id,
109
+ recordedAt: marshalling.unmarshalDate(data.recorded_at),
110
+ requestBody: data.request_body,
111
+ requestId: data.request_id,
112
+ resource: data.resource ? unmarshalResource(data.resource) : void 0,
113
+ serviceName: data.service_name,
114
+ sourceIp: data.source_ip,
115
+ statusCode: data.status_code,
116
+ userAgent: data.user_agent
117
+ };
118
+ };
119
+ const unmarshalListEventsResponse = (data) => {
120
+ if (!json.isJSONObject(data)) {
121
+ throw new TypeError(
122
+ `Unmarshalling the type 'ListEventsResponse' failed as data isn't a dictionary.`
123
+ );
124
+ }
125
+ return {
126
+ events: marshalling.unmarshalArrayOfObject(data.events, unmarshalEvent),
127
+ nextPageToken: data.next_page_token
128
+ };
129
+ };
130
+ const unmarshalProduct = (data) => {
131
+ if (!json.isJSONObject(data)) {
132
+ throw new TypeError(
133
+ `Unmarshalling the type 'Product' failed as data isn't a dictionary.`
134
+ );
135
+ }
136
+ return {
137
+ name: data.name,
138
+ title: data.title
139
+ };
140
+ };
141
+ const unmarshalListProductsResponse = (data) => {
142
+ if (!json.isJSONObject(data)) {
143
+ throw new TypeError(
144
+ `Unmarshalling the type 'ListProductsResponse' failed as data isn't a dictionary.`
145
+ );
146
+ }
147
+ return {
148
+ products: marshalling.unmarshalArrayOfObject(data.products, unmarshalProduct),
149
+ totalCount: data.total_count
150
+ };
151
+ };
152
+ exports.unmarshalEvent = unmarshalEvent;
153
+ exports.unmarshalListEventsResponse = unmarshalListEventsResponse;
154
+ exports.unmarshalListProductsResponse = unmarshalListProductsResponse;
155
+ exports.unmarshalResource = unmarshalResource;
@@ -0,0 +1,5 @@
1
+ import type { Event, ListEventsResponse, ListProductsResponse, Resource } from './types.gen';
2
+ export declare const unmarshalResource: (data: unknown) => Resource;
3
+ export declare const unmarshalEvent: (data: unknown) => Event;
4
+ export declare const unmarshalListEventsResponse: (data: unknown) => ListEventsResponse;
5
+ export declare const unmarshalListProductsResponse: (data: unknown) => ListProductsResponse;
@@ -0,0 +1,155 @@
1
+ import { isJSONObject } from "../../../helpers/json.js";
2
+ import { unmarshalArrayOfObject, unmarshalDate } from "../../../helpers/marshalling.js";
3
+ import "../../../vendor/base64/index.js";
4
+ const unmarshalKubernetesACLInfo = (data) => {
5
+ if (!isJSONObject(data)) {
6
+ throw new TypeError(
7
+ `Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary.`
8
+ );
9
+ }
10
+ return {};
11
+ };
12
+ const unmarshalKubernetesClusterInfo = (data) => {
13
+ if (!isJSONObject(data)) {
14
+ throw new TypeError(
15
+ `Unmarshalling the type 'KubernetesClusterInfo' failed as data isn't a dictionary.`
16
+ );
17
+ }
18
+ return {};
19
+ };
20
+ const unmarshalKubernetesNodeInfo = (data) => {
21
+ if (!isJSONObject(data)) {
22
+ throw new TypeError(
23
+ `Unmarshalling the type 'KubernetesNodeInfo' failed as data isn't a dictionary.`
24
+ );
25
+ }
26
+ return {
27
+ id: data.id,
28
+ name: data.name
29
+ };
30
+ };
31
+ const unmarshalKubernetesPoolInfo = (data) => {
32
+ if (!isJSONObject(data)) {
33
+ throw new TypeError(
34
+ `Unmarshalling the type 'KubernetesPoolInfo' failed as data isn't a dictionary.`
35
+ );
36
+ }
37
+ return {
38
+ id: data.id,
39
+ name: data.name
40
+ };
41
+ };
42
+ const unmarshalSecretManagerSecretInfo = (data) => {
43
+ if (!isJSONObject(data)) {
44
+ throw new TypeError(
45
+ `Unmarshalling the type 'SecretManagerSecretInfo' failed as data isn't a dictionary.`
46
+ );
47
+ }
48
+ return {
49
+ path: data.path
50
+ };
51
+ };
52
+ const unmarshalSecretManagerSecretVersionInfo = (data) => {
53
+ if (!isJSONObject(data)) {
54
+ throw new TypeError(
55
+ `Unmarshalling the type 'SecretManagerSecretVersionInfo' failed as data isn't a dictionary.`
56
+ );
57
+ }
58
+ return {
59
+ revision: data.revision
60
+ };
61
+ };
62
+ const unmarshalEventPrincipal = (data) => {
63
+ if (!isJSONObject(data)) {
64
+ throw new TypeError(
65
+ `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`
66
+ );
67
+ }
68
+ return {
69
+ id: data.id
70
+ };
71
+ };
72
+ const unmarshalResource = (data) => {
73
+ if (!isJSONObject(data)) {
74
+ throw new TypeError(
75
+ `Unmarshalling the type 'Resource' failed as data isn't a dictionary.`
76
+ );
77
+ }
78
+ return {
79
+ createdAt: unmarshalDate(data.created_at),
80
+ deletedAt: unmarshalDate(data.deleted_at),
81
+ id: data.id,
82
+ kubeAclInfo: data.kube_acl_info ? unmarshalKubernetesACLInfo(data.kube_acl_info) : void 0,
83
+ kubeClusterInfo: data.kube_cluster_info ? unmarshalKubernetesClusterInfo(data.kube_cluster_info) : void 0,
84
+ kubeNodeInfo: data.kube_node_info ? unmarshalKubernetesNodeInfo(data.kube_node_info) : void 0,
85
+ kubePoolInfo: data.kube_pool_info ? unmarshalKubernetesPoolInfo(data.kube_pool_info) : void 0,
86
+ name: data.name,
87
+ secmSecretInfo: data.secm_secret_info ? unmarshalSecretManagerSecretInfo(data.secm_secret_info) : void 0,
88
+ secmSecretVersionInfo: data.secm_secret_version_info ? unmarshalSecretManagerSecretVersionInfo(data.secm_secret_version_info) : void 0,
89
+ type: data.type,
90
+ updatedAt: unmarshalDate(data.updated_at)
91
+ };
92
+ };
93
+ const unmarshalEvent = (data) => {
94
+ if (!isJSONObject(data)) {
95
+ throw new TypeError(
96
+ `Unmarshalling the type 'Event' failed as data isn't a dictionary.`
97
+ );
98
+ }
99
+ return {
100
+ id: data.id,
101
+ locality: data.locality,
102
+ methodName: data.method_name,
103
+ organizationId: data.organization_id,
104
+ principal: data.principal ? unmarshalEventPrincipal(data.principal) : void 0,
105
+ productName: data.product_name,
106
+ projectId: data.project_id,
107
+ recordedAt: unmarshalDate(data.recorded_at),
108
+ requestBody: data.request_body,
109
+ requestId: data.request_id,
110
+ resource: data.resource ? unmarshalResource(data.resource) : void 0,
111
+ serviceName: data.service_name,
112
+ sourceIp: data.source_ip,
113
+ statusCode: data.status_code,
114
+ userAgent: data.user_agent
115
+ };
116
+ };
117
+ const unmarshalListEventsResponse = (data) => {
118
+ if (!isJSONObject(data)) {
119
+ throw new TypeError(
120
+ `Unmarshalling the type 'ListEventsResponse' failed as data isn't a dictionary.`
121
+ );
122
+ }
123
+ return {
124
+ events: unmarshalArrayOfObject(data.events, unmarshalEvent),
125
+ nextPageToken: data.next_page_token
126
+ };
127
+ };
128
+ const unmarshalProduct = (data) => {
129
+ if (!isJSONObject(data)) {
130
+ throw new TypeError(
131
+ `Unmarshalling the type 'Product' failed as data isn't a dictionary.`
132
+ );
133
+ }
134
+ return {
135
+ name: data.name,
136
+ title: data.title
137
+ };
138
+ };
139
+ const unmarshalListProductsResponse = (data) => {
140
+ if (!isJSONObject(data)) {
141
+ throw new TypeError(
142
+ `Unmarshalling the type 'ListProductsResponse' failed as data isn't a dictionary.`
143
+ );
144
+ }
145
+ return {
146
+ products: unmarshalArrayOfObject(data.products, unmarshalProduct),
147
+ totalCount: data.total_count
148
+ };
149
+ };
150
+ export {
151
+ unmarshalEvent,
152
+ unmarshalListEventsResponse,
153
+ unmarshalListProductsResponse,
154
+ unmarshalResource
155
+ };
@@ -0,0 +1,161 @@
1
+ import type { Region } from '../../../bridge';
2
+ export type ListEventsRequestOrderBy = 'recorded_at_desc' | 'recorded_at_asc';
3
+ export type ResourceType = 'unknown_type' | 'secm_secret' | 'secm_secret_version' | 'kube_cluster' | 'kube_pool' | 'kube_node' | 'kube_acl';
4
+ export interface KubernetesACLInfo {
5
+ }
6
+ export interface KubernetesClusterInfo {
7
+ }
8
+ export interface KubernetesNodeInfo {
9
+ id: string;
10
+ name: string;
11
+ }
12
+ export interface KubernetesPoolInfo {
13
+ id: string;
14
+ name: string;
15
+ }
16
+ export interface SecretManagerSecretInfo {
17
+ path: string;
18
+ }
19
+ export interface SecretManagerSecretVersionInfo {
20
+ revision: number;
21
+ }
22
+ export interface EventPrincipal {
23
+ id: string;
24
+ }
25
+ export interface Resource {
26
+ id: string;
27
+ type: ResourceType;
28
+ createdAt?: Date;
29
+ updatedAt?: Date;
30
+ deletedAt?: Date;
31
+ name?: string;
32
+ /**
33
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
34
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
35
+ * set.
36
+ */
37
+ secmSecretInfo?: SecretManagerSecretInfo;
38
+ /**
39
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
40
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
41
+ * set.
42
+ */
43
+ secmSecretVersionInfo?: SecretManagerSecretVersionInfo;
44
+ /**
45
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
46
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
47
+ * set.
48
+ */
49
+ kubeClusterInfo?: KubernetesClusterInfo;
50
+ /**
51
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
52
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
53
+ * set.
54
+ */
55
+ kubePoolInfo?: KubernetesPoolInfo;
56
+ /**
57
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
58
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
59
+ * set.
60
+ */
61
+ kubeNodeInfo?: KubernetesNodeInfo;
62
+ /**
63
+ * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo',
64
+ * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be
65
+ * set.
66
+ */
67
+ kubeAclInfo?: KubernetesACLInfo;
68
+ }
69
+ export interface Event {
70
+ /** ID of the event. */
71
+ id: string;
72
+ /** Timestamp of the event. */
73
+ recordedAt?: Date;
74
+ /** Locality of the resource attached to the event. */
75
+ locality: string;
76
+ /** User or IAM application at the origin of the event. */
77
+ principal?: EventPrincipal;
78
+ /** Organization ID containing the event. */
79
+ organizationId: string;
80
+ /** (Optional) Project of the resource attached to the event. */
81
+ projectId?: string;
82
+ /** IP address at the origin of the event. */
83
+ sourceIp: string;
84
+ /** User Agent at the origin of the event. */
85
+ userAgent?: string;
86
+ /** Product name of the resource attached to the event. */
87
+ productName: string;
88
+ /** API name called to trigger the event. */
89
+ serviceName: string;
90
+ /** API method called to trigger the event. */
91
+ methodName: string;
92
+ /** Resource attached to the event. */
93
+ resource?: Resource;
94
+ /** Unique identifier of the request at the origin of the event. */
95
+ requestId: string;
96
+ /** Request at the origin of the event. */
97
+ requestBody?: Record<string, unknown>;
98
+ /** HTTP status code resulting of the API call. */
99
+ statusCode: number;
100
+ }
101
+ export interface Product {
102
+ /** Product title. */
103
+ title: string;
104
+ /** Product name. */
105
+ name: string;
106
+ }
107
+ export type ListEventsRequest = {
108
+ /**
109
+ * Region to target. If none is passed will use default region from the
110
+ * config.
111
+ */
112
+ region?: Region;
113
+ /** (Optional) ID of the Project containing the Audit Trail events. */
114
+ projectId?: string;
115
+ /** ID of the Organization containing the Audit Trail events. */
116
+ organizationId?: string;
117
+ /** (Optional) Returns a paginated list of Scaleway resources' features. */
118
+ resourceType?: ResourceType;
119
+ /** (Optional) Name of the method or the API call performed. */
120
+ methodName?: string;
121
+ /**
122
+ * (Optional) HTTP status code of the request. Returns either `200` if the
123
+ * request was successful or `403` if the permission was denied.
124
+ */
125
+ status?: number;
126
+ /**
127
+ * (Optional) The `recorded_after` parameter defines the earliest timestamp
128
+ * from which Audit Trail events are retrieved. Returns `one hour ago` by
129
+ * default.
130
+ */
131
+ recordedAfter?: Date;
132
+ /**
133
+ * (Optional) The `recorded_before` parameter defines the latest timestamp up
134
+ * to which Audit Trail events are retrieved. Returns `now` by default.
135
+ */
136
+ recordedBefore?: Date;
137
+ orderBy?: ListEventsRequestOrderBy;
138
+ pageSize?: number;
139
+ pageToken?: string;
140
+ /** (Optional) Name of the Scaleway resource in a hyphenated format. */
141
+ productName?: string;
142
+ };
143
+ export interface ListEventsResponse {
144
+ /** Single page of events matching the requested criteria. */
145
+ events: Event[];
146
+ /** Page token to use in following calls to keep listing. */
147
+ nextPageToken?: string;
148
+ }
149
+ export type ListProductsRequest = {
150
+ /**
151
+ * Region to target. If none is passed will use default region from the
152
+ * config.
153
+ */
154
+ region?: Region;
155
+ };
156
+ export interface ListProductsResponse {
157
+ /** List of all products integrated with Audit Trail. */
158
+ products: Product[];
159
+ /** Number of integrated products. */
160
+ totalCount: number;
161
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ListEventsRequest = {
4
+ methodName: {
5
+ pattern: /^[a-zA-Z][a-zA-Z0-9_]*$/
6
+ },
7
+ pageSize: {
8
+ greaterThanOrEqual: 1,
9
+ lessThanOrEqual: 1e3
10
+ },
11
+ productName: {
12
+ pattern: /^[a-z]+(-[a-z]+)*$/
13
+ },
14
+ status: {
15
+ greaterThanOrEqual: 200,
16
+ lessThan: 600
17
+ }
18
+ };
19
+ exports.ListEventsRequest = ListEventsRequest;