1 package qapi
2
3 import (
4 "encoding/json"
5 "fmt"
6 )
7
8
9
10
11
12
13
14
15
16
17
18 type ShutdownEvent struct {
19 Guest bool `json:"guest"`
20 Reason ShutdownCause `json:"reason"`
21 }
22
23
24
25
26
27
28
29
30 type PowerdownEvent struct{}
31
32
33
34
35
36
37
38 type ResetEvent struct {
39 Guest bool `json:"guest"`
40 Reason ShutdownCause `json:"reason"`
41 }
42
43
44
45
46
47
48
49 type StopEvent struct{}
50
51
52
53
54
55
56
57 type ResumeEvent struct{}
58
59
60
61
62
63
64
65
66 type SuspendEvent struct{}
67
68
69
70
71
72
73
74
75
76
77 type SuspendDiskEvent struct{}
78
79
80
81
82
83
84
85 type WakeupEvent struct{}
86
87
88
89
90
91
92
93
94
95
96
97
98
99 type WatchdogEvent struct {
100 Action WatchdogAction `json:"action"`
101 }
102
103
104
105
106
107
108
109 type GuestPanickedEvent struct {
110 Action GuestPanicAction `json:"action"`
111 Info *GuestPanicInformation `json:"info,omitempty"`
112 }
113
114
115
116
117
118
119
120 type GuestCrashloadedEvent struct {
121 Action GuestPanicAction `json:"action"`
122 Info *GuestPanicInformation `json:"info,omitempty"`
123 }
124
125
126
127
128
129
130
131
132
133 type MemoryFailureEvent struct {
134 Recipient MemoryFailureRecipient `json:"recipient"`
135 Action MemoryFailureAction `json:"action"`
136 Flags MemoryFailureFlags `json:"flags"`
137 }
138
139
140
141
142
143
144
145
146
147
148
149
150 type DeviceTrayMovedEvent struct {
151 Device string `json:"device"`
152 Id string `json:"id"`
153 TrayOpen bool `json:"tray-open"`
154 }
155
156
157
158
159
160
161
162
163
164
165
166 type PrManagerStatusChangedEvent struct {
167 Id string `json:"id"`
168 Connected bool `json:"connected"`
169 }
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186 type BlockImageCorruptedEvent struct {
187 Device string `json:"device"`
188 NodeName *string `json:"node-name,omitempty"`
189 Msg string `json:"msg"`
190 Offset *int64 `json:"offset,omitempty"`
191 Size *int64 `json:"size,omitempty"`
192 Fatal bool `json:"fatal"`
193 }
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208 type BlockIoErrorEvent struct {
209 Device string `json:"device"`
210 NodeName *string `json:"node-name,omitempty"`
211 Operation IoOperationType `json:"operation"`
212 Action BlockErrorAction `json:"action"`
213 Nospace *bool `json:"nospace,omitempty"`
214 Reason string `json:"reason"`
215 }
216
217
218
219
220
221
222
223
224
225
226 type BlockJobCompletedEvent struct {
227 Type JobType `json:"type"`
228 Device string `json:"device"`
229 Len int64 `json:"len"`
230 Offset int64 `json:"offset"`
231 Speed int64 `json:"speed"`
232 Error *string `json:"error,omitempty"`
233 }
234
235
236
237
238
239
240
241
242
243
244 type BlockJobCancelledEvent struct {
245 Type JobType `json:"type"`
246 Device string `json:"device"`
247 Len int64 `json:"len"`
248 Offset int64 `json:"offset"`
249 Speed int64 `json:"speed"`
250 }
251
252
253
254
255
256
257
258
259
260
261 type BlockJobErrorEvent struct {
262 Device string `json:"device"`
263 Operation IoOperationType `json:"operation"`
264 Action BlockErrorAction `json:"action"`
265 }
266
267
268
269
270
271
272
273
274
275
276
277
278 type BlockJobReadyEvent struct {
279 Type JobType `json:"type"`
280 Device string `json:"device"`
281 Len int64 `json:"len"`
282 Offset int64 `json:"offset"`
283 Speed int64 `json:"speed"`
284 }
285
286
287
288
289
290
291
292
293
294
295 type BlockJobPendingEvent struct {
296 Type JobType `json:"type"`
297 Id string `json:"id"`
298 }
299
300
301
302
303
304
305
306
307
308 type BlockWriteThresholdEvent struct {
309 NodeName string `json:"node-name"`
310 AmountExceeded uint64 `json:"amount-exceeded"`
311 WriteThreshold uint64 `json:"write-threshold"`
312 }
313
314
315
316
317
318
319
320
321
322
323 type QuorumFailureEvent struct {
324 Reference string `json:"reference"`
325 SectorNum int64 `json:"sector-num"`
326 SectorsCount int64 `json:"sectors-count"`
327 }
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348 type QuorumReportBadEvent struct {
349 Type QuorumOpType `json:"type"`
350 Error *string `json:"error,omitempty"`
351 NodeName string `json:"node-name"`
352 SectorNum int64 `json:"sector-num"`
353 SectorsCount int64 `json:"sectors-count"`
354 }
355
356
357
358
359 type JobStatusChangeEvent struct {
360 Id string `json:"id"`
361 Status JobStatus `json:"status"`
362 }
363
364
365
366
367 type BlockExportDeletedEvent struct {
368 Id string `json:"id"`
369 }
370
371
372
373
374
375
376
377
378
379
380 type VserportChangeEvent struct {
381 Id string `json:"id"`
382 Open bool `json:"open"`
383 }
384
385
386
387
388
389
390
391
392 type DumpCompletedEvent struct {
393 Result DumpQueryResult `json:"result"`
394 Error *string `json:"error,omitempty"`
395 }
396
397
398
399
400
401
402
403
404
405
406
407 type NicRxFilterChangedEvent struct {
408 Name *string `json:"name,omitempty"`
409 Path string `json:"path"`
410 }
411
412
413
414
415
416
417
418
419
420
421
422 type FailoverNegotiatedEvent struct {
423 DeviceId string `json:"device-id"`
424 }
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439 type RdmaGidStatusChangedEvent struct {
440 Netdev string `json:"netdev"`
441 GidStatus bool `json:"gid-status"`
442 SubnetPrefix uint64 `json:"subnet-prefix"`
443 InterfaceId uint64 `json:"interface-id"`
444 }
445
446
447
448
449
450
451
452
453
454
455
456 type SpiceConnectedEvent struct {
457 Server SpiceBasicInfo `json:"server"`
458 Client SpiceBasicInfo `json:"client"`
459 }
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474 type SpiceInitializedEvent struct {
475 Server SpiceServerInfo `json:"server"`
476 Client SpiceChannel `json:"client"`
477 }
478
479
480
481
482
483
484
485
486
487
488
489 type SpiceDisconnectedEvent struct {
490 Server SpiceBasicInfo `json:"server"`
491 Client SpiceBasicInfo `json:"client"`
492 }
493
494
495
496
497
498
499
500 type SpiceMigrateCompletedEvent struct{}
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516 type VncConnectedEvent struct {
517 Server VncServerInfo `json:"server"`
518 Client VncBasicInfo `json:"client"`
519 }
520
521
522
523
524
525
526
527
528
529
530
531
532
533 type VncInitializedEvent struct {
534 Server VncServerInfo `json:"server"`
535 Client VncClientInfo `json:"client"`
536 }
537
538
539
540
541
542
543
544
545
546
547
548
549 type VncDisconnectedEvent struct {
550 Server VncServerInfo `json:"server"`
551 Client VncClientInfo `json:"client"`
552 }
553
554
555
556
557
558
559
560
561 type MigrationEvent struct {
562 Status MigrationStatus `json:"status"`
563 }
564
565
566
567
568
569
570
571
572 type MigrationPassEvent struct {
573 Pass int64 `json:"pass"`
574 }
575
576
577
578
579
580
581
582
583 type ColoExitEvent struct {
584 Mode COLOMode `json:"mode"`
585 Reason COLOExitReason `json:"reason"`
586 }
587
588
589
590
591
592
593
594
595
596 type UnplugPrimaryEvent struct {
597 DeviceId string `json:"device-id"`
598 }
599
600
601
602
603
604
605
606
607
608
609
610 type DeviceDeletedEvent struct {
611 Device *string `json:"device,omitempty"`
612 Path string `json:"path"`
613 }
614
615
616
617
618
619
620
621
622
623
624 type DeviceUnplugGuestErrorEvent struct {
625 Device *string `json:"device,omitempty"`
626 Path string `json:"path"`
627 }
628
629
630
631
632
633
634
635
636
637
638
639 type BalloonChangeEvent struct {
640 Actual int64 `json:"actual"`
641 }
642
643
644
645
646
647
648
649
650
651
652
653
654 type MemoryDeviceSizeChangeEvent struct {
655 Id *string `json:"id,omitempty"`
656 Size uint64 `json:"size"`
657 QomPath string `json:"qom-path"`
658 }
659
660
661
662
663
664
665
666
667
668
669 type MemUnplugErrorEvent struct {
670 Device string `json:"device"`
671 Msg string `json:"msg"`
672 }
673
674
675
676
677
678
679
680
681
682
683
684
685 type RtcChangeEvent struct {
686 Offset int64 `json:"offset"`
687 QomPath string `json:"qom-path"`
688 }
689
690
691
692
693
694
695
696
697 type AcpiDeviceOstEvent struct {
698 Info ACPIOSTInfo `json:"info"`
699 }
700
701 type EventBase struct {
702 Name string `json:"event"`
703 Timestamp struct {
704 Seconds int64 `json:"seconds"`
705 Microseconds int64 `json:"microseconds"`
706 } `json:"timestamp"`
707 }
708
709 type Event struct {
710 EventBase
711 Arg Any `json:"data,omitempty"`
712 }
713
714 func (s *Event) UnmarshalJSON(data []byte) error {
715
716 var base EventBase
717 if err := json.Unmarshal(data, &base); err != nil {
718 return err
719 }
720 s.EventBase = base
721
722 switch base.Name {
723 case "ACPI_DEVICE_OST":
724 tmp := struct {
725 Value *AcpiDeviceOstEvent `json:"data,omitempty"`
726 }{}
727 if err := json.Unmarshal(data, &tmp); err != nil {
728 return err
729 }
730 if tmp.Value == nil {
731 s.Arg = nil
732 } else {
733 s.Arg = *tmp.Value
734 }
735 case "BALLOON_CHANGE":
736 tmp := struct {
737 Value *BalloonChangeEvent `json:"data,omitempty"`
738 }{}
739 if err := json.Unmarshal(data, &tmp); err != nil {
740 return err
741 }
742 if tmp.Value == nil {
743 s.Arg = nil
744 } else {
745 s.Arg = *tmp.Value
746 }
747 case "BLOCK_EXPORT_DELETED":
748 tmp := struct {
749 Value *BlockExportDeletedEvent `json:"data,omitempty"`
750 }{}
751 if err := json.Unmarshal(data, &tmp); err != nil {
752 return err
753 }
754 if tmp.Value == nil {
755 s.Arg = nil
756 } else {
757 s.Arg = *tmp.Value
758 }
759 case "BLOCK_IMAGE_CORRUPTED":
760 tmp := struct {
761 Value *BlockImageCorruptedEvent `json:"data,omitempty"`
762 }{}
763 if err := json.Unmarshal(data, &tmp); err != nil {
764 return err
765 }
766 if tmp.Value == nil {
767 s.Arg = nil
768 } else {
769 s.Arg = *tmp.Value
770 }
771 case "BLOCK_IO_ERROR":
772 tmp := struct {
773 Value *BlockIoErrorEvent `json:"data,omitempty"`
774 }{}
775 if err := json.Unmarshal(data, &tmp); err != nil {
776 return err
777 }
778 if tmp.Value == nil {
779 s.Arg = nil
780 } else {
781 s.Arg = *tmp.Value
782 }
783 case "BLOCK_JOB_CANCELLED":
784 tmp := struct {
785 Value *BlockJobCancelledEvent `json:"data,omitempty"`
786 }{}
787 if err := json.Unmarshal(data, &tmp); err != nil {
788 return err
789 }
790 if tmp.Value == nil {
791 s.Arg = nil
792 } else {
793 s.Arg = *tmp.Value
794 }
795 case "BLOCK_JOB_COMPLETED":
796 tmp := struct {
797 Value *BlockJobCompletedEvent `json:"data,omitempty"`
798 }{}
799 if err := json.Unmarshal(data, &tmp); err != nil {
800 return err
801 }
802 if tmp.Value == nil {
803 s.Arg = nil
804 } else {
805 s.Arg = *tmp.Value
806 }
807 case "BLOCK_JOB_ERROR":
808 tmp := struct {
809 Value *BlockJobErrorEvent `json:"data,omitempty"`
810 }{}
811 if err := json.Unmarshal(data, &tmp); err != nil {
812 return err
813 }
814 if tmp.Value == nil {
815 s.Arg = nil
816 } else {
817 s.Arg = *tmp.Value
818 }
819 case "BLOCK_JOB_PENDING":
820 tmp := struct {
821 Value *BlockJobPendingEvent `json:"data,omitempty"`
822 }{}
823 if err := json.Unmarshal(data, &tmp); err != nil {
824 return err
825 }
826 if tmp.Value == nil {
827 s.Arg = nil
828 } else {
829 s.Arg = *tmp.Value
830 }
831 case "BLOCK_JOB_READY":
832 tmp := struct {
833 Value *BlockJobReadyEvent `json:"data,omitempty"`
834 }{}
835 if err := json.Unmarshal(data, &tmp); err != nil {
836 return err
837 }
838 if tmp.Value == nil {
839 s.Arg = nil
840 } else {
841 s.Arg = *tmp.Value
842 }
843 case "BLOCK_WRITE_THRESHOLD":
844 tmp := struct {
845 Value *BlockWriteThresholdEvent `json:"data,omitempty"`
846 }{}
847 if err := json.Unmarshal(data, &tmp); err != nil {
848 return err
849 }
850 if tmp.Value == nil {
851 s.Arg = nil
852 } else {
853 s.Arg = *tmp.Value
854 }
855 case "COLO_EXIT":
856 tmp := struct {
857 Value *ColoExitEvent `json:"data,omitempty"`
858 }{}
859 if err := json.Unmarshal(data, &tmp); err != nil {
860 return err
861 }
862 if tmp.Value == nil {
863 s.Arg = nil
864 } else {
865 s.Arg = *tmp.Value
866 }
867 case "DEVICE_DELETED":
868 tmp := struct {
869 Value *DeviceDeletedEvent `json:"data,omitempty"`
870 }{}
871 if err := json.Unmarshal(data, &tmp); err != nil {
872 return err
873 }
874 if tmp.Value == nil {
875 s.Arg = nil
876 } else {
877 s.Arg = *tmp.Value
878 }
879 case "DEVICE_TRAY_MOVED":
880 tmp := struct {
881 Value *DeviceTrayMovedEvent `json:"data,omitempty"`
882 }{}
883 if err := json.Unmarshal(data, &tmp); err != nil {
884 return err
885 }
886 if tmp.Value == nil {
887 s.Arg = nil
888 } else {
889 s.Arg = *tmp.Value
890 }
891 case "DEVICE_UNPLUG_GUEST_ERROR":
892 tmp := struct {
893 Value *DeviceUnplugGuestErrorEvent `json:"data,omitempty"`
894 }{}
895 if err := json.Unmarshal(data, &tmp); err != nil {
896 return err
897 }
898 if tmp.Value == nil {
899 s.Arg = nil
900 } else {
901 s.Arg = *tmp.Value
902 }
903 case "DUMP_COMPLETED":
904 tmp := struct {
905 Value *DumpCompletedEvent `json:"data,omitempty"`
906 }{}
907 if err := json.Unmarshal(data, &tmp); err != nil {
908 return err
909 }
910 if tmp.Value == nil {
911 s.Arg = nil
912 } else {
913 s.Arg = *tmp.Value
914 }
915 case "FAILOVER_NEGOTIATED":
916 tmp := struct {
917 Value *FailoverNegotiatedEvent `json:"data,omitempty"`
918 }{}
919 if err := json.Unmarshal(data, &tmp); err != nil {
920 return err
921 }
922 if tmp.Value == nil {
923 s.Arg = nil
924 } else {
925 s.Arg = *tmp.Value
926 }
927 case "GUEST_CRASHLOADED":
928 tmp := struct {
929 Value *GuestCrashloadedEvent `json:"data,omitempty"`
930 }{}
931 if err := json.Unmarshal(data, &tmp); err != nil {
932 return err
933 }
934 if tmp.Value == nil {
935 s.Arg = nil
936 } else {
937 s.Arg = *tmp.Value
938 }
939 case "GUEST_PANICKED":
940 tmp := struct {
941 Value *GuestPanickedEvent `json:"data,omitempty"`
942 }{}
943 if err := json.Unmarshal(data, &tmp); err != nil {
944 return err
945 }
946 if tmp.Value == nil {
947 s.Arg = nil
948 } else {
949 s.Arg = *tmp.Value
950 }
951 case "JOB_STATUS_CHANGE":
952 tmp := struct {
953 Value *JobStatusChangeEvent `json:"data,omitempty"`
954 }{}
955 if err := json.Unmarshal(data, &tmp); err != nil {
956 return err
957 }
958 if tmp.Value == nil {
959 s.Arg = nil
960 } else {
961 s.Arg = *tmp.Value
962 }
963 case "MEMORY_DEVICE_SIZE_CHANGE":
964 tmp := struct {
965 Value *MemoryDeviceSizeChangeEvent `json:"data,omitempty"`
966 }{}
967 if err := json.Unmarshal(data, &tmp); err != nil {
968 return err
969 }
970 if tmp.Value == nil {
971 s.Arg = nil
972 } else {
973 s.Arg = *tmp.Value
974 }
975 case "MEMORY_FAILURE":
976 tmp := struct {
977 Value *MemoryFailureEvent `json:"data,omitempty"`
978 }{}
979 if err := json.Unmarshal(data, &tmp); err != nil {
980 return err
981 }
982 if tmp.Value == nil {
983 s.Arg = nil
984 } else {
985 s.Arg = *tmp.Value
986 }
987 case "MEM_UNPLUG_ERROR":
988 tmp := struct {
989 Value *MemUnplugErrorEvent `json:"data,omitempty"`
990 }{}
991 if err := json.Unmarshal(data, &tmp); err != nil {
992 return err
993 }
994 if tmp.Value == nil {
995 s.Arg = nil
996 } else {
997 s.Arg = *tmp.Value
998 }
999 case "MIGRATION":
1000 tmp := struct {
1001 Value *MigrationEvent `json:"data,omitempty"`
1002 }{}
1003 if err := json.Unmarshal(data, &tmp); err != nil {
1004 return err
1005 }
1006 if tmp.Value == nil {
1007 s.Arg = nil
1008 } else {
1009 s.Arg = *tmp.Value
1010 }
1011 case "MIGRATION_PASS":
1012 tmp := struct {
1013 Value *MigrationPassEvent `json:"data,omitempty"`
1014 }{}
1015 if err := json.Unmarshal(data, &tmp); err != nil {
1016 return err
1017 }
1018 if tmp.Value == nil {
1019 s.Arg = nil
1020 } else {
1021 s.Arg = *tmp.Value
1022 }
1023 case "NIC_RX_FILTER_CHANGED":
1024 tmp := struct {
1025 Value *NicRxFilterChangedEvent `json:"data,omitempty"`
1026 }{}
1027 if err := json.Unmarshal(data, &tmp); err != nil {
1028 return err
1029 }
1030 if tmp.Value == nil {
1031 s.Arg = nil
1032 } else {
1033 s.Arg = *tmp.Value
1034 }
1035 case "POWERDOWN":
1036 tmp := struct {
1037 Value *PowerdownEvent `json:"data,omitempty"`
1038 }{}
1039 if err := json.Unmarshal(data, &tmp); err != nil {
1040 return err
1041 }
1042 if tmp.Value == nil {
1043 s.Arg = nil
1044 } else {
1045 s.Arg = *tmp.Value
1046 }
1047 case "PR_MANAGER_STATUS_CHANGED":
1048 tmp := struct {
1049 Value *PrManagerStatusChangedEvent `json:"data,omitempty"`
1050 }{}
1051 if err := json.Unmarshal(data, &tmp); err != nil {
1052 return err
1053 }
1054 if tmp.Value == nil {
1055 s.Arg = nil
1056 } else {
1057 s.Arg = *tmp.Value
1058 }
1059 case "QUORUM_FAILURE":
1060 tmp := struct {
1061 Value *QuorumFailureEvent `json:"data,omitempty"`
1062 }{}
1063 if err := json.Unmarshal(data, &tmp); err != nil {
1064 return err
1065 }
1066 if tmp.Value == nil {
1067 s.Arg = nil
1068 } else {
1069 s.Arg = *tmp.Value
1070 }
1071 case "QUORUM_REPORT_BAD":
1072 tmp := struct {
1073 Value *QuorumReportBadEvent `json:"data,omitempty"`
1074 }{}
1075 if err := json.Unmarshal(data, &tmp); err != nil {
1076 return err
1077 }
1078 if tmp.Value == nil {
1079 s.Arg = nil
1080 } else {
1081 s.Arg = *tmp.Value
1082 }
1083 case "RDMA_GID_STATUS_CHANGED":
1084 tmp := struct {
1085 Value *RdmaGidStatusChangedEvent `json:"data,omitempty"`
1086 }{}
1087 if err := json.Unmarshal(data, &tmp); err != nil {
1088 return err
1089 }
1090 if tmp.Value == nil {
1091 s.Arg = nil
1092 } else {
1093 s.Arg = *tmp.Value
1094 }
1095 case "RESET":
1096 tmp := struct {
1097 Value *ResetEvent `json:"data,omitempty"`
1098 }{}
1099 if err := json.Unmarshal(data, &tmp); err != nil {
1100 return err
1101 }
1102 if tmp.Value == nil {
1103 s.Arg = nil
1104 } else {
1105 s.Arg = *tmp.Value
1106 }
1107 case "RESUME":
1108 tmp := struct {
1109 Value *ResumeEvent `json:"data,omitempty"`
1110 }{}
1111 if err := json.Unmarshal(data, &tmp); err != nil {
1112 return err
1113 }
1114 if tmp.Value == nil {
1115 s.Arg = nil
1116 } else {
1117 s.Arg = *tmp.Value
1118 }
1119 case "RTC_CHANGE":
1120 tmp := struct {
1121 Value *RtcChangeEvent `json:"data,omitempty"`
1122 }{}
1123 if err := json.Unmarshal(data, &tmp); err != nil {
1124 return err
1125 }
1126 if tmp.Value == nil {
1127 s.Arg = nil
1128 } else {
1129 s.Arg = *tmp.Value
1130 }
1131 case "SHUTDOWN":
1132 tmp := struct {
1133 Value *ShutdownEvent `json:"data,omitempty"`
1134 }{}
1135 if err := json.Unmarshal(data, &tmp); err != nil {
1136 return err
1137 }
1138 if tmp.Value == nil {
1139 s.Arg = nil
1140 } else {
1141 s.Arg = *tmp.Value
1142 }
1143 case "SPICE_CONNECTED":
1144 tmp := struct {
1145 Value *SpiceConnectedEvent `json:"data,omitempty"`
1146 }{}
1147 if err := json.Unmarshal(data, &tmp); err != nil {
1148 return err
1149 }
1150 if tmp.Value == nil {
1151 s.Arg = nil
1152 } else {
1153 s.Arg = *tmp.Value
1154 }
1155 case "SPICE_DISCONNECTED":
1156 tmp := struct {
1157 Value *SpiceDisconnectedEvent `json:"data,omitempty"`
1158 }{}
1159 if err := json.Unmarshal(data, &tmp); err != nil {
1160 return err
1161 }
1162 if tmp.Value == nil {
1163 s.Arg = nil
1164 } else {
1165 s.Arg = *tmp.Value
1166 }
1167 case "SPICE_INITIALIZED":
1168 tmp := struct {
1169 Value *SpiceInitializedEvent `json:"data,omitempty"`
1170 }{}
1171 if err := json.Unmarshal(data, &tmp); err != nil {
1172 return err
1173 }
1174 if tmp.Value == nil {
1175 s.Arg = nil
1176 } else {
1177 s.Arg = *tmp.Value
1178 }
1179 case "SPICE_MIGRATE_COMPLETED":
1180 tmp := struct {
1181 Value *SpiceMigrateCompletedEvent `json:"data,omitempty"`
1182 }{}
1183 if err := json.Unmarshal(data, &tmp); err != nil {
1184 return err
1185 }
1186 if tmp.Value == nil {
1187 s.Arg = nil
1188 } else {
1189 s.Arg = *tmp.Value
1190 }
1191 case "STOP":
1192 tmp := struct {
1193 Value *StopEvent `json:"data,omitempty"`
1194 }{}
1195 if err := json.Unmarshal(data, &tmp); err != nil {
1196 return err
1197 }
1198 if tmp.Value == nil {
1199 s.Arg = nil
1200 } else {
1201 s.Arg = *tmp.Value
1202 }
1203 case "SUSPEND":
1204 tmp := struct {
1205 Value *SuspendEvent `json:"data,omitempty"`
1206 }{}
1207 if err := json.Unmarshal(data, &tmp); err != nil {
1208 return err
1209 }
1210 if tmp.Value == nil {
1211 s.Arg = nil
1212 } else {
1213 s.Arg = *tmp.Value
1214 }
1215 case "SUSPEND_DISK":
1216 tmp := struct {
1217 Value *SuspendDiskEvent `json:"data,omitempty"`
1218 }{}
1219 if err := json.Unmarshal(data, &tmp); err != nil {
1220 return err
1221 }
1222 if tmp.Value == nil {
1223 s.Arg = nil
1224 } else {
1225 s.Arg = *tmp.Value
1226 }
1227 case "UNPLUG_PRIMARY":
1228 tmp := struct {
1229 Value *UnplugPrimaryEvent `json:"data,omitempty"`
1230 }{}
1231 if err := json.Unmarshal(data, &tmp); err != nil {
1232 return err
1233 }
1234 if tmp.Value == nil {
1235 s.Arg = nil
1236 } else {
1237 s.Arg = *tmp.Value
1238 }
1239 case "VNC_CONNECTED":
1240 tmp := struct {
1241 Value *VncConnectedEvent `json:"data,omitempty"`
1242 }{}
1243 if err := json.Unmarshal(data, &tmp); err != nil {
1244 return err
1245 }
1246 if tmp.Value == nil {
1247 s.Arg = nil
1248 } else {
1249 s.Arg = *tmp.Value
1250 }
1251 case "VNC_DISCONNECTED":
1252 tmp := struct {
1253 Value *VncDisconnectedEvent `json:"data,omitempty"`
1254 }{}
1255 if err := json.Unmarshal(data, &tmp); err != nil {
1256 return err
1257 }
1258 if tmp.Value == nil {
1259 s.Arg = nil
1260 } else {
1261 s.Arg = *tmp.Value
1262 }
1263 case "VNC_INITIALIZED":
1264 tmp := struct {
1265 Value *VncInitializedEvent `json:"data,omitempty"`
1266 }{}
1267 if err := json.Unmarshal(data, &tmp); err != nil {
1268 return err
1269 }
1270 if tmp.Value == nil {
1271 s.Arg = nil
1272 } else {
1273 s.Arg = *tmp.Value
1274 }
1275 case "VSERPORT_CHANGE":
1276 tmp := struct {
1277 Value *VserportChangeEvent `json:"data,omitempty"`
1278 }{}
1279 if err := json.Unmarshal(data, &tmp); err != nil {
1280 return err
1281 }
1282 if tmp.Value == nil {
1283 s.Arg = nil
1284 } else {
1285 s.Arg = *tmp.Value
1286 }
1287 case "WAKEUP":
1288 tmp := struct {
1289 Value *WakeupEvent `json:"data,omitempty"`
1290 }{}
1291 if err := json.Unmarshal(data, &tmp); err != nil {
1292 return err
1293 }
1294 if tmp.Value == nil {
1295 s.Arg = nil
1296 } else {
1297 s.Arg = *tmp.Value
1298 }
1299 case "WATCHDOG":
1300 tmp := struct {
1301 Value *WatchdogEvent `json:"data,omitempty"`
1302 }{}
1303 if err := json.Unmarshal(data, &tmp); err != nil {
1304 return err
1305 }
1306 if tmp.Value == nil {
1307 s.Arg = nil
1308 } else {
1309 s.Arg = *tmp.Value
1310 }
1311
1312 default:
1313 fmt.Println("Failed to decode Event", base.Name)
1314 }
1315
1316 return nil
1317 }
1318
View as plain text