@scaleway/sdk-container 1.8.0 → 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.
@@ -1,512 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalContainerHealthCheckSpecHTTPProbe = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'ContainerHealthCheckSpecHTTPProbe' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- path: data.path
13
- };
14
- };
15
- const unmarshalContainerHealthCheckSpecTCPProbe = (data) => {
16
- if (!sdkClient.isJSONObject(data)) {
17
- throw new TypeError(
18
- `Unmarshalling the type 'ContainerHealthCheckSpecTCPProbe' failed as data isn't a dictionary.`
19
- );
20
- }
21
- return {};
22
- };
23
- const unmarshalContainerHealthCheckSpec = (data) => {
24
- if (!sdkClient.isJSONObject(data)) {
25
- throw new TypeError(
26
- `Unmarshalling the type 'ContainerHealthCheckSpec' failed as data isn't a dictionary.`
27
- );
28
- }
29
- return {
30
- failureThreshold: data.failure_threshold,
31
- http: data.http ? unmarshalContainerHealthCheckSpecHTTPProbe(data.http) : void 0,
32
- interval: data.interval,
33
- tcp: data.tcp ? unmarshalContainerHealthCheckSpecTCPProbe(data.tcp) : void 0
34
- };
35
- };
36
- const unmarshalContainerScalingOption = (data) => {
37
- if (!sdkClient.isJSONObject(data)) {
38
- throw new TypeError(
39
- `Unmarshalling the type 'ContainerScalingOption' failed as data isn't a dictionary.`
40
- );
41
- }
42
- return {
43
- concurrentRequestsThreshold: data.concurrent_requests_threshold,
44
- cpuUsageThreshold: data.cpu_usage_threshold,
45
- memoryUsageThreshold: data.memory_usage_threshold
46
- };
47
- };
48
- const unmarshalSecretHashedValue = (data) => {
49
- if (!sdkClient.isJSONObject(data)) {
50
- throw new TypeError(
51
- `Unmarshalling the type 'SecretHashedValue' failed as data isn't a dictionary.`
52
- );
53
- }
54
- return {
55
- hashedValue: data.hashed_value,
56
- key: data.key
57
- };
58
- };
59
- const unmarshalContainer = (data) => {
60
- if (!sdkClient.isJSONObject(data)) {
61
- throw new TypeError(
62
- `Unmarshalling the type 'Container' failed as data isn't a dictionary.`
63
- );
64
- }
65
- return {
66
- args: data.args,
67
- command: data.command,
68
- cpuLimit: data.cpu_limit,
69
- createdAt: sdkClient.unmarshalDate(data.created_at),
70
- description: data.description,
71
- domainName: data.domain_name,
72
- environmentVariables: data.environment_variables,
73
- errorMessage: data.error_message,
74
- healthCheck: data.health_check ? unmarshalContainerHealthCheckSpec(data.health_check) : void 0,
75
- httpOption: data.http_option,
76
- id: data.id,
77
- localStorageLimit: data.local_storage_limit,
78
- maxConcurrency: data.max_concurrency,
79
- maxScale: data.max_scale,
80
- memoryLimit: data.memory_limit,
81
- minScale: data.min_scale,
82
- name: data.name,
83
- namespaceId: data.namespace_id,
84
- port: data.port,
85
- privacy: data.privacy,
86
- privateNetworkId: data.private_network_id,
87
- protocol: data.protocol,
88
- readyAt: sdkClient.unmarshalDate(data.ready_at),
89
- region: data.region,
90
- registryImage: data.registry_image,
91
- sandbox: data.sandbox,
92
- scalingOption: data.scaling_option ? unmarshalContainerScalingOption(data.scaling_option) : void 0,
93
- secretEnvironmentVariables: sdkClient.unmarshalArrayOfObject(
94
- data.secret_environment_variables,
95
- unmarshalSecretHashedValue
96
- ),
97
- status: data.status,
98
- tags: data.tags,
99
- timeout: data.timeout,
100
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
101
- };
102
- };
103
- const unmarshalCron = (data) => {
104
- if (!sdkClient.isJSONObject(data)) {
105
- throw new TypeError(
106
- `Unmarshalling the type 'Cron' failed as data isn't a dictionary.`
107
- );
108
- }
109
- return {
110
- args: data.args,
111
- containerId: data.container_id,
112
- id: data.id,
113
- name: data.name,
114
- schedule: data.schedule,
115
- status: data.status
116
- };
117
- };
118
- const unmarshalDomain = (data) => {
119
- if (!sdkClient.isJSONObject(data)) {
120
- throw new TypeError(
121
- `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`
122
- );
123
- }
124
- return {
125
- containerId: data.container_id,
126
- errorMessage: data.error_message,
127
- hostname: data.hostname,
128
- id: data.id,
129
- status: data.status,
130
- url: data.url
131
- };
132
- };
133
- const unmarshalNamespace = (data) => {
134
- if (!sdkClient.isJSONObject(data)) {
135
- throw new TypeError(
136
- `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`
137
- );
138
- }
139
- return {
140
- createdAt: sdkClient.unmarshalDate(data.created_at),
141
- description: data.description,
142
- environmentVariables: data.environment_variables,
143
- errorMessage: data.error_message,
144
- id: data.id,
145
- name: data.name,
146
- organizationId: data.organization_id,
147
- projectId: data.project_id,
148
- region: data.region,
149
- registryEndpoint: data.registry_endpoint,
150
- registryNamespaceId: data.registry_namespace_id,
151
- secretEnvironmentVariables: sdkClient.unmarshalArrayOfObject(
152
- data.secret_environment_variables,
153
- unmarshalSecretHashedValue
154
- ),
155
- status: data.status,
156
- tags: data.tags,
157
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
158
- vpcIntegrationActivated: data.vpc_integration_activated
159
- };
160
- };
161
- const unmarshalToken = (data) => {
162
- if (!sdkClient.isJSONObject(data)) {
163
- throw new TypeError(
164
- `Unmarshalling the type 'Token' failed as data isn't a dictionary.`
165
- );
166
- }
167
- return {
168
- containerId: data.container_id,
169
- description: data.description,
170
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
171
- id: data.id,
172
- namespaceId: data.namespace_id,
173
- publicKey: data.public_key,
174
- status: data.status,
175
- token: data.token
176
- };
177
- };
178
- const unmarshalTriggerMnqNatsClientConfig = (data) => {
179
- if (!sdkClient.isJSONObject(data)) {
180
- throw new TypeError(
181
- `Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`
182
- );
183
- }
184
- return {
185
- mnqCredentialId: data.mnq_credential_id,
186
- mnqNatsAccountId: data.mnq_nats_account_id,
187
- mnqProjectId: data.mnq_project_id,
188
- mnqRegion: data.mnq_region,
189
- subject: data.subject
190
- };
191
- };
192
- const unmarshalTriggerMnqSqsClientConfig = (data) => {
193
- if (!sdkClient.isJSONObject(data)) {
194
- throw new TypeError(
195
- `Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`
196
- );
197
- }
198
- return {
199
- mnqCredentialId: data.mnq_credential_id,
200
- mnqProjectId: data.mnq_project_id,
201
- mnqRegion: data.mnq_region,
202
- queue: data.queue
203
- };
204
- };
205
- const unmarshalTriggerSqsClientConfig = (data) => {
206
- if (!sdkClient.isJSONObject(data)) {
207
- throw new TypeError(
208
- `Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`
209
- );
210
- }
211
- return {
212
- accessKey: data.access_key,
213
- endpoint: data.endpoint,
214
- queueUrl: data.queue_url,
215
- secretKey: data.secret_key
216
- };
217
- };
218
- const unmarshalTrigger = (data) => {
219
- if (!sdkClient.isJSONObject(data)) {
220
- throw new TypeError(
221
- `Unmarshalling the type 'Trigger' failed as data isn't a dictionary.`
222
- );
223
- }
224
- return {
225
- containerId: data.container_id,
226
- description: data.description,
227
- errorMessage: data.error_message,
228
- id: data.id,
229
- inputType: data.input_type,
230
- name: data.name,
231
- scwNatsConfig: data.scw_nats_config ? unmarshalTriggerMnqNatsClientConfig(data.scw_nats_config) : void 0,
232
- scwSqsConfig: data.scw_sqs_config ? unmarshalTriggerMnqSqsClientConfig(data.scw_sqs_config) : void 0,
233
- sqsConfig: data.sqs_config ? unmarshalTriggerSqsClientConfig(data.sqs_config) : void 0,
234
- status: data.status
235
- };
236
- };
237
- const unmarshalListContainersResponse = (data) => {
238
- if (!sdkClient.isJSONObject(data)) {
239
- throw new TypeError(
240
- `Unmarshalling the type 'ListContainersResponse' failed as data isn't a dictionary.`
241
- );
242
- }
243
- return {
244
- containers: sdkClient.unmarshalArrayOfObject(data.containers, unmarshalContainer),
245
- totalCount: data.total_count
246
- };
247
- };
248
- const unmarshalListCronsResponse = (data) => {
249
- if (!sdkClient.isJSONObject(data)) {
250
- throw new TypeError(
251
- `Unmarshalling the type 'ListCronsResponse' failed as data isn't a dictionary.`
252
- );
253
- }
254
- return {
255
- crons: sdkClient.unmarshalArrayOfObject(data.crons, unmarshalCron),
256
- totalCount: data.total_count
257
- };
258
- };
259
- const unmarshalListDomainsResponse = (data) => {
260
- if (!sdkClient.isJSONObject(data)) {
261
- throw new TypeError(
262
- `Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`
263
- );
264
- }
265
- return {
266
- domains: sdkClient.unmarshalArrayOfObject(data.domains, unmarshalDomain),
267
- totalCount: data.total_count
268
- };
269
- };
270
- const unmarshalListNamespacesResponse = (data) => {
271
- if (!sdkClient.isJSONObject(data)) {
272
- throw new TypeError(
273
- `Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`
274
- );
275
- }
276
- return {
277
- namespaces: sdkClient.unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
278
- totalCount: data.total_count
279
- };
280
- };
281
- const unmarshalListTokensResponse = (data) => {
282
- if (!sdkClient.isJSONObject(data)) {
283
- throw new TypeError(
284
- `Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`
285
- );
286
- }
287
- return {
288
- tokens: sdkClient.unmarshalArrayOfObject(data.tokens, unmarshalToken),
289
- totalCount: data.total_count
290
- };
291
- };
292
- const unmarshalListTriggersResponse = (data) => {
293
- if (!sdkClient.isJSONObject(data)) {
294
- throw new TypeError(
295
- `Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary.`
296
- );
297
- }
298
- return {
299
- totalCount: data.total_count,
300
- triggers: sdkClient.unmarshalArrayOfObject(data.triggers, unmarshalTrigger)
301
- };
302
- };
303
- const marshalContainerHealthCheckSpecHTTPProbe = (request, defaults) => ({
304
- path: request.path
305
- });
306
- const marshalContainerHealthCheckSpecTCPProbe = (request, defaults) => ({});
307
- const marshalContainerHealthCheckSpec = (request, defaults) => ({
308
- failure_threshold: request.failureThreshold,
309
- interval: request.interval,
310
- ...sdkClient.resolveOneOf([
311
- {
312
- param: "http",
313
- value: request.http !== void 0 ? marshalContainerHealthCheckSpecHTTPProbe(request.http) : void 0
314
- },
315
- {
316
- param: "tcp",
317
- value: request.tcp !== void 0 ? marshalContainerHealthCheckSpecTCPProbe(request.tcp) : void 0
318
- }
319
- ])
320
- });
321
- const marshalContainerScalingOption = (request, defaults) => ({
322
- ...sdkClient.resolveOneOf([
323
- {
324
- param: "concurrent_requests_threshold",
325
- value: request.concurrentRequestsThreshold
326
- },
327
- { param: "cpu_usage_threshold", value: request.cpuUsageThreshold },
328
- { param: "memory_usage_threshold", value: request.memoryUsageThreshold }
329
- ])
330
- });
331
- const marshalSecret = (request, defaults) => ({
332
- key: request.key,
333
- value: request.value
334
- });
335
- const marshalCreateContainerRequest = (request, defaults) => ({
336
- args: request.args,
337
- command: request.command,
338
- cpu_limit: request.cpuLimit,
339
- description: request.description,
340
- environment_variables: request.environmentVariables,
341
- health_check: request.healthCheck !== void 0 ? marshalContainerHealthCheckSpec(request.healthCheck) : void 0,
342
- http_option: request.httpOption,
343
- local_storage_limit: request.localStorageLimit,
344
- max_concurrency: request.maxConcurrency,
345
- max_scale: request.maxScale,
346
- memory_limit: request.memoryLimit,
347
- min_scale: request.minScale,
348
- name: request.name,
349
- namespace_id: request.namespaceId,
350
- port: request.port,
351
- privacy: request.privacy,
352
- private_network_id: request.privateNetworkId,
353
- protocol: request.protocol,
354
- registry_image: request.registryImage,
355
- sandbox: request.sandbox,
356
- scaling_option: request.scalingOption !== void 0 ? marshalContainerScalingOption(request.scalingOption) : void 0,
357
- secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
358
- (elt) => marshalSecret(elt)
359
- ) : void 0,
360
- tags: request.tags,
361
- timeout: request.timeout
362
- });
363
- const marshalCreateCronRequest = (request, defaults) => ({
364
- args: request.args,
365
- container_id: request.containerId,
366
- name: request.name,
367
- schedule: request.schedule
368
- });
369
- const marshalCreateDomainRequest = (request, defaults) => ({
370
- container_id: request.containerId,
371
- hostname: request.hostname
372
- });
373
- const marshalCreateNamespaceRequest = (request, defaults) => ({
374
- activate_vpc_integration: request.activateVpcIntegration,
375
- description: request.description,
376
- environment_variables: request.environmentVariables,
377
- name: request.name || randomName("cns"),
378
- project_id: request.projectId ?? defaults.defaultProjectId,
379
- secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
380
- (elt) => marshalSecret(elt)
381
- ) : void 0,
382
- tags: request.tags
383
- });
384
- const marshalCreateTokenRequest = (request, defaults) => ({
385
- description: request.description,
386
- expires_at: request.expiresAt,
387
- ...sdkClient.resolveOneOf([
388
- { param: "container_id", value: request.containerId },
389
- { param: "namespace_id", value: request.namespaceId }
390
- ])
391
- });
392
- const marshalCreateTriggerRequestMnqNatsClientConfig = (request, defaults) => ({
393
- mnq_nats_account_id: request.mnqNatsAccountId,
394
- mnq_project_id: request.mnqProjectId,
395
- mnq_region: request.mnqRegion,
396
- subject: request.subject
397
- });
398
- const marshalCreateTriggerRequestMnqSqsClientConfig = (request, defaults) => ({
399
- mnq_project_id: request.mnqProjectId,
400
- mnq_region: request.mnqRegion,
401
- queue: request.queue
402
- });
403
- const marshalCreateTriggerRequestSqsClientConfig = (request, defaults) => ({
404
- access_key: request.accessKey,
405
- endpoint: request.endpoint,
406
- queue_url: request.queueUrl,
407
- secret_key: request.secretKey
408
- });
409
- const marshalCreateTriggerRequest = (request, defaults) => ({
410
- container_id: request.containerId,
411
- description: request.description,
412
- name: request.name,
413
- ...sdkClient.resolveOneOf([
414
- {
415
- param: "scw_sqs_config",
416
- value: request.scwSqsConfig !== void 0 ? marshalCreateTriggerRequestMnqSqsClientConfig(
417
- request.scwSqsConfig
418
- ) : void 0
419
- },
420
- {
421
- param: "scw_nats_config",
422
- value: request.scwNatsConfig !== void 0 ? marshalCreateTriggerRequestMnqNatsClientConfig(
423
- request.scwNatsConfig
424
- ) : void 0
425
- },
426
- {
427
- param: "sqs_config",
428
- value: request.sqsConfig !== void 0 ? marshalCreateTriggerRequestSqsClientConfig(
429
- request.sqsConfig
430
- ) : void 0
431
- }
432
- ])
433
- });
434
- const marshalUpdateContainerRequest = (request, defaults) => ({
435
- args: request.args,
436
- command: request.command,
437
- cpu_limit: request.cpuLimit,
438
- description: request.description,
439
- environment_variables: request.environmentVariables,
440
- health_check: request.healthCheck !== void 0 ? marshalContainerHealthCheckSpec(request.healthCheck) : void 0,
441
- http_option: request.httpOption,
442
- local_storage_limit: request.localStorageLimit,
443
- max_concurrency: request.maxConcurrency,
444
- max_scale: request.maxScale,
445
- memory_limit: request.memoryLimit,
446
- min_scale: request.minScale,
447
- port: request.port,
448
- privacy: request.privacy,
449
- private_network_id: request.privateNetworkId,
450
- protocol: request.protocol,
451
- redeploy: request.redeploy,
452
- registry_image: request.registryImage,
453
- sandbox: request.sandbox,
454
- scaling_option: request.scalingOption !== void 0 ? marshalContainerScalingOption(request.scalingOption) : void 0,
455
- secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
456
- (elt) => marshalSecret(elt)
457
- ) : void 0,
458
- tags: request.tags,
459
- timeout: request.timeout
460
- });
461
- const marshalUpdateCronRequest = (request, defaults) => ({
462
- args: request.args,
463
- container_id: request.containerId,
464
- name: request.name,
465
- schedule: request.schedule
466
- });
467
- const marshalUpdateNamespaceRequest = (request, defaults) => ({
468
- description: request.description,
469
- environment_variables: request.environmentVariables,
470
- secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
471
- (elt) => marshalSecret(elt)
472
- ) : void 0,
473
- tags: request.tags
474
- });
475
- const marshalUpdateTriggerRequestSqsClientConfig = (request, defaults) => ({
476
- access_key: request.accessKey,
477
- secret_key: request.secretKey
478
- });
479
- const marshalUpdateTriggerRequest = (request, defaults) => ({
480
- description: request.description,
481
- name: request.name,
482
- ...sdkClient.resolveOneOf([
483
- {
484
- param: "sqs_config",
485
- value: request.sqsConfig !== void 0 ? marshalUpdateTriggerRequestSqsClientConfig(
486
- request.sqsConfig
487
- ) : void 0
488
- }
489
- ])
490
- });
491
- exports.marshalCreateContainerRequest = marshalCreateContainerRequest;
492
- exports.marshalCreateCronRequest = marshalCreateCronRequest;
493
- exports.marshalCreateDomainRequest = marshalCreateDomainRequest;
494
- exports.marshalCreateNamespaceRequest = marshalCreateNamespaceRequest;
495
- exports.marshalCreateTokenRequest = marshalCreateTokenRequest;
496
- exports.marshalCreateTriggerRequest = marshalCreateTriggerRequest;
497
- exports.marshalUpdateContainerRequest = marshalUpdateContainerRequest;
498
- exports.marshalUpdateCronRequest = marshalUpdateCronRequest;
499
- exports.marshalUpdateNamespaceRequest = marshalUpdateNamespaceRequest;
500
- exports.marshalUpdateTriggerRequest = marshalUpdateTriggerRequest;
501
- exports.unmarshalContainer = unmarshalContainer;
502
- exports.unmarshalCron = unmarshalCron;
503
- exports.unmarshalDomain = unmarshalDomain;
504
- exports.unmarshalListContainersResponse = unmarshalListContainersResponse;
505
- exports.unmarshalListCronsResponse = unmarshalListCronsResponse;
506
- exports.unmarshalListDomainsResponse = unmarshalListDomainsResponse;
507
- exports.unmarshalListNamespacesResponse = unmarshalListNamespacesResponse;
508
- exports.unmarshalListTokensResponse = unmarshalListTokensResponse;
509
- exports.unmarshalListTriggersResponse = unmarshalListTriggersResponse;
510
- exports.unmarshalNamespace = unmarshalNamespace;
511
- exports.unmarshalToken = unmarshalToken;
512
- exports.unmarshalTrigger = unmarshalTrigger;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ContainerHealthCheckSpec = {
4
- failureThreshold: {
5
- greaterThanOrEqual: 3,
6
- lessThanOrEqual: 50
7
- }
8
- };
9
- const ContainerHealthCheckSpecHTTPProbe = {
10
- path: {
11
- maxLength: 100,
12
- minLength: 1
13
- }
14
- };
15
- const ContainerScalingOption = {};
16
- const CreateContainerRequest = {
17
- privateNetworkId: {
18
- ignoreEmpty: true
19
- }
20
- };
21
- const CreateTriggerRequest = {
22
- description: {
23
- maxLength: 255
24
- },
25
- name: {
26
- maxLength: 50,
27
- minLength: 1
28
- }
29
- };
30
- const CreateTriggerRequestMnqNatsClientConfig = {
31
- mnqRegion: {
32
- maxLength: 20,
33
- minLength: 1
34
- },
35
- subject: {
36
- maxLength: 100,
37
- minLength: 1,
38
- pattern: /^[^\s]+$/
39
- }
40
- };
41
- const CreateTriggerRequestMnqSqsClientConfig = {
42
- mnqRegion: {
43
- maxLength: 20,
44
- minLength: 1
45
- },
46
- queue: {
47
- maxLength: 100,
48
- minLength: 1
49
- }
50
- };
51
- const UpdateContainerRequest = {
52
- privateNetworkId: {
53
- ignoreEmpty: true
54
- }
55
- };
56
- const UpdateTriggerRequest = {
57
- description: {
58
- maxLength: 255
59
- },
60
- name: {
61
- maxLength: 50,
62
- minLength: 1
63
- }
64
- };
65
- exports.ContainerHealthCheckSpec = ContainerHealthCheckSpec;
66
- exports.ContainerHealthCheckSpecHTTPProbe = ContainerHealthCheckSpecHTTPProbe;
67
- exports.ContainerScalingOption = ContainerScalingOption;
68
- exports.CreateContainerRequest = CreateContainerRequest;
69
- exports.CreateTriggerRequest = CreateTriggerRequest;
70
- exports.CreateTriggerRequestMnqNatsClientConfig = CreateTriggerRequestMnqNatsClientConfig;
71
- exports.CreateTriggerRequestMnqSqsClientConfig = CreateTriggerRequestMnqSqsClientConfig;
72
- exports.UpdateContainerRequest = UpdateContainerRequest;
73
- exports.UpdateTriggerRequest = UpdateTriggerRequest;