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
use jsonrpsee_types::JsonValue;
#[derive(Debug)]
pub enum ObjectType {
GpuGroup,
Host,
Message,
Network,
Pbd,
Pci,
Pgpu,
Pif,
Pool,
Sr,
Task,
Vbd,
Vdi,
VdiSnapshot,
VdiUnmanaged,
Vif,
Vm,
VmController,
VmSnapshot,
VmTemplate,
}
impl ToString for ObjectType {
fn to_string(&self) -> String {
match self {
ObjectType::GpuGroup => "gpuGroup",
ObjectType::Host => "host",
ObjectType::Message => "message",
ObjectType::Network => "network",
ObjectType::Pbd => "PBD",
ObjectType::Pci => "PCI",
ObjectType::Pgpu => "PGPU",
ObjectType::Pif => "PIF",
ObjectType::Pool => "pool",
ObjectType::Sr => "SR",
ObjectType::Task => "task",
ObjectType::Vbd => "VBD",
ObjectType::Vdi => "VDI",
ObjectType::VdiSnapshot => "VDI-snapshot",
ObjectType::VdiUnmanaged => "VDI-unmanaged",
ObjectType::Vif => "VIF",
ObjectType::Vm => "VM",
ObjectType::VmController => "VM-controller",
ObjectType::VmSnapshot => "VM-snapshot",
ObjectType::VmTemplate => "VM-template",
}
.to_string()
}
}
impl From<ObjectType> for JsonValue {
fn from(val: ObjectType) -> Self {
JsonValue::String(val.to_string())
}
}