@@ -26,6 +26,14 @@ func GetGeneratedCommands() *core.Commands {
26
26
baremetalBmc (),
27
27
baremetalOffer (),
28
28
baremetalServerList (),
29
+ baremetalServerGet (),
30
+ baremetalServerCreate (),
31
+ baremetalServerUpdate (),
32
+ baremetalServerInstall (),
33
+ baremetalServerDelete (),
34
+ baremetalServerReboot (),
35
+ baremetalServerStart (),
36
+ baremetalServerStop (),
29
37
)
30
38
}
31
39
func baremetalRoot () * core.Command {
@@ -142,3 +150,271 @@ func baremetalServerList() *core.Command {
142
150
},
143
151
}
144
152
}
153
+
154
+ func baremetalServerGet () * core.Command {
155
+ return & core.Command {
156
+ Short : `Get server` ,
157
+ Long : `Get the server associated with the given ID.` ,
158
+ Namespace : "baremetal" ,
159
+ Resource : "server" ,
160
+ Verb : "get" ,
161
+ ArgsType : reflect .TypeOf (baremetal.GetServerRequest {}),
162
+ ArgSpecs : core.ArgSpecs {
163
+ {
164
+ Name : "server-id" ,
165
+ Short : `ID of the server` ,
166
+ Required : true ,
167
+ },
168
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
169
+ },
170
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
171
+ request := args .(* baremetal.GetServerRequest )
172
+
173
+ client := core .ExtractClient (ctx )
174
+ api := baremetal .NewAPI (client )
175
+ return api .GetServer (request )
176
+
177
+ },
178
+ }
179
+ }
180
+
181
+ func baremetalServerCreate () * core.Command {
182
+ return & core.Command {
183
+ Short : `Create server` ,
184
+ Long : `Create a new server. Once the server is created, you probably want to install an OS.` ,
185
+ Namespace : "baremetal" ,
186
+ Resource : "server" ,
187
+ Verb : "create" ,
188
+ ArgsType : reflect .TypeOf (baremetal.CreateServerRequest {}),
189
+ ArgSpecs : core.ArgSpecs {
190
+ {
191
+ Name : "offer-id" ,
192
+ Short : `Offer ID of the new server` ,
193
+ Required : true ,
194
+ },
195
+ {
196
+ Name : "name" ,
197
+ Short : `Name of the server (≠hostname)` ,
198
+ Required : true ,
199
+ },
200
+ {
201
+ Name : "description" ,
202
+ Short : `Description associated to the server, max 255 characters` ,
203
+ Required : true ,
204
+ },
205
+ {
206
+ Name : "tags.{index}" ,
207
+ Short : `Tags to associate to the server` ,
208
+ Required : false ,
209
+ },
210
+ core .OrganizationIDArgSpec (),
211
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
212
+ },
213
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
214
+ request := args .(* baremetal.CreateServerRequest )
215
+
216
+ client := core .ExtractClient (ctx )
217
+ api := baremetal .NewAPI (client )
218
+ return api .CreateServer (request )
219
+
220
+ },
221
+ }
222
+ }
223
+
224
+ func baremetalServerUpdate () * core.Command {
225
+ return & core.Command {
226
+ Short : `Update server` ,
227
+ Long : `Update the server associated with the given ID.` ,
228
+ Namespace : "baremetal" ,
229
+ Resource : "server" ,
230
+ Verb : "update" ,
231
+ ArgsType : reflect .TypeOf (baremetal.UpdateServerRequest {}),
232
+ ArgSpecs : core.ArgSpecs {
233
+ {
234
+ Name : "server-id" ,
235
+ Short : `ID of the server to update` ,
236
+ Required : true ,
237
+ },
238
+ {
239
+ Name : "name" ,
240
+ Short : `Name of the server (≠hostname), not updated if null` ,
241
+ Required : false ,
242
+ },
243
+ {
244
+ Name : "description" ,
245
+ Short : `Description associated to the server, max 255 characters, not updated if null` ,
246
+ Required : false ,
247
+ },
248
+ {
249
+ Name : "tags" ,
250
+ Short : `Tags associated to the server, not updated if null` ,
251
+ Required : false ,
252
+ },
253
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
254
+ },
255
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
256
+ request := args .(* baremetal.UpdateServerRequest )
257
+
258
+ client := core .ExtractClient (ctx )
259
+ api := baremetal .NewAPI (client )
260
+ return api .UpdateServer (request )
261
+
262
+ },
263
+ }
264
+ }
265
+
266
+ func baremetalServerInstall () * core.Command {
267
+ return & core.Command {
268
+ Short : `Install server` ,
269
+ Long : `Install an OS on the server associated with the given ID.` ,
270
+ Namespace : "baremetal" ,
271
+ Resource : "server" ,
272
+ Verb : "install" ,
273
+ ArgsType : reflect .TypeOf (baremetal.InstallServerRequest {}),
274
+ ArgSpecs : core.ArgSpecs {
275
+ {
276
+ Name : "server-id" ,
277
+ Short : `Server ID to install` ,
278
+ Required : true ,
279
+ },
280
+ {
281
+ Name : "os-id" ,
282
+ Short : `ID of the OS to install on the server` ,
283
+ Required : true ,
284
+ },
285
+ {
286
+ Name : "hostname" ,
287
+ Short : `Hostname of the server` ,
288
+ Required : true ,
289
+ },
290
+ {
291
+ Name : "ssh-key-ids.{index}" ,
292
+ Short : `SSH key IDs authorized on the server` ,
293
+ Required : true ,
294
+ },
295
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
296
+ },
297
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
298
+ request := args .(* baremetal.InstallServerRequest )
299
+
300
+ client := core .ExtractClient (ctx )
301
+ api := baremetal .NewAPI (client )
302
+ return api .InstallServer (request )
303
+
304
+ },
305
+ }
306
+ }
307
+
308
+ func baremetalServerDelete () * core.Command {
309
+ return & core.Command {
310
+ Short : `Delete server` ,
311
+ Long : `Delete the server associated with the given ID.` ,
312
+ Namespace : "baremetal" ,
313
+ Resource : "server" ,
314
+ Verb : "delete" ,
315
+ ArgsType : reflect .TypeOf (baremetal.DeleteServerRequest {}),
316
+ ArgSpecs : core.ArgSpecs {
317
+ {
318
+ Name : "server-id" ,
319
+ Short : `ID of the server to delete` ,
320
+ Required : true ,
321
+ },
322
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
323
+ },
324
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
325
+ request := args .(* baremetal.DeleteServerRequest )
326
+
327
+ client := core .ExtractClient (ctx )
328
+ api := baremetal .NewAPI (client )
329
+ return api .DeleteServer (request )
330
+
331
+ },
332
+ }
333
+ }
334
+
335
+ func baremetalServerReboot () * core.Command {
336
+ return & core.Command {
337
+ Short : `Reboot server` ,
338
+ Long : `Reboot the server associated with the given ID, use boot param to reboot in rescue.` ,
339
+ Namespace : "baremetal" ,
340
+ Resource : "server" ,
341
+ Verb : "reboot" ,
342
+ ArgsType : reflect .TypeOf (baremetal.RebootServerRequest {}),
343
+ ArgSpecs : core.ArgSpecs {
344
+ {
345
+ Name : "server-id" ,
346
+ Short : `ID of the server to reboot` ,
347
+ Required : true ,
348
+ },
349
+ {
350
+ Name : "boot-type" ,
351
+ Short : `The type of boot` ,
352
+ Required : false ,
353
+ EnumValues : []string {"normal" , "rescue" },
354
+ },
355
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
356
+ },
357
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
358
+ request := args .(* baremetal.RebootServerRequest )
359
+
360
+ client := core .ExtractClient (ctx )
361
+ api := baremetal .NewAPI (client )
362
+ return api .RebootServer (request )
363
+
364
+ },
365
+ }
366
+ }
367
+
368
+ func baremetalServerStart () * core.Command {
369
+ return & core.Command {
370
+ Short : `Start server` ,
371
+ Long : `Start the server associated with the given ID.` ,
372
+ Namespace : "baremetal" ,
373
+ Resource : "server" ,
374
+ Verb : "start" ,
375
+ ArgsType : reflect .TypeOf (baremetal.StartServerRequest {}),
376
+ ArgSpecs : core.ArgSpecs {
377
+ {
378
+ Name : "server-id" ,
379
+ Short : `ID of the server to start` ,
380
+ Required : true ,
381
+ },
382
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
383
+ },
384
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
385
+ request := args .(* baremetal.StartServerRequest )
386
+
387
+ client := core .ExtractClient (ctx )
388
+ api := baremetal .NewAPI (client )
389
+ return api .StartServer (request )
390
+
391
+ },
392
+ }
393
+ }
394
+
395
+ func baremetalServerStop () * core.Command {
396
+ return & core.Command {
397
+ Short : `Stop server` ,
398
+ Long : `Stop the server associated with the given ID.` ,
399
+ Namespace : "baremetal" ,
400
+ Resource : "server" ,
401
+ Verb : "stop" ,
402
+ ArgsType : reflect .TypeOf (baremetal.StopServerRequest {}),
403
+ ArgSpecs : core.ArgSpecs {
404
+ {
405
+ Name : "server-id" ,
406
+ Short : `ID of the server to stop` ,
407
+ Required : true ,
408
+ },
409
+ core .ZoneArgSpec (scw .ZoneFrPar2 ),
410
+ },
411
+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
412
+ request := args .(* baremetal.StopServerRequest )
413
+
414
+ client := core .ExtractClient (ctx )
415
+ api := baremetal .NewAPI (client )
416
+ return api .StopServer (request )
417
+
418
+ },
419
+ }
420
+ }
0 commit comments