@scaleway/sdk-applesilicon 1.4.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,5 +1,5 @@
1
1
  import randomName from "@scaleway/random-name";
2
- import { isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
3
3
  const unmarshalOSSupportedServerType = (data) => {
4
4
  if (!isJSONObject(data)) {
5
5
  throw new TypeError(
@@ -27,10 +27,7 @@ const unmarshalOS = (data) => {
27
27
  label: data.label,
28
28
  name: data.name,
29
29
  releaseNotesUrl: data.release_notes_url,
30
- supportedServerTypes: unmarshalArrayOfObject(
31
- data.supported_server_types,
32
- unmarshalOSSupportedServerType
33
- ),
30
+ supportedServerTypes: unmarshalArrayOfObject(data.supported_server_types, unmarshalOSSupportedServerType),
34
31
  tags: data.tags,
35
32
  version: data.version,
36
33
  xcodeVersion: data.xcode_version
@@ -67,6 +64,7 @@ const unmarshalServer = (data) => {
67
64
  );
68
65
  }
69
66
  return {
67
+ appliedRunnerConfigurationIds: data.applied_runner_configuration_ids,
70
68
  commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
71
69
  createdAt: unmarshalDate(data.created_at),
72
70
  deletableAt: unmarshalDate(data.deletable_at),
@@ -92,6 +90,55 @@ const unmarshalServer = (data) => {
92
90
  zone: data.zone
93
91
  };
94
92
  };
93
+ const unmarshalGithubRunnerConfiguration = (data) => {
94
+ if (!isJSONObject(data)) {
95
+ throw new TypeError(
96
+ `Unmarshalling the type 'GithubRunnerConfiguration' failed as data isn't a dictionary.`
97
+ );
98
+ }
99
+ return {
100
+ labels: data.labels,
101
+ token: data.token,
102
+ url: data.url
103
+ };
104
+ };
105
+ const unmarshalGitlabRunnerConfiguration = (data) => {
106
+ if (!isJSONObject(data)) {
107
+ throw new TypeError(
108
+ `Unmarshalling the type 'GitlabRunnerConfiguration' failed as data isn't a dictionary.`
109
+ );
110
+ }
111
+ return {
112
+ token: data.token,
113
+ url: data.url
114
+ };
115
+ };
116
+ const unmarshalRunnerConfigurationV2 = (data) => {
117
+ if (!isJSONObject(data)) {
118
+ throw new TypeError(
119
+ `Unmarshalling the type 'RunnerConfigurationV2' failed as data isn't a dictionary.`
120
+ );
121
+ }
122
+ return {
123
+ githubConfiguration: data.github_configuration ? unmarshalGithubRunnerConfiguration(data.github_configuration) : void 0,
124
+ gitlabConfiguration: data.gitlab_configuration ? unmarshalGitlabRunnerConfiguration(data.gitlab_configuration) : void 0,
125
+ name: data.name,
126
+ provider: data.provider
127
+ };
128
+ };
129
+ const unmarshalRunner = (data) => {
130
+ if (!isJSONObject(data)) {
131
+ throw new TypeError(
132
+ `Unmarshalling the type 'Runner' failed as data isn't a dictionary.`
133
+ );
134
+ }
135
+ return {
136
+ configuration: data.configuration ? unmarshalRunnerConfigurationV2(data.configuration) : void 0,
137
+ errorMessage: data.error_message,
138
+ id: data.id,
139
+ status: data.status
140
+ };
141
+ };
95
142
  const unmarshalServerPrivateNetwork = (data) => {
96
143
  if (!isJSONObject(data)) {
97
144
  throw new TypeError(
@@ -248,6 +295,17 @@ const unmarshalListOSResponse = (data) => {
248
295
  totalCount: data.total_count
249
296
  };
250
297
  };
298
+ const unmarshalListRunnersResponse = (data) => {
299
+ if (!isJSONObject(data)) {
300
+ throw new TypeError(
301
+ `Unmarshalling the type 'ListRunnersResponse' failed as data isn't a dictionary.`
302
+ );
303
+ }
304
+ return {
305
+ runners: unmarshalArrayOfObject(data.runners, unmarshalRunner),
306
+ totalCount: data.total_count
307
+ };
308
+ };
251
309
  const unmarshalListServerPrivateNetworksResponse = (data) => {
252
310
  if (!isJSONObject(data)) {
253
311
  throw new TypeError(
@@ -255,10 +313,7 @@ const unmarshalListServerPrivateNetworksResponse = (data) => {
255
313
  );
256
314
  }
257
315
  return {
258
- serverPrivateNetworks: unmarshalArrayOfObject(
259
- data.server_private_networks,
260
- unmarshalServerPrivateNetwork
261
- ),
316
+ serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork),
262
317
  totalCount: data.total_count
263
318
  };
264
319
  };
@@ -290,10 +345,7 @@ const unmarshalSetServerPrivateNetworksResponse = (data) => {
290
345
  );
291
346
  }
292
347
  return {
293
- serverPrivateNetworks: unmarshalArrayOfObject(
294
- data.server_private_networks,
295
- unmarshalServerPrivateNetwork
296
- )
348
+ serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork)
297
349
  };
298
350
  };
299
351
  const unmarshalStartConnectivityDiagnosticResponse = (data) => {
@@ -315,13 +367,39 @@ const marshalBatchCreateServersRequest = (request, defaults) => ({
315
367
  os_id: request.osId,
316
368
  project_id: request.projectId ?? defaults.defaultProjectId,
317
369
  public_bandwidth_bps: request.publicBandwidthBps,
318
- requests: request.requests !== void 0 ? request.requests.map(
319
- (elt) => marshalBatchCreateServersRequestBatchInnerCreateServerRequest(
320
- elt
321
- )
322
- ) : void 0,
370
+ requests: request.requests !== void 0 ? request.requests.map((elt) => marshalBatchCreateServersRequestBatchInnerCreateServerRequest(elt)) : void 0,
323
371
  type: request.type
324
372
  });
373
+ const marshalGithubRunnerConfiguration = (request, defaults) => ({
374
+ labels: request.labels,
375
+ token: request.token,
376
+ url: request.url
377
+ });
378
+ const marshalGitlabRunnerConfiguration = (request, defaults) => ({
379
+ token: request.token,
380
+ url: request.url
381
+ });
382
+ const marshalRunnerConfigurationV2 = (request, defaults) => ({
383
+ name: request.name,
384
+ provider: request.provider,
385
+ ...resolveOneOf([
386
+ {
387
+ param: "github_configuration",
388
+ value: request.githubConfiguration !== void 0 ? marshalGithubRunnerConfiguration(request.githubConfiguration) : void 0
389
+ },
390
+ {
391
+ param: "gitlab_configuration",
392
+ value: request.gitlabConfiguration !== void 0 ? marshalGitlabRunnerConfiguration(request.gitlabConfiguration) : void 0
393
+ }
394
+ ])
395
+ });
396
+ const marshalCreateRunnerRequest = (request, defaults) => ({
397
+ project_id: request.projectId ?? defaults.defaultProjectId,
398
+ runner_configuration: marshalRunnerConfigurationV2(request.runnerConfiguration)
399
+ });
400
+ const marshalAppliedRunnerConfigurations = (request, defaults) => ({
401
+ runner_configuration_ids: request.runnerConfigurationIds
402
+ });
325
403
  const marshalRunnerConfiguration = (request, defaults) => ({
326
404
  name: request.name,
327
405
  provider: request.provider,
@@ -329,6 +407,7 @@ const marshalRunnerConfiguration = (request, defaults) => ({
329
407
  url: request.url
330
408
  });
331
409
  const marshalCreateServerRequest = (request, defaults) => ({
410
+ applied_runner_configurations: request.appliedRunnerConfigurations !== void 0 ? marshalAppliedRunnerConfigurations(request.appliedRunnerConfigurations) : void 0,
332
411
  commitment_type: request.commitmentType,
333
412
  enable_vpc: request.enableVpc,
334
413
  name: request.name || randomName("as"),
@@ -351,10 +430,14 @@ const marshalReinstallServerRequest = (request, defaults) => ({
351
430
  const marshalStartConnectivityDiagnosticRequest = (request, defaults) => ({
352
431
  server_id: request.serverId
353
432
  });
433
+ const marshalUpdateRunnerRequest = (request, defaults) => ({
434
+ runner_configuration: marshalRunnerConfigurationV2(request.runnerConfiguration)
435
+ });
354
436
  const marshalCommitmentTypeValue = (request, defaults) => ({
355
437
  commitment_type: request.commitmentType
356
438
  });
357
439
  const marshalUpdateServerRequest = (request, defaults) => ({
440
+ applied_runner_configurations: request.appliedRunnerConfigurations !== void 0 ? marshalAppliedRunnerConfigurations(request.appliedRunnerConfigurations) : void 0,
358
441
  commitment_type: request.commitmentType !== void 0 ? marshalCommitmentTypeValue(request.commitmentType) : void 0,
359
442
  enable_vpc: request.enableVpc,
360
443
  name: request.name,
@@ -363,19 +446,23 @@ const marshalUpdateServerRequest = (request, defaults) => ({
363
446
  });
364
447
  export {
365
448
  marshalBatchCreateServersRequest,
449
+ marshalCreateRunnerRequest,
366
450
  marshalCreateServerRequest,
367
451
  marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
368
452
  marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
369
453
  marshalReinstallServerRequest,
370
454
  marshalStartConnectivityDiagnosticRequest,
455
+ marshalUpdateRunnerRequest,
371
456
  marshalUpdateServerRequest,
372
457
  unmarshalBatchCreateServersResponse,
373
458
  unmarshalConnectivityDiagnostic,
374
459
  unmarshalListOSResponse,
460
+ unmarshalListRunnersResponse,
375
461
  unmarshalListServerPrivateNetworksResponse,
376
462
  unmarshalListServerTypesResponse,
377
463
  unmarshalListServersResponse,
378
464
  unmarshalOS,
465
+ unmarshalRunner,
379
466
  unmarshalServer,
380
467
  unmarshalServerPrivateNetwork,
381
468
  unmarshalServerType,
@@ -5,6 +5,8 @@ export type ConnectivityDiagnosticDiagnosticStatus = 'unknown_status' | 'process
5
5
  export type ListServerPrivateNetworksRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
6
6
  export type ListServersRequestOrderBy = 'created_at_asc' | 'created_at_desc';
7
7
  export type RunnerConfigurationProvider = 'unknown_provider' | 'github' | 'gitlab';
8
+ export type RunnerConfigurationV2Provider = 'unknown_provider' | 'github' | 'gitlab';
9
+ export type RunnerStatus = 'unknown_status' | 'waiting' | 'enabled' | 'disabled' | 'error';
8
10
  export type ServerPrivateNetworkServerStatus = 'unknown_status' | 'attaching' | 'attached' | 'error' | 'detaching' | 'locked';
9
11
  export type ServerPrivateNetworkStatus = 'vpc_unknown_status' | 'vpc_enabled' | 'vpc_updating' | 'vpc_disabled';
10
12
  export type ServerStatus = 'unknown_status' | 'starting' | 'ready' | 'error' | 'rebooting' | 'updating' | 'locking' | 'locked' | 'unlocking' | 'reinstalling' | 'busy';
@@ -13,6 +15,15 @@ export interface OSSupportedServerType {
13
15
  serverType: string;
14
16
  fastDeliveryAvailable: boolean;
15
17
  }
18
+ export interface GithubRunnerConfiguration {
19
+ url: string;
20
+ token: string;
21
+ labels: string[];
22
+ }
23
+ export interface GitlabRunnerConfiguration {
24
+ url: string;
25
+ token: string;
26
+ }
16
27
  export interface Commitment {
17
28
  type: CommitmentType;
18
29
  cancelled: boolean;
@@ -55,7 +66,7 @@ export interface OS {
55
66
  */
56
67
  compatibleServerTypes?: string[];
57
68
  /**
58
- * Url of the release notes for the OS image or softwares pre-installed.
69
+ * Url of the release notes for the OS image or software pre-installed.
59
70
  */
60
71
  releaseNotesUrl: string;
61
72
  /**
@@ -77,6 +88,20 @@ export interface RunnerConfiguration {
77
88
  token: string;
78
89
  provider: RunnerConfigurationProvider;
79
90
  }
91
+ export interface RunnerConfigurationV2 {
92
+ name: string;
93
+ provider: RunnerConfigurationV2Provider;
94
+ /**
95
+ *
96
+ * One-of ('configuration'): at most one of 'githubConfiguration', 'gitlabConfiguration' could be set.
97
+ */
98
+ githubConfiguration?: GithubRunnerConfiguration;
99
+ /**
100
+ *
101
+ * One-of ('configuration'): at most one of 'githubConfiguration', 'gitlabConfiguration' could be set.
102
+ */
103
+ gitlabConfiguration?: GitlabRunnerConfiguration;
104
+ }
80
105
  export interface ServerTypeCPU {
81
106
  name: string;
82
107
  coreCount: number;
@@ -192,13 +217,17 @@ export interface Server {
192
217
  */
193
218
  publicBandwidthBps: number;
194
219
  /**
195
- * Current runner configuration, empty if none is installed.
220
+ * @deprecated Current runner configuration, empty if none is installed.
196
221
  */
197
222
  runnerConfiguration?: RunnerConfiguration;
198
223
  /**
199
224
  * A list of tags attached to the server.
200
225
  */
201
226
  tags: string[];
227
+ /**
228
+ * Runner configurations applied on the server, optional.
229
+ */
230
+ appliedRunnerConfigurationIds: string[];
202
231
  }
203
232
  export interface ConnectivityDiagnosticServerHealth {
204
233
  lastCheckinDate?: Date;
@@ -208,6 +237,15 @@ export interface ConnectivityDiagnosticServerHealth {
208
237
  isSshPortUp: boolean;
209
238
  isVncPortUp: boolean;
210
239
  }
240
+ export interface AppliedRunnerConfigurations {
241
+ runnerConfigurationIds: string[];
242
+ }
243
+ export interface Runner {
244
+ id: string;
245
+ configuration?: RunnerConfigurationV2;
246
+ status: RunnerStatus;
247
+ errorMessage: string;
248
+ }
211
249
  export interface ServerPrivateNetwork {
212
250
  /**
213
251
  * ID of the Server-to-Private Network mapping.
@@ -339,6 +377,20 @@ export interface ConnectivityDiagnostic {
339
377
  supportedActions: ConnectivityDiagnosticActionType[];
340
378
  errorMessage: string;
341
379
  }
380
+ export type CreateRunnerRequest = {
381
+ /**
382
+ * Zone to target. If none is passed will use default zone from the config.
383
+ */
384
+ zone?: ScwZone;
385
+ /**
386
+ * Creates a runner in the given project_id.
387
+ */
388
+ projectId?: string;
389
+ /**
390
+ * Configuration details for the runner.
391
+ */
392
+ runnerConfiguration: RunnerConfigurationV2;
393
+ };
342
394
  export type CreateServerRequest = {
343
395
  /**
344
396
  * Zone to target. If none is passed will use default zone from the config.
@@ -373,9 +425,23 @@ export type CreateServerRequest = {
373
425
  */
374
426
  publicBandwidthBps: number;
375
427
  /**
376
- * Specify the configuration to install an optional CICD runner on the server during installation.
428
+ * @deprecated Specify the configuration to install an optional CICD runner on the server during installation.
377
429
  */
378
430
  runnerConfiguration?: RunnerConfiguration;
431
+ /**
432
+ * Runner configurations to apply on the server, existing ones missing from the specified configuration will be removed from the server.
433
+ */
434
+ appliedRunnerConfigurations?: AppliedRunnerConfigurations;
435
+ };
436
+ export type DeleteRunnerRequest = {
437
+ /**
438
+ * Zone to target. If none is passed will use default zone from the config.
439
+ */
440
+ zone?: ScwZone;
441
+ /**
442
+ * ID of the runner configuration to delete.
443
+ */
444
+ runnerId: string;
379
445
  };
380
446
  export type DeleteServerRequest = {
381
447
  /**
@@ -404,6 +470,16 @@ export type GetOSRequest = {
404
470
  */
405
471
  osId: string;
406
472
  };
473
+ export type GetRunnerRequest = {
474
+ /**
475
+ * Zone to target. If none is passed will use default zone from the config.
476
+ */
477
+ zone?: ScwZone;
478
+ /**
479
+ * ID of the runner configuration to get.
480
+ */
481
+ runnerId: string;
482
+ };
407
483
  export type GetServerRequest = {
408
484
  /**
409
485
  * Zone to target. If none is passed will use default zone from the config.
@@ -456,6 +532,36 @@ export interface ListOSResponse {
456
532
  */
457
533
  os: OS[];
458
534
  }
535
+ export type ListRunnersRequest = {
536
+ /**
537
+ * Zone to target. If none is passed will use default zone from the config.
538
+ */
539
+ zone?: ScwZone;
540
+ /**
541
+ * ID of the server for which to list applied runner configurations.
542
+ */
543
+ serverId?: string;
544
+ /**
545
+ * Only list servers of this project ID.
546
+ */
547
+ projectId?: string;
548
+ /**
549
+ * Only list servers of this Organization ID.
550
+ */
551
+ organizationId?: string;
552
+ /**
553
+ * Positive integer to choose the page to return.
554
+ */
555
+ page?: number;
556
+ /**
557
+ * Positive integer lower or equal to 100 to select the number of items to return.
558
+ */
559
+ pageSize?: number;
560
+ };
561
+ export interface ListRunnersResponse {
562
+ totalCount: number;
563
+ runners: Runner[];
564
+ }
459
565
  export interface ListServerPrivateNetworksResponse {
460
566
  serverPrivateNetworks: ServerPrivateNetwork[];
461
567
  totalCount: number;
@@ -637,6 +743,20 @@ export type StartConnectivityDiagnosticRequest = {
637
743
  export interface StartConnectivityDiagnosticResponse {
638
744
  diagnosticId: string;
639
745
  }
746
+ export type UpdateRunnerRequest = {
747
+ /**
748
+ * Zone to target. If none is passed will use default zone from the config.
749
+ */
750
+ zone?: ScwZone;
751
+ /**
752
+ * ID of the runner configuration to update.
753
+ */
754
+ runnerId: string;
755
+ /**
756
+ * Configuration details for the runner.
757
+ */
758
+ runnerConfiguration: RunnerConfigurationV2;
759
+ };
640
760
  export type UpdateServerRequest = {
641
761
  /**
642
762
  * Zone to target. If none is passed will use default zone from the config.
@@ -666,4 +786,8 @@ export type UpdateServerRequest = {
666
786
  * Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint.
667
787
  */
668
788
  publicBandwidthBps?: number;
789
+ /**
790
+ * Runner configurations to apply on the server, existing ones missing from the specified configuration will be removed from the server.
791
+ */
792
+ appliedRunnerConfigurations?: AppliedRunnerConfigurations;
669
793
  };
@@ -0,0 +1,6 @@
1
+ export declare const RunnerConfigurationV2: {
2
+ name: {
3
+ maxLength: number;
4
+ minLength: number;
5
+ };
6
+ };
@@ -0,0 +1,9 @@
1
+ const RunnerConfigurationV2 = {
2
+ name: {
3
+ maxLength: 255,
4
+ minLength: 1
5
+ }
6
+ };
7
+ export {
8
+ RunnerConfigurationV2
9
+ };
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-applesilicon",
3
- "version": "1.4.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK applesilicon",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/applesilicon"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1alpha1/index.gen.cjs");
4
- exports.Applesiliconv1alpha1 = index_gen;