@@ -43,96 +43,132 @@ type event_record =
4343 | VMPP of [`VMPP ] Ref .t * API .vMPP_t option
4444 | VMSS of [`VMSS ] Ref .t * API .vMSS_t option
4545
46- let maybe f x = match x with Some x -> Some (f x) | None -> None
47-
4846let record_of_event ev =
4947 let rpc = ev.Event_types. snapshot in
5048 match ev.Event_types. ty with
5149 | "session" ->
5250 Session
5351 ( Ref. of_secret_string ev.Event_types. reference
54- , maybe API. session_t_of_rpc rpc
52+ , Option. map API. session_t_of_rpc rpc
5553 )
5654 | "task" ->
57- Task (Ref. of_string ev.Event_types. reference, maybe API. task_t_of_rpc rpc)
55+ Task
56+ ( Ref. of_string ev.Event_types. reference
57+ , Option. map API. task_t_of_rpc rpc
58+ )
5859 | "event" ->
5960 Event
60- (Ref. of_string ev.Event_types. reference, maybe API. event_t_of_rpc rpc)
61+ ( Ref. of_string ev.Event_types. reference
62+ , Option. map API. event_t_of_rpc rpc
63+ )
6164 | "vm" ->
62- VM (Ref. of_string ev.Event_types. reference, maybe API. vM_t_of_rpc rpc)
65+ VM (Ref. of_string ev.Event_types. reference, Option. map API. vM_t_of_rpc rpc)
6366 | "vm_metrics" ->
6467 VM_metrics
6568 ( Ref. of_string ev.Event_types. reference
66- , maybe API. vM_metrics_t_of_rpc rpc
69+ , Option. map API. vM_metrics_t_of_rpc rpc
6770 )
6871 | "vm_guest_metrics" ->
6972 VM_guest_metrics
7073 ( Ref. of_string ev.Event_types. reference
71- , maybe API. vM_guest_metrics_t_of_rpc rpc
74+ , Option. map API. vM_guest_metrics_t_of_rpc rpc
7275 )
7376 | "host" ->
74- Host (Ref. of_string ev.Event_types. reference, maybe API. host_t_of_rpc rpc)
77+ Host
78+ ( Ref. of_string ev.Event_types. reference
79+ , Option. map API. host_t_of_rpc rpc
80+ )
7581 | "host_metrics" ->
7682 Host_metrics
7783 ( Ref. of_string ev.Event_types. reference
78- , maybe API. host_metrics_t_of_rpc rpc
84+ , Option. map API. host_metrics_t_of_rpc rpc
7985 )
8086 | "host_cpu" ->
8187 Host_cpu
82- (Ref. of_string ev.Event_types. reference, maybe API. host_cpu_t_of_rpc rpc)
88+ ( Ref. of_string ev.Event_types. reference
89+ , Option. map API. host_cpu_t_of_rpc rpc
90+ )
8391 | "network" ->
8492 Network
85- (Ref. of_string ev.Event_types. reference, maybe API. network_t_of_rpc rpc)
93+ ( Ref. of_string ev.Event_types. reference
94+ , Option. map API. network_t_of_rpc rpc
95+ )
8696 | "vif" ->
87- VIF (Ref. of_string ev.Event_types. reference, maybe API. vIF_t_of_rpc rpc)
97+ VIF
98+ (Ref. of_string ev.Event_types. reference, Option. map API. vIF_t_of_rpc rpc)
8899 | "vif_metrics" ->
89100 VIF_metrics
90101 ( Ref. of_string ev.Event_types. reference
91- , maybe API. vIF_metrics_t_of_rpc rpc
102+ , Option. map API. vIF_metrics_t_of_rpc rpc
92103 )
93104 | "pif" ->
94- PIF (Ref. of_string ev.Event_types. reference, maybe API. pIF_t_of_rpc rpc)
105+ PIF
106+ (Ref. of_string ev.Event_types. reference, Option. map API. pIF_t_of_rpc rpc)
95107 | "pif_metrics" ->
96108 PIF_metrics
97109 ( Ref. of_string ev.Event_types. reference
98- , maybe API. pIF_metrics_t_of_rpc rpc
110+ , Option. map API. pIF_metrics_t_of_rpc rpc
99111 )
100112 | "sr" ->
101- SR (Ref. of_string ev.Event_types. reference, maybe API. sR_t_of_rpc rpc)
113+ SR (Ref. of_string ev.Event_types. reference, Option. map API. sR_t_of_rpc rpc)
102114 | "vdi" ->
103- VDI (Ref. of_string ev.Event_types. reference, maybe API. vDI_t_of_rpc rpc)
115+ VDI
116+ (Ref. of_string ev.Event_types. reference, Option. map API. vDI_t_of_rpc rpc)
104117 | "vbd" ->
105- VBD (Ref. of_string ev.Event_types. reference, maybe API. vBD_t_of_rpc rpc)
118+ VBD
119+ (Ref. of_string ev.Event_types. reference, Option. map API. vBD_t_of_rpc rpc)
106120 | "vbd_metrics" ->
107121 VBD_metrics
108122 ( Ref. of_string ev.Event_types. reference
109- , maybe API. vBD_metrics_t_of_rpc rpc
123+ , Option. map API. vBD_metrics_t_of_rpc rpc
110124 )
111125 | "pbd" ->
112- PBD (Ref. of_string ev.Event_types. reference, maybe API. pBD_t_of_rpc rpc)
126+ PBD
127+ (Ref. of_string ev.Event_types. reference, Option. map API. pBD_t_of_rpc rpc)
113128 | "crashdump" ->
114129 Crashdump
115130 ( Ref. of_string ev.Event_types. reference
116- , maybe API. crashdump_t_of_rpc rpc
131+ , Option. map API. crashdump_t_of_rpc rpc
117132 )
118133 | "vtpm" ->
119- VTPM (Ref. of_string ev.Event_types. reference, maybe API. vTPM_t_of_rpc rpc)
134+ VTPM
135+ ( Ref. of_string ev.Event_types. reference
136+ , Option. map API. vTPM_t_of_rpc rpc
137+ )
120138 | "console" ->
121139 Console
122- (Ref. of_string ev.Event_types. reference, maybe API. console_t_of_rpc rpc)
140+ ( Ref. of_string ev.Event_types. reference
141+ , Option. map API. console_t_of_rpc rpc
142+ )
123143 | "user" ->
124- User (Ref. of_string ev.Event_types. reference, maybe API. user_t_of_rpc rpc)
144+ User
145+ ( Ref. of_string ev.Event_types. reference
146+ , Option. map API. user_t_of_rpc rpc
147+ )
125148 | "pool" ->
126- Pool (Ref. of_string ev.Event_types. reference, maybe API. pool_t_of_rpc rpc)
149+ Pool
150+ ( Ref. of_string ev.Event_types. reference
151+ , Option. map API. pool_t_of_rpc rpc
152+ )
127153 | "message" ->
128154 Message
129- (Ref. of_string ev.Event_types. reference, maybe API. message_t_of_rpc rpc)
155+ ( Ref. of_string ev.Event_types. reference
156+ , Option. map API. message_t_of_rpc rpc
157+ )
130158 | "secret" ->
131159 Secret
132- (Ref. of_string ev.Event_types. reference, maybe API. secret_t_of_rpc rpc)
160+ ( Ref. of_string ev.Event_types. reference
161+ , Option. map API. secret_t_of_rpc rpc
162+ )
133163 | "vmpp" ->
134- VMPP (Ref. of_string ev.Event_types. reference, maybe API. vMPP_t_of_rpc rpc)
164+ VMPP
165+ ( Ref. of_string ev.Event_types. reference
166+ , Option. map API. vMPP_t_of_rpc rpc
167+ )
135168 | "vmss" ->
136- VMSS (Ref. of_string ev.Event_types. reference, maybe API. vMSS_t_of_rpc rpc)
169+ VMSS
170+ ( Ref. of_string ev.Event_types. reference
171+ , Option. map API. vMSS_t_of_rpc rpc
172+ )
137173 | _ ->
138174 failwith " unknown event type"
0 commit comments