@scaleway/sdk-kafka 2.1.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.
@@ -0,0 +1,3 @@
1
+ import type { ClusterStatus } from './types.gen.js';
2
+ /** Lists transient statutes of the enum {@link ClusterStatus}. */
3
+ export declare const CLUSTER_TRANSIENT_STATUSES: ClusterStatus[];
@@ -0,0 +1,8 @@
1
+ const CLUSTER_TRANSIENT_STATUSES = [
2
+ "creating",
3
+ "configuring",
4
+ "deleting"
5
+ ];
6
+ export {
7
+ CLUSTER_TRANSIENT_STATUSES
8
+ };
@@ -0,0 +1,5 @@
1
+ export { API, } from './api.gen.js';
2
+ export * from './content.gen.js';
3
+ export * from './marshalling.gen.js';
4
+ export type { Cluster, ClusterSetting, ClusterStatus, CreateClusterRequest, CreateClusterRequestVolumeSpec, CreateEndpointRequest, DeleteClusterRequest, DeleteEndpointRequest, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicDetails, EndpointSpec, EndpointSpecPrivateNetworkDetails, EndpointSpecPublicDetails, GetClusterCertificateAuthorityRequest, GetClusterRequest, ListClustersRequest, ListClustersRequestOrderBy, ListClustersResponse, ListNodeTypesRequest, ListNodeTypesResponse, ListUsersRequest, ListUsersRequestOrderBy, ListUsersResponse, ListVersionsRequest, ListVersionsResponse, NodeType, NodeTypeStock, NodeTypeVolumeType, RenewClusterCertificateAuthorityRequest, UpdateClusterRequest, UpdateUserRequest, User, Version, VersionAvailableSetting, VersionAvailableSettingBooleanProperty, VersionAvailableSettingFloatProperty, VersionAvailableSettingIntegerProperty, VersionAvailableSettingStringProperty, Volume, VolumeType, } from './types.gen.js';
5
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -0,0 +1,20 @@
1
+ import { API } from "./api.gen.js";
2
+ import { CLUSTER_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalCreateClusterRequest, marshalCreateEndpointRequest, marshalUpdateClusterRequest, marshalUpdateUserRequest, unmarshalCluster, unmarshalEndpoint, unmarshalListClustersResponse, unmarshalListNodeTypesResponse, unmarshalListUsersResponse, unmarshalListVersionsResponse, unmarshalUser } from "./marshalling.gen.js";
4
+ import * as validationRules_gen from "./validation-rules.gen.js";
5
+ export {
6
+ API,
7
+ CLUSTER_TRANSIENT_STATUSES,
8
+ validationRules_gen as ValidationRules,
9
+ marshalCreateClusterRequest,
10
+ marshalCreateEndpointRequest,
11
+ marshalUpdateClusterRequest,
12
+ marshalUpdateUserRequest,
13
+ unmarshalCluster,
14
+ unmarshalEndpoint,
15
+ unmarshalListClustersResponse,
16
+ unmarshalListNodeTypesResponse,
17
+ unmarshalListUsersResponse,
18
+ unmarshalListVersionsResponse,
19
+ unmarshalUser
20
+ };
@@ -0,0 +1,13 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { Cluster, CreateClusterRequest, CreateEndpointRequest, Endpoint, ListClustersResponse, ListNodeTypesResponse, ListUsersResponse, ListVersionsResponse, UpdateClusterRequest, UpdateUserRequest, User } from './types.gen.js';
3
+ export declare const unmarshalEndpoint: (data: unknown) => Endpoint;
4
+ export declare const unmarshalCluster: (data: unknown) => Cluster;
5
+ export declare const unmarshalUser: (data: unknown) => User;
6
+ export declare const unmarshalListClustersResponse: (data: unknown) => ListClustersResponse;
7
+ export declare const unmarshalListNodeTypesResponse: (data: unknown) => ListNodeTypesResponse;
8
+ export declare const unmarshalListUsersResponse: (data: unknown) => ListUsersResponse;
9
+ export declare const unmarshalListVersionsResponse: (data: unknown) => ListVersionsResponse;
10
+ export declare const marshalCreateClusterRequest: (request: CreateClusterRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalCreateEndpointRequest: (request: CreateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;
12
+ export declare const marshalUpdateClusterRequest: (request: UpdateClusterRequest, defaults: DefaultValues) => Record<string, unknown>;
13
+ export declare const marshalUpdateUserRequest: (request: UpdateUserRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,300 @@
1
+ import randomName from "@scaleway/random-name";
2
+ import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
3
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
4
+ if (!isJSONObject(data)) {
5
+ throw new TypeError(
6
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
7
+ );
8
+ }
9
+ return {
10
+ privateNetworkId: data.private_network_id
11
+ };
12
+ };
13
+ const unmarshalEndpointPublicDetails = (data) => {
14
+ if (!isJSONObject(data)) {
15
+ throw new TypeError(
16
+ `Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
17
+ );
18
+ }
19
+ return {};
20
+ };
21
+ const unmarshalEndpoint = (data) => {
22
+ if (!isJSONObject(data)) {
23
+ throw new TypeError(
24
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
25
+ );
26
+ }
27
+ return {
28
+ dnsRecords: data.dns_records,
29
+ id: data.id,
30
+ port: data.port,
31
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
32
+ publicNetwork: data.public_network ? unmarshalEndpointPublicDetails(data.public_network) : void 0
33
+ };
34
+ };
35
+ const unmarshalClusterSetting = (data) => {
36
+ if (!isJSONObject(data)) {
37
+ throw new TypeError(
38
+ `Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`
39
+ );
40
+ }
41
+ return {
42
+ boolValue: data.bool_value,
43
+ floatValue: data.float_value,
44
+ intValue: data.int_value,
45
+ name: data.name,
46
+ stringValue: data.string_value
47
+ };
48
+ };
49
+ const unmarshalVolume = (data) => {
50
+ if (!isJSONObject(data)) {
51
+ throw new TypeError(
52
+ `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
53
+ );
54
+ }
55
+ return {
56
+ sizeBytes: data.size_bytes,
57
+ type: data.type
58
+ };
59
+ };
60
+ const unmarshalCluster = (data) => {
61
+ if (!isJSONObject(data)) {
62
+ throw new TypeError(
63
+ `Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`
64
+ );
65
+ }
66
+ return {
67
+ createdAt: unmarshalDate(data.created_at),
68
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
69
+ id: data.id,
70
+ name: data.name,
71
+ nodeAmount: data.node_amount,
72
+ nodeType: data.node_type,
73
+ organizationId: data.organization_id,
74
+ projectId: data.project_id,
75
+ region: data.region,
76
+ settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting),
77
+ status: data.status,
78
+ tags: data.tags,
79
+ updatedAt: unmarshalDate(data.updated_at),
80
+ version: data.version,
81
+ volume: data.volume ? unmarshalVolume(data.volume) : void 0
82
+ };
83
+ };
84
+ const unmarshalUser = (data) => {
85
+ if (!isJSONObject(data)) {
86
+ throw new TypeError(
87
+ `Unmarshalling the type 'User' failed as data isn't a dictionary.`
88
+ );
89
+ }
90
+ return {
91
+ username: data.username
92
+ };
93
+ };
94
+ const unmarshalListClustersResponse = (data) => {
95
+ if (!isJSONObject(data)) {
96
+ throw new TypeError(
97
+ `Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`
98
+ );
99
+ }
100
+ return {
101
+ clusters: unmarshalArrayOfObject(data.clusters, unmarshalCluster),
102
+ totalCount: data.total_count
103
+ };
104
+ };
105
+ const unmarshalNodeTypeVolumeType = (data) => {
106
+ if (!isJSONObject(data)) {
107
+ throw new TypeError(
108
+ `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
109
+ );
110
+ }
111
+ return {
112
+ chunkSizeBytes: data.chunk_size_bytes,
113
+ description: data.description,
114
+ maxSizeBytes: data.max_size_bytes,
115
+ minSizeBytes: data.min_size_bytes,
116
+ type: data.type
117
+ };
118
+ };
119
+ const unmarshalNodeType = (data) => {
120
+ if (!isJSONObject(data)) {
121
+ throw new TypeError(
122
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
123
+ );
124
+ }
125
+ return {
126
+ availableVolumeTypes: unmarshalArrayOfObject(data.available_volume_types, unmarshalNodeTypeVolumeType),
127
+ beta: data.beta,
128
+ clusterRange: data.cluster_range,
129
+ description: data.description,
130
+ disabled: data.disabled,
131
+ memoryBytes: data.memory_bytes,
132
+ name: data.name,
133
+ stockStatus: data.stock_status,
134
+ vcpus: data.vcpus
135
+ };
136
+ };
137
+ const unmarshalListNodeTypesResponse = (data) => {
138
+ if (!isJSONObject(data)) {
139
+ throw new TypeError(
140
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
141
+ );
142
+ }
143
+ return {
144
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
145
+ totalCount: data.total_count
146
+ };
147
+ };
148
+ const unmarshalListUsersResponse = (data) => {
149
+ if (!isJSONObject(data)) {
150
+ throw new TypeError(
151
+ `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
152
+ );
153
+ }
154
+ return {
155
+ totalCount: data.total_count,
156
+ users: unmarshalArrayOfObject(data.users, unmarshalUser)
157
+ };
158
+ };
159
+ const unmarshalVersionAvailableSettingBooleanProperty = (data) => {
160
+ if (!isJSONObject(data)) {
161
+ throw new TypeError(
162
+ `Unmarshalling the type 'VersionAvailableSettingBooleanProperty' failed as data isn't a dictionary.`
163
+ );
164
+ }
165
+ return {
166
+ defaultValue: data.default_value
167
+ };
168
+ };
169
+ const unmarshalVersionAvailableSettingFloatProperty = (data) => {
170
+ if (!isJSONObject(data)) {
171
+ throw new TypeError(
172
+ `Unmarshalling the type 'VersionAvailableSettingFloatProperty' failed as data isn't a dictionary.`
173
+ );
174
+ }
175
+ return {
176
+ defaultValue: data.default_value,
177
+ max: data.max,
178
+ min: data.min,
179
+ unit: data.unit
180
+ };
181
+ };
182
+ const unmarshalVersionAvailableSettingIntegerProperty = (data) => {
183
+ if (!isJSONObject(data)) {
184
+ throw new TypeError(
185
+ `Unmarshalling the type 'VersionAvailableSettingIntegerProperty' failed as data isn't a dictionary.`
186
+ );
187
+ }
188
+ return {
189
+ defaultValue: data.default_value,
190
+ max: data.max,
191
+ min: data.min,
192
+ unit: data.unit
193
+ };
194
+ };
195
+ const unmarshalVersionAvailableSettingStringProperty = (data) => {
196
+ if (!isJSONObject(data)) {
197
+ throw new TypeError(
198
+ `Unmarshalling the type 'VersionAvailableSettingStringProperty' failed as data isn't a dictionary.`
199
+ );
200
+ }
201
+ return {
202
+ defaultValue: data.default_value,
203
+ stringConstraint: data.string_constraint
204
+ };
205
+ };
206
+ const unmarshalVersionAvailableSetting = (data) => {
207
+ if (!isJSONObject(data)) {
208
+ throw new TypeError(
209
+ `Unmarshalling the type 'VersionAvailableSetting' failed as data isn't a dictionary.`
210
+ );
211
+ }
212
+ return {
213
+ boolProperty: data.bool_property ? unmarshalVersionAvailableSettingBooleanProperty(data.bool_property) : void 0,
214
+ description: data.description,
215
+ floatProperty: data.float_property ? unmarshalVersionAvailableSettingFloatProperty(data.float_property) : void 0,
216
+ hotConfigurable: data.hot_configurable,
217
+ intProperty: data.int_property ? unmarshalVersionAvailableSettingIntegerProperty(data.int_property) : void 0,
218
+ name: data.name,
219
+ stringProperty: data.string_property ? unmarshalVersionAvailableSettingStringProperty(data.string_property) : void 0
220
+ };
221
+ };
222
+ const unmarshalVersion = (data) => {
223
+ if (!isJSONObject(data)) {
224
+ throw new TypeError(
225
+ `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
226
+ );
227
+ }
228
+ return {
229
+ availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalVersionAvailableSetting),
230
+ endOfLifeAt: unmarshalDate(data.end_of_life_at),
231
+ version: data.version
232
+ };
233
+ };
234
+ const unmarshalListVersionsResponse = (data) => {
235
+ if (!isJSONObject(data)) {
236
+ throw new TypeError(
237
+ `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
238
+ );
239
+ }
240
+ return {
241
+ totalCount: data.total_count,
242
+ versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
243
+ };
244
+ };
245
+ const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
246
+ private_network_id: request.privateNetworkId
247
+ });
248
+ const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
249
+ const marshalCreateClusterRequestVolumeSpec = (request, defaults) => ({
250
+ size_bytes: request.sizeBytes,
251
+ type: request.type
252
+ });
253
+ const marshalEndpointSpec = (request, defaults) => ({
254
+ ...resolveOneOf([
255
+ {
256
+ param: "public_network",
257
+ value: request.publicNetwork !== void 0 ? marshalEndpointSpecPublicDetails(request.publicNetwork) : void 0
258
+ },
259
+ {
260
+ param: "private_network",
261
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(request.privateNetwork) : void 0
262
+ }
263
+ ])
264
+ });
265
+ const marshalCreateClusterRequest = (request, defaults) => ({
266
+ endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
267
+ name: request.name || randomName("kafk"),
268
+ node_amount: request.nodeAmount,
269
+ node_type: request.nodeType,
270
+ password: request.password,
271
+ project_id: request.projectId ?? defaults.defaultProjectId,
272
+ tags: request.tags,
273
+ user_name: request.userName,
274
+ version: request.version,
275
+ volume: request.volume !== void 0 ? marshalCreateClusterRequestVolumeSpec(request.volume) : void 0
276
+ });
277
+ const marshalCreateEndpointRequest = (request, defaults) => ({
278
+ cluster_id: request.clusterId,
279
+ endpoint: marshalEndpointSpec(request.endpoint)
280
+ });
281
+ const marshalUpdateClusterRequest = (request, defaults) => ({
282
+ name: request.name,
283
+ tags: request.tags
284
+ });
285
+ const marshalUpdateUserRequest = (request, defaults) => ({
286
+ password: request.password
287
+ });
288
+ export {
289
+ marshalCreateClusterRequest,
290
+ marshalCreateEndpointRequest,
291
+ marshalUpdateClusterRequest,
292
+ marshalUpdateUserRequest,
293
+ unmarshalCluster,
294
+ unmarshalEndpoint,
295
+ unmarshalListClustersResponse,
296
+ unmarshalListNodeTypesResponse,
297
+ unmarshalListUsersResponse,
298
+ unmarshalListVersionsResponse,
299
+ unmarshalUser
300
+ };