@scaleway/sdk-applesilicon 1.1.0 → 1.3.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.
@@ -57,6 +57,23 @@ class API extends sdkClient.API {
57
57
  },
58
58
  marshalling_gen.unmarshalServer
59
59
  );
60
+ /**
61
+ * Create multiple servers atomically. Create multiple servers in the targeted zone specifying their configurations. If the request cannot entirely be fulfilled, no servers are created.
62
+ *
63
+ * @param request - The request {@link BatchCreateServersRequest}
64
+ * @returns A Promise of BatchCreateServersResponse
65
+ */
66
+ batchCreateServers = (request) => this.client.fetch(
67
+ {
68
+ body: JSON.stringify(
69
+ marshalling_gen.marshalBatchCreateServersRequest(request, this.client.settings)
70
+ ),
71
+ headers: jsonContentHeaders,
72
+ method: "POST",
73
+ path: `/apple-silicon/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/batch-create-servers`
74
+ },
75
+ marshalling_gen.unmarshalBatchCreateServersResponse
76
+ );
60
77
  pageOfListServers = (request = {}) => this.client.fetch(
61
78
  {
62
79
  method: "GET",
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
3
- import type { ConnectivityDiagnostic, CreateServerRequest, DeleteServerRequest, GetConnectivityDiagnosticRequest, GetOSRequest, GetServerRequest, GetServerTypeRequest, ListOSRequest, ListOSResponse, ListServerPrivateNetworksResponse, ListServerTypesRequest, ListServerTypesResponse, ListServersRequest, ListServersResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiGetServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerType, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest } from './types.gen';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { BatchCreateServersRequest, BatchCreateServersResponse, ConnectivityDiagnostic, CreateServerRequest, DeleteServerRequest, GetConnectivityDiagnosticRequest, GetOSRequest, GetServerRequest, GetServerTypeRequest, ListOSRequest, ListOSResponse, ListServerPrivateNetworksResponse, ListServersRequest, ListServersResponse, ListServerTypesRequest, ListServerTypesResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiGetServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerType, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest } from './types.gen';
4
4
  /**
5
5
  * Apple silicon API.
6
6
 
@@ -33,6 +33,13 @@ export declare class API extends ParentAPI {
33
33
  * @returns A Promise of Server
34
34
  */
35
35
  createServer: (request: Readonly<CreateServerRequest>) => Promise<Server>;
36
+ /**
37
+ * Create multiple servers atomically. Create multiple servers in the targeted zone specifying their configurations. If the request cannot entirely be fulfilled, no servers are created.
38
+ *
39
+ * @param request - The request {@link BatchCreateServersRequest}
40
+ * @returns A Promise of BatchCreateServersResponse
41
+ */
42
+ batchCreateServers: (request: Readonly<BatchCreateServersRequest>) => Promise<BatchCreateServersResponse>;
36
43
  protected pageOfListServers: (request?: Readonly<ListServersRequest>) => Promise<ListServersResponse>;
37
44
  /**
38
45
  * List all servers. List all servers in the specified zone. By default, returned servers in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
@@ -1,6 +1,6 @@
1
1
  import { API as API$1, toApiLocality, validatePathParam, urlParams, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
2
  import { SERVER_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListServerTypesResponse, unmarshalServerType, marshalCreateServerRequest, unmarshalServer, unmarshalListServersResponse, unmarshalListOSResponse, unmarshalOS, marshalUpdateServerRequest, marshalReinstallServerRequest, marshalStartConnectivityDiagnosticRequest, unmarshalStartConnectivityDiagnosticResponse, unmarshalConnectivityDiagnostic, unmarshalServerPrivateNetwork, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, unmarshalSetServerPrivateNetworksResponse, unmarshalListServerPrivateNetworksResponse } from "./marshalling.gen.js";
3
+ import { unmarshalListServerTypesResponse, unmarshalServerType, marshalCreateServerRequest, unmarshalServer, marshalBatchCreateServersRequest, unmarshalBatchCreateServersResponse, unmarshalListServersResponse, unmarshalListOSResponse, unmarshalOS, marshalUpdateServerRequest, marshalReinstallServerRequest, marshalStartConnectivityDiagnosticRequest, unmarshalStartConnectivityDiagnosticResponse, unmarshalConnectivityDiagnostic, unmarshalServerPrivateNetwork, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, unmarshalSetServerPrivateNetworksResponse, unmarshalListServerPrivateNetworksResponse } from "./marshalling.gen.js";
4
4
  const jsonContentHeaders = {
5
5
  "Content-Type": "application/json; charset=utf-8"
6
6
  };
@@ -55,6 +55,23 @@ class API extends API$1 {
55
55
  },
56
56
  unmarshalServer
57
57
  );
58
+ /**
59
+ * Create multiple servers atomically. Create multiple servers in the targeted zone specifying their configurations. If the request cannot entirely be fulfilled, no servers are created.
60
+ *
61
+ * @param request - The request {@link BatchCreateServersRequest}
62
+ * @returns A Promise of BatchCreateServersResponse
63
+ */
64
+ batchCreateServers = (request) => this.client.fetch(
65
+ {
66
+ body: JSON.stringify(
67
+ marshalBatchCreateServersRequest(request, this.client.settings)
68
+ ),
69
+ headers: jsonContentHeaders,
70
+ method: "POST",
71
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/batch-create-servers`
72
+ },
73
+ unmarshalBatchCreateServersResponse
74
+ );
58
75
  pageOfListServers = (request = {}) => this.client.fetch(
59
76
  {
60
77
  method: "GET",
@@ -8,12 +8,14 @@ exports.PrivateNetworkAPI = api_gen.PrivateNetworkAPI;
8
8
  exports.SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES = content_gen.SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES;
9
9
  exports.SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES = content_gen.SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES;
10
10
  exports.SERVER_TRANSIENT_STATUSES = content_gen.SERVER_TRANSIENT_STATUSES;
11
+ exports.marshalBatchCreateServersRequest = marshalling_gen.marshalBatchCreateServersRequest;
11
12
  exports.marshalCreateServerRequest = marshalling_gen.marshalCreateServerRequest;
12
13
  exports.marshalPrivateNetworkApiAddServerPrivateNetworkRequest = marshalling_gen.marshalPrivateNetworkApiAddServerPrivateNetworkRequest;
13
14
  exports.marshalPrivateNetworkApiSetServerPrivateNetworksRequest = marshalling_gen.marshalPrivateNetworkApiSetServerPrivateNetworksRequest;
14
15
  exports.marshalReinstallServerRequest = marshalling_gen.marshalReinstallServerRequest;
15
16
  exports.marshalStartConnectivityDiagnosticRequest = marshalling_gen.marshalStartConnectivityDiagnosticRequest;
16
17
  exports.marshalUpdateServerRequest = marshalling_gen.marshalUpdateServerRequest;
18
+ exports.unmarshalBatchCreateServersResponse = marshalling_gen.unmarshalBatchCreateServersResponse;
17
19
  exports.unmarshalConnectivityDiagnostic = marshalling_gen.unmarshalConnectivityDiagnostic;
18
20
  exports.unmarshalListOSResponse = marshalling_gen.unmarshalListOSResponse;
19
21
  exports.unmarshalListServerPrivateNetworksResponse = marshalling_gen.unmarshalListServerPrivateNetworksResponse;
@@ -1,4 +1,4 @@
1
1
  export { API, PrivateNetworkAPI, } from './api.gen';
2
2
  export * from './content.gen';
3
3
  export * from './marshalling.gen';
4
- export type { Commitment, CommitmentType, CommitmentTypeValue, ConnectivityDiagnostic, ConnectivityDiagnosticActionType, ConnectivityDiagnosticDiagnosticStatus, ConnectivityDiagnosticServerHealth, CreateServerRequest, DeleteServerRequest, GetConnectivityDiagnosticRequest, GetOSRequest, GetServerRequest, GetServerTypeRequest, ListOSRequest, ListOSResponse, ListServerPrivateNetworksRequestOrderBy, ListServerPrivateNetworksResponse, ListServerTypesRequest, ListServerTypesResponse, ListServersRequest, ListServersRequestOrderBy, ListServersResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiGetServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerPrivateNetworkServerStatus, ServerPrivateNetworkStatus, ServerStatus, ServerType, ServerTypeCPU, ServerTypeDisk, ServerTypeGPU, ServerTypeMemory, ServerTypeNetwork, ServerTypeStock, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest, } from './types.gen';
4
+ export type { BatchCreateServersRequest, BatchCreateServersRequestBatchInnerCreateServerRequest, BatchCreateServersResponse, Commitment, CommitmentType, CommitmentTypeValue, ConnectivityDiagnostic, ConnectivityDiagnosticActionType, ConnectivityDiagnosticDiagnosticStatus, ConnectivityDiagnosticServerHealth, CreateServerRequest, DeleteServerRequest, GetConnectivityDiagnosticRequest, GetOSRequest, GetServerRequest, GetServerTypeRequest, ListOSRequest, ListOSResponse, ListServerPrivateNetworksRequestOrderBy, ListServerPrivateNetworksResponse, ListServersRequest, ListServersRequestOrderBy, ListServersResponse, ListServerTypesRequest, ListServerTypesResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiGetServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerPrivateNetworkServerStatus, ServerPrivateNetworkStatus, ServerStatus, ServerType, ServerTypeCPU, ServerTypeDisk, ServerTypeGPU, ServerTypeMemory, ServerTypeNetwork, ServerTypeStock, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest, } from './types.gen';
@@ -1,18 +1,20 @@
1
1
  import { API, PrivateNetworkAPI } from "./api.gen.js";
2
2
  import { SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { marshalCreateServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalReinstallServerRequest, marshalStartConnectivityDiagnosticRequest, marshalUpdateServerRequest, unmarshalConnectivityDiagnostic, unmarshalListOSResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServerTypesResponse, unmarshalListServersResponse, unmarshalOS, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalServerType, unmarshalSetServerPrivateNetworksResponse, unmarshalStartConnectivityDiagnosticResponse } from "./marshalling.gen.js";
3
+ import { marshalBatchCreateServersRequest, marshalCreateServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalReinstallServerRequest, marshalStartConnectivityDiagnosticRequest, marshalUpdateServerRequest, unmarshalBatchCreateServersResponse, unmarshalConnectivityDiagnostic, unmarshalListOSResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServerTypesResponse, unmarshalListServersResponse, unmarshalOS, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalServerType, unmarshalSetServerPrivateNetworksResponse, unmarshalStartConnectivityDiagnosticResponse } from "./marshalling.gen.js";
4
4
  export {
5
5
  API,
6
6
  PrivateNetworkAPI,
7
7
  SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES,
8
8
  SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES,
9
9
  SERVER_TRANSIENT_STATUSES,
10
+ marshalBatchCreateServersRequest,
10
11
  marshalCreateServerRequest,
11
12
  marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
12
13
  marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
13
14
  marshalReinstallServerRequest,
14
15
  marshalStartConnectivityDiagnosticRequest,
15
16
  marshalUpdateServerRequest,
17
+ unmarshalBatchCreateServersResponse,
16
18
  unmarshalConnectivityDiagnostic,
17
19
  unmarshalListOSResponse,
18
20
  unmarshalListServerPrivateNetworksResponse,
@@ -20,6 +20,47 @@ const unmarshalOS = (data) => {
20
20
  xcodeVersion: data.xcode_version
21
21
  };
22
22
  };
23
+ const unmarshalCommitment = (data) => {
24
+ if (!sdkClient.isJSONObject(data)) {
25
+ throw new TypeError(
26
+ `Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
27
+ );
28
+ }
29
+ return {
30
+ cancelled: data.cancelled,
31
+ type: data.type
32
+ };
33
+ };
34
+ const unmarshalServer = (data) => {
35
+ if (!sdkClient.isJSONObject(data)) {
36
+ throw new TypeError(
37
+ `Unmarshalling the type 'Server' failed as data isn't a dictionary.`
38
+ );
39
+ }
40
+ return {
41
+ commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
42
+ createdAt: sdkClient.unmarshalDate(data.created_at),
43
+ deletableAt: sdkClient.unmarshalDate(data.deletable_at),
44
+ deletionScheduled: data.deletion_scheduled,
45
+ delivered: data.delivered,
46
+ id: data.id,
47
+ ip: data.ip,
48
+ name: data.name,
49
+ organizationId: data.organization_id,
50
+ os: data.os ? unmarshalOS(data.os) : void 0,
51
+ projectId: data.project_id,
52
+ publicBandwidthBps: data.public_bandwidth_bps,
53
+ sshUsername: data.ssh_username,
54
+ status: data.status,
55
+ sudoPassword: data.sudo_password,
56
+ type: data.type,
57
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
58
+ vncPort: data.vnc_port,
59
+ vncUrl: data.vnc_url,
60
+ vpcStatus: data.vpc_status,
61
+ zone: data.zone
62
+ };
63
+ };
23
64
  const unmarshalServerPrivateNetwork = (data) => {
24
65
  if (!sdkClient.isJSONObject(data)) {
25
66
  throw new TypeError(
@@ -111,45 +152,14 @@ const unmarshalServerType = (data) => {
111
152
  stock: data.stock
112
153
  };
113
154
  };
114
- const unmarshalCommitment = (data) => {
115
- if (!sdkClient.isJSONObject(data)) {
116
- throw new TypeError(
117
- `Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
118
- );
119
- }
120
- return {
121
- cancelled: data.cancelled,
122
- type: data.type
123
- };
124
- };
125
- const unmarshalServer = (data) => {
155
+ const unmarshalBatchCreateServersResponse = (data) => {
126
156
  if (!sdkClient.isJSONObject(data)) {
127
157
  throw new TypeError(
128
- `Unmarshalling the type 'Server' failed as data isn't a dictionary.`
158
+ `Unmarshalling the type 'BatchCreateServersResponse' failed as data isn't a dictionary.`
129
159
  );
130
160
  }
131
161
  return {
132
- commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
133
- createdAt: sdkClient.unmarshalDate(data.created_at),
134
- deletableAt: sdkClient.unmarshalDate(data.deletable_at),
135
- deletionScheduled: data.deletion_scheduled,
136
- delivered: data.delivered,
137
- id: data.id,
138
- ip: data.ip,
139
- name: data.name,
140
- organizationId: data.organization_id,
141
- os: data.os ? unmarshalOS(data.os) : void 0,
142
- projectId: data.project_id,
143
- publicBandwidthBps: data.public_bandwidth_bps,
144
- sshUsername: data.ssh_username,
145
- status: data.status,
146
- sudoPassword: data.sudo_password,
147
- type: data.type,
148
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
149
- vncPort: data.vnc_port,
150
- vncUrl: data.vnc_url,
151
- vpcStatus: data.vpc_status,
152
- zone: data.zone
162
+ servers: sdkClient.unmarshalArrayOfObject(data.servers, unmarshalServer)
153
163
  };
154
164
  };
155
165
  const unmarshalConnectivityDiagnosticServerHealth = (data) => {
@@ -251,6 +261,22 @@ const unmarshalStartConnectivityDiagnosticResponse = (data) => {
251
261
  diagnosticId: data.diagnostic_id
252
262
  };
253
263
  };
264
+ const marshalBatchCreateServersRequestBatchInnerCreateServerRequest = (request, defaults) => ({
265
+ name: request.name
266
+ });
267
+ const marshalBatchCreateServersRequest = (request, defaults) => ({
268
+ commitment_type: request.commitmentType,
269
+ enable_vpc: request.enableVpc,
270
+ os_id: request.osId,
271
+ project_id: request.projectId ?? defaults.defaultProjectId,
272
+ public_bandwidth_bps: request.publicBandwidthBps,
273
+ requests: request.requests !== void 0 ? request.requests.map(
274
+ (elt) => marshalBatchCreateServersRequestBatchInnerCreateServerRequest(
275
+ elt
276
+ )
277
+ ) : void 0,
278
+ type: request.type
279
+ });
254
280
  const marshalCreateServerRequest = (request, defaults) => ({
255
281
  commitment_type: request.commitmentType,
256
282
  enable_vpc: request.enableVpc,
@@ -283,12 +309,14 @@ const marshalUpdateServerRequest = (request, defaults) => ({
283
309
  public_bandwidth_bps: request.publicBandwidthBps,
284
310
  schedule_deletion: request.scheduleDeletion
285
311
  });
312
+ exports.marshalBatchCreateServersRequest = marshalBatchCreateServersRequest;
286
313
  exports.marshalCreateServerRequest = marshalCreateServerRequest;
287
314
  exports.marshalPrivateNetworkApiAddServerPrivateNetworkRequest = marshalPrivateNetworkApiAddServerPrivateNetworkRequest;
288
315
  exports.marshalPrivateNetworkApiSetServerPrivateNetworksRequest = marshalPrivateNetworkApiSetServerPrivateNetworksRequest;
289
316
  exports.marshalReinstallServerRequest = marshalReinstallServerRequest;
290
317
  exports.marshalStartConnectivityDiagnosticRequest = marshalStartConnectivityDiagnosticRequest;
291
318
  exports.marshalUpdateServerRequest = marshalUpdateServerRequest;
319
+ exports.unmarshalBatchCreateServersResponse = unmarshalBatchCreateServersResponse;
292
320
  exports.unmarshalConnectivityDiagnostic = unmarshalConnectivityDiagnostic;
293
321
  exports.unmarshalListOSResponse = unmarshalListOSResponse;
294
322
  exports.unmarshalListServerPrivateNetworksResponse = unmarshalListServerPrivateNetworksResponse;
@@ -1,9 +1,10 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { ConnectivityDiagnostic, CreateServerRequest, ListOSResponse, ListServerPrivateNetworksResponse, ListServerTypesResponse, ListServersResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerType, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest } from './types.gen';
2
+ import type { BatchCreateServersRequest, BatchCreateServersResponse, ConnectivityDiagnostic, CreateServerRequest, ListOSResponse, ListServerPrivateNetworksResponse, ListServersResponse, ListServerTypesResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerType, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest } from './types.gen';
3
3
  export declare const unmarshalOS: (data: unknown) => OS;
4
+ export declare const unmarshalServer: (data: unknown) => Server;
4
5
  export declare const unmarshalServerPrivateNetwork: (data: unknown) => ServerPrivateNetwork;
5
6
  export declare const unmarshalServerType: (data: unknown) => ServerType;
6
- export declare const unmarshalServer: (data: unknown) => Server;
7
+ export declare const unmarshalBatchCreateServersResponse: (data: unknown) => BatchCreateServersResponse;
7
8
  export declare const unmarshalConnectivityDiagnostic: (data: unknown) => ConnectivityDiagnostic;
8
9
  export declare const unmarshalListOSResponse: (data: unknown) => ListOSResponse;
9
10
  export declare const unmarshalListServerPrivateNetworksResponse: (data: unknown) => ListServerPrivateNetworksResponse;
@@ -11,6 +12,7 @@ export declare const unmarshalListServerTypesResponse: (data: unknown) => ListSe
11
12
  export declare const unmarshalListServersResponse: (data: unknown) => ListServersResponse;
12
13
  export declare const unmarshalSetServerPrivateNetworksResponse: (data: unknown) => SetServerPrivateNetworksResponse;
13
14
  export declare const unmarshalStartConnectivityDiagnosticResponse: (data: unknown) => StartConnectivityDiagnosticResponse;
15
+ export declare const marshalBatchCreateServersRequest: (request: BatchCreateServersRequest, defaults: DefaultValues) => Record<string, unknown>;
14
16
  export declare const marshalCreateServerRequest: (request: CreateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
15
17
  export declare const marshalPrivateNetworkApiAddServerPrivateNetworkRequest: (request: PrivateNetworkApiAddServerPrivateNetworkRequest, defaults: DefaultValues) => Record<string, unknown>;
16
18
  export declare const marshalPrivateNetworkApiSetServerPrivateNetworksRequest: (request: PrivateNetworkApiSetServerPrivateNetworksRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -18,6 +18,47 @@ const unmarshalOS = (data) => {
18
18
  xcodeVersion: data.xcode_version
19
19
  };
20
20
  };
21
+ const unmarshalCommitment = (data) => {
22
+ if (!isJSONObject(data)) {
23
+ throw new TypeError(
24
+ `Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
25
+ );
26
+ }
27
+ return {
28
+ cancelled: data.cancelled,
29
+ type: data.type
30
+ };
31
+ };
32
+ const unmarshalServer = (data) => {
33
+ if (!isJSONObject(data)) {
34
+ throw new TypeError(
35
+ `Unmarshalling the type 'Server' failed as data isn't a dictionary.`
36
+ );
37
+ }
38
+ return {
39
+ commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
40
+ createdAt: unmarshalDate(data.created_at),
41
+ deletableAt: unmarshalDate(data.deletable_at),
42
+ deletionScheduled: data.deletion_scheduled,
43
+ delivered: data.delivered,
44
+ id: data.id,
45
+ ip: data.ip,
46
+ name: data.name,
47
+ organizationId: data.organization_id,
48
+ os: data.os ? unmarshalOS(data.os) : void 0,
49
+ projectId: data.project_id,
50
+ publicBandwidthBps: data.public_bandwidth_bps,
51
+ sshUsername: data.ssh_username,
52
+ status: data.status,
53
+ sudoPassword: data.sudo_password,
54
+ type: data.type,
55
+ updatedAt: unmarshalDate(data.updated_at),
56
+ vncPort: data.vnc_port,
57
+ vncUrl: data.vnc_url,
58
+ vpcStatus: data.vpc_status,
59
+ zone: data.zone
60
+ };
61
+ };
21
62
  const unmarshalServerPrivateNetwork = (data) => {
22
63
  if (!isJSONObject(data)) {
23
64
  throw new TypeError(
@@ -109,45 +150,14 @@ const unmarshalServerType = (data) => {
109
150
  stock: data.stock
110
151
  };
111
152
  };
112
- const unmarshalCommitment = (data) => {
113
- if (!isJSONObject(data)) {
114
- throw new TypeError(
115
- `Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
116
- );
117
- }
118
- return {
119
- cancelled: data.cancelled,
120
- type: data.type
121
- };
122
- };
123
- const unmarshalServer = (data) => {
153
+ const unmarshalBatchCreateServersResponse = (data) => {
124
154
  if (!isJSONObject(data)) {
125
155
  throw new TypeError(
126
- `Unmarshalling the type 'Server' failed as data isn't a dictionary.`
156
+ `Unmarshalling the type 'BatchCreateServersResponse' failed as data isn't a dictionary.`
127
157
  );
128
158
  }
129
159
  return {
130
- commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
131
- createdAt: unmarshalDate(data.created_at),
132
- deletableAt: unmarshalDate(data.deletable_at),
133
- deletionScheduled: data.deletion_scheduled,
134
- delivered: data.delivered,
135
- id: data.id,
136
- ip: data.ip,
137
- name: data.name,
138
- organizationId: data.organization_id,
139
- os: data.os ? unmarshalOS(data.os) : void 0,
140
- projectId: data.project_id,
141
- publicBandwidthBps: data.public_bandwidth_bps,
142
- sshUsername: data.ssh_username,
143
- status: data.status,
144
- sudoPassword: data.sudo_password,
145
- type: data.type,
146
- updatedAt: unmarshalDate(data.updated_at),
147
- vncPort: data.vnc_port,
148
- vncUrl: data.vnc_url,
149
- vpcStatus: data.vpc_status,
150
- zone: data.zone
160
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServer)
151
161
  };
152
162
  };
153
163
  const unmarshalConnectivityDiagnosticServerHealth = (data) => {
@@ -249,6 +259,22 @@ const unmarshalStartConnectivityDiagnosticResponse = (data) => {
249
259
  diagnosticId: data.diagnostic_id
250
260
  };
251
261
  };
262
+ const marshalBatchCreateServersRequestBatchInnerCreateServerRequest = (request, defaults) => ({
263
+ name: request.name
264
+ });
265
+ const marshalBatchCreateServersRequest = (request, defaults) => ({
266
+ commitment_type: request.commitmentType,
267
+ enable_vpc: request.enableVpc,
268
+ os_id: request.osId,
269
+ project_id: request.projectId ?? defaults.defaultProjectId,
270
+ public_bandwidth_bps: request.publicBandwidthBps,
271
+ requests: request.requests !== void 0 ? request.requests.map(
272
+ (elt) => marshalBatchCreateServersRequestBatchInnerCreateServerRequest(
273
+ elt
274
+ )
275
+ ) : void 0,
276
+ type: request.type
277
+ });
252
278
  const marshalCreateServerRequest = (request, defaults) => ({
253
279
  commitment_type: request.commitmentType,
254
280
  enable_vpc: request.enableVpc,
@@ -282,12 +308,14 @@ const marshalUpdateServerRequest = (request, defaults) => ({
282
308
  schedule_deletion: request.scheduleDeletion
283
309
  });
284
310
  export {
311
+ marshalBatchCreateServersRequest,
285
312
  marshalCreateServerRequest,
286
313
  marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
287
314
  marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
288
315
  marshalReinstallServerRequest,
289
316
  marshalStartConnectivityDiagnosticRequest,
290
317
  marshalUpdateServerRequest,
318
+ unmarshalBatchCreateServersResponse,
291
319
  unmarshalConnectivityDiagnostic,
292
320
  unmarshalListOSResponse,
293
321
  unmarshalListServerPrivateNetworksResponse,
@@ -8,6 +8,10 @@ export type ServerPrivateNetworkServerStatus = 'unknown_status' | 'attaching' |
8
8
  export type ServerPrivateNetworkStatus = 'vpc_unknown_status' | 'vpc_enabled' | 'vpc_updating' | 'vpc_disabled';
9
9
  export type ServerStatus = 'unknown_status' | 'starting' | 'ready' | 'error' | 'rebooting' | 'updating' | 'locking' | 'locked' | 'unlocking' | 'reinstalling' | 'busy';
10
10
  export type ServerTypeStock = 'unknown_stock' | 'no_stock' | 'low_stock' | 'high_stock';
11
+ export interface Commitment {
12
+ type: CommitmentType;
13
+ cancelled: boolean;
14
+ }
11
15
  export interface OS {
12
16
  /**
13
17
  * Unique ID of the OS.
@@ -66,9 +70,94 @@ export interface ServerTypeNetwork {
66
70
  publicBandwidthBps: number;
67
71
  supportedBandwidth: number[];
68
72
  }
69
- export interface Commitment {
70
- type: CommitmentType;
71
- cancelled: boolean;
73
+ export interface BatchCreateServersRequestBatchInnerCreateServerRequest {
74
+ name: string;
75
+ }
76
+ export interface Server {
77
+ /**
78
+ * UUID of the server.
79
+ */
80
+ id: string;
81
+ /**
82
+ * Type of the server.
83
+ */
84
+ type: string;
85
+ /**
86
+ * Name of the server.
87
+ */
88
+ name: string;
89
+ /**
90
+ * Project this server is associated with.
91
+ */
92
+ projectId: string;
93
+ /**
94
+ * Organization this server is associated with.
95
+ */
96
+ organizationId: string;
97
+ /**
98
+ * IPv4 address of the server.
99
+ */
100
+ ip: string;
101
+ /**
102
+ * Vnc:// URL to access Apple Remote Desktop.
103
+ */
104
+ vncUrl: string;
105
+ /**
106
+ * SSH Username for remote shell.
107
+ */
108
+ sshUsername: string;
109
+ /**
110
+ * Admin password required to execute commands.
111
+ */
112
+ sudoPassword: string;
113
+ /**
114
+ * VNC port to use for remote desktop connection.
115
+ */
116
+ vncPort: number;
117
+ /**
118
+ * Initially installed OS, this does not necessarily reflect the current OS version.
119
+ */
120
+ os?: OS;
121
+ /**
122
+ * Current status of the server.
123
+ */
124
+ status: ServerStatus;
125
+ /**
126
+ * Date on which the server was created.
127
+ */
128
+ createdAt?: Date;
129
+ /**
130
+ * Date on which the server was last updated.
131
+ */
132
+ updatedAt?: Date;
133
+ /**
134
+ * Date from which the server can be deleted.
135
+ */
136
+ deletableAt?: Date;
137
+ /**
138
+ * Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise.
139
+ */
140
+ deletionScheduled: boolean;
141
+ /**
142
+ * Zone of the server.
143
+ */
144
+ zone: ScwZone;
145
+ /**
146
+ * Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status.
147
+ */
148
+ delivered: boolean;
149
+ /**
150
+ * Activation status of optional Private Network feature support for this server.
151
+ */
152
+ vpcStatus: ServerPrivateNetworkStatus;
153
+ /**
154
+ * Commitment scheme applied to this server.
155
+ */
156
+ commitment?: Commitment;
157
+ /**
158
+ * Public bandwidth configured for this server. Expressed in bits per second.
159
+ */
160
+ publicBandwidthBps: number;
72
161
  }
73
162
  export interface ConnectivityDiagnosticServerHealth {
74
163
  lastCheckinDate?: Date;
@@ -154,94 +243,48 @@ export interface ServerType {
154
243
  */
155
244
  defaultOs?: OS;
156
245
  }
157
- export interface Server {
158
- /**
159
- * UUID of the server.
160
- */
161
- id: string;
162
- /**
163
- * Type of the server.
164
- */
165
- type: string;
166
- /**
167
- * Name of the server.
168
- */
169
- name: string;
170
- /**
171
- * Project this server is associated with.
172
- */
173
- projectId: string;
174
- /**
175
- * Organization this server is associated with.
176
- */
177
- organizationId: string;
178
- /**
179
- * IPv4 address of the server.
180
- */
181
- ip: string;
182
- /**
183
- * Vnc:// URL to access Apple Remote Desktop.
184
- */
185
- vncUrl: string;
186
- /**
187
- * SSH Username for remote shell.
188
- */
189
- sshUsername: string;
190
- /**
191
- * Admin password required to execute commands.
192
- */
193
- sudoPassword: string;
194
- /**
195
- * VNC port to use for remote desktop connection.
196
- */
197
- vncPort: number;
198
- /**
199
- * Initially installed OS, this does not necessarily reflect the current OS version.
200
- */
201
- os?: OS;
202
- /**
203
- * Current status of the server.
204
- */
205
- status: ServerStatus;
246
+ export interface CommitmentTypeValue {
247
+ commitmentType: CommitmentType;
248
+ }
249
+ export type BatchCreateServersRequest = {
206
250
  /**
207
- * Date on which the server was created.
251
+ * Zone to target. If none is passed will use default zone from the config.
208
252
  */
209
- createdAt?: Date;
253
+ zone?: ScwZone;
210
254
  /**
211
- * Date on which the server was last updated.
255
+ * Create servers in the given project ID.
212
256
  */
213
- updatedAt?: Date;
257
+ projectId?: string;
214
258
  /**
215
- * Date from which the server can be deleted.
259
+ * Create servers of the given type.
216
260
  */
217
- deletableAt?: Date;
261
+ type: string;
218
262
  /**
219
- * Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise.
263
+ * Create servers & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time.
220
264
  */
221
- deletionScheduled: boolean;
265
+ osId?: string;
222
266
  /**
223
- * Zone of the server.
267
+ * Activate the Private Network feature for these servers. This feature is configured through the Apple Silicon - Private Networks API.
224
268
  */
225
- zone: ScwZone;
269
+ enableVpc: boolean;
226
270
  /**
227
- * Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status.
271
+ * Activate commitment for these servers. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type.
228
272
  */
229
- delivered: boolean;
273
+ commitmentType?: CommitmentType;
230
274
  /**
231
- * Activation status of optional Private Network feature support for this server.
275
+ * Public bandwidth to configure for these servers. This defaults to the minimum bandwidth for the corresponding server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
232
276
  */
233
- vpcStatus: ServerPrivateNetworkStatus;
277
+ publicBandwidthBps: number;
234
278
  /**
235
- * Commitment scheme applied to this server.
279
+ * List of servers to create.
236
280
  */
237
- commitment?: Commitment;
281
+ requests?: BatchCreateServersRequestBatchInnerCreateServerRequest[];
282
+ };
283
+ export interface BatchCreateServersResponse {
238
284
  /**
239
- * Public bandwidth configured for this server. Expressed in bits per second.
285
+ * List of created servers.
240
286
  */
241
- publicBandwidthBps: number;
242
- }
243
- export interface CommitmentTypeValue {
244
- commitmentType: CommitmentType;
287
+ servers: Server[];
245
288
  }
246
289
  export interface ConnectivityDiagnostic {
247
290
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-applesilicon",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Scaleway SDK applesilicon",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -26,17 +26,17 @@
26
26
  "directory": "packages_generated/applesilicon"
27
27
  },
28
28
  "engines": {
29
- "node": ">=20.19.1"
29
+ "node": ">=20.19.4"
30
30
  },
31
31
  "dependencies": {
32
- "@scaleway/random-name": "5.1.1",
33
- "@scaleway/sdk-std": "1.0.5"
32
+ "@scaleway/random-name": "5.1.2",
33
+ "@scaleway/sdk-std": "1.0.6"
34
34
  },
35
35
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.0"
36
+ "@scaleway/sdk-client": "^1.3.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.0"
39
+ "@scaleway/sdk-client": "^1.3.1"
40
40
  },
41
41
  "scripts": {
42
42
  "package:check": "pnpm publint",