@scaleway/sdk-baremetal 2.5.0 → 2.6.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.
@@ -2,416 +2,213 @@ import { SERVER_TRANSIENT_STATUSES } from "./content.gen.js";
2
2
  import { marshalAddOptionServerRequest, marshalBatchCreateServersRequest, marshalCreateServerRequest, marshalInstallServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalRebootServerRequest, marshalStartBMCAccessRequest, marshalStartServerRequest, marshalUpdateIPRequest, marshalUpdateServerRequest, marshalUpdateSettingRequest, marshalValidatePartitioningSchemaRequest, unmarshalBMCAccess, unmarshalBatchCreateServersResponse, unmarshalGetServerMetricsResponse, unmarshalIP, unmarshalListOSResponse, unmarshalListOffersResponse, unmarshalListOptionsResponse, unmarshalListServerEventsResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalListSettingsResponse, unmarshalOS, unmarshalOffer, unmarshalOption, unmarshalSchema, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalSetServerPrivateNetworksResponse, unmarshalSetting } from "./marshalling.gen.js";
3
3
  import { API as API$1, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
4
  //#region src/v1/api.gen.ts
5
- var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
6
6
  /**
7
7
  * Elastic Metal API.
8
8
 
9
9
  This API allows you to manage your Elastic Metal servers.
10
10
  */
11
11
  var API = class extends API$1 {
12
- /**
13
- * Locality of this API.
14
- * type {'zone','region','global','unspecified'}
15
- */
16
- static LOCALITY = toApiLocality({ zones: [
17
- "fr-par-1",
18
- "fr-par-2",
19
- "nl-ams-1",
20
- "nl-ams-2",
21
- "pl-waw-2",
22
- "pl-waw-3"
23
- ] });
24
- pageOfListServers = (request = {}) => this.client.fetch({
25
- method: "GET",
26
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
27
- urlParams: urlParams(["name", request.name], ["option_id", request.optionId], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["status", request.status], ["tags", request.tags])
28
- }, unmarshalListServersResponse);
29
- /**
30
- * List Elastic Metal servers for an Organization. List Elastic Metal servers for a specific Organization.
31
- *
32
- * @param request - The request {@link ListServersRequest}
33
- * @returns A Promise of ListServersResponse
34
- */
35
- listServers = (request = {}) => enrichForPagination("servers", this.pageOfListServers, request);
36
- /**
37
- * Get a specific Elastic Metal server. Get full details of an existing Elastic Metal server associated with the ID.
38
- *
39
- * @param request - The request {@link GetServerRequest}
40
- * @returns A Promise of Server
41
- */
42
- getServer = (request) => this.client.fetch({
43
- method: "GET",
44
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
45
- }, unmarshalServer);
46
- /**
47
- * Waits for {@link Server} to be in a final state.
48
- *
49
- * @param request - The request {@link GetServerRequest}
50
- * @param options - The waiting options
51
- * @returns A Promise of Server
52
- */
53
- waitForServer = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
54
- /**
55
- * Create an Elastic Metal server. Create a new Elastic Metal server. Once the server is created, proceed with the [installation of an OS](#post-3e949e).
56
- *
57
- * @param request - The request {@link CreateServerRequest}
58
- * @returns A Promise of Server
59
- */
60
- createServer = (request) => this.client.fetch({
61
- body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
62
- headers: jsonContentHeaders,
63
- method: "POST",
64
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`
65
- }, unmarshalServer);
66
- /**
67
- * Create multiple Elastic Metal servers. Create multiple new Elastic Metal servers. Once the servers are created, proceed with the [installation of an OS](#post-3e949e).
68
- *
69
- * @param request - The request {@link BatchCreateServersRequest}
70
- * @returns A Promise of BatchCreateServersResponse
71
- */
72
- batchCreateServers = (request = {}) => this.client.fetch({
73
- body: JSON.stringify(marshalBatchCreateServersRequest(request, this.client.settings)),
74
- headers: jsonContentHeaders,
75
- method: "POST",
76
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/batch-create-servers`
77
- }, unmarshalBatchCreateServersResponse);
78
- /**
79
- * Update an Elastic Metal server. Update the server associated with the ID. You can update parameters such as the server's name, tags, description and protection flag. Any parameters left null in the request body are not updated.
80
- *
81
- * @param request - The request {@link UpdateServerRequest}
82
- * @returns A Promise of Server
83
- */
84
- updateServer = (request) => this.client.fetch({
85
- body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
86
- headers: jsonContentHeaders,
87
- method: "PATCH",
88
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
89
- }, unmarshalServer);
90
- /**
91
- * Install an Elastic Metal server. Install an Operating System (OS) on the Elastic Metal server with a specific ID.
92
- *
93
- * @param request - The request {@link InstallServerRequest}
94
- * @returns A Promise of Server
95
- */
96
- installServer = async (request) => this.client.fetch({
97
- body: JSON.stringify(await marshalInstallServerRequest(request, this.client.settings)),
98
- headers: jsonContentHeaders,
99
- method: "POST",
100
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/install`
101
- }, unmarshalServer);
102
- /**
103
- * Return server metrics. Get the ping status of the server associated with the ID.
104
- *
105
- * @param request - The request {@link GetServerMetricsRequest}
106
- * @returns A Promise of GetServerMetricsResponse
107
- */
108
- getServerMetrics = (request) => this.client.fetch({
109
- method: "GET",
110
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/metrics`
111
- }, unmarshalGetServerMetricsResponse);
112
- /**
113
- * Delete an Elastic Metal server. Delete the server associated with the ID.
114
- *
115
- * @param request - The request {@link DeleteServerRequest}
116
- * @returns A Promise of Server
117
- */
118
- deleteServer = (request) => this.client.fetch({
119
- method: "DELETE",
120
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
121
- }, unmarshalServer);
122
- /**
123
- * Reboot an Elastic Metal server. Reboot the Elastic Metal server associated with the ID, use the `boot_type` `rescue` to reboot the server in rescue mode.
124
- *
125
- * @param request - The request {@link RebootServerRequest}
126
- * @returns A Promise of Server
127
- */
128
- rebootServer = (request) => this.client.fetch({
129
- body: JSON.stringify(marshalRebootServerRequest(request, this.client.settings)),
130
- headers: jsonContentHeaders,
131
- method: "POST",
132
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/reboot`
133
- }, unmarshalServer);
134
- /**
135
- * Start an Elastic Metal server. Start the server associated with the ID.
136
- *
137
- * @param request - The request {@link StartServerRequest}
138
- * @returns A Promise of Server
139
- */
140
- startServer = (request) => this.client.fetch({
141
- body: JSON.stringify(marshalStartServerRequest(request, this.client.settings)),
142
- headers: jsonContentHeaders,
143
- method: "POST",
144
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/start`
145
- }, unmarshalServer);
146
- /**
147
- * Stop an Elastic Metal server. Stop the server associated with the ID. The server remains allocated to your account and all data remains on the local storage of the server.
148
- *
149
- * @param request - The request {@link StopServerRequest}
150
- * @returns A Promise of Server
151
- */
152
- stopServer = (request) => this.client.fetch({
153
- body: "{}",
154
- headers: jsonContentHeaders,
155
- method: "POST",
156
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/stop`
157
- }, unmarshalServer);
158
- pageOfListServerEvents = (request) => this.client.fetch({
159
- method: "GET",
160
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/events`,
161
- urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
162
- }, unmarshalListServerEventsResponse);
163
- /**
164
- * List server events. List event (i.e. start/stop/reboot) associated to the server ID.
165
- *
166
- * @param request - The request {@link ListServerEventsRequest}
167
- * @returns A Promise of ListServerEventsResponse
168
- */
169
- listServerEvents = (request) => enrichForPagination("events", this.pageOfListServerEvents, request);
170
- /**
171
- * Get default partitioning schema. Get the default partitioning schema for the given offer ID and OS ID.
172
- *
173
- * @param request - The request {@link GetDefaultPartitioningSchemaRequest}
174
- * @returns A Promise of Schema
175
- */
176
- getDefaultPartitioningSchema = (request) => this.client.fetch({
177
- method: "GET",
178
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/default`,
179
- urlParams: urlParams(["offer_id", request.offerId], ["os_id", request.osId])
180
- }, unmarshalSchema);
181
- /**
182
- * Validate client partitioning schema. Validate the incoming partitioning schema from a user before installing the server. Return default ErrorCode if invalid.
183
- *
184
- * @param request - The request {@link ValidatePartitioningSchemaRequest}
185
- */
186
- validatePartitioningSchema = (request) => this.client.fetch({
187
- body: JSON.stringify(marshalValidatePartitioningSchemaRequest(request, this.client.settings)),
188
- headers: jsonContentHeaders,
189
- method: "POST",
190
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
191
- });
192
- /**
193
- * Start BMC access. Start BMC (Baseboard Management Controller) access associated with the ID.
194
- The BMC (Baseboard Management Controller) access is available one hour after the installation of the server.
195
- You need first to create an option Remote Access. You will find the ID and the price with a call to listOffers (https://developers.scaleway.com/en/products/baremetal/api/#get-78db92). Then add the option https://developers.scaleway.com/en/products/baremetal/api/#post-b14abd.
196
- After adding the BMC option, you need to Get Remote Access to get the login/password https://developers.scaleway.com/en/products/baremetal/api/#get-cefc0f. Do not forget to delete the Option after use.
197
- *
198
- * @param request - The request {@link StartBMCAccessRequest}
199
- * @returns A Promise of BMCAccess
200
- */
201
- startBMCAccess = (request) => this.client.fetch({
202
- body: JSON.stringify(marshalStartBMCAccessRequest(request, this.client.settings)),
203
- headers: jsonContentHeaders,
204
- method: "POST",
205
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
206
- }, unmarshalBMCAccess);
207
- /**
208
- * Get BMC access. Get the BMC (Baseboard Management Controller) access associated with the ID, including the URL and login information needed to connect.
209
- *
210
- * @param request - The request {@link GetBMCAccessRequest}
211
- * @returns A Promise of BMCAccess
212
- */
213
- getBMCAccess = (request) => this.client.fetch({
214
- method: "GET",
215
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
216
- }, unmarshalBMCAccess);
217
- /**
218
- * Stop BMC access. Stop BMC (Baseboard Management Controller) access associated with the ID.
219
- *
220
- * @param request - The request {@link StopBMCAccessRequest}
221
- */
222
- stopBMCAccess = (request) => this.client.fetch({
223
- method: "DELETE",
224
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
225
- });
226
- /**
227
- * Update IP. Configure the IP address associated with the server ID and IP ID. You can use this method to set a reverse DNS for an IP address.
228
- *
229
- * @param request - The request {@link UpdateIPRequest}
230
- * @returns A Promise of IP
231
- */
232
- updateIP = (request) => this.client.fetch({
233
- body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
234
- headers: jsonContentHeaders,
235
- method: "PATCH",
236
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/ips/${validatePathParam("ipId", request.ipId)}`
237
- }, unmarshalIP);
238
- /**
239
- * Add server option. Add an option, such as Private Networks, to a specific server.
240
- *
241
- * @param request - The request {@link AddOptionServerRequest}
242
- * @returns A Promise of Server
243
- */
244
- addOptionServer = (request) => this.client.fetch({
245
- body: JSON.stringify(marshalAddOptionServerRequest(request, this.client.settings)),
246
- headers: jsonContentHeaders,
247
- method: "POST",
248
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/options/${validatePathParam("optionId", request.optionId)}`
249
- }, unmarshalServer);
250
- /**
251
- * Delete server option. Delete an option from a specific server.
252
- *
253
- * @param request - The request {@link DeleteOptionServerRequest}
254
- * @returns A Promise of Server
255
- */
256
- deleteOptionServer = (request) => this.client.fetch({
257
- method: "DELETE",
258
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/options/${validatePathParam("optionId", request.optionId)}`
259
- }, unmarshalServer);
260
- /**
261
- * Migrate server offer. Migrate server with hourly offer to monthly offer.
262
- *
263
- * @param request - The request {@link MigrateServerToMonthlyOfferRequest}
264
- * @returns A Promise of Server
265
- */
266
- migrateServerToMonthlyOffer = (request) => this.client.fetch({
267
- method: "POST",
268
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/migrate-offer-monthly`
269
- }, unmarshalServer);
270
- pageOfListOffers = (request = {}) => this.client.fetch({
271
- method: "GET",
272
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers`,
273
- urlParams: urlParams(["name", request.name], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["subscription_period", request.subscriptionPeriod])
274
- }, unmarshalListOffersResponse);
275
- /**
276
- * List offers. List all available Elastic Metal server configurations.
277
- *
278
- * @param request - The request {@link ListOffersRequest}
279
- * @returns A Promise of ListOffersResponse
280
- */
281
- listOffers = (request = {}) => enrichForPagination("offers", this.pageOfListOffers, request);
282
- /**
283
- * Get offer. Get details of an offer identified by its offer ID.
284
- *
285
- * @param request - The request {@link GetOfferRequest}
286
- * @returns A Promise of Offer
287
- */
288
- getOffer = (request) => this.client.fetch({
289
- method: "GET",
290
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam("offerId", request.offerId)}`
291
- }, unmarshalOffer);
292
- /**
293
- * Get option. Return specific option for the ID.
294
- *
295
- * @param request - The request {@link GetOptionRequest}
296
- * @returns A Promise of Option
297
- */
298
- getOption = (request) => this.client.fetch({
299
- method: "GET",
300
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam("optionId", request.optionId)}`
301
- }, unmarshalOption);
302
- pageOfListOptions = (request = {}) => this.client.fetch({
303
- method: "GET",
304
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options`,
305
- urlParams: urlParams(["name", request.name], ["offer_id", request.offerId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
306
- }, unmarshalListOptionsResponse);
307
- /**
308
- * List options. List all options matching with filters.
309
- *
310
- * @param request - The request {@link ListOptionsRequest}
311
- * @returns A Promise of ListOptionsResponse
312
- */
313
- listOptions = (request = {}) => enrichForPagination("options", this.pageOfListOptions, request);
314
- pageOfListSettings = (request = {}) => this.client.fetch({
315
- method: "GET",
316
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings`,
317
- urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
318
- }, unmarshalListSettingsResponse);
319
- /**
320
- * List all settings. Return all settings for a Project ID.
321
- *
322
- * @param request - The request {@link ListSettingsRequest}
323
- * @returns A Promise of ListSettingsResponse
324
- */
325
- listSettings = (request = {}) => enrichForPagination("settings", this.pageOfListSettings, request);
326
- /**
327
- * Update setting. Update a setting for a Project ID (enable or disable).
328
- *
329
- * @param request - The request {@link UpdateSettingRequest}
330
- * @returns A Promise of Setting
331
- */
332
- updateSetting = (request) => this.client.fetch({
333
- body: JSON.stringify(marshalUpdateSettingRequest(request, this.client.settings)),
334
- headers: jsonContentHeaders,
335
- method: "PATCH",
336
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam("settingId", request.settingId)}`
337
- }, unmarshalSetting);
338
- pageOfListOS = (request = {}) => this.client.fetch({
339
- method: "GET",
340
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os`,
341
- urlParams: urlParams(["offer_id", request.offerId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
342
- }, unmarshalListOSResponse);
343
- /**
344
- * List available OSes. List all OSes that are available for installation on Elastic Metal servers.
345
- *
346
- * @param request - The request {@link ListOSRequest}
347
- * @returns A Promise of ListOSResponse
348
- */
349
- listOS = (request = {}) => enrichForPagination("os", this.pageOfListOS, request);
350
- /**
351
- * Get OS with an ID. Return the specific OS for the ID.
352
- *
353
- * @param request - The request {@link GetOSRequest}
354
- * @returns A Promise of OS
355
- */
356
- getOS = (request) => this.client.fetch({
357
- method: "GET",
358
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam("osId", request.osId)}`
359
- }, unmarshalOS);
12
+ constructor(..._args) {
13
+ super(..._args);
14
+ this.pageOfListServers = (request = {}) => this.client.fetch({
15
+ method: "GET",
16
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
17
+ urlParams: urlParams(["name", request.name], ["option_id", request.optionId], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["status", request.status], ["tags", request.tags])
18
+ }, unmarshalListServersResponse);
19
+ this.listServers = (request = {}) => enrichForPagination("servers", this.pageOfListServers, request);
20
+ this.getServer = (request) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
23
+ }, unmarshalServer);
24
+ this.waitForServer = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
25
+ this.createServer = (request) => this.client.fetch({
26
+ body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
27
+ headers: jsonContentHeaders,
28
+ method: "POST",
29
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`
30
+ }, unmarshalServer);
31
+ this.batchCreateServers = (request = {}) => this.client.fetch({
32
+ body: JSON.stringify(marshalBatchCreateServersRequest(request, this.client.settings)),
33
+ headers: jsonContentHeaders,
34
+ method: "POST",
35
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/batch-create-servers`
36
+ }, unmarshalBatchCreateServersResponse);
37
+ this.updateServer = (request) => this.client.fetch({
38
+ body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
39
+ headers: jsonContentHeaders,
40
+ method: "PATCH",
41
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
42
+ }, unmarshalServer);
43
+ this.installServer = async (request) => this.client.fetch({
44
+ body: JSON.stringify(await marshalInstallServerRequest(request, this.client.settings)),
45
+ headers: jsonContentHeaders,
46
+ method: "POST",
47
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/install`
48
+ }, unmarshalServer);
49
+ this.getServerMetrics = (request) => this.client.fetch({
50
+ method: "GET",
51
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/metrics`
52
+ }, unmarshalGetServerMetricsResponse);
53
+ this.deleteServer = (request) => this.client.fetch({
54
+ method: "DELETE",
55
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
56
+ }, unmarshalServer);
57
+ this.rebootServer = (request) => this.client.fetch({
58
+ body: JSON.stringify(marshalRebootServerRequest(request, this.client.settings)),
59
+ headers: jsonContentHeaders,
60
+ method: "POST",
61
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/reboot`
62
+ }, unmarshalServer);
63
+ this.startServer = (request) => this.client.fetch({
64
+ body: JSON.stringify(marshalStartServerRequest(request, this.client.settings)),
65
+ headers: jsonContentHeaders,
66
+ method: "POST",
67
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/start`
68
+ }, unmarshalServer);
69
+ this.stopServer = (request) => this.client.fetch({
70
+ body: "{}",
71
+ headers: jsonContentHeaders,
72
+ method: "POST",
73
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/stop`
74
+ }, unmarshalServer);
75
+ this.pageOfListServerEvents = (request) => this.client.fetch({
76
+ method: "GET",
77
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/events`,
78
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
79
+ }, unmarshalListServerEventsResponse);
80
+ this.listServerEvents = (request) => enrichForPagination("events", this.pageOfListServerEvents, request);
81
+ this.getDefaultPartitioningSchema = (request) => this.client.fetch({
82
+ method: "GET",
83
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/default`,
84
+ urlParams: urlParams(["offer_id", request.offerId], ["os_id", request.osId])
85
+ }, unmarshalSchema);
86
+ this.validatePartitioningSchema = (request) => this.client.fetch({
87
+ body: JSON.stringify(marshalValidatePartitioningSchemaRequest(request, this.client.settings)),
88
+ headers: jsonContentHeaders,
89
+ method: "POST",
90
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
91
+ });
92
+ this.startBMCAccess = (request) => this.client.fetch({
93
+ body: JSON.stringify(marshalStartBMCAccessRequest(request, this.client.settings)),
94
+ headers: jsonContentHeaders,
95
+ method: "POST",
96
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
97
+ }, unmarshalBMCAccess);
98
+ this.getBMCAccess = (request) => this.client.fetch({
99
+ method: "GET",
100
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
101
+ }, unmarshalBMCAccess);
102
+ this.stopBMCAccess = (request) => this.client.fetch({
103
+ method: "DELETE",
104
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/bmc-access`
105
+ });
106
+ this.updateIP = (request) => this.client.fetch({
107
+ body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
108
+ headers: jsonContentHeaders,
109
+ method: "PATCH",
110
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/ips/${validatePathParam("ipId", request.ipId)}`
111
+ }, unmarshalIP);
112
+ this.addOptionServer = (request) => this.client.fetch({
113
+ body: JSON.stringify(marshalAddOptionServerRequest(request, this.client.settings)),
114
+ headers: jsonContentHeaders,
115
+ method: "POST",
116
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/options/${validatePathParam("optionId", request.optionId)}`
117
+ }, unmarshalServer);
118
+ this.deleteOptionServer = (request) => this.client.fetch({
119
+ method: "DELETE",
120
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/options/${validatePathParam("optionId", request.optionId)}`
121
+ }, unmarshalServer);
122
+ this.migrateServerToMonthlyOffer = (request) => this.client.fetch({
123
+ method: "POST",
124
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/migrate-offer-monthly`
125
+ }, unmarshalServer);
126
+ this.pageOfListOffers = (request = {}) => this.client.fetch({
127
+ method: "GET",
128
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers`,
129
+ urlParams: urlParams(["name", request.name], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["subscription_period", request.subscriptionPeriod])
130
+ }, unmarshalListOffersResponse);
131
+ this.listOffers = (request = {}) => enrichForPagination("offers", this.pageOfListOffers, request);
132
+ this.getOffer = (request) => this.client.fetch({
133
+ method: "GET",
134
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam("offerId", request.offerId)}`
135
+ }, unmarshalOffer);
136
+ this.getOption = (request) => this.client.fetch({
137
+ method: "GET",
138
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam("optionId", request.optionId)}`
139
+ }, unmarshalOption);
140
+ this.pageOfListOptions = (request = {}) => this.client.fetch({
141
+ method: "GET",
142
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options`,
143
+ urlParams: urlParams(["name", request.name], ["offer_id", request.offerId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
144
+ }, unmarshalListOptionsResponse);
145
+ this.listOptions = (request = {}) => enrichForPagination("options", this.pageOfListOptions, request);
146
+ this.pageOfListSettings = (request = {}) => this.client.fetch({
147
+ method: "GET",
148
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings`,
149
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
150
+ }, unmarshalListSettingsResponse);
151
+ this.listSettings = (request = {}) => enrichForPagination("settings", this.pageOfListSettings, request);
152
+ this.updateSetting = (request) => this.client.fetch({
153
+ body: JSON.stringify(marshalUpdateSettingRequest(request, this.client.settings)),
154
+ headers: jsonContentHeaders,
155
+ method: "PATCH",
156
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam("settingId", request.settingId)}`
157
+ }, unmarshalSetting);
158
+ this.pageOfListOS = (request = {}) => this.client.fetch({
159
+ method: "GET",
160
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os`,
161
+ urlParams: urlParams(["offer_id", request.offerId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
162
+ }, unmarshalListOSResponse);
163
+ this.listOS = (request = {}) => enrichForPagination("os", this.pageOfListOS, request);
164
+ this.getOS = (request) => this.client.fetch({
165
+ method: "GET",
166
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam("osId", request.osId)}`
167
+ }, unmarshalOS);
168
+ }
169
+ static {
170
+ this.LOCALITY = toApiLocality({ zones: [
171
+ "fr-par-1",
172
+ "fr-par-2",
173
+ "nl-ams-1",
174
+ "nl-ams-2",
175
+ "pl-waw-2",
176
+ "pl-waw-3"
177
+ ] });
178
+ }
360
179
  };
361
180
  /**
362
181
  * Elastic Metal - Private Network API.
363
182
  */
364
183
  var PrivateNetworkAPI = class extends API$1 {
365
- /**
366
- * Locality of this API.
367
- * type {'zone','region','global','unspecified'}
368
- */
369
- static LOCALITY = toApiLocality({ zones: ["fr-par-2"] });
370
- /**
371
- * Add a server to a Private Network.
372
- *
373
- * @param request - The request {@link PrivateNetworkApiAddServerPrivateNetworkRequest}
374
- * @returns A Promise of ServerPrivateNetwork
375
- */
376
- addServerPrivateNetwork = (request) => this.client.fetch({
377
- body: JSON.stringify(marshalPrivateNetworkApiAddServerPrivateNetworkRequest(request, this.client.settings)),
378
- headers: jsonContentHeaders,
379
- method: "POST",
380
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks`
381
- }, unmarshalServerPrivateNetwork);
382
- /**
383
- * Set multiple Private Networks on a server.
384
- *
385
- * @param request - The request {@link PrivateNetworkApiSetServerPrivateNetworksRequest}
386
- * @returns A Promise of SetServerPrivateNetworksResponse
387
- */
388
- setServerPrivateNetworks = (request) => this.client.fetch({
389
- body: JSON.stringify(marshalPrivateNetworkApiSetServerPrivateNetworksRequest(request, this.client.settings)),
390
- headers: jsonContentHeaders,
391
- method: "PUT",
392
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks`
393
- }, unmarshalSetServerPrivateNetworksResponse);
394
- pageOfListServerPrivateNetworks = (request = {}) => this.client.fetch({
395
- method: "GET",
396
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/server-private-networks`,
397
- urlParams: urlParams(["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["private_network_id", request.privateNetworkId], ["project_id", request.projectId], ["server_id", request.serverId])
398
- }, unmarshalListServerPrivateNetworksResponse);
399
- /**
400
- * List the Private Networks of a server.
401
- *
402
- * @param request - The request {@link PrivateNetworkApiListServerPrivateNetworksRequest}
403
- * @returns A Promise of ListServerPrivateNetworksResponse
404
- */
405
- listServerPrivateNetworks = (request = {}) => enrichForPagination("serverPrivateNetworks", this.pageOfListServerPrivateNetworks, request);
406
- /**
407
- * Delete a Private Network.
408
- *
409
- * @param request - The request {@link PrivateNetworkApiDeleteServerPrivateNetworkRequest}
410
- */
411
- deleteServerPrivateNetwork = (request) => this.client.fetch({
412
- method: "DELETE",
413
- path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}`
414
- });
184
+ constructor(..._args2) {
185
+ super(..._args2);
186
+ this.addServerPrivateNetwork = (request) => this.client.fetch({
187
+ body: JSON.stringify(marshalPrivateNetworkApiAddServerPrivateNetworkRequest(request, this.client.settings)),
188
+ headers: jsonContentHeaders,
189
+ method: "POST",
190
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks`
191
+ }, unmarshalServerPrivateNetwork);
192
+ this.setServerPrivateNetworks = (request) => this.client.fetch({
193
+ body: JSON.stringify(marshalPrivateNetworkApiSetServerPrivateNetworksRequest(request, this.client.settings)),
194
+ headers: jsonContentHeaders,
195
+ method: "PUT",
196
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks`
197
+ }, unmarshalSetServerPrivateNetworksResponse);
198
+ this.pageOfListServerPrivateNetworks = (request = {}) => this.client.fetch({
199
+ method: "GET",
200
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/server-private-networks`,
201
+ urlParams: urlParams(["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["private_network_id", request.privateNetworkId], ["project_id", request.projectId], ["server_id", request.serverId])
202
+ }, unmarshalListServerPrivateNetworksResponse);
203
+ this.listServerPrivateNetworks = (request = {}) => enrichForPagination("serverPrivateNetworks", this.pageOfListServerPrivateNetworks, request);
204
+ this.deleteServerPrivateNetwork = (request) => this.client.fetch({
205
+ method: "DELETE",
206
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}`
207
+ });
208
+ }
209
+ static {
210
+ this.LOCALITY = toApiLocality({ zones: ["fr-par-2"] });
211
+ }
415
212
  };
416
213
  //#endregion
417
214
  export { API, PrivateNetworkAPI };