...

Source file src/victortoso.com/qapi-go/pkg/qapi/events.go

Documentation: victortoso.com/qapi-go/pkg/qapi

     1  package qapi
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  // Emitted when the virtual machine has shut down, indicating that qemu is
     9  // about to exit.
    10  //
    11  // Note: If the command-line option "-no-shutdown" has been specified, qemu will
    12  // not exit, and a STOP event will eventually follow the SHUTDOWN event
    13  //
    14  // Since: 0.12
    15  //
    16  // Example: <- { "event": "SHUTDOWN", "data": { "guest": true },
    17  //      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
    18  type ShutdownEvent struct {
    19  	Guest  bool          `json:"guest"`  // If true, the shutdown was triggered by a guest request (such as a guest-initiated ACPI shutdown request or other hardware-specific action) rather than a host request (such as sending qemu a SIGINT). (since 2.10)
    20  	Reason ShutdownCause `json:"reason"` // The @ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
    21  }
    22  
    23  // Emitted when the virtual machine is powered down through the power control
    24  // system, such as via ACPI.
    25  //
    26  // Since: 0.12
    27  //
    28  // Example: <- { "event": "POWERDOWN",
    29  //      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
    30  type PowerdownEvent struct{}
    31  
    32  // Emitted when the virtual machine is reset
    33  //
    34  // Since: 0.12
    35  //
    36  // Example: <- { "event": "RESET", "data": { "guest": false },
    37  //      "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
    38  type ResetEvent struct {
    39  	Guest  bool          `json:"guest"`  // If true, the reset was triggered by a guest request (such as a guest-initiated ACPI reboot request or other hardware-specific action) rather than a host request (such as the QMP command system_reset). (since 2.10)
    40  	Reason ShutdownCause `json:"reason"` // The @ShutdownCause of the RESET. (since 4.0)
    41  }
    42  
    43  // Emitted when the virtual machine is stopped
    44  //
    45  // Since: 0.12
    46  //
    47  // Example: <- { "event": "STOP",
    48  //      "timestamp": { "seconds": 1267041730, "microseconds": 281295 } }
    49  type StopEvent struct{}
    50  
    51  // Emitted when the virtual machine resumes execution
    52  //
    53  // Since: 0.12
    54  //
    55  // Example: <- { "event": "RESUME",
    56  //      "timestamp": { "seconds": 1271770767, "microseconds": 582542 } }
    57  type ResumeEvent struct{}
    58  
    59  // Emitted when guest enters a hardware suspension state, for example, S3 state,
    60  // which is sometimes called standby state
    61  //
    62  // Since: 1.1
    63  //
    64  // Example: <- { "event": "SUSPEND",
    65  //      "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
    66  type SuspendEvent struct{}
    67  
    68  // Emitted when guest enters a hardware suspension state with data saved on
    69  // disk, for example, S4 state, which is sometimes called hibernate state
    70  //
    71  // Note: QEMU shuts down (similar to event @SHUTDOWN) when entering this state
    72  //
    73  // Since: 1.2
    74  //
    75  // Example: <-   { "event": "SUSPEND_DISK",
    76  //        "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
    77  type SuspendDiskEvent struct{}
    78  
    79  // Emitted when the guest has woken up from suspend state and is running
    80  //
    81  // Since: 1.1
    82  //
    83  // Example: <- { "event": "WAKEUP",
    84  //      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
    85  type WakeupEvent struct{}
    86  
    87  // Emitted when the watchdog device's timer is expired
    88  //
    89  // Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
    90  // followed respectively by the RESET, SHUTDOWN, or STOP events
    91  //
    92  // Note: This event is rate-limited.
    93  //
    94  // Since: 0.13
    95  //
    96  // Example: <- { "event": "WATCHDOG",
    97  //      "data": { "action": "reset" },
    98  //      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
    99  type WatchdogEvent struct {
   100  	Action WatchdogAction `json:"action"` // action that has been taken
   101  }
   102  
   103  // Emitted when guest OS panic is detected
   104  //
   105  // Since: 1.5
   106  //
   107  // Example: <- { "event": "GUEST_PANICKED",
   108  //      "data": { "action": "pause" } }
   109  type GuestPanickedEvent struct {
   110  	Action GuestPanicAction       `json:"action"`         // action that has been taken, currently always "pause"
   111  	Info   *GuestPanicInformation `json:"info,omitempty"` // information about a panic (since 2.9)
   112  }
   113  
   114  // Emitted when guest OS crash loaded is detected
   115  //
   116  // Since: 5.0
   117  //
   118  // Example: <- { "event": "GUEST_CRASHLOADED",
   119  //      "data": { "action": "run" } }
   120  type GuestCrashloadedEvent struct {
   121  	Action GuestPanicAction       `json:"action"`         // action that has been taken, currently always "run"
   122  	Info   *GuestPanicInformation `json:"info,omitempty"` // information about a panic
   123  }
   124  
   125  // Emitted when a memory failure occurs on host side.
   126  //
   127  // Since: 5.2
   128  //
   129  // Example: <- { "event": "MEMORY_FAILURE",
   130  //      "data": { "recipient": "hypervisor",
   131  //                "action": "fatal",
   132  //                "flags": { 'action-required': false } }
   133  type MemoryFailureEvent struct {
   134  	Recipient MemoryFailureRecipient `json:"recipient"` // recipient is defined as @MemoryFailureRecipient.
   135  	Action    MemoryFailureAction    `json:"action"`    // action that has been taken. action is defined as @MemoryFailureAction.
   136  	Flags     MemoryFailureFlags     `json:"flags"`     // flags for MemoryFailureAction. action is defined as @MemoryFailureFlags.
   137  }
   138  
   139  // Emitted whenever the tray of a removable device is moved by the guest or by
   140  // HMP/QMP commands
   141  //
   142  // Since: 1.1
   143  //
   144  // Example: <- { "event": "DEVICE_TRAY_MOVED",
   145  //      "data": { "device": "ide1-cd0",
   146  //                "id": "/machine/unattached/device[22]",
   147  //                "tray-open": true
   148  //      },
   149  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   150  type DeviceTrayMovedEvent struct {
   151  	Device   string `json:"device"`    // Block device name. This is always present for compatibility reasons, but it can be empty ("") if the image does not have a device name associated.
   152  	Id       string `json:"id"`        // The name or QOM path of the guest device (since 2.8)
   153  	TrayOpen bool   `json:"tray-open"` // true if the tray has been opened or false if it has been closed
   154  }
   155  
   156  // Emitted whenever the connected status of a persistent reservation
   157  // manager changes.
   158  //
   159  // Since: 3.0
   160  //
   161  // Example: <- { "event": "PR_MANAGER_STATUS_CHANGED",
   162  //      "data": { "id": "pr-helper0",
   163  //                "connected": true
   164  //      },
   165  //      "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
   166  type PrManagerStatusChangedEvent struct {
   167  	Id        string `json:"id"`        // The id of the PR manager object
   168  	Connected bool   `json:"connected"` // true if the PR manager is connected to a backend
   169  }
   170  
   171  // Emitted when a disk image is being marked corrupt. The image can be
   172  // identified by its device or node name. The 'device' field is always
   173  // present for compatibility reasons, but it can be empty ("") if the
   174  // image does not have a device name associated.
   175  //
   176  // Note: If action is "stop", a STOP event will eventually follow the
   177  // BLOCK_IO_ERROR event.
   178  //
   179  // Example: <- { "event": "BLOCK_IMAGE_CORRUPTED",
   180  //      "data": { "device": "ide0-hd0", "node-name": "node0",
   181  //                "msg": "Prevented active L1 table overwrite", "offset": 196608,
   182  //                "size": 65536 },
   183  //      "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
   184  //
   185  // Since: 1.7
   186  type BlockImageCorruptedEvent struct {
   187  	Device   string  `json:"device"`              // device name. This is always present for compatibility reasons, but it can be empty ("") if the image does not have a device name associated.
   188  	NodeName *string `json:"node-name,omitempty"` // node name (Since: 2.4)
   189  	Msg      string  `json:"msg"`                 // informative message for human consumption, such as the kind of corruption being detected. It should not be parsed by machine as it is not guaranteed to be stable
   190  	Offset   *int64  `json:"offset,omitempty"`    // if the corruption resulted from an image access, this is the host's access offset into the image
   191  	Size     *int64  `json:"size,omitempty"`      // if the corruption resulted from an image access, this is the access size
   192  	Fatal    bool    `json:"fatal"`               // if set, the image is marked corrupt and therefore unusable after this event and must be repaired (Since 2.2; before, every BLOCK_IMAGE_CORRUPTED event was fatal)
   193  }
   194  
   195  // Emitted when a disk I/O error occurs
   196  //
   197  // Note: If action is "stop", a STOP event will eventually follow the
   198  // BLOCK_IO_ERROR event
   199  //
   200  // Since: 0.13
   201  //
   202  // Example: <- { "event": "BLOCK_IO_ERROR",
   203  //      "data": { "device": "ide0-hd1",
   204  //                "node-name": "#block212",
   205  //                "operation": "write",
   206  //                "action": "stop" },
   207  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   208  type BlockIoErrorEvent struct {
   209  	Device    string           `json:"device"`              // device name. This is always present for compatibility reasons, but it can be empty ("") if the image does not have a device name associated.
   210  	NodeName  *string          `json:"node-name,omitempty"` // node name. Note that errors may be reported for the root node that is directly attached to a guest device rather than for the node where the error occurred. The node name is not present if the drive is empty. (Since: 2.8)
   211  	Operation IoOperationType  `json:"operation"`           // I/O operation
   212  	Action    BlockErrorAction `json:"action"`              // action that has been taken
   213  	Nospace   *bool            `json:"nospace,omitempty"`   // true if I/O error was caused due to a no-space condition. This key is only present if query-block's io-status is present, please see query-block documentation for more information (since: 2.2)
   214  	Reason    string           `json:"reason"`              // human readable string describing the error cause. (This field is a debugging aid for humans, it should not be parsed by applications) (since: 2.2)
   215  }
   216  
   217  // Emitted when a block job has completed
   218  //
   219  // Since: 1.1
   220  //
   221  // Example: <- { "event": "BLOCK_JOB_COMPLETED",
   222  //      "data": { "type": "stream", "device": "virtio-disk0",
   223  //                "len": 10737418240, "offset": 10737418240,
   224  //                "speed": 0 },
   225  //      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
   226  type BlockJobCompletedEvent struct {
   227  	Type   JobType `json:"type"`            // job type
   228  	Device string  `json:"device"`          // The job identifier. Originally the device name but other values are allowed since QEMU 2.7
   229  	Len    int64   `json:"len"`             // maximum progress value
   230  	Offset int64   `json:"offset"`          // current progress value. On success this is equal to len. On failure this is less than len
   231  	Speed  int64   `json:"speed"`           // rate limit, bytes per second
   232  	Error  *string `json:"error,omitempty"` // error message. Only present on failure. This field contains a human-readable error message. There are no semantics other than that streaming has failed and clients should not try to interpret the error string
   233  }
   234  
   235  // Emitted when a block job has been cancelled
   236  //
   237  // Since: 1.1
   238  //
   239  // Example: <- { "event": "BLOCK_JOB_CANCELLED",
   240  //      "data": { "type": "stream", "device": "virtio-disk0",
   241  //                "len": 10737418240, "offset": 134217728,
   242  //                "speed": 0 },
   243  //      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
   244  type BlockJobCancelledEvent struct {
   245  	Type   JobType `json:"type"`   // job type
   246  	Device string  `json:"device"` // The job identifier. Originally the device name but other values are allowed since QEMU 2.7
   247  	Len    int64   `json:"len"`    // maximum progress value
   248  	Offset int64   `json:"offset"` // current progress value. On success this is equal to len. On failure this is less than len
   249  	Speed  int64   `json:"speed"`  // rate limit, bytes per second
   250  }
   251  
   252  // Emitted when a block job encounters an error
   253  //
   254  // Since: 1.3
   255  //
   256  // Example: <- { "event": "BLOCK_JOB_ERROR",
   257  //      "data": { "device": "ide0-hd1",
   258  //                "operation": "write",
   259  //                "action": "stop" },
   260  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   261  type BlockJobErrorEvent struct {
   262  	Device    string           `json:"device"`    // The job identifier. Originally the device name but other values are allowed since QEMU 2.7
   263  	Operation IoOperationType  `json:"operation"` // I/O operation
   264  	Action    BlockErrorAction `json:"action"`    // action that has been taken
   265  }
   266  
   267  // Emitted when a block job is ready to complete
   268  //
   269  // Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
   270  // event
   271  //
   272  // Since: 1.3
   273  //
   274  // Example: <- { "event": "BLOCK_JOB_READY",
   275  //      "data": { "device": "drive0", "type": "mirror", "speed": 0,
   276  //                "len": 2097152, "offset": 2097152 }
   277  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   278  type BlockJobReadyEvent struct {
   279  	Type   JobType `json:"type"`   // job type
   280  	Device string  `json:"device"` // The job identifier. Originally the device name but other values are allowed since QEMU 2.7
   281  	Len    int64   `json:"len"`    // maximum progress value
   282  	Offset int64   `json:"offset"` // current progress value. On success this is equal to len. On failure this is less than len
   283  	Speed  int64   `json:"speed"`  // rate limit, bytes per second
   284  }
   285  
   286  // Emitted when a block job is awaiting explicit authorization to finalize graph
   287  // changes via @block-job-finalize. If this job is part of a transaction, it will
   288  // not emit this event until the transaction has converged first.
   289  //
   290  // Since: 2.12
   291  //
   292  // Example: <- { "event": "BLOCK_JOB_WAITING",
   293  //      "data": { "device": "drive0", "type": "mirror" },
   294  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   295  type BlockJobPendingEvent struct {
   296  	Type JobType `json:"type"` // job type
   297  	Id   string  `json:"id"`   // The job identifier.
   298  }
   299  
   300  // Emitted when writes on block device reaches or exceeds the
   301  // configured write threshold. For thin-provisioned devices, this
   302  // means the device should be extended to avoid pausing for
   303  // disk exhaustion.
   304  // The event is one shot. Once triggered, it needs to be
   305  // re-registered with another block-set-write-threshold command.
   306  //
   307  // Since: 2.3
   308  type BlockWriteThresholdEvent struct {
   309  	NodeName       string `json:"node-name"`       // graph node name on which the threshold was exceeded.
   310  	AmountExceeded uint64 `json:"amount-exceeded"` // amount of data which exceeded the threshold, in bytes.
   311  	WriteThreshold uint64 `json:"write-threshold"` // last configured threshold, in bytes.
   312  }
   313  
   314  // Emitted by the Quorum block driver if it fails to establish a quorum
   315  //
   316  // Note: This event is rate-limited.
   317  //
   318  // Since: 2.0
   319  //
   320  // Example: <- { "event": "QUORUM_FAILURE",
   321  //      "data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
   322  //      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
   323  type QuorumFailureEvent struct {
   324  	Reference    string `json:"reference"`     // device name if defined else node name
   325  	SectorNum    int64  `json:"sector-num"`    // number of the first sector of the failed read operation
   326  	SectorsCount int64  `json:"sectors-count"` // failed read operation sector count
   327  }
   328  
   329  // Emitted to report a corruption of a Quorum file
   330  //
   331  // Note: This event is rate-limited.
   332  //
   333  // Since: 2.0
   334  //
   335  // Example: 1. Read operation
   336  //
   337  // { "event": "QUORUM_REPORT_BAD",
   338  //      "data": { "node-name": "node0", "sector-num": 345435, "sectors-count": 5,
   339  //                "type": "read" },
   340  //      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
   341  //
   342  // 2. Flush operation
   343  //
   344  // { "event": "QUORUM_REPORT_BAD",
   345  //      "data": { "node-name": "node0", "sector-num": 0, "sectors-count": 2097120,
   346  //                "type": "flush", "error": "Broken pipe" },
   347  //      "timestamp": { "seconds": 1456406829, "microseconds": 291763 } }
   348  type QuorumReportBadEvent struct {
   349  	Type         QuorumOpType `json:"type"`            // quorum operation type (Since 2.6)
   350  	Error        *string      `json:"error,omitempty"` // error message. Only present on failure. This field contains a human-readable error message. There are no semantics other than that the block layer reported an error and clients should not try to interpret the error string.
   351  	NodeName     string       `json:"node-name"`       // the graph node name of the block driver state
   352  	SectorNum    int64        `json:"sector-num"`      // number of the first sector of the failed read operation
   353  	SectorsCount int64        `json:"sectors-count"`   // failed read operation sector count
   354  }
   355  
   356  // Emitted when a job transitions to a different status.
   357  //
   358  // Since: 3.0
   359  type JobStatusChangeEvent struct {
   360  	Id     string    `json:"id"`     // The job identifier
   361  	Status JobStatus `json:"status"` // The new job status
   362  }
   363  
   364  // Emitted when a block export is removed and its id can be reused.
   365  //
   366  // Since: 5.2
   367  type BlockExportDeletedEvent struct {
   368  	Id string `json:"id"` // Block export id.
   369  }
   370  
   371  // Emitted when the guest opens or closes a virtio-serial port.
   372  //
   373  // Note: This event is rate-limited.
   374  //
   375  // Since: 2.1
   376  //
   377  // Example: <- { "event": "VSERPORT_CHANGE",
   378  //      "data": { "id": "channel0", "open": true },
   379  //      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
   380  type VserportChangeEvent struct {
   381  	Id   string `json:"id"`   // device identifier of the virtio-serial port
   382  	Open bool   `json:"open"` // true if the guest has opened the virtio-serial port
   383  }
   384  
   385  // Emitted when background dump has completed
   386  //
   387  // Since: 2.6
   388  //
   389  // Example: { "event": "DUMP_COMPLETED",
   390  //   "data": {"result": {"total": 1090650112, "status": "completed",
   391  //                       "completed": 1090650112} } }
   392  type DumpCompletedEvent struct {
   393  	Result DumpQueryResult `json:"result"`          // final dump status
   394  	Error  *string         `json:"error,omitempty"` // human-readable error string that provides hint on why dump failed. Only presents on failure. The user should not try to interpret the error string.
   395  }
   396  
   397  // Emitted once until the 'query-rx-filter' command is executed, the first event
   398  // will always be emitted
   399  //
   400  // Since: 1.6
   401  //
   402  // Example: <- { "event": "NIC_RX_FILTER_CHANGED",
   403  //      "data": { "name": "vnet0",
   404  //                "path": "/machine/peripheral/vnet0/virtio-backend" },
   405  //      "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
   406  //    }
   407  type NicRxFilterChangedEvent struct {
   408  	Name *string `json:"name,omitempty"` // net client name
   409  	Path string  `json:"path"`           // device path
   410  }
   411  
   412  // Emitted when VIRTIO_NET_F_STANDBY was enabled during feature negotiation.
   413  // Failover primary devices which were hidden (not hotplugged when requested)
   414  // before will now be hotplugged by the virtio-net standby device.
   415  //
   416  // device-id: QEMU device id of the unplugged device
   417  //
   418  // Since: 4.2
   419  //
   420  // Example: <- { "event": "FAILOVER_NEGOTIATED",
   421  //      "data": "net1" }
   422  type FailoverNegotiatedEvent struct {
   423  	DeviceId string `json:"device-id"`
   424  }
   425  
   426  // Emitted when guest driver adds/deletes GID to/from device
   427  //
   428  // None: @interface-id : Interface ID
   429  //
   430  // Since: 4.0
   431  //
   432  // Example: <- {"timestamp": {"seconds": 1541579657, "microseconds": 986760},
   433  //     "event": "RDMA_GID_STATUS_CHANGED",
   434  //     "data":
   435  //         {"netdev": "bridge0",
   436  //         "interface-id": 15880512517475447892,
   437  //         "gid-status": true,
   438  //         "subnet-prefix": 33022}}
   439  type RdmaGidStatusChangedEvent struct {
   440  	Netdev       string `json:"netdev"`        // RoCE Network Device name
   441  	GidStatus    bool   `json:"gid-status"`    // Add or delete indication
   442  	SubnetPrefix uint64 `json:"subnet-prefix"` // Subnet Prefix
   443  	InterfaceId  uint64 `json:"interface-id"`
   444  }
   445  
   446  // Emitted when a SPICE client establishes a connection
   447  //
   448  // Since: 0.14
   449  //
   450  // Example: <- { "timestamp": {"seconds": 1290688046, "microseconds": 388707},
   451  //      "event": "SPICE_CONNECTED",
   452  //      "data": {
   453  //        "server": { "port": "5920", "family": "ipv4", "host": "127.0.0.1"},
   454  //        "client": {"port": "52873", "family": "ipv4", "host": "127.0.0.1"}
   455  //    }}
   456  type SpiceConnectedEvent struct {
   457  	Server SpiceBasicInfo `json:"server"` // server information
   458  	Client SpiceBasicInfo `json:"client"` // client information
   459  }
   460  
   461  // Emitted after initial handshake and authentication takes place (if any)
   462  // and the SPICE channel is up and running
   463  //
   464  // Since: 0.14
   465  //
   466  // Example: <- { "timestamp": {"seconds": 1290688046, "microseconds": 417172},
   467  //      "event": "SPICE_INITIALIZED",
   468  //      "data": {"server": {"auth": "spice", "port": "5921",
   469  //                          "family": "ipv4", "host": "127.0.0.1"},
   470  //               "client": {"port": "49004", "family": "ipv4", "channel-type": 3,
   471  //                          "connection-id": 1804289383, "host": "127.0.0.1",
   472  //                          "channel-id": 0, "tls": true}
   473  //    }}
   474  type SpiceInitializedEvent struct {
   475  	Server SpiceServerInfo `json:"server"` // server information
   476  	Client SpiceChannel    `json:"client"` // client information
   477  }
   478  
   479  // Emitted when the SPICE connection is closed
   480  //
   481  // Since: 0.14
   482  //
   483  // Example: <- { "timestamp": {"seconds": 1290688046, "microseconds": 388707},
   484  //      "event": "SPICE_DISCONNECTED",
   485  //      "data": {
   486  //        "server": { "port": "5920", "family": "ipv4", "host": "127.0.0.1"},
   487  //        "client": {"port": "52873", "family": "ipv4", "host": "127.0.0.1"}
   488  //    }}
   489  type SpiceDisconnectedEvent struct {
   490  	Server SpiceBasicInfo `json:"server"` // server information
   491  	Client SpiceBasicInfo `json:"client"` // client information
   492  }
   493  
   494  // Emitted when SPICE migration has completed
   495  //
   496  // Since: 1.3
   497  //
   498  // Example: <- { "timestamp": {"seconds": 1290688046, "microseconds": 417172},
   499  //      "event": "SPICE_MIGRATE_COMPLETED" }
   500  type SpiceMigrateCompletedEvent struct{}
   501  
   502  // Emitted when a VNC client establishes a connection
   503  //
   504  // Note: This event is emitted before any authentication takes place, thus
   505  // the authentication ID is not provided
   506  //
   507  // Since: 0.13
   508  //
   509  // Example: <- { "event": "VNC_CONNECTED",
   510  //      "data": {
   511  //            "server": { "auth": "sasl", "family": "ipv4",
   512  //                        "service": "5901", "host": "0.0.0.0" },
   513  //            "client": { "family": "ipv4", "service": "58425",
   514  //                        "host": "127.0.0.1" } },
   515  //      "timestamp": { "seconds": 1262976601, "microseconds": 975795 } }
   516  type VncConnectedEvent struct {
   517  	Server VncServerInfo `json:"server"` // server information
   518  	Client VncBasicInfo  `json:"client"` // client information
   519  }
   520  
   521  // Emitted after authentication takes place (if any) and the VNC session is
   522  // made active
   523  //
   524  // Since: 0.13
   525  //
   526  // Example: <-  { "event": "VNC_INITIALIZED",
   527  //       "data": {
   528  //            "server": { "auth": "sasl", "family": "ipv4",
   529  //                        "service": "5901", "host": "0.0.0.0"},
   530  //            "client": { "family": "ipv4", "service": "46089",
   531  //                        "host": "127.0.0.1", "sasl_username": "luiz" } },
   532  //       "timestamp": { "seconds": 1263475302, "microseconds": 150772 } }
   533  type VncInitializedEvent struct {
   534  	Server VncServerInfo `json:"server"` // server information
   535  	Client VncClientInfo `json:"client"` // client information
   536  }
   537  
   538  // Emitted when the connection is closed
   539  //
   540  // Since: 0.13
   541  //
   542  // Example: <- { "event": "VNC_DISCONNECTED",
   543  //      "data": {
   544  //            "server": { "auth": "sasl", "family": "ipv4",
   545  //                        "service": "5901", "host": "0.0.0.0" },
   546  //            "client": { "family": "ipv4", "service": "58425",
   547  //                        "host": "127.0.0.1", "sasl_username": "luiz" } },
   548  //      "timestamp": { "seconds": 1262976601, "microseconds": 975795 } }
   549  type VncDisconnectedEvent struct {
   550  	Server VncServerInfo `json:"server"` // server information
   551  	Client VncClientInfo `json:"client"` // client information
   552  }
   553  
   554  // Emitted when a migration event happens
   555  //
   556  // Since: 2.4
   557  //
   558  // Example: <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
   559  //     "event": "MIGRATION",
   560  //     "data": {"status": "completed"} }
   561  type MigrationEvent struct {
   562  	Status MigrationStatus `json:"status"` // @MigrationStatus describing the current migration status.
   563  }
   564  
   565  // Emitted from the source side of a migration at the start of each pass
   566  // (when it syncs the dirty bitmap)
   567  //
   568  // Since: 2.6
   569  //
   570  // Example: { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
   571  //   "event": "MIGRATION_PASS", "data": {"pass": 2} }
   572  type MigrationPassEvent struct {
   573  	Pass int64 `json:"pass"` // An incrementing count (starting at 1 on the first pass)
   574  }
   575  
   576  // Emitted when VM finishes COLO mode due to some errors happening or
   577  // at the request of users.
   578  //
   579  // Since: 3.1
   580  //
   581  // Example: <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
   582  //      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
   583  type ColoExitEvent struct {
   584  	Mode   COLOMode       `json:"mode"`   // report COLO mode when COLO exited.
   585  	Reason COLOExitReason `json:"reason"` // describes the reason for the COLO exit.
   586  }
   587  
   588  // Emitted from source side of a migration when migration state is
   589  // WAIT_UNPLUG. Device was unplugged by guest operating system.
   590  // Device resources in QEMU are kept on standby to be able to re-plug it in case
   591  // of migration failure.
   592  //
   593  // Since: 4.2
   594  //
   595  // Example: {"event": "UNPLUG_PRIMARY", "data": {"device-id": "hostdev0"} }
   596  type UnplugPrimaryEvent struct {
   597  	DeviceId string `json:"device-id"` // QEMU device id of the unplugged device
   598  }
   599  
   600  // Emitted whenever the device removal completion is acknowledged by the guest.
   601  // At this point, it's safe to reuse the specified device ID. Device removal can
   602  // be initiated by the guest or by HMP/QMP commands.
   603  //
   604  // Since: 1.5
   605  //
   606  // Example: <- { "event": "DEVICE_DELETED",
   607  //      "data": { "device": "virtio-net-pci-0",
   608  //                "path": "/machine/peripheral/virtio-net-pci-0" },
   609  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   610  type DeviceDeletedEvent struct {
   611  	Device *string `json:"device,omitempty"` // the device's ID if it has one
   612  	Path   string  `json:"path"`             // the device's QOM path
   613  }
   614  
   615  // Emitted when a device hot unplug fails due to a guest reported error.
   616  //
   617  // Since: 6.2
   618  //
   619  // Example: <- { "event": "DEVICE_UNPLUG_GUEST_ERROR"
   620  //      "data": { "device": "core1",
   621  //                "path": "/machine/peripheral/core1" },
   622  //      },
   623  //      "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
   624  type DeviceUnplugGuestErrorEvent struct {
   625  	Device *string `json:"device,omitempty"` // the device's ID if it has one
   626  	Path   string  `json:"path"`             // the device's QOM path
   627  }
   628  
   629  // Emitted when the guest changes the actual BALLOON level. This value is
   630  // equivalent to the @actual field return by the 'query-balloon' command
   631  //
   632  // Note: this event is rate-limited.
   633  //
   634  // Since: 1.2
   635  //
   636  // Example: <- { "event": "BALLOON_CHANGE",
   637  //      "data": { "actual": 944766976 },
   638  //      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
   639  type BalloonChangeEvent struct {
   640  	Actual int64 `json:"actual"` // the logical size of the VM in bytes Formula used: logical_vm_size = vm_ram_size - balloon_size
   641  }
   642  
   643  // Emitted when the size of a memory device changes. Only emitted for memory
   644  // devices that can actually change the size (e.g., virtio-mem due to guest
   645  // action).
   646  //
   647  // Note: this event is rate-limited.
   648  //
   649  // Since: 5.1
   650  //
   651  // Example: <- { "event": "MEMORY_DEVICE_SIZE_CHANGE",
   652  //      "data": { "id": "vm0", "size": 1073741824},
   653  //      "timestamp": { "seconds": 1588168529, "microseconds": 201316 } }
   654  type MemoryDeviceSizeChangeEvent struct {
   655  	Id      *string `json:"id,omitempty"` // device's ID
   656  	Size    uint64  `json:"size"`         // the new size of memory that the device provides
   657  	QomPath string  `json:"qom-path"`     // path to the device object in the QOM tree (since 6.2)
   658  }
   659  
   660  // Emitted when memory hot unplug error occurs.
   661  //
   662  // Since: 2.4
   663  //
   664  // Example: <- { "event": "MEM_UNPLUG_ERROR"
   665  //      "data": { "device": "dimm1",
   666  //                "msg": "acpi: device unplug for unsupported device"
   667  //      },
   668  //      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
   669  type MemUnplugErrorEvent struct {
   670  	Device string `json:"device"` // device name
   671  	Msg    string `json:"msg"`    // Informative message
   672  }
   673  
   674  // Emitted when the guest changes the RTC time.
   675  //
   676  // Note: This event is rate-limited.
   677  // It is not guaranteed that the RTC in the system implements
   678  // this event, or even that the system has an RTC at all.
   679  //
   680  // Since: 0.13
   681  //
   682  // Example: <-   { "event": "RTC_CHANGE",
   683  //        "data": { "offset": 78 },
   684  //        "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
   685  type RtcChangeEvent struct {
   686  	Offset  int64  `json:"offset"`   // offset in seconds between base RTC clock (as specified by -rtc base), and new RTC clock value
   687  	QomPath string `json:"qom-path"` // path to the RTC object in the QOM tree
   688  }
   689  
   690  // Emitted when guest executes ACPI _OST method.
   691  //
   692  // Since: 2.1
   693  //
   694  // Example: <- { "event": "ACPI_DEVICE_OST",
   695  //      "data": { "device": "d1", "slot": "0",
   696  //                "slot-type": "DIMM", "source": 1, "status": 0 } }
   697  type AcpiDeviceOstEvent struct {
   698  	Info ACPIOSTInfo `json:"info"` // OSPM Status Indication
   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