/
enums.go
477 lines (416 loc) · 8.13 KB
/
enums.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
package goproxmox
import "fmt"
type Bios int
const (
BIOS_SeaBIOS Bios = 1 + iota
BIOS_OVMF
)
var biosValues = [...]string{
"seabios",
"ovmf",
}
// String returns the name of the Bios.
func (m Bios) String() string { return biosValues[m-1] }
func BiosFromString(s string) (Bios, error) {
for i, v := range biosValues {
if s == v {
return Bios(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to Bios values", s)
}
type BootDevice int
const (
BOOT_Floppy BootDevice = 1 + iota
BOOT_HardDisk
BOOT_CDROM
BOOT_Network
)
var bootDeviceValues = [...]string{
"a",
"c",
"d",
"n",
}
// String returns the name of the BootDevice.
func (m BootDevice) String() string { return bootDeviceValues[m-1] }
func BootDeviceFromString(s string) (BootDevice, error) {
for i, v := range bootDeviceValues {
if s == v {
return BootDevice(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to BootDevice values", s)
}
type CPUType int
const (
CPU_486 CPUType = 1 + iota
CPU_Broadwell
CPU_Broadwell_noTSX
CPU_Conroe
CPU_Haswell
CPU_Haswell_noTSX
CPU_IvyBridge
CPU_Nehalem
CPU_Opteron_G1
CPU_Opteron_G2
CPU_Opteron_G3
CPU_Opteron_G4
CPU_Opteron_G5
CPU_Penryn
CPU_SandyBridge
CPU_Skylake_Client
CPU_Westmere
CPU_Athlon
CPU_Core2duo
CPU_CoreDuo
CPU_HOST
CPU_KVM32
CPU_KVM64
CPU_Pentium
CPU_Pentium2
CPU_Pentium3
CPU_Phenom
CPU_Qemu32
CPU_Qemu64
)
var cpuTypeValues = [...]string{
"486",
"Broadwell",
"Broadwell-noTSX",
"Conroe",
"Haswell",
"Haswell-noTSX",
"IvyBridge",
"Nehalem",
"Opteron_G1",
"Opteron_G2",
"Opteron_G3",
"Opteron_G4",
"Opteron_G5",
"Penryn",
"SandyBridge",
"Skylake-Client",
"Westmere",
"athlon",
"core2duo",
"coreduo",
"host",
"kvm32",
"kvm64",
"pentium",
"pentium2",
"pentium3",
"phenom",
"qemu32",
"qemu64",
}
// String returns the name of the CPUType.
func (m CPUType) String() string { return cpuTypeValues[m-1] }
func CPUTypeFromString(s string) (CPUType, error) {
for i, v := range bootDeviceValues {
if s == v {
return CPUType(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to CPUType values", s)
}
type HugePages int
const (
HugePages_1024 HugePages = 1 + iota
HugePages_2
HugePages_ANY
)
var hugePagesValues = [...]string{
"1024",
"2",
"any",
}
// String returns the name of the HugePages.
func (m HugePages) String() string { return hugePagesValues[m-1] }
func HugePagesFromString(s string) (HugePages, error) {
for i, v := range bootDeviceValues {
if s == v {
return HugePages(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to HugePages values", s)
}
type KeyboardLayout int
const (
KeyboardLayout_DA KeyboardLayout = 1 + iota
KeyboardLayout_DE
KeyboardLayout_DE_CH
KeyboardLayout_EN_GB
KeyboardLayout_EN_US
KeyboardLayout_ES
KeyboardLayout_FI
KeyboardLayout_FR
KeyboardLayout_FR_BE
KeyboardLayout_FR_CA
KeyboardLayout_FR_CH
KeyboardLayout_HU
KeyboardLayout_IS
KeyboardLayout_IT
KeyboardLayout_JA
KeyboardLayout_LT
KeyboardLayout_MK
KeyboardLayout_NL
KeyboardLayout_NO
KeyboardLayout_PL
KeyboardLayout_PT
KeyboardLayout_PT_BR
KeyboardLayout_SL
KeyboardLayout_SV
KeyboardLayout_TR
)
var keyboardLayoutValues = [...]string{
"da",
"de",
"de-ch",
"en-gb",
"en-us",
"es",
"fi",
"fr",
"fr-be",
"fr-ca",
"fr-ch",
"hu",
"is",
"it",
"ja",
"lt",
"mk",
"nl",
"no",
"pl",
"pt",
"pt-br",
"sl",
"sv",
"tr",
}
// String returns the name of the KeyboardLayout.
func (m KeyboardLayout) String() string { return keyboardLayoutValues[m-1] }
func KeyboardLayoutFromString(s string) (KeyboardLayout, error) {
for i, v := range bootDeviceValues {
if s == v {
return KeyboardLayout(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to KeyboardLayout values", s)
}
type Lock int
const (
Lock_Migrate Lock = 1 + iota
Lock_Backup
Lock_Snapshot
Lock_Rollback
)
var lockValues = [...]string{
"migrate",
"backup",
"snapshot",
"rollback",
}
// String returns the name of the Lock.
func (m Lock) String() string { return lockValues[m-1] }
func LockFromString(s string) (Lock, error) {
for i, v := range bootDeviceValues {
if s == v {
return Lock(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to Lock values", s)
}
type OSType int
const (
OS_Unspecified OSType = 1 + iota
OS_WindowsXP
OS_Windows2000
OS_Windows2003
OS_Windows2008
OS_WindowsVista
OS_Windows7
OS_Windows8_2012
OS_Linux24
OS_Linux26_3X
OS_Solaris
)
var osTypeValues = [...]string{
"other",
"wxp",
"w2k",
"w2k3",
"w2k8",
"wvista",
"win7",
"win8",
"l24",
"l26",
"solaris",
}
// String returns the name of the OSType.
func (m OSType) String() string { return osTypeValues[m-1] }
func OSTypeFromString(s string) (OSType, error) {
for i, v := range bootDeviceValues {
if s == v {
return OSType(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to OSType values", s)
}
type SCSIControllerType int
const (
SCSI_LSI SCSIControllerType = 1 + iota
SCSI_LSI53C810
SCSI_VirtIO_SCSI_PCI
SCSI_VirtIO_SCSI_SINGLE
SCSI_MEGASAS
SCSI_PVSCSI
)
var scsiControllerTypeValues = [...]string{
"lsi",
"lsi53c810",
"virtio-scsi-pci",
"virtio-scsi-single",
"megasas",
"pvscsi",
}
// String returns the name of the SCSIControllerType.
func (m SCSIControllerType) String() string { return scsiControllerTypeValues[m-1] }
func SCSIControllerTypeFromString(s string) (SCSIControllerType, error) {
for i, v := range bootDeviceValues {
if s == v {
return SCSIControllerType(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to SCSIControllerType values", s)
}
type VGAType int
const (
VGA_Cirrus VGAType = 1 + iota
VGA_QXL
VGA_QXL2
VGA_QXL3
VGA_QXL4
VGA_Serial0
VGA_Serial1
VGA_Serial2
VGA_Serial3
VGA_std
VGA_VMWare
)
var vgaTypeValues = [...]string{
"cirrus",
"qxl",
"qxl2",
"qxl3",
"qxl4",
"serial0",
"serial1",
"serial2",
"serial3",
"std",
"vmware",
}
// String returns the name of the VGAType.
func (m VGAType) String() string { return vgaTypeValues[m-1] }
func VGATypeFromString(s string) (VGAType, error) {
for i, v := range bootDeviceValues {
if s == v {
return VGAType(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to VGAType values", s)
}
type NetworkCardModel int
const (
NetworkCard_E1000 NetworkCardModel = 1 + iota
NetworkCard_E1000_82540em
NetworkCard_E1000_82544gc
NetworkCard_E1000_82545em
NetworkCard_I82551
NetworkCard_I82557b
NetworkCard_I82559er
NetworkCard_NE2K_ISA
NetworkCard_NE2K_PCI
NetworkCard_PCNET
NetworkCard_RTL8139
NetworkCard_VIRTIO
NetworkCard_VMXNET3
)
var networkCardModelValues = [...]string{
"e1000",
"e1000-82540em",
"e1000-82544gc",
"e1000-82545em",
"i82551",
"i82557b",
"i82559er",
"ne2k_isa",
"ne2k_pci",
"pcnet",
"rtl8139",
"virtio",
"vmxnet3",
}
// String returns the name of the NetworkCardModel.
func (m NetworkCardModel) String() string { return networkCardModelValues[m-1] }
func NetworkCardModelFromString(s string) (NetworkCardModel, error) {
for i, v := range networkCardModelValues {
if s == v {
return NetworkCardModel(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to NetworkCardModel values", s)
}
type VolumeFormat int
const (
VolumeFormat_CLOOP VolumeFormat = 1 + iota
VolumeFormat_COW
VolumeFormat_QCOW
VolumeFormat_QCOW2
VolumeFormat_QED
VolumeFormat_RAW
VolumeFormat_VMDK
)
var volumeFormatValues = [...]string{
"cloop",
"cow",
"qcow",
"qcow2",
"qed",
"raw",
"vmdk",
}
// String returns the name of the VolumeFormat.
func (m VolumeFormat) String() string { return volumeFormatValues[m-1] }
func VolumeFormatFromString(s string) (VolumeFormat, error) {
for i, v := range volumeFormatValues {
if s == v {
return VolumeFormat(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to VolumeFormat values", s)
}
type MediaType int
const (
MediaType_CDROM MediaType = 1 + iota
MediaType_DISK
)
var mediaTypeValues = [...]string{
"cdrom",
"disk",
}
// String returns the name of the MediaType.
func (m MediaType) String() string { return mediaTypeValues[m-1] }
func MediaTypeFromString(s string) (MediaType, error) {
for i, v := range mediaTypeValues {
if s == v {
return MediaType(i + 1), nil
}
}
return 0, fmt.Errorf("%s does not belong to MediaType values", s)
}