From 19faaa04a0854de2bb5469e7ec7d4a42e74d9b7b Mon Sep 17 00:00:00 2001 From: Connor Kuehl Date: Thu, 8 Dec 2022 19:06:38 -0600 Subject: [PATCH] regenerate against QEMU 7.1.0 --- internal/qmp-gen/main.go | 2 +- qmp/raw/autogen.go | 23774 +++++++++++++++++++++++++++---------- 2 files changed, 17550 insertions(+), 6226 deletions(-) diff --git a/internal/qmp-gen/main.go b/internal/qmp-gen/main.go index 427c871..6b6784b 100644 --- a/internal/qmp-gen/main.go +++ b/internal/qmp-gen/main.go @@ -23,7 +23,7 @@ import ( qapischema "github.com/digitalocean/go-qemu/qapi-schema" ) -const specURL = `https://raw.githubusercontent.com/qemu/qemu/stable-2.11/qapi-schema.json` +const specURL = `https://gitlab.com/qemu-project/qemu/-/raw/v7.1.0/qapi/qapi-schema.json` var ( inputSpec = flag.String("input", specURL, "Input spec") diff --git a/qmp/raw/autogen.go b/qmp/raw/autogen.go index 3391964..bcc1c91 100644 --- a/qmp/raw/autogen.go +++ b/qmp/raw/autogen.go @@ -158,8 +158,22 @@ type AddfdInfo struct { FD int64 `json:"fd"` } +// AnnounceParameters -> AnnounceParameters (struct) + +// AnnounceParameters implements the "AnnounceParameters" QMP API type. +type AnnounceParameters struct { + Initial int64 `json:"initial"` + Max int64 `json:"max"` + Rounds int64 `json:"rounds"` + Step int64 `json:"step"` + Interfaces []string `json:"interfaces,omitempty"` + ID *string `json:"id,omitempty"` +} + // EVENT BALLOON_CHANGE +// EVENT BLOCK_EXPORT_DELETED + // EVENT BLOCK_IMAGE_CORRUPTED // EVENT BLOCK_IO_ERROR @@ -170,10 +184,21 @@ type AddfdInfo struct { // EVENT BLOCK_JOB_ERROR +// EVENT BLOCK_JOB_PENDING + // EVENT BLOCK_JOB_READY // EVENT BLOCK_WRITE_THRESHOLD +// BackupPerf -> BackupPerf (struct) + +// BackupPerf implements the "BackupPerf" QMP API type. +type BackupPerf struct { + UseCopyRange *bool `json:"use-copy-range,omitempty"` + MaxWorkers *int64 `json:"max-workers,omitempty"` + MaxChunk *int64 `json:"max-chunk,omitempty"` +} + // BalloonInfo -> BalloonInfo (struct) // BalloonInfo implements the "BalloonInfo" QMP API type. @@ -181,6 +206,90 @@ type BalloonInfo struct { Actual int64 `json:"actual"` } +// BitmapMigrationBitmapAlias -> BitmapMigrationBitmapAlias (struct) + +// BitmapMigrationBitmapAlias implements the "BitmapMigrationBitmapAlias" QMP API type. +type BitmapMigrationBitmapAlias struct { + Name string `json:"name"` + Alias string `json:"alias"` + Transform *BitmapMigrationBitmapAliasTransform `json:"transform,omitempty"` +} + +// BitmapMigrationBitmapAliasTransform -> BitmapMigrationBitmapAliasTransform (struct) + +// BitmapMigrationBitmapAliasTransform implements the "BitmapMigrationBitmapAliasTransform" QMP API type. +type BitmapMigrationBitmapAliasTransform struct { + Persistent *bool `json:"persistent,omitempty"` +} + +// BitmapMigrationNodeAlias -> BitmapMigrationNodeAlias (struct) + +// BitmapMigrationNodeAlias implements the "BitmapMigrationNodeAlias" QMP API type. +type BitmapMigrationNodeAlias struct { + NodeName string `json:"node-name"` + Alias string `json:"alias"` + Bitmaps []BitmapMigrationBitmapAlias `json:"bitmaps"` +} + +// BitmapSyncMode -> BitmapSyncMode (enum) + +// BitmapSyncMode implements the "BitmapSyncMode" QMP API type. +type BitmapSyncMode int + +// Known values of BitmapSyncMode. +const ( + BitmapSyncModeOnSuccess BitmapSyncMode = iota + BitmapSyncModeNever + BitmapSyncModeAlways +) + +// String implements fmt.Stringer. +func (e BitmapSyncMode) String() string { + switch e { + case BitmapSyncModeOnSuccess: + return "on-success" + case BitmapSyncModeNever: + return "never" + case BitmapSyncModeAlways: + return "always" + default: + return fmt.Sprintf("BitmapSyncMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BitmapSyncMode) MarshalJSON() ([]byte, error) { + switch e { + case BitmapSyncModeOnSuccess: + return json.Marshal("on-success") + case BitmapSyncModeNever: + return json.Marshal("never") + case BitmapSyncModeAlways: + return json.Marshal("always") + default: + return nil, fmt.Errorf("unknown enum value %q for BitmapSyncMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BitmapSyncMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "on-success": + *e = BitmapSyncModeOnSuccess + case "never": + *e = BitmapSyncModeNever + case "always": + *e = BitmapSyncModeAlways + default: + return fmt.Errorf("unknown enum value %q for BitmapSyncMode", s) + } + return nil +} + // BlkdebugEvent -> BlkdebugEvent (enum) // BlkdebugEvent implements the "BlkdebugEvent" QMP API type. @@ -234,6 +343,8 @@ const ( BlkdebugEventL1ShrinkWriteTable BlkdebugEventL1ShrinkFreeL2Clusters BlkdebugEventCorWrite + BlkdebugEventClusterAllocSpace + BlkdebugEventNone ) // String implements fmt.Stringer. @@ -331,6 +442,10 @@ func (e BlkdebugEvent) String() string { return "l1_shrink_free_l2_clusters" case BlkdebugEventCorWrite: return "cor_write" + case BlkdebugEventClusterAllocSpace: + return "cluster_alloc_space" + case BlkdebugEventNone: + return "none" default: return fmt.Sprintf("BlkdebugEvent(%d)", e) } @@ -431,6 +546,10 @@ func (e BlkdebugEvent) MarshalJSON() ([]byte, error) { return json.Marshal("l1_shrink_free_l2_clusters") case BlkdebugEventCorWrite: return json.Marshal("cor_write") + case BlkdebugEventClusterAllocSpace: + return json.Marshal("cluster_alloc_space") + case BlkdebugEventNone: + return json.Marshal("none") default: return nil, fmt.Errorf("unknown enum value %q for BlkdebugEvent", e) } @@ -535,22 +654,107 @@ func (e *BlkdebugEvent) UnmarshalJSON(bs []byte) error { *e = BlkdebugEventL1ShrinkFreeL2Clusters case "cor_write": *e = BlkdebugEventCorWrite + case "cluster_alloc_space": + *e = BlkdebugEventClusterAllocSpace + case "none": + *e = BlkdebugEventNone default: return fmt.Errorf("unknown enum value %q for BlkdebugEvent", s) } return nil } +// BlkdebugIOType -> BlkdebugIOType (enum) + +// BlkdebugIOType implements the "BlkdebugIOType" QMP API type. +type BlkdebugIOType int + +// Known values of BlkdebugIOType. +const ( + BlkdebugIOTypeRead BlkdebugIOType = iota + BlkdebugIOTypeWrite + BlkdebugIOTypeWriteZeroes + BlkdebugIOTypeDiscard + BlkdebugIOTypeFlush + BlkdebugIOTypeBlockStatus +) + +// String implements fmt.Stringer. +func (e BlkdebugIOType) String() string { + switch e { + case BlkdebugIOTypeRead: + return "read" + case BlkdebugIOTypeWrite: + return "write" + case BlkdebugIOTypeWriteZeroes: + return "write-zeroes" + case BlkdebugIOTypeDiscard: + return "discard" + case BlkdebugIOTypeFlush: + return "flush" + case BlkdebugIOTypeBlockStatus: + return "block-status" + default: + return fmt.Sprintf("BlkdebugIOType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlkdebugIOType) MarshalJSON() ([]byte, error) { + switch e { + case BlkdebugIOTypeRead: + return json.Marshal("read") + case BlkdebugIOTypeWrite: + return json.Marshal("write") + case BlkdebugIOTypeWriteZeroes: + return json.Marshal("write-zeroes") + case BlkdebugIOTypeDiscard: + return json.Marshal("discard") + case BlkdebugIOTypeFlush: + return json.Marshal("flush") + case BlkdebugIOTypeBlockStatus: + return json.Marshal("block-status") + default: + return nil, fmt.Errorf("unknown enum value %q for BlkdebugIOType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlkdebugIOType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "read": + *e = BlkdebugIOTypeRead + case "write": + *e = BlkdebugIOTypeWrite + case "write-zeroes": + *e = BlkdebugIOTypeWriteZeroes + case "discard": + *e = BlkdebugIOTypeDiscard + case "flush": + *e = BlkdebugIOTypeFlush + case "block-status": + *e = BlkdebugIOTypeBlockStatus + default: + return fmt.Errorf("unknown enum value %q for BlkdebugIOType", s) + } + return nil +} + // BlkdebugInjectErrorOptions -> BlkdebugInjectErrorOptions (struct) // BlkdebugInjectErrorOptions implements the "BlkdebugInjectErrorOptions" QMP API type. type BlkdebugInjectErrorOptions struct { - Event BlkdebugEvent `json:"event"` - State *int64 `json:"state,omitempty"` - Errno *int64 `json:"errno,omitempty"` - Sector *int64 `json:"sector,omitempty"` - Once *bool `json:"once,omitempty"` - Immediately *bool `json:"immediately,omitempty"` + Event BlkdebugEvent `json:"event"` + State *int64 `json:"state,omitempty"` + Iotype *BlkdebugIOType `json:"iotype,omitempty"` + Errno *int64 `json:"errno,omitempty"` + Sector *int64 `json:"sector,omitempty"` + Once *bool `json:"once,omitempty"` + Immediately *bool `json:"immediately,omitempty"` } // BlkdebugSetStateOptions -> BlkdebugSetStateOptions (struct) @@ -566,38 +770,38 @@ type BlkdebugSetStateOptions struct { // BlockDeviceInfo implements the "BlockDeviceInfo" QMP API type. type BlockDeviceInfo struct { - File string `json:"file"` - NodeName *string `json:"node-name,omitempty"` - Ro bool `json:"ro"` - Drv string `json:"drv"` - BackingFile *string `json:"backing_file,omitempty"` - BackingFileDepth int64 `json:"backing_file_depth"` - Encrypted bool `json:"encrypted"` - EncryptionKeyMissing bool `json:"encryption_key_missing"` - DetectZeroes BlockdevDetectZeroesOptions `json:"detect_zeroes"` - Bps int64 `json:"bps"` - BpsRd int64 `json:"bps_rd"` - BpsWr int64 `json:"bps_wr"` - Iops int64 `json:"iops"` - IopsRd int64 `json:"iops_rd"` - IopsWr int64 `json:"iops_wr"` - Image ImageInfo `json:"image"` - BpsMax *int64 `json:"bps_max,omitempty"` - BpsRdMax *int64 `json:"bps_rd_max,omitempty"` - BpsWrMax *int64 `json:"bps_wr_max,omitempty"` - IopsMax *int64 `json:"iops_max,omitempty"` - IopsRdMax *int64 `json:"iops_rd_max,omitempty"` - IopsWrMax *int64 `json:"iops_wr_max,omitempty"` - BpsMaxLength *int64 `json:"bps_max_length,omitempty"` - BpsRdMaxLength *int64 `json:"bps_rd_max_length,omitempty"` - BpsWrMaxLength *int64 `json:"bps_wr_max_length,omitempty"` - IopsMaxLength *int64 `json:"iops_max_length,omitempty"` - IopsRdMaxLength *int64 `json:"iops_rd_max_length,omitempty"` - IopsWrMaxLength *int64 `json:"iops_wr_max_length,omitempty"` - IopsSize *int64 `json:"iops_size,omitempty"` - Group *string `json:"group,omitempty"` - Cache BlockdevCacheInfo `json:"cache"` - WriteThreshold int64 `json:"write_threshold"` + File string `json:"file"` + NodeName *string `json:"node-name,omitempty"` + Ro bool `json:"ro"` + Drv string `json:"drv"` + BackingFile *string `json:"backing_file,omitempty"` + BackingFileDepth int64 `json:"backing_file_depth"` + Encrypted bool `json:"encrypted"` + DetectZeroes BlockdevDetectZeroesOptions `json:"detect_zeroes"` + Bps int64 `json:"bps"` + BpsRd int64 `json:"bps_rd"` + BpsWr int64 `json:"bps_wr"` + Iops int64 `json:"iops"` + IopsRd int64 `json:"iops_rd"` + IopsWr int64 `json:"iops_wr"` + Image ImageInfo `json:"image"` + BpsMax *int64 `json:"bps_max,omitempty"` + BpsRdMax *int64 `json:"bps_rd_max,omitempty"` + BpsWrMax *int64 `json:"bps_wr_max,omitempty"` + IopsMax *int64 `json:"iops_max,omitempty"` + IopsRdMax *int64 `json:"iops_rd_max,omitempty"` + IopsWrMax *int64 `json:"iops_wr_max,omitempty"` + BpsMaxLength *int64 `json:"bps_max_length,omitempty"` + BpsRdMaxLength *int64 `json:"bps_rd_max_length,omitempty"` + BpsWrMaxLength *int64 `json:"bps_wr_max_length,omitempty"` + IopsMaxLength *int64 `json:"iops_max_length,omitempty"` + IopsRdMaxLength *int64 `json:"iops_rd_max_length,omitempty"` + IopsWrMaxLength *int64 `json:"iops_wr_max_length,omitempty"` + IopsSize *int64 `json:"iops_size,omitempty"` + Group *string `json:"group,omitempty"` + Cache BlockdevCacheInfo `json:"cache"` + WriteThreshold int64 `json:"write_threshold"` + DirtyBitmaps []BlockDirtyInfo `json:"dirty-bitmaps,omitempty"` } // BlockDeviceIoStatus -> BlockDeviceIOStatus (enum) @@ -663,27 +867,36 @@ func (e *BlockDeviceIOStatus) UnmarshalJSON(bs []byte) error { // BlockDeviceStats implements the "BlockDeviceStats" QMP API type. type BlockDeviceStats struct { - RdBytes int64 `json:"rd_bytes"` - WrBytes int64 `json:"wr_bytes"` - RdOperations int64 `json:"rd_operations"` - WrOperations int64 `json:"wr_operations"` - FlushOperations int64 `json:"flush_operations"` - FlushTotalTimeNs int64 `json:"flush_total_time_ns"` - WrTotalTimeNs int64 `json:"wr_total_time_ns"` - RdTotalTimeNs int64 `json:"rd_total_time_ns"` - WrHighestOffset int64 `json:"wr_highest_offset"` - RdMerged int64 `json:"rd_merged"` - WrMerged int64 `json:"wr_merged"` - IdleTimeNs *int64 `json:"idle_time_ns,omitempty"` - FailedRdOperations int64 `json:"failed_rd_operations"` - FailedWrOperations int64 `json:"failed_wr_operations"` - FailedFlushOperations int64 `json:"failed_flush_operations"` - InvalidRdOperations int64 `json:"invalid_rd_operations"` - InvalidWrOperations int64 `json:"invalid_wr_operations"` - InvalidFlushOperations int64 `json:"invalid_flush_operations"` - AccountInvalid bool `json:"account_invalid"` - AccountFailed bool `json:"account_failed"` - TimedStats []BlockDeviceTimedStats `json:"timed_stats"` + RdBytes int64 `json:"rd_bytes"` + WrBytes int64 `json:"wr_bytes"` + UnmapBytes int64 `json:"unmap_bytes"` + RdOperations int64 `json:"rd_operations"` + WrOperations int64 `json:"wr_operations"` + FlushOperations int64 `json:"flush_operations"` + UnmapOperations int64 `json:"unmap_operations"` + RdTotalTimeNs int64 `json:"rd_total_time_ns"` + WrTotalTimeNs int64 `json:"wr_total_time_ns"` + FlushTotalTimeNs int64 `json:"flush_total_time_ns"` + UnmapTotalTimeNs int64 `json:"unmap_total_time_ns"` + WrHighestOffset int64 `json:"wr_highest_offset"` + RdMerged int64 `json:"rd_merged"` + WrMerged int64 `json:"wr_merged"` + UnmapMerged int64 `json:"unmap_merged"` + IdleTimeNs *int64 `json:"idle_time_ns,omitempty"` + FailedRdOperations int64 `json:"failed_rd_operations"` + FailedWrOperations int64 `json:"failed_wr_operations"` + FailedFlushOperations int64 `json:"failed_flush_operations"` + FailedUnmapOperations int64 `json:"failed_unmap_operations"` + InvalidRdOperations int64 `json:"invalid_rd_operations"` + InvalidWrOperations int64 `json:"invalid_wr_operations"` + InvalidFlushOperations int64 `json:"invalid_flush_operations"` + InvalidUnmapOperations int64 `json:"invalid_unmap_operations"` + AccountInvalid bool `json:"account_invalid"` + AccountFailed bool `json:"account_failed"` + TimedStats []BlockDeviceTimedStats `json:"timed_stats"` + RdLatencyHistogram *BlockLatencyHistogramInfo `json:"rd_latency_histogram,omitempty"` + WrLatencyHistogram *BlockLatencyHistogramInfo `json:"wr_latency_histogram,omitempty"` + FlushLatencyHistogram *BlockLatencyHistogramInfo `json:"flush_latency_histogram,omitempty"` } // BlockDeviceTimedStats -> BlockDeviceTimedStats (struct) @@ -720,7 +933,51 @@ type BlockDirtyBitmapAdd struct { Name string `json:"name"` Granularity *uint32 `json:"granularity,omitempty"` Persistent *bool `json:"persistent,omitempty"` - Autoload *bool `json:"autoload,omitempty"` + Disabled *bool `json:"disabled,omitempty"` +} + +// BlockDirtyBitmapMerge -> BlockDirtyBitmapMerge (struct) + +// BlockDirtyBitmapMerge implements the "BlockDirtyBitmapMerge" QMP API type. +type BlockDirtyBitmapMerge struct { + Node string `json:"node"` + Target string `json:"target"` + Bitmaps []BlockDirtyBitmapOrStr `json:"bitmaps"` +} + +// BlockDirtyBitmapOrStr -> BlockDirtyBitmapOrStr (alternate) + +// BlockDirtyBitmapOrStr implements the "BlockDirtyBitmapOrStr" QMP API type. +// +// Can be one of: +// - BlockDirtyBitmapOrStrVariantExternal +// - BlockDirtyBitmapOrStrVariantLocal +type BlockDirtyBitmapOrStr interface { + isBlockDirtyBitmapOrStr() +} + +// BlockDirtyBitmapOrStrVariantExternal is an implementation of BlockDirtyBitmapOrStr +type BlockDirtyBitmapOrStrVariantExternal BlockDirtyBitmap + +func (BlockDirtyBitmapOrStrVariantExternal) isBlockDirtyBitmapOrStr() {} + +// BlockDirtyBitmapOrStrVariantLocal is an implementation of BlockDirtyBitmapOrStr +type BlockDirtyBitmapOrStrVariantLocal string + +func (BlockDirtyBitmapOrStrVariantLocal) isBlockDirtyBitmapOrStr() {} + +func decodeBlockDirtyBitmapOrStr(bs json.RawMessage) (BlockDirtyBitmapOrStr, error) { + + var local BlockDirtyBitmapOrStrVariantLocal + if err := json.Unmarshal([]byte(bs), &local); err == nil { + return local, nil + } + + var external BlockDirtyBitmapOrStrVariantExternal + if err := json.Unmarshal([]byte(bs), &external); err == nil { + return external, nil + } + return nil, fmt.Errorf("unable to decode %q as a BlockDirtyBitmapOrStr", string(bs)) } // BlockDirtyBitmapSha256 -> BlockDirtyBitmapSha256 (struct) @@ -734,10 +991,13 @@ type BlockDirtyBitmapSha256 struct { // BlockDirtyInfo implements the "BlockDirtyInfo" QMP API type. type BlockDirtyInfo struct { - Name *string `json:"name,omitempty"` - Count int64 `json:"count"` - Granularity uint32 `json:"granularity"` - Status DirtyBitmapStatus `json:"status"` + Name *string `json:"name,omitempty"` + Count int64 `json:"count"` + Granularity uint32 `json:"granularity"` + Recording bool `json:"recording"` + Busy bool `json:"busy"` + Persistent bool `json:"persistent"` + Inconsistent *bool `json:"inconsistent,omitempty"` } // BlockErrorAction -> BlockErrorAction (enum) @@ -799,6 +1059,285 @@ func (e *BlockErrorAction) UnmarshalJSON(bs []byte) error { return nil } +// BlockExportInfo -> BlockExportInfo (struct) + +// BlockExportInfo implements the "BlockExportInfo" QMP API type. +type BlockExportInfo struct { + ID string `json:"id"` + Type BlockExportType `json:"type"` + NodeName string `json:"node-name"` + ShuttingDown bool `json:"shutting-down"` +} + +// BlockExportOptions -> BlockExportOptions (flat union) + +// BlockExportOptions implements the "BlockExportOptions" QMP API type. +// +// Can be one of: +// - BlockExportOptionsVariantFuse +// - BlockExportOptionsVariantNBD +// - BlockExportOptionsVariantVduseBlk +// - BlockExportOptionsVariantVhostUserBlk +type BlockExportOptions interface { + isBlockExportOptions() +} + +// BlockExportOptionsVariantFuse is an implementation of BlockExportOptions. +type BlockExportOptionsVariantFuse struct { + ID string `json:"id"` + FixedIothread *bool `json:"fixed-iothread,omitempty"` + Iothread *string `json:"iothread,omitempty"` + NodeName string `json:"node-name"` + Writable *bool `json:"writable,omitempty"` + Writethrough *bool `json:"writethrough,omitempty"` + Mountpoint string `json:"mountpoint"` + Growable *bool `json:"growable,omitempty"` + AllowOther *FuseExportAllowOther `json:"allow-other,omitempty"` +} + +func (BlockExportOptionsVariantFuse) isBlockExportOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockExportOptionsVariantFuse) MarshalJSON() ([]byte, error) { + v := struct { + Type BlockExportType `json:"type"` + BlockExportOptionsVariantFuse + }{ + BlockExportTypeFuse, + s, + } + return json.Marshal(v) +} + +// BlockExportOptionsVariantNBD is an implementation of BlockExportOptions. +type BlockExportOptionsVariantNBD struct { + ID string `json:"id"` + FixedIothread *bool `json:"fixed-iothread,omitempty"` + Iothread *string `json:"iothread,omitempty"` + NodeName string `json:"node-name"` + Writable *bool `json:"writable,omitempty"` + Writethrough *bool `json:"writethrough,omitempty"` + Bitmaps []BlockDirtyBitmapOrStr `json:"bitmaps,omitempty"` + AllocationDepth *bool `json:"allocation-depth,omitempty"` +} + +func (BlockExportOptionsVariantNBD) isBlockExportOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockExportOptionsVariantNBD) MarshalJSON() ([]byte, error) { + v := struct { + Type BlockExportType `json:"type"` + BlockExportOptionsVariantNBD + }{ + BlockExportTypeNBD, + s, + } + return json.Marshal(v) +} + +// BlockExportOptionsVariantVduseBlk is an implementation of BlockExportOptions. +type BlockExportOptionsVariantVduseBlk struct { + ID string `json:"id"` + FixedIothread *bool `json:"fixed-iothread,omitempty"` + Iothread *string `json:"iothread,omitempty"` + NodeName string `json:"node-name"` + Writable *bool `json:"writable,omitempty"` + Writethrough *bool `json:"writethrough,omitempty"` + Name string `json:"name"` + NumQueues *uint16 `json:"num-queues,omitempty"` + QueueSize *uint16 `json:"queue-size,omitempty"` + LogicalBlockSize *uint64 `json:"logical-block-size,omitempty"` + Serial *string `json:"serial,omitempty"` +} + +func (BlockExportOptionsVariantVduseBlk) isBlockExportOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockExportOptionsVariantVduseBlk) MarshalJSON() ([]byte, error) { + v := struct { + Type BlockExportType `json:"type"` + BlockExportOptionsVariantVduseBlk + }{ + BlockExportTypeVduseBlk, + s, + } + return json.Marshal(v) +} + +// BlockExportOptionsVariantVhostUserBlk is an implementation of BlockExportOptions. +type BlockExportOptionsVariantVhostUserBlk struct { + ID string `json:"id"` + FixedIothread *bool `json:"fixed-iothread,omitempty"` + Iothread *string `json:"iothread,omitempty"` + NodeName string `json:"node-name"` + Writable *bool `json:"writable,omitempty"` + Writethrough *bool `json:"writethrough,omitempty"` + Addr SocketAddress `json:"addr"` + LogicalBlockSize *uint64 `json:"logical-block-size,omitempty"` + NumQueues *uint16 `json:"num-queues,omitempty"` +} + +func (BlockExportOptionsVariantVhostUserBlk) isBlockExportOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockExportOptionsVariantVhostUserBlk) MarshalJSON() ([]byte, error) { + v := struct { + Type BlockExportType `json:"type"` + BlockExportOptionsVariantVhostUserBlk + }{ + BlockExportTypeVhostUserBlk, + s, + } + return json.Marshal(v) +} + +func decodeBlockExportOptions(bs json.RawMessage) (BlockExportOptions, error) { + v := struct { + Type BlockExportType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case BlockExportTypeFuse: + var ret BlockExportOptionsVariantFuse + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockExportTypeNBD: + var ret BlockExportOptionsVariantNBD + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockExportTypeVduseBlk: + var ret BlockExportOptionsVariantVduseBlk + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockExportTypeVhostUserBlk: + var ret BlockExportOptionsVariantVhostUserBlk + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union BlockExportOptions", v.Type) + } +} + +// BlockExportRemoveMode -> BlockExportRemoveMode (enum) + +// BlockExportRemoveMode implements the "BlockExportRemoveMode" QMP API type. +type BlockExportRemoveMode int + +// Known values of BlockExportRemoveMode. +const ( + BlockExportRemoveModeSafe BlockExportRemoveMode = iota + BlockExportRemoveModeHard +) + +// String implements fmt.Stringer. +func (e BlockExportRemoveMode) String() string { + switch e { + case BlockExportRemoveModeSafe: + return "safe" + case BlockExportRemoveModeHard: + return "hard" + default: + return fmt.Sprintf("BlockExportRemoveMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockExportRemoveMode) MarshalJSON() ([]byte, error) { + switch e { + case BlockExportRemoveModeSafe: + return json.Marshal("safe") + case BlockExportRemoveModeHard: + return json.Marshal("hard") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockExportRemoveMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockExportRemoveMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "safe": + *e = BlockExportRemoveModeSafe + case "hard": + *e = BlockExportRemoveModeHard + default: + return fmt.Errorf("unknown enum value %q for BlockExportRemoveMode", s) + } + return nil +} + +// BlockExportType -> BlockExportType (enum) + +// BlockExportType implements the "BlockExportType" QMP API type. +type BlockExportType int + +// Known values of BlockExportType. +const ( + BlockExportTypeNBD BlockExportType = iota + BlockExportTypeVhostUserBlk + BlockExportTypeFuse + BlockExportTypeVduseBlk +) + +// String implements fmt.Stringer. +func (e BlockExportType) String() string { + switch e { + case BlockExportTypeNBD: + return "nbd" + case BlockExportTypeVhostUserBlk: + return "vhost-user-blk" + case BlockExportTypeFuse: + return "fuse" + case BlockExportTypeVduseBlk: + return "vduse-blk" + default: + return fmt.Sprintf("BlockExportType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockExportType) MarshalJSON() ([]byte, error) { + switch e { + case BlockExportTypeNBD: + return json.Marshal("nbd") + case BlockExportTypeVhostUserBlk: + return json.Marshal("vhost-user-blk") + case BlockExportTypeFuse: + return json.Marshal("fuse") + case BlockExportTypeVduseBlk: + return json.Marshal("vduse-blk") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockExportType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockExportType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "nbd": + *e = BlockExportTypeNBD + case "vhost-user-blk": + *e = BlockExportTypeVhostUserBlk + case "fuse": + *e = BlockExportTypeFuse + case "vduse-blk": + *e = BlockExportTypeVduseBlk + default: + return fmt.Errorf("unknown enum value %q for BlockExportType", s) + } + return nil +} + // BlockIOThrottle -> BlockIOThrottle (struct) // BlockIOThrottle implements the "BlockIOThrottle" QMP API type. @@ -831,94 +1370,105 @@ type BlockIOThrottle struct { // BlockInfo implements the "BlockInfo" QMP API type. type BlockInfo struct { - Device string `json:"device"` - Qdev *string `json:"qdev,omitempty"` - Type string `json:"type"` - Removable bool `json:"removable"` - Locked bool `json:"locked"` - Inserted *BlockDeviceInfo `json:"inserted,omitempty"` - TrayOpen *bool `json:"tray_open,omitempty"` - IOStatus *BlockDeviceIOStatus `json:"io-status,omitempty"` - DirtyBitmaps []BlockDirtyInfo `json:"dirty-bitmaps,omitempty"` + Device string `json:"device"` + Qdev *string `json:"qdev,omitempty"` + Type string `json:"type"` + Removable bool `json:"removable"` + Locked bool `json:"locked"` + Inserted *BlockDeviceInfo `json:"inserted,omitempty"` + TrayOpen *bool `json:"tray_open,omitempty"` + IOStatus *BlockDeviceIOStatus `json:"io-status,omitempty"` } // BlockJobInfo -> BlockJobInfo (struct) // BlockJobInfo implements the "BlockJobInfo" QMP API type. type BlockJobInfo struct { - Type string `json:"type"` - Device string `json:"device"` - Len int64 `json:"len"` - Offset int64 `json:"offset"` - Busy bool `json:"busy"` - Paused bool `json:"paused"` - Speed int64 `json:"speed"` - IOStatus BlockDeviceIOStatus `json:"io-status"` - Ready bool `json:"ready"` + Type string `json:"type"` + Device string `json:"device"` + Len int64 `json:"len"` + Offset int64 `json:"offset"` + Busy bool `json:"busy"` + Paused bool `json:"paused"` + Speed int64 `json:"speed"` + IOStatus BlockDeviceIOStatus `json:"io-status"` + Ready bool `json:"ready"` + Status JobStatus `json:"status"` + AutoFinalize bool `json:"auto-finalize"` + AutoDismiss bool `json:"auto-dismiss"` + Error *string `json:"error,omitempty"` +} + +// BlockLatencyHistogramInfo -> BlockLatencyHistogramInfo (struct) + +// BlockLatencyHistogramInfo implements the "BlockLatencyHistogramInfo" QMP API type. +type BlockLatencyHistogramInfo struct { + Boundaries []uint64 `json:"boundaries"` + Bins []uint64 `json:"bins"` } -// BlockJobType -> BlockJobType (enum) +// BlockPermission -> BlockPermission (enum) -// BlockJobType implements the "BlockJobType" QMP API type. -type BlockJobType int +// BlockPermission implements the "BlockPermission" QMP API type. +type BlockPermission int -// Known values of BlockJobType. +// Known values of BlockPermission. const ( - BlockJobTypeCommit BlockJobType = iota - BlockJobTypeStream - BlockJobTypeMirror - BlockJobTypeBackup + BlockPermissionConsistentRead BlockPermission = iota + BlockPermissionWrite + BlockPermissionWriteUnchanged + BlockPermissionResize ) // String implements fmt.Stringer. -func (e BlockJobType) String() string { +func (e BlockPermission) String() string { switch e { - case BlockJobTypeCommit: - return "commit" - case BlockJobTypeStream: - return "stream" - case BlockJobTypeMirror: - return "mirror" - case BlockJobTypeBackup: - return "backup" + case BlockPermissionConsistentRead: + return "consistent-read" + case BlockPermissionWrite: + return "write" + case BlockPermissionWriteUnchanged: + return "write-unchanged" + case BlockPermissionResize: + return "resize" default: - return fmt.Sprintf("BlockJobType(%d)", e) + return fmt.Sprintf("BlockPermission(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e BlockJobType) MarshalJSON() ([]byte, error) { +func (e BlockPermission) MarshalJSON() ([]byte, error) { switch e { - case BlockJobTypeCommit: - return json.Marshal("commit") - case BlockJobTypeStream: - return json.Marshal("stream") - case BlockJobTypeMirror: - return json.Marshal("mirror") - case BlockJobTypeBackup: - return json.Marshal("backup") + case BlockPermissionConsistentRead: + return json.Marshal("consistent-read") + case BlockPermissionWrite: + return json.Marshal("write") + case BlockPermissionWriteUnchanged: + return json.Marshal("write-unchanged") + case BlockPermissionResize: + return json.Marshal("resize") default: - return nil, fmt.Errorf("unknown enum value %q for BlockJobType", e) + return nil, fmt.Errorf("unknown enum value %q for BlockPermission", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *BlockJobType) UnmarshalJSON(bs []byte) error { +func (e *BlockPermission) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "commit": - *e = BlockJobTypeCommit - case "stream": - *e = BlockJobTypeStream - case "mirror": - *e = BlockJobTypeMirror - case "backup": - *e = BlockJobTypeBackup + case "consistent-read": + *e = BlockPermissionConsistentRead + case "write": + *e = BlockPermissionWrite + case "write-unchanged": + *e = BlockPermissionWriteUnchanged + case "resize": + *e = BlockPermissionResize default: - return fmt.Errorf("unknown enum value %q for BlockJobType", s) + return fmt.Errorf("unknown enum value %q for BlockPermission", s) } return nil } @@ -927,22 +1477,125 @@ func (e *BlockJobType) UnmarshalJSON(bs []byte) error { // BlockStats implements the "BlockStats" QMP API type. type BlockStats struct { - Device *string `json:"device,omitempty"` - NodeName *string `json:"node-name,omitempty"` - Stats BlockDeviceStats `json:"stats"` - Parent *BlockStats `json:"parent,omitempty"` - Backing *BlockStats `json:"backing,omitempty"` + Device *string `json:"device,omitempty"` + Qdev *string `json:"qdev,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Stats BlockDeviceStats `json:"stats"` + DriverSpecific *BlockStatsSpecific `json:"driver-specific,omitempty"` + Parent *BlockStats `json:"parent,omitempty"` + Backing *BlockStats `json:"backing,omitempty"` } -// BlockdevAioOptions -> BlockdevAIOOptions (enum) - -// BlockdevAIOOptions implements the "BlockdevAioOptions" QMP API type. -type BlockdevAIOOptions int +// BlockStatsSpecific -> BlockStatsSpecific (flat union) -// Known values of BlockdevAIOOptions. +// BlockStatsSpecific implements the "BlockStatsSpecific" QMP API type. +// +// Can be one of: +// - BlockStatsSpecificVariantFile +// - BlockStatsSpecificVariantHostDevice +// - BlockStatsSpecificVariantNvme +type BlockStatsSpecific interface { + isBlockStatsSpecific() +} + +// BlockStatsSpecificVariantFile is an implementation of BlockStatsSpecific. +type BlockStatsSpecificVariantFile struct { + DiscardNbOK uint64 `json:"discard-nb-ok"` + DiscardNbFailed uint64 `json:"discard-nb-failed"` + DiscardBytesOK uint64 `json:"discard-bytes-ok"` +} + +func (BlockStatsSpecificVariantFile) isBlockStatsSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockStatsSpecificVariantFile) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockStatsSpecificVariantFile + }{ + BlockdevDriverFile, + s, + } + return json.Marshal(v) +} + +// BlockStatsSpecificVariantHostDevice is an implementation of BlockStatsSpecific. +type BlockStatsSpecificVariantHostDevice struct { + DiscardNbOK uint64 `json:"discard-nb-ok"` + DiscardNbFailed uint64 `json:"discard-nb-failed"` + DiscardBytesOK uint64 `json:"discard-bytes-ok"` +} + +func (BlockStatsSpecificVariantHostDevice) isBlockStatsSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockStatsSpecificVariantHostDevice) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockStatsSpecificVariantHostDevice + }{ + BlockdevDriverHostDevice, + s, + } + return json.Marshal(v) +} + +// BlockStatsSpecificVariantNvme is an implementation of BlockStatsSpecific. +type BlockStatsSpecificVariantNvme struct { + CompletionErrors uint64 `json:"completion-errors"` + AlignedAccesses uint64 `json:"aligned-accesses"` + UnalignedAccesses uint64 `json:"unaligned-accesses"` +} + +func (BlockStatsSpecificVariantNvme) isBlockStatsSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockStatsSpecificVariantNvme) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockStatsSpecificVariantNvme + }{ + BlockdevDriverNvme, + s, + } + return json.Marshal(v) +} + +func decodeBlockStatsSpecific(bs json.RawMessage) (BlockStatsSpecific, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Driver { + case BlockdevDriverFile: + var ret BlockStatsSpecificVariantFile + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverHostDevice: + var ret BlockStatsSpecificVariantHostDevice + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverNvme: + var ret BlockStatsSpecificVariantNvme + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union BlockStatsSpecific", v.Driver) + } +} + +// BlockdevAioOptions -> BlockdevAIOOptions (enum) + +// BlockdevAIOOptions implements the "BlockdevAioOptions" QMP API type. +type BlockdevAIOOptions int + +// Known values of BlockdevAIOOptions. const ( BlockdevAIOOptionsThreads BlockdevAIOOptions = iota BlockdevAIOOptionsNative + BlockdevAIOOptionsIOUring ) // String implements fmt.Stringer. @@ -952,6 +1605,8 @@ func (e BlockdevAIOOptions) String() string { return "threads" case BlockdevAIOOptionsNative: return "native" + case BlockdevAIOOptionsIOUring: + return "io_uring" default: return fmt.Sprintf("BlockdevAIOOptions(%d)", e) } @@ -964,6 +1619,8 @@ func (e BlockdevAIOOptions) MarshalJSON() ([]byte, error) { return json.Marshal("threads") case BlockdevAIOOptionsNative: return json.Marshal("native") + case BlockdevAIOOptionsIOUring: + return json.Marshal("io_uring") default: return nil, fmt.Errorf("unknown enum value %q for BlockdevAIOOptions", e) } @@ -980,24 +1637,101 @@ func (e *BlockdevAIOOptions) UnmarshalJSON(bs []byte) error { *e = BlockdevAIOOptionsThreads case "native": *e = BlockdevAIOOptionsNative + case "io_uring": + *e = BlockdevAIOOptionsIOUring default: return fmt.Errorf("unknown enum value %q for BlockdevAIOOptions", s) } return nil } +// BlockdevAmendOptions -> BlockdevAmendOptions (flat union) + +// BlockdevAmendOptions implements the "BlockdevAmendOptions" QMP API type. +// +// Can be one of: +// - BlockdevAmendOptionsVariantLUKS +// - BlockdevAmendOptionsVariantQcow2 +type BlockdevAmendOptions interface { + isBlockdevAmendOptions() +} + +// BlockdevAmendOptionsVariantLUKS is an implementation of BlockdevAmendOptions. +type BlockdevAmendOptionsVariantLUKS struct { +} + +func (BlockdevAmendOptionsVariantLUKS) isBlockdevAmendOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevAmendOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevAmendOptionsVariantLUKS + }{ + BlockdevDriverLUKS, + s, + } + return json.Marshal(v) +} + +// BlockdevAmendOptionsVariantQcow2 is an implementation of BlockdevAmendOptions. +type BlockdevAmendOptionsVariantQcow2 struct { + Encrypt *QCryptoBlockAmendOptions `json:"encrypt,omitempty"` +} + +func (BlockdevAmendOptionsVariantQcow2) isBlockdevAmendOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevAmendOptionsVariantQcow2) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevAmendOptionsVariantQcow2 + }{ + BlockdevDriverQcow2, + s, + } + return json.Marshal(v) +} + +func decodeBlockdevAmendOptions(bs json.RawMessage) (BlockdevAmendOptions, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Driver { + case BlockdevDriverLUKS: + var ret BlockdevAmendOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverQcow2: + var ret BlockdevAmendOptionsVariantQcow2 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union BlockdevAmendOptions", v.Driver) + } +} + // BlockdevBackup -> BlockdevBackup (struct) // BlockdevBackup implements the "BlockdevBackup" QMP API type. type BlockdevBackup struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Target string `json:"target"` - Sync MirrorSyncMode `json:"sync"` - Speed *int64 `json:"speed,omitempty"` - Compress *bool `json:"compress,omitempty"` - OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` - OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + Sync MirrorSyncMode `json:"sync"` + Speed *int64 `json:"speed,omitempty"` + Bitmap *string `json:"bitmap,omitempty"` + BitmapMode *BitmapSyncMode `json:"bitmap-mode,omitempty"` + Compress *bool `json:"compress,omitempty"` + OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` + OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` + FilterNodeName *string `json:"filter-node-name,omitempty"` + XPerf *BackupPerf `json:"x-perf,omitempty"` + Target string `json:"target"` } // BlockdevCacheInfo -> BlockdevCacheInfo (struct) @@ -1076,257 +1810,699 @@ func (e *BlockdevChangeReadOnlyMode) UnmarshalJSON(bs []byte) error { return nil } -// BlockdevDetectZeroesOptions -> BlockdevDetectZeroesOptions (enum) - -// BlockdevDetectZeroesOptions implements the "BlockdevDetectZeroesOptions" QMP API type. -type BlockdevDetectZeroesOptions int +// BlockdevCreateOptions -> BlockdevCreateOptions (flat union) -// Known values of BlockdevDetectZeroesOptions. -const ( - BlockdevDetectZeroesOptionsOff BlockdevDetectZeroesOptions = iota - BlockdevDetectZeroesOptionsOn - BlockdevDetectZeroesOptionsUnmap -) +// BlockdevCreateOptions implements the "BlockdevCreateOptions" QMP API type. +// +// Can be one of: +// - BlockdevCreateOptionsVariantFile +// - BlockdevCreateOptionsVariantGluster +// - BlockdevCreateOptionsVariantLUKS +// - BlockdevCreateOptionsVariantNfs +// - BlockdevCreateOptionsVariantParallels +// - BlockdevCreateOptionsVariantQcow +// - BlockdevCreateOptionsVariantQcow2 +// - BlockdevCreateOptionsVariantQed +// - BlockdevCreateOptionsVariantRbd +// - BlockdevCreateOptionsVariantSSH +// - BlockdevCreateOptionsVariantVdi +// - BlockdevCreateOptionsVariantVhdx +// - BlockdevCreateOptionsVariantVMDK +// - BlockdevCreateOptionsVariantVpc +type BlockdevCreateOptions interface { + isBlockdevCreateOptions() +} + +// BlockdevCreateOptionsVariantFile is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantFile struct { + Filename string `json:"filename"` + Size uint64 `json:"size"` + Preallocation *PreallocMode `json:"preallocation,omitempty"` + Nocow *bool `json:"nocow,omitempty"` + ExtentSizeHint *uint64 `json:"extent-size-hint,omitempty"` +} + +func (BlockdevCreateOptionsVariantFile) isBlockdevCreateOptions() {} -// String implements fmt.Stringer. -func (e BlockdevDetectZeroesOptions) String() string { - switch e { - case BlockdevDetectZeroesOptionsOff: - return "off" - case BlockdevDetectZeroesOptionsOn: - return "on" - case BlockdevDetectZeroesOptionsUnmap: - return "unmap" - default: - return fmt.Sprintf("BlockdevDetectZeroesOptions(%d)", e) +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantFile) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantFile + }{ + BlockdevDriverFile, + s, } + return json.Marshal(v) } +// BlockdevCreateOptionsVariantGluster is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantGluster struct { + Location BlockdevOptionsGluster `json:"location"` + Size uint64 `json:"size"` + Preallocation *PreallocMode `json:"preallocation,omitempty"` +} + +func (BlockdevCreateOptionsVariantGluster) isBlockdevCreateOptions() {} + // MarshalJSON implements json.Marshaler. -func (e BlockdevDetectZeroesOptions) MarshalJSON() ([]byte, error) { - switch e { - case BlockdevDetectZeroesOptionsOff: - return json.Marshal("off") - case BlockdevDetectZeroesOptionsOn: - return json.Marshal("on") - case BlockdevDetectZeroesOptionsUnmap: - return json.Marshal("unmap") - default: - return nil, fmt.Errorf("unknown enum value %q for BlockdevDetectZeroesOptions", e) +func (s BlockdevCreateOptionsVariantGluster) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantGluster + }{ + BlockdevDriverGluster, + s, } + return json.Marshal(v) } -// UnmarshalJSON implements json.Unmarshaler. -func (e *BlockdevDetectZeroesOptions) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err - } - switch s { - case "off": - *e = BlockdevDetectZeroesOptionsOff - case "on": - *e = BlockdevDetectZeroesOptionsOn - case "unmap": - *e = BlockdevDetectZeroesOptionsUnmap - default: - return fmt.Errorf("unknown enum value %q for BlockdevDetectZeroesOptions", s) - } - return nil +// BlockdevCreateOptionsVariantLUKS is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantLUKS struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + Preallocation *PreallocMode `json:"preallocation,omitempty"` } -// BlockdevDiscardOptions -> BlockdevDiscardOptions (enum) +func (BlockdevCreateOptionsVariantLUKS) isBlockdevCreateOptions() {} -// BlockdevDiscardOptions implements the "BlockdevDiscardOptions" QMP API type. -type BlockdevDiscardOptions int +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantLUKS + }{ + BlockdevDriverLUKS, + s, + } + return json.Marshal(v) +} -// Known values of BlockdevDiscardOptions. -const ( - BlockdevDiscardOptionsIgnore BlockdevDiscardOptions = iota - BlockdevDiscardOptionsUnmap -) +// BlockdevCreateOptionsVariantNfs is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantNfs struct { + Location BlockdevOptionsNfs `json:"location"` + Size uint64 `json:"size"` +} -// String implements fmt.Stringer. -func (e BlockdevDiscardOptions) String() string { - switch e { - case BlockdevDiscardOptionsIgnore: - return "ignore" - case BlockdevDiscardOptionsUnmap: - return "unmap" - default: - return fmt.Sprintf("BlockdevDiscardOptions(%d)", e) +func (BlockdevCreateOptionsVariantNfs) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantNfs) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantNfs + }{ + BlockdevDriverNfs, + s, } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantParallels is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantParallels struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + ClusterSize *uint64 `json:"cluster-size,omitempty"` } +func (BlockdevCreateOptionsVariantParallels) isBlockdevCreateOptions() {} + // MarshalJSON implements json.Marshaler. -func (e BlockdevDiscardOptions) MarshalJSON() ([]byte, error) { - switch e { - case BlockdevDiscardOptionsIgnore: - return json.Marshal("ignore") - case BlockdevDiscardOptionsUnmap: - return json.Marshal("unmap") - default: - return nil, fmt.Errorf("unknown enum value %q for BlockdevDiscardOptions", e) +func (s BlockdevCreateOptionsVariantParallels) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantParallels + }{ + BlockdevDriverParallels, + s, } + return json.Marshal(v) } -// UnmarshalJSON implements json.Unmarshaler. -func (e *BlockdevDiscardOptions) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err - } - switch s { - case "ignore": - *e = BlockdevDiscardOptionsIgnore - case "unmap": - *e = BlockdevDiscardOptionsUnmap - default: - return fmt.Errorf("unknown enum value %q for BlockdevDiscardOptions", s) - } - return nil +// BlockdevCreateOptionsVariantQcow is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantQcow struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + BackingFile *string `json:"backing-file,omitempty"` + Encrypt *QCryptoBlockCreateOptions `json:"encrypt,omitempty"` } -// BlockdevDriver -> BlockdevDriver (enum) +func (BlockdevCreateOptionsVariantQcow) isBlockdevCreateOptions() {} -// BlockdevDriver implements the "BlockdevDriver" QMP API type. -type BlockdevDriver int +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantQcow) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantQcow + }{ + BlockdevDriverQcow, + s, + } + return json.Marshal(v) +} -// Known values of BlockdevDriver. -const ( - BlockdevDriverBlkdebug BlockdevDriver = iota - BlockdevDriverBlkverify - BlockdevDriverBochs - BlockdevDriverCloop - BlockdevDriverDmg - BlockdevDriverFile - BlockdevDriverFTP - BlockdevDriverFTPS - BlockdevDriverGluster - BlockdevDriverHostCdrom - BlockdevDriverHostDevice - BlockdevDriverHTTP - BlockdevDriverHTTPS - BlockdevDriverIscsi - BlockdevDriverLUKS - BlockdevDriverNBD - BlockdevDriverNfs - BlockdevDriverNullAIO - BlockdevDriverNullCo - BlockdevDriverParallels - BlockdevDriverQcow - BlockdevDriverQcow2 - BlockdevDriverQed - BlockdevDriverQuorum - BlockdevDriverRaw - BlockdevDriverRbd - BlockdevDriverReplication - BlockdevDriverSheepdog - BlockdevDriverSSH - BlockdevDriverThrottle - BlockdevDriverVdi - BlockdevDriverVhdx - BlockdevDriverVMDK - BlockdevDriverVpc - BlockdevDriverVvfat - BlockdevDriverVxhs -) +// BlockdevCreateOptionsVariantQcow2 is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantQcow2 struct { + File BlockdevRef `json:"file"` + DataFile *BlockdevRef `json:"data-file,omitempty"` + DataFileRaw *bool `json:"data-file-raw,omitempty"` + ExtendedL2 *bool `json:"extended-l2,omitempty"` + Size uint64 `json:"size"` + Version *BlockdevQcow2Version `json:"version,omitempty"` + BackingFile *string `json:"backing-file,omitempty"` + BackingFmt *BlockdevDriver `json:"backing-fmt,omitempty"` + Encrypt *QCryptoBlockCreateOptions `json:"encrypt,omitempty"` + ClusterSize *uint64 `json:"cluster-size,omitempty"` + Preallocation *PreallocMode `json:"preallocation,omitempty"` + LazyRefcounts *bool `json:"lazy-refcounts,omitempty"` + RefcountBits *int64 `json:"refcount-bits,omitempty"` + CompressionType *Qcow2CompressionType `json:"compression-type,omitempty"` +} -// String implements fmt.Stringer. -func (e BlockdevDriver) String() string { - switch e { - case BlockdevDriverBlkdebug: - return "blkdebug" - case BlockdevDriverBlkverify: - return "blkverify" - case BlockdevDriverBochs: - return "bochs" - case BlockdevDriverCloop: - return "cloop" - case BlockdevDriverDmg: - return "dmg" +func (BlockdevCreateOptionsVariantQcow2) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantQcow2) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantQcow2 + }{ + BlockdevDriverQcow2, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantQed is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantQed struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + BackingFile *string `json:"backing-file,omitempty"` + BackingFmt *BlockdevDriver `json:"backing-fmt,omitempty"` + ClusterSize *uint64 `json:"cluster-size,omitempty"` + TableSize *int64 `json:"table-size,omitempty"` +} + +func (BlockdevCreateOptionsVariantQed) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantQed) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantQed + }{ + BlockdevDriverQed, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantRbd is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantRbd struct { + Location BlockdevOptionsRbd `json:"location"` + Size uint64 `json:"size"` + ClusterSize *uint64 `json:"cluster-size,omitempty"` + Encrypt *RbdEncryptionCreateOptions `json:"encrypt,omitempty"` +} + +func (BlockdevCreateOptionsVariantRbd) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantRbd) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantRbd + }{ + BlockdevDriverRbd, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantSSH is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantSSH struct { + Location BlockdevOptionsSSH `json:"location"` + Size uint64 `json:"size"` +} + +func (BlockdevCreateOptionsVariantSSH) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantSSH) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantSSH + }{ + BlockdevDriverSSH, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantVdi is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantVdi struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + Preallocation *PreallocMode `json:"preallocation,omitempty"` +} + +func (BlockdevCreateOptionsVariantVdi) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantVdi) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantVdi + }{ + BlockdevDriverVdi, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantVhdx is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantVhdx struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + LogSize *uint64 `json:"log-size,omitempty"` + BlockSize *uint64 `json:"block-size,omitempty"` + Subformat *BlockdevVhdxSubformat `json:"subformat,omitempty"` + BlockStateZero *bool `json:"block-state-zero,omitempty"` +} + +func (BlockdevCreateOptionsVariantVhdx) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantVhdx) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantVhdx + }{ + BlockdevDriverVhdx, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantVMDK is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantVMDK struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + Extents []BlockdevRef `json:"extents,omitempty"` + Subformat *BlockdevVMDKSubformat `json:"subformat,omitempty"` + BackingFile *string `json:"backing-file,omitempty"` + AdapterType *BlockdevVMDKAdapterType `json:"adapter-type,omitempty"` + Hwversion *string `json:"hwversion,omitempty"` + Toolsversion *string `json:"toolsversion,omitempty"` + ZeroedGrain *bool `json:"zeroed-grain,omitempty"` +} + +func (BlockdevCreateOptionsVariantVMDK) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantVMDK) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantVMDK + }{ + BlockdevDriverVMDK, + s, + } + return json.Marshal(v) +} + +// BlockdevCreateOptionsVariantVpc is an implementation of BlockdevCreateOptions. +type BlockdevCreateOptionsVariantVpc struct { + File BlockdevRef `json:"file"` + Size uint64 `json:"size"` + Subformat *BlockdevVpcSubformat `json:"subformat,omitempty"` + ForceSize *bool `json:"force-size,omitempty"` +} + +func (BlockdevCreateOptionsVariantVpc) isBlockdevCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevCreateOptionsVariantVpc) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevCreateOptionsVariantVpc + }{ + BlockdevDriverVpc, + s, + } + return json.Marshal(v) +} + +func decodeBlockdevCreateOptions(bs json.RawMessage) (BlockdevCreateOptions, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Driver { case BlockdevDriverFile: - return "file" - case BlockdevDriverFTP: - return "ftp" - case BlockdevDriverFTPS: - return "ftps" + var ret BlockdevCreateOptionsVariantFile + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverGluster: - return "gluster" - case BlockdevDriverHostCdrom: - return "host_cdrom" - case BlockdevDriverHostDevice: - return "host_device" - case BlockdevDriverHTTP: - return "http" - case BlockdevDriverHTTPS: - return "https" - case BlockdevDriverIscsi: - return "iscsi" + var ret BlockdevCreateOptionsVariantGluster + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverLUKS: - return "luks" - case BlockdevDriverNBD: - return "nbd" + var ret BlockdevCreateOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverNfs: - return "nfs" - case BlockdevDriverNullAIO: - return "null-aio" - case BlockdevDriverNullCo: - return "null-co" + var ret BlockdevCreateOptionsVariantNfs + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverParallels: - return "parallels" + var ret BlockdevCreateOptionsVariantParallels + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverQcow: - return "qcow" + var ret BlockdevCreateOptionsVariantQcow + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverQcow2: - return "qcow2" + var ret BlockdevCreateOptionsVariantQcow2 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverQed: - return "qed" - case BlockdevDriverQuorum: - return "quorum" - case BlockdevDriverRaw: - return "raw" + var ret BlockdevCreateOptionsVariantQed + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverRbd: - return "rbd" - case BlockdevDriverReplication: - return "replication" - case BlockdevDriverSheepdog: - return "sheepdog" + var ret BlockdevCreateOptionsVariantRbd + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverSSH: - return "ssh" - case BlockdevDriverThrottle: - return "throttle" + var ret BlockdevCreateOptionsVariantSSH + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverVdi: - return "vdi" + var ret BlockdevCreateOptionsVariantVdi + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverVhdx: - return "vhdx" + var ret BlockdevCreateOptionsVariantVhdx + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverVMDK: - return "vmdk" + var ret BlockdevCreateOptionsVariantVMDK + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverVpc: - return "vpc" - case BlockdevDriverVvfat: - return "vvfat" - case BlockdevDriverVxhs: - return "vxhs" + var ret BlockdevCreateOptionsVariantVpc + err := json.Unmarshal([]byte(bs), &ret) + return ret, err default: - return fmt.Sprintf("BlockdevDriver(%d)", e) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union BlockdevCreateOptions", v.Driver) } } -// MarshalJSON implements json.Marshaler. -func (e BlockdevDriver) MarshalJSON() ([]byte, error) { - switch e { - case BlockdevDriverBlkdebug: - return json.Marshal("blkdebug") - case BlockdevDriverBlkverify: - return json.Marshal("blkverify") - case BlockdevDriverBochs: - return json.Marshal("bochs") - case BlockdevDriverCloop: - return json.Marshal("cloop") - case BlockdevDriverDmg: +// BlockdevDetectZeroesOptions -> BlockdevDetectZeroesOptions (enum) + +// BlockdevDetectZeroesOptions implements the "BlockdevDetectZeroesOptions" QMP API type. +type BlockdevDetectZeroesOptions int + +// Known values of BlockdevDetectZeroesOptions. +const ( + BlockdevDetectZeroesOptionsOff BlockdevDetectZeroesOptions = iota + BlockdevDetectZeroesOptionsOn + BlockdevDetectZeroesOptionsUnmap +) + +// String implements fmt.Stringer. +func (e BlockdevDetectZeroesOptions) String() string { + switch e { + case BlockdevDetectZeroesOptionsOff: + return "off" + case BlockdevDetectZeroesOptionsOn: + return "on" + case BlockdevDetectZeroesOptionsUnmap: + return "unmap" + default: + return fmt.Sprintf("BlockdevDetectZeroesOptions(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevDetectZeroesOptions) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevDetectZeroesOptionsOff: + return json.Marshal("off") + case BlockdevDetectZeroesOptionsOn: + return json.Marshal("on") + case BlockdevDetectZeroesOptionsUnmap: + return json.Marshal("unmap") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevDetectZeroesOptions", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevDetectZeroesOptions) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "off": + *e = BlockdevDetectZeroesOptionsOff + case "on": + *e = BlockdevDetectZeroesOptionsOn + case "unmap": + *e = BlockdevDetectZeroesOptionsUnmap + default: + return fmt.Errorf("unknown enum value %q for BlockdevDetectZeroesOptions", s) + } + return nil +} + +// BlockdevDiscardOptions -> BlockdevDiscardOptions (enum) + +// BlockdevDiscardOptions implements the "BlockdevDiscardOptions" QMP API type. +type BlockdevDiscardOptions int + +// Known values of BlockdevDiscardOptions. +const ( + BlockdevDiscardOptionsIgnore BlockdevDiscardOptions = iota + BlockdevDiscardOptionsUnmap +) + +// String implements fmt.Stringer. +func (e BlockdevDiscardOptions) String() string { + switch e { + case BlockdevDiscardOptionsIgnore: + return "ignore" + case BlockdevDiscardOptionsUnmap: + return "unmap" + default: + return fmt.Sprintf("BlockdevDiscardOptions(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevDiscardOptions) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevDiscardOptionsIgnore: + return json.Marshal("ignore") + case BlockdevDiscardOptionsUnmap: + return json.Marshal("unmap") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevDiscardOptions", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevDiscardOptions) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "ignore": + *e = BlockdevDiscardOptionsIgnore + case "unmap": + *e = BlockdevDiscardOptionsUnmap + default: + return fmt.Errorf("unknown enum value %q for BlockdevDiscardOptions", s) + } + return nil +} + +// BlockdevDriver -> BlockdevDriver (enum) + +// BlockdevDriver implements the "BlockdevDriver" QMP API type. +type BlockdevDriver int + +// Known values of BlockdevDriver. +const ( + BlockdevDriverBlkdebug BlockdevDriver = iota + BlockdevDriverBlklogwrites + BlockdevDriverBlkreplay + BlockdevDriverBlkverify + BlockdevDriverBochs + BlockdevDriverCloop + BlockdevDriverCompress + BlockdevDriverCopyBeforeWrite + BlockdevDriverCopyOnRead + BlockdevDriverDmg + BlockdevDriverFile + BlockdevDriverSnapshotAccess + BlockdevDriverFTP + BlockdevDriverFTPS + BlockdevDriverGluster + BlockdevDriverHostCdrom + BlockdevDriverHostDevice + BlockdevDriverHTTP + BlockdevDriverHTTPS + BlockdevDriverIscsi + BlockdevDriverLUKS + BlockdevDriverNBD + BlockdevDriverNfs + BlockdevDriverNullAIO + BlockdevDriverNullCo + BlockdevDriverNvme + BlockdevDriverParallels + BlockdevDriverPreallocate + BlockdevDriverQcow + BlockdevDriverQcow2 + BlockdevDriverQed + BlockdevDriverQuorum + BlockdevDriverRaw + BlockdevDriverRbd + BlockdevDriverReplication + BlockdevDriverSSH + BlockdevDriverThrottle + BlockdevDriverVdi + BlockdevDriverVhdx + BlockdevDriverVMDK + BlockdevDriverVpc + BlockdevDriverVvfat +) + +// String implements fmt.Stringer. +func (e BlockdevDriver) String() string { + switch e { + case BlockdevDriverBlkdebug: + return "blkdebug" + case BlockdevDriverBlklogwrites: + return "blklogwrites" + case BlockdevDriverBlkreplay: + return "blkreplay" + case BlockdevDriverBlkverify: + return "blkverify" + case BlockdevDriverBochs: + return "bochs" + case BlockdevDriverCloop: + return "cloop" + case BlockdevDriverCompress: + return "compress" + case BlockdevDriverCopyBeforeWrite: + return "copy-before-write" + case BlockdevDriverCopyOnRead: + return "copy-on-read" + case BlockdevDriverDmg: + return "dmg" + case BlockdevDriverFile: + return "file" + case BlockdevDriverSnapshotAccess: + return "snapshot-access" + case BlockdevDriverFTP: + return "ftp" + case BlockdevDriverFTPS: + return "ftps" + case BlockdevDriverGluster: + return "gluster" + case BlockdevDriverHostCdrom: + return "host_cdrom" + case BlockdevDriverHostDevice: + return "host_device" + case BlockdevDriverHTTP: + return "http" + case BlockdevDriverHTTPS: + return "https" + case BlockdevDriverIscsi: + return "iscsi" + case BlockdevDriverLUKS: + return "luks" + case BlockdevDriverNBD: + return "nbd" + case BlockdevDriverNfs: + return "nfs" + case BlockdevDriverNullAIO: + return "null-aio" + case BlockdevDriverNullCo: + return "null-co" + case BlockdevDriverNvme: + return "nvme" + case BlockdevDriverParallels: + return "parallels" + case BlockdevDriverPreallocate: + return "preallocate" + case BlockdevDriverQcow: + return "qcow" + case BlockdevDriverQcow2: + return "qcow2" + case BlockdevDriverQed: + return "qed" + case BlockdevDriverQuorum: + return "quorum" + case BlockdevDriverRaw: + return "raw" + case BlockdevDriverRbd: + return "rbd" + case BlockdevDriverReplication: + return "replication" + case BlockdevDriverSSH: + return "ssh" + case BlockdevDriverThrottle: + return "throttle" + case BlockdevDriverVdi: + return "vdi" + case BlockdevDriverVhdx: + return "vhdx" + case BlockdevDriverVMDK: + return "vmdk" + case BlockdevDriverVpc: + return "vpc" + case BlockdevDriverVvfat: + return "vvfat" + default: + return fmt.Sprintf("BlockdevDriver(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevDriver) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevDriverBlkdebug: + return json.Marshal("blkdebug") + case BlockdevDriverBlklogwrites: + return json.Marshal("blklogwrites") + case BlockdevDriverBlkreplay: + return json.Marshal("blkreplay") + case BlockdevDriverBlkverify: + return json.Marshal("blkverify") + case BlockdevDriverBochs: + return json.Marshal("bochs") + case BlockdevDriverCloop: + return json.Marshal("cloop") + case BlockdevDriverCompress: + return json.Marshal("compress") + case BlockdevDriverCopyBeforeWrite: + return json.Marshal("copy-before-write") + case BlockdevDriverCopyOnRead: + return json.Marshal("copy-on-read") + case BlockdevDriverDmg: return json.Marshal("dmg") case BlockdevDriverFile: return json.Marshal("file") + case BlockdevDriverSnapshotAccess: + return json.Marshal("snapshot-access") case BlockdevDriverFTP: return json.Marshal("ftp") case BlockdevDriverFTPS: @@ -1353,8 +2529,12 @@ func (e BlockdevDriver) MarshalJSON() ([]byte, error) { return json.Marshal("null-aio") case BlockdevDriverNullCo: return json.Marshal("null-co") + case BlockdevDriverNvme: + return json.Marshal("nvme") case BlockdevDriverParallels: return json.Marshal("parallels") + case BlockdevDriverPreallocate: + return json.Marshal("preallocate") case BlockdevDriverQcow: return json.Marshal("qcow") case BlockdevDriverQcow2: @@ -1369,8 +2549,6 @@ func (e BlockdevDriver) MarshalJSON() ([]byte, error) { return json.Marshal("rbd") case BlockdevDriverReplication: return json.Marshal("replication") - case BlockdevDriverSheepdog: - return json.Marshal("sheepdog") case BlockdevDriverSSH: return json.Marshal("ssh") case BlockdevDriverThrottle: @@ -1385,8 +2563,6 @@ func (e BlockdevDriver) MarshalJSON() ([]byte, error) { return json.Marshal("vpc") case BlockdevDriverVvfat: return json.Marshal("vvfat") - case BlockdevDriverVxhs: - return json.Marshal("vxhs") default: return nil, fmt.Errorf("unknown enum value %q for BlockdevDriver", e) } @@ -1401,16 +2577,28 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error { switch s { case "blkdebug": *e = BlockdevDriverBlkdebug + case "blklogwrites": + *e = BlockdevDriverBlklogwrites + case "blkreplay": + *e = BlockdevDriverBlkreplay case "blkverify": *e = BlockdevDriverBlkverify case "bochs": *e = BlockdevDriverBochs case "cloop": *e = BlockdevDriverCloop + case "compress": + *e = BlockdevDriverCompress + case "copy-before-write": + *e = BlockdevDriverCopyBeforeWrite + case "copy-on-read": + *e = BlockdevDriverCopyOnRead case "dmg": *e = BlockdevDriverDmg case "file": *e = BlockdevDriverFile + case "snapshot-access": + *e = BlockdevDriverSnapshotAccess case "ftp": *e = BlockdevDriverFTP case "ftps": @@ -1437,8 +2625,12 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error { *e = BlockdevDriverNullAIO case "null-co": *e = BlockdevDriverNullCo + case "nvme": + *e = BlockdevDriverNvme case "parallels": *e = BlockdevDriverParallels + case "preallocate": + *e = BlockdevDriverPreallocate case "qcow": *e = BlockdevDriverQcow case "qcow2": @@ -1453,8 +2645,6 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error { *e = BlockdevDriverRbd case "replication": *e = BlockdevDriverReplication - case "sheepdog": - *e = BlockdevDriverSheepdog case "ssh": *e = BlockdevDriverSSH case "throttle": @@ -1469,8 +2659,6 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error { *e = BlockdevDriverVpc case "vvfat": *e = BlockdevDriverVvfat - case "vxhs": - *e = BlockdevDriverVxhs default: return fmt.Errorf("unknown enum value %q for BlockdevDriver", s) } @@ -1556,9 +2744,14 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error { // // Can be one of: // - BlockdevOptionsVariantBlkdebug +// - BlockdevOptionsVariantBlklogwrites +// - BlockdevOptionsVariantBlkreplay // - BlockdevOptionsVariantBlkverify // - BlockdevOptionsVariantBochs // - BlockdevOptionsVariantCloop +// - BlockdevOptionsVariantCompress +// - BlockdevOptionsVariantCopyBeforeWrite +// - BlockdevOptionsVariantCopyOnRead // - BlockdevOptionsVariantDmg // - BlockdevOptionsVariantFile // - BlockdevOptionsVariantFTP @@ -1574,7 +2767,9 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error { // - BlockdevOptionsVariantNfs // - BlockdevOptionsVariantNullAIO // - BlockdevOptionsVariantNullCo +// - BlockdevOptionsVariantNvme // - BlockdevOptionsVariantParallels +// - BlockdevOptionsVariantPreallocate // - BlockdevOptionsVariantQcow // - BlockdevOptionsVariantQcow2 // - BlockdevOptionsVariantQed @@ -1582,7 +2777,7 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error { // - BlockdevOptionsVariantRaw // - BlockdevOptionsVariantRbd // - BlockdevOptionsVariantReplication -// - BlockdevOptionsVariantSheepdog +// - BlockdevOptionsVariantSnapshotAccess // - BlockdevOptionsVariantSSH // - BlockdevOptionsVariantThrottle // - BlockdevOptionsVariantVdi @@ -1590,29 +2785,31 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error { // - BlockdevOptionsVariantVMDK // - BlockdevOptionsVariantVpc // - BlockdevOptionsVariantVvfat -// - BlockdevOptionsVariantVxhs type BlockdevOptions interface { isBlockdevOptions() } // BlockdevOptionsVariantBlkdebug is an implementation of BlockdevOptions. type BlockdevOptionsVariantBlkdebug struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Image BlockdevRef `json:"image"` - Config *string `json:"config,omitempty"` - Align *int64 `json:"align,omitempty"` - MaxTransfer *int32 `json:"max-transfer,omitempty"` - OptWriteZero *int32 `json:"opt-write-zero,omitempty"` - MaxWriteZero *int32 `json:"max-write-zero,omitempty"` - OptDiscard *int32 `json:"opt-discard,omitempty"` - MaxDiscard *int32 `json:"max-discard,omitempty"` - InjectError []BlkdebugInjectErrorOptions `json:"inject-error,omitempty"` - SetState []BlkdebugSetStateOptions `json:"set-state,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Image BlockdevRef `json:"image"` + Config *string `json:"config,omitempty"` + Align *int64 `json:"align,omitempty"` + MaxTransfer *int32 `json:"max-transfer,omitempty"` + OptWriteZero *int32 `json:"opt-write-zero,omitempty"` + MaxWriteZero *int32 `json:"max-write-zero,omitempty"` + OptDiscard *int32 `json:"opt-discard,omitempty"` + MaxDiscard *int32 `json:"max-discard,omitempty"` + InjectError []BlkdebugInjectErrorOptions `json:"inject-error,omitempty"` + SetState []BlkdebugSetStateOptions `json:"set-state,omitempty"` + TakeChildPerms []BlockPermission `json:"take-child-perms,omitempty"` + UnshareChildPerms []BlockPermission `json:"unshare-child-perms,omitempty"` } func (BlockdevOptionsVariantBlkdebug) isBlockdevOptions() {} @@ -1629,12 +2826,69 @@ func (s BlockdevOptionsVariantBlkdebug) MarshalJSON() ([]byte, error) { return json.Marshal(v) } -// BlockdevOptionsVariantBlkverify is an implementation of BlockdevOptions. -type BlockdevOptionsVariantBlkverify struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` +// BlockdevOptionsVariantBlklogwrites is an implementation of BlockdevOptions. +type BlockdevOptionsVariantBlklogwrites struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + File BlockdevRef `json:"file"` + Log BlockdevRef `json:"log"` + LogSectorSize *uint32 `json:"log-sector-size,omitempty"` + LogAppend *bool `json:"log-append,omitempty"` + LogSuperUpdateInterval *uint64 `json:"log-super-update-interval,omitempty"` +} + +func (BlockdevOptionsVariantBlklogwrites) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantBlklogwrites) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantBlklogwrites + }{ + BlockdevDriverBlklogwrites, + s, + } + return json.Marshal(v) +} + +// BlockdevOptionsVariantBlkreplay is an implementation of BlockdevOptions. +type BlockdevOptionsVariantBlkreplay struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Image BlockdevRef `json:"image"` +} + +func (BlockdevOptionsVariantBlkreplay) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantBlkreplay) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantBlkreplay + }{ + BlockdevDriverBlkreplay, + s, + } + return json.Marshal(v) +} + +// BlockdevOptionsVariantBlkverify is an implementation of BlockdevOptions. +type BlockdevOptionsVariantBlkverify struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Test BlockdevRef `json:"test"` @@ -1661,6 +2915,7 @@ type BlockdevOptionsVariantBochs struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -1686,6 +2941,7 @@ type BlockdevOptionsVariantCloop struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -1705,12 +2961,94 @@ func (s BlockdevOptionsVariantCloop) MarshalJSON() ([]byte, error) { return json.Marshal(v) } +// BlockdevOptionsVariantCompress is an implementation of BlockdevOptions. +type BlockdevOptionsVariantCompress struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + File BlockdevRef `json:"file"` +} + +func (BlockdevOptionsVariantCompress) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantCompress) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantCompress + }{ + BlockdevDriverCompress, + s, + } + return json.Marshal(v) +} + +// BlockdevOptionsVariantCopyBeforeWrite is an implementation of BlockdevOptions. +type BlockdevOptionsVariantCopyBeforeWrite struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Target BlockdevRef `json:"target"` + Bitmap *BlockDirtyBitmap `json:"bitmap,omitempty"` + OnCbwError *OnCbwError `json:"on-cbw-error,omitempty"` + CbwTimeout *uint32 `json:"cbw-timeout,omitempty"` +} + +func (BlockdevOptionsVariantCopyBeforeWrite) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantCopyBeforeWrite) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantCopyBeforeWrite + }{ + BlockdevDriverCopyBeforeWrite, + s, + } + return json.Marshal(v) +} + +// BlockdevOptionsVariantCopyOnRead is an implementation of BlockdevOptions. +type BlockdevOptionsVariantCopyOnRead struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Bottom *string `json:"bottom,omitempty"` +} + +func (BlockdevOptionsVariantCopyOnRead) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantCopyOnRead) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantCopyOnRead + }{ + BlockdevDriverCopyOnRead, + s, + } + return json.Marshal(v) +} + // BlockdevOptionsVariantDmg is an implementation of BlockdevOptions. type BlockdevOptionsVariantDmg struct { NodeName *string `json:"node-name,omitempty"` Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -1732,16 +3070,20 @@ func (s BlockdevOptionsVariantDmg) MarshalJSON() ([]byte, error) { // BlockdevOptionsVariantFile is an implementation of BlockdevOptions. type BlockdevOptionsVariantFile struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Filename string `json:"filename"` - PrManager *string `json:"pr-manager,omitempty"` - Locking *OnOffAuto `json:"locking,omitempty"` - AIO *BlockdevAIOOptions `json:"aio,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Filename string `json:"filename"` + PrManager *string `json:"pr-manager,omitempty"` + Locking *OnOffAuto `json:"locking,omitempty"` + AIO *BlockdevAIOOptions `json:"aio,omitempty"` + AIOMaxBatch *int64 `json:"aio-max-batch,omitempty"` + DropCache *bool `json:"drop-cache,omitempty"` + XCheckCacheDropped *bool `json:"x-check-cache-dropped,omitempty"` } func (BlockdevOptionsVariantFile) isBlockdevOptions() {} @@ -1764,6 +3106,7 @@ type BlockdevOptionsVariantFTP struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` } @@ -1788,6 +3131,7 @@ type BlockdevOptionsVariantFTPS struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Sslverify *bool `json:"sslverify,omitempty"` @@ -1813,6 +3157,7 @@ type BlockdevOptionsVariantGluster struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Volume string `json:"volume"` @@ -1838,16 +3183,20 @@ func (s BlockdevOptionsVariantGluster) MarshalJSON() ([]byte, error) { // BlockdevOptionsVariantHostCdrom is an implementation of BlockdevOptions. type BlockdevOptionsVariantHostCdrom struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Filename string `json:"filename"` - PrManager *string `json:"pr-manager,omitempty"` - Locking *OnOffAuto `json:"locking,omitempty"` - AIO *BlockdevAIOOptions `json:"aio,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Filename string `json:"filename"` + PrManager *string `json:"pr-manager,omitempty"` + Locking *OnOffAuto `json:"locking,omitempty"` + AIO *BlockdevAIOOptions `json:"aio,omitempty"` + AIOMaxBatch *int64 `json:"aio-max-batch,omitempty"` + DropCache *bool `json:"drop-cache,omitempty"` + XCheckCacheDropped *bool `json:"x-check-cache-dropped,omitempty"` } func (BlockdevOptionsVariantHostCdrom) isBlockdevOptions() {} @@ -1866,16 +3215,20 @@ func (s BlockdevOptionsVariantHostCdrom) MarshalJSON() ([]byte, error) { // BlockdevOptionsVariantHostDevice is an implementation of BlockdevOptions. type BlockdevOptionsVariantHostDevice struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Filename string `json:"filename"` - PrManager *string `json:"pr-manager,omitempty"` - Locking *OnOffAuto `json:"locking,omitempty"` - AIO *BlockdevAIOOptions `json:"aio,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Filename string `json:"filename"` + PrManager *string `json:"pr-manager,omitempty"` + Locking *OnOffAuto `json:"locking,omitempty"` + AIO *BlockdevAIOOptions `json:"aio,omitempty"` + AIOMaxBatch *int64 `json:"aio-max-batch,omitempty"` + DropCache *bool `json:"drop-cache,omitempty"` + XCheckCacheDropped *bool `json:"x-check-cache-dropped,omitempty"` } func (BlockdevOptionsVariantHostDevice) isBlockdevOptions() {} @@ -1898,6 +3251,7 @@ type BlockdevOptionsVariantHTTP struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Cookie *string `json:"cookie,omitempty"` @@ -1924,6 +3278,7 @@ type BlockdevOptionsVariantHTTPS struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Cookie *string `json:"cookie,omitempty"` @@ -1951,6 +3306,7 @@ type BlockdevOptionsVariantIscsi struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Transport IscsiTransport `json:"transport"` @@ -1984,6 +3340,7 @@ type BlockdevOptionsVariantLUKS struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` KeySecret *string `json:"key-secret,omitempty"` @@ -2005,15 +3362,20 @@ func (s BlockdevOptionsVariantLUKS) MarshalJSON() ([]byte, error) { // BlockdevOptionsVariantNBD is an implementation of BlockdevOptions. type BlockdevOptionsVariantNBD struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Server SocketAddress `json:"server"` - Export *string `json:"export,omitempty"` - TLSCreds *string `json:"tls-creds,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Server SocketAddress `json:"server"` + Export *string `json:"export,omitempty"` + TLSCreds *string `json:"tls-creds,omitempty"` + TLSHostname *string `json:"tls-hostname,omitempty"` + XDirtyBitmap *string `json:"x-dirty-bitmap,omitempty"` + ReconnectDelay *uint32 `json:"reconnect-delay,omitempty"` + OpenTimeout *uint32 `json:"open-timeout,omitempty"` } func (BlockdevOptionsVariantNBD) isBlockdevOptions() {} @@ -2036,6 +3398,7 @@ type BlockdevOptionsVariantNfs struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Server NfsServer `json:"server"` @@ -2068,10 +3431,12 @@ type BlockdevOptionsVariantNullAIO struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Size *int64 `json:"size,omitempty"` LatencyNs *uint64 `json:"latency-ns,omitempty"` + ReadZeroes *bool `json:"read-zeroes,omitempty"` } func (BlockdevOptionsVariantNullAIO) isBlockdevOptions() {} @@ -2094,10 +3459,12 @@ type BlockdevOptionsVariantNullCo struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Size *int64 `json:"size,omitempty"` LatencyNs *uint64 `json:"latency-ns,omitempty"` + ReadZeroes *bool `json:"read-zeroes,omitempty"` } func (BlockdevOptionsVariantNullCo) isBlockdevOptions() {} @@ -2114,12 +3481,40 @@ func (s BlockdevOptionsVariantNullCo) MarshalJSON() ([]byte, error) { return json.Marshal(v) } +// BlockdevOptionsVariantNvme is an implementation of BlockdevOptions. +type BlockdevOptionsVariantNvme struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Device string `json:"device"` + Namespace int64 `json:"namespace"` +} + +func (BlockdevOptionsVariantNvme) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantNvme) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantNvme + }{ + BlockdevDriverNvme, + s, + } + return json.Marshal(v) +} + // BlockdevOptionsVariantParallels is an implementation of BlockdevOptions. type BlockdevOptionsVariantParallels struct { NodeName *string `json:"node-name,omitempty"` Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -2139,12 +3534,40 @@ func (s BlockdevOptionsVariantParallels) MarshalJSON() ([]byte, error) { return json.Marshal(v) } +// BlockdevOptionsVariantPreallocate is an implementation of BlockdevOptions. +type BlockdevOptionsVariantPreallocate struct { + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + PreallocAlign *int64 `json:"prealloc-align,omitempty"` + PreallocSize *int64 `json:"prealloc-size,omitempty"` +} + +func (BlockdevOptionsVariantPreallocate) isBlockdevOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s BlockdevOptionsVariantPreallocate) MarshalJSON() ([]byte, error) { + v := struct { + Driver BlockdevDriver `json:"driver"` + BlockdevOptionsVariantPreallocate + }{ + BlockdevDriverPreallocate, + s, + } + return json.Marshal(v) +} + // BlockdevOptionsVariantQcow is an implementation of BlockdevOptions. type BlockdevOptionsVariantQcow struct { NodeName *string `json:"node-name,omitempty"` Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Encrypt *BlockdevQcowEncryption `json:"encrypt,omitempty"` @@ -2170,6 +3593,7 @@ type BlockdevOptionsVariantQcow2 struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` LazyRefcounts *bool `json:"lazy-refcounts,omitempty"` @@ -2179,9 +3603,11 @@ type BlockdevOptionsVariantQcow2 struct { OverlapCheck *Qcow2OverlapChecks `json:"overlap-check,omitempty"` CacheSize *int64 `json:"cache-size,omitempty"` L2CacheSize *int64 `json:"l2-cache-size,omitempty"` + L2CacheEntrySize *int64 `json:"l2-cache-entry-size,omitempty"` RefcountCacheSize *int64 `json:"refcount-cache-size,omitempty"` CacheCleanInterval *int64 `json:"cache-clean-interval,omitempty"` Encrypt *BlockdevQcow2Encryption `json:"encrypt,omitempty"` + DataFile *BlockdevRef `json:"data-file,omitempty"` } func (BlockdevOptionsVariantQcow2) isBlockdevOptions() {} @@ -2204,6 +3630,7 @@ type BlockdevOptionsVariantQed struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Backing *BlockdevRefOrNull `json:"backing,omitempty"` @@ -2229,6 +3656,7 @@ type BlockdevOptionsVariantQuorum struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Blkverify *bool `json:"blkverify,omitempty"` @@ -2258,6 +3686,7 @@ type BlockdevOptionsVariantRaw struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Offset *int64 `json:"offset,omitempty"` @@ -2280,18 +3709,23 @@ func (s BlockdevOptionsVariantRaw) MarshalJSON() ([]byte, error) { // BlockdevOptionsVariantRbd is an implementation of BlockdevOptions. type BlockdevOptionsVariantRbd struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Pool string `json:"pool"` - Image string `json:"image"` - Conf *string `json:"conf,omitempty"` - Snapshot *string `json:"snapshot,omitempty"` - User *string `json:"user,omitempty"` - Server []InetSocketAddressBase `json:"server,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Discard *BlockdevDiscardOptions `json:"discard,omitempty"` + Cache *BlockdevCacheOptions `json:"cache,omitempty"` + ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` + ForceShare *bool `json:"force-share,omitempty"` + DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` + Pool string `json:"pool"` + Namespace *string `json:"namespace,omitempty"` + Image string `json:"image"` + Conf *string `json:"conf,omitempty"` + Snapshot *string `json:"snapshot,omitempty"` + Encrypt *RbdEncryptionOptions `json:"encrypt,omitempty"` + User *string `json:"user,omitempty"` + AuthClientRequired []RbdAuthMode `json:"auth-client-required,omitempty"` + KeySecret *string `json:"key-secret,omitempty"` + Server []InetSocketAddressBase `json:"server,omitempty"` } func (BlockdevOptionsVariantRbd) isBlockdevOptions() {} @@ -2314,6 +3748,7 @@ type BlockdevOptionsVariantReplication struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Mode ReplicationMode `json:"mode"` @@ -2334,29 +3769,27 @@ func (s BlockdevOptionsVariantReplication) MarshalJSON() ([]byte, error) { return json.Marshal(v) } -// BlockdevOptionsVariantSheepdog is an implementation of BlockdevOptions. -type BlockdevOptionsVariantSheepdog struct { +// BlockdevOptionsVariantSnapshotAccess is an implementation of BlockdevOptions. +type BlockdevOptionsVariantSnapshotAccess struct { NodeName *string `json:"node-name,omitempty"` Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - Server SocketAddress `json:"server"` - Vdi string `json:"vdi"` - SnapID *uint32 `json:"snap-id,omitempty"` - Tag *string `json:"tag,omitempty"` + File BlockdevRef `json:"file"` } -func (BlockdevOptionsVariantSheepdog) isBlockdevOptions() {} +func (BlockdevOptionsVariantSnapshotAccess) isBlockdevOptions() {} // MarshalJSON implements json.Marshaler. -func (s BlockdevOptionsVariantSheepdog) MarshalJSON() ([]byte, error) { +func (s BlockdevOptionsVariantSnapshotAccess) MarshalJSON() ([]byte, error) { v := struct { Driver BlockdevDriver `json:"driver"` - BlockdevOptionsVariantSheepdog + BlockdevOptionsVariantSnapshotAccess }{ - BlockdevDriverSheepdog, + BlockdevDriverSnapshotAccess, s, } return json.Marshal(v) @@ -2368,11 +3801,13 @@ type BlockdevOptionsVariantSSH struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Server InetSocketAddress `json:"server"` Path string `json:"path"` User *string `json:"user,omitempty"` + HostKeyCheck *SSHHostKeyCheck `json:"host-key-check,omitempty"` } func (BlockdevOptionsVariantSSH) isBlockdevOptions() {} @@ -2395,6 +3830,7 @@ type BlockdevOptionsVariantThrottle struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` ThrottleGroup string `json:"throttle-group"` @@ -2421,6 +3857,7 @@ type BlockdevOptionsVariantVdi struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -2446,6 +3883,7 @@ type BlockdevOptionsVariantVhdx struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -2471,6 +3909,7 @@ type BlockdevOptionsVariantVMDK struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Backing *BlockdevRefOrNull `json:"backing,omitempty"` @@ -2496,6 +3935,7 @@ type BlockdevOptionsVariantVpc struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` File BlockdevRef `json:"file"` @@ -2521,6 +3961,7 @@ type BlockdevOptionsVariantVvfat struct { Discard *BlockdevDiscardOptions `json:"discard,omitempty"` Cache *BlockdevCacheOptions `json:"cache,omitempty"` ReadOnly *bool `json:"read-only,omitempty"` + AutoReadOnly *bool `json:"auto-read-only,omitempty"` ForceShare *bool `json:"force-share,omitempty"` DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` Dir string `json:"dir"` @@ -2544,33 +3985,6 @@ func (s BlockdevOptionsVariantVvfat) MarshalJSON() ([]byte, error) { return json.Marshal(v) } -// BlockdevOptionsVariantVxhs is an implementation of BlockdevOptions. -type BlockdevOptionsVariantVxhs struct { - NodeName *string `json:"node-name,omitempty"` - Discard *BlockdevDiscardOptions `json:"discard,omitempty"` - Cache *BlockdevCacheOptions `json:"cache,omitempty"` - ReadOnly *bool `json:"read-only,omitempty"` - ForceShare *bool `json:"force-share,omitempty"` - DetectZeroes *BlockdevDetectZeroesOptions `json:"detect-zeroes,omitempty"` - VdiskID string `json:"vdisk-id"` - Server InetSocketAddressBase `json:"server"` - TLSCreds *string `json:"tls-creds,omitempty"` -} - -func (BlockdevOptionsVariantVxhs) isBlockdevOptions() {} - -// MarshalJSON implements json.Marshaler. -func (s BlockdevOptionsVariantVxhs) MarshalJSON() ([]byte, error) { - v := struct { - Driver BlockdevDriver `json:"driver"` - BlockdevOptionsVariantVxhs - }{ - BlockdevDriverVxhs, - s, - } - return json.Marshal(v) -} - func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { v := struct { Driver BlockdevDriver `json:"driver"` @@ -2583,6 +3997,14 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { var ret BlockdevOptionsVariantBlkdebug err := json.Unmarshal([]byte(bs), &ret) return ret, err + case BlockdevDriverBlklogwrites: + var ret BlockdevOptionsVariantBlklogwrites + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverBlkreplay: + var ret BlockdevOptionsVariantBlkreplay + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverBlkverify: var ret BlockdevOptionsVariantBlkverify err := json.Unmarshal([]byte(bs), &ret) @@ -2595,6 +4017,18 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { var ret BlockdevOptionsVariantCloop err := json.Unmarshal([]byte(bs), &ret) return ret, err + case BlockdevDriverCompress: + var ret BlockdevOptionsVariantCompress + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverCopyBeforeWrite: + var ret BlockdevOptionsVariantCopyBeforeWrite + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case BlockdevDriverCopyOnRead: + var ret BlockdevOptionsVariantCopyOnRead + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverDmg: var ret BlockdevOptionsVariantDmg err := json.Unmarshal([]byte(bs), &ret) @@ -2655,10 +4089,18 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { var ret BlockdevOptionsVariantNullCo err := json.Unmarshal([]byte(bs), &ret) return ret, err + case BlockdevDriverNvme: + var ret BlockdevOptionsVariantNvme + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverParallels: var ret BlockdevOptionsVariantParallels err := json.Unmarshal([]byte(bs), &ret) return ret, err + case BlockdevDriverPreallocate: + var ret BlockdevOptionsVariantPreallocate + err := json.Unmarshal([]byte(bs), &ret) + return ret, err case BlockdevDriverQcow: var ret BlockdevOptionsVariantQcow err := json.Unmarshal([]byte(bs), &ret) @@ -2687,8 +4129,8 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { var ret BlockdevOptionsVariantReplication err := json.Unmarshal([]byte(bs), &ret) return ret, err - case BlockdevDriverSheepdog: - var ret BlockdevOptionsVariantSheepdog + case BlockdevDriverSnapshotAccess: + var ret BlockdevOptionsVariantSnapshotAccess err := json.Unmarshal([]byte(bs), &ret) return ret, err case BlockdevDriverSSH: @@ -2719,15 +4161,62 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) { var ret BlockdevOptionsVariantVvfat err := json.Unmarshal([]byte(bs), &ret) return ret, err - case BlockdevDriverVxhs: - var ret BlockdevOptionsVariantVxhs - err := json.Unmarshal([]byte(bs), &ret) - return ret, err default: return nil, fmt.Errorf("unknown flat union subtype %q for flat union BlockdevOptions", v.Driver) } } +// BlockdevOptionsGluster -> BlockdevOptionsGluster (struct) + +// BlockdevOptionsGluster implements the "BlockdevOptionsGluster" QMP API type. +type BlockdevOptionsGluster struct { + Volume string `json:"volume"` + Path string `json:"path"` + Server []SocketAddress `json:"server"` + Debug *int64 `json:"debug,omitempty"` + Logfile *string `json:"logfile,omitempty"` +} + +// BlockdevOptionsNfs -> BlockdevOptionsNfs (struct) + +// BlockdevOptionsNfs implements the "BlockdevOptionsNfs" QMP API type. +type BlockdevOptionsNfs struct { + Server NfsServer `json:"server"` + Path string `json:"path"` + User *int64 `json:"user,omitempty"` + Group *int64 `json:"group,omitempty"` + TCPSynCount *int64 `json:"tcp-syn-count,omitempty"` + ReadaheadSize *int64 `json:"readahead-size,omitempty"` + PageCacheSize *int64 `json:"page-cache-size,omitempty"` + Debug *int64 `json:"debug,omitempty"` +} + +// BlockdevOptionsRbd -> BlockdevOptionsRbd (struct) + +// BlockdevOptionsRbd implements the "BlockdevOptionsRbd" QMP API type. +type BlockdevOptionsRbd struct { + Pool string `json:"pool"` + Namespace *string `json:"namespace,omitempty"` + Image string `json:"image"` + Conf *string `json:"conf,omitempty"` + Snapshot *string `json:"snapshot,omitempty"` + Encrypt *RbdEncryptionOptions `json:"encrypt,omitempty"` + User *string `json:"user,omitempty"` + AuthClientRequired []RbdAuthMode `json:"auth-client-required,omitempty"` + KeySecret *string `json:"key-secret,omitempty"` + Server []InetSocketAddressBase `json:"server,omitempty"` +} + +// BlockdevOptionsSsh -> BlockdevOptionsSSH (struct) + +// BlockdevOptionsSSH implements the "BlockdevOptionsSsh" QMP API type. +type BlockdevOptionsSSH struct { + Server InetSocketAddress `json:"server"` + Path string `json:"path"` + User *string `json:"user,omitempty"` + HostKeyCheck *SSHHostKeyCheck `json:"host-key-check,omitempty"` +} + // BlockdevQcow2Encryption -> BlockdevQcow2Encryption (flat union) // BlockdevQcow2Encryption implements the "BlockdevQcow2Encryption" QMP API type. @@ -2850,6 +4339,58 @@ func (e *BlockdevQcow2EncryptionFormat) UnmarshalJSON(bs []byte) error { return nil } +// BlockdevQcow2Version -> BlockdevQcow2Version (enum) + +// BlockdevQcow2Version implements the "BlockdevQcow2Version" QMP API type. +type BlockdevQcow2Version int + +// Known values of BlockdevQcow2Version. +const ( + BlockdevQcow2VersionV2 BlockdevQcow2Version = iota + BlockdevQcow2VersionV3 +) + +// String implements fmt.Stringer. +func (e BlockdevQcow2Version) String() string { + switch e { + case BlockdevQcow2VersionV2: + return "v2" + case BlockdevQcow2VersionV3: + return "v3" + default: + return fmt.Sprintf("BlockdevQcow2Version(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevQcow2Version) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevQcow2VersionV2: + return json.Marshal("v2") + case BlockdevQcow2VersionV3: + return json.Marshal("v3") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevQcow2Version", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevQcow2Version) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "v2": + *e = BlockdevQcow2VersionV2 + case "v3": + *e = BlockdevQcow2VersionV3 + default: + return fmt.Errorf("unknown enum value %q for BlockdevQcow2Version", s) + } + return nil +} + // BlockdevQcowEncryption -> BlockdevQcowEncryption (flat union) // BlockdevQcowEncryption implements the "BlockdevQcowEncryption" QMP API type. @@ -2955,42 +4496,48 @@ type BlockdevRef interface { // BlockdevRefVariantDefinition is an implementation of BlockdevRef type BlockdevRefVariantDefinition BlockdevOptions -func (BlockdevOptionsVariantBlkdebug) isBlockdevRef() {} -func (BlockdevOptionsVariantBlkverify) isBlockdevRef() {} -func (BlockdevOptionsVariantBochs) isBlockdevRef() {} -func (BlockdevOptionsVariantCloop) isBlockdevRef() {} -func (BlockdevOptionsVariantDmg) isBlockdevRef() {} -func (BlockdevOptionsVariantFile) isBlockdevRef() {} -func (BlockdevOptionsVariantFTP) isBlockdevRef() {} -func (BlockdevOptionsVariantFTPS) isBlockdevRef() {} -func (BlockdevOptionsVariantGluster) isBlockdevRef() {} -func (BlockdevOptionsVariantHostCdrom) isBlockdevRef() {} -func (BlockdevOptionsVariantHostDevice) isBlockdevRef() {} -func (BlockdevOptionsVariantHTTP) isBlockdevRef() {} -func (BlockdevOptionsVariantHTTPS) isBlockdevRef() {} -func (BlockdevOptionsVariantIscsi) isBlockdevRef() {} -func (BlockdevOptionsVariantLUKS) isBlockdevRef() {} -func (BlockdevOptionsVariantNBD) isBlockdevRef() {} -func (BlockdevOptionsVariantNfs) isBlockdevRef() {} -func (BlockdevOptionsVariantNullAIO) isBlockdevRef() {} -func (BlockdevOptionsVariantNullCo) isBlockdevRef() {} -func (BlockdevOptionsVariantParallels) isBlockdevRef() {} -func (BlockdevOptionsVariantQcow) isBlockdevRef() {} -func (BlockdevOptionsVariantQcow2) isBlockdevRef() {} -func (BlockdevOptionsVariantQed) isBlockdevRef() {} -func (BlockdevOptionsVariantQuorum) isBlockdevRef() {} -func (BlockdevOptionsVariantRaw) isBlockdevRef() {} -func (BlockdevOptionsVariantRbd) isBlockdevRef() {} -func (BlockdevOptionsVariantReplication) isBlockdevRef() {} -func (BlockdevOptionsVariantSheepdog) isBlockdevRef() {} -func (BlockdevOptionsVariantSSH) isBlockdevRef() {} -func (BlockdevOptionsVariantThrottle) isBlockdevRef() {} -func (BlockdevOptionsVariantVdi) isBlockdevRef() {} -func (BlockdevOptionsVariantVhdx) isBlockdevRef() {} -func (BlockdevOptionsVariantVMDK) isBlockdevRef() {} -func (BlockdevOptionsVariantVpc) isBlockdevRef() {} -func (BlockdevOptionsVariantVvfat) isBlockdevRef() {} -func (BlockdevOptionsVariantVxhs) isBlockdevRef() {} +func (BlockdevOptionsVariantBlkdebug) isBlockdevRef() {} +func (BlockdevOptionsVariantBlklogwrites) isBlockdevRef() {} +func (BlockdevOptionsVariantBlkreplay) isBlockdevRef() {} +func (BlockdevOptionsVariantBlkverify) isBlockdevRef() {} +func (BlockdevOptionsVariantBochs) isBlockdevRef() {} +func (BlockdevOptionsVariantCloop) isBlockdevRef() {} +func (BlockdevOptionsVariantCompress) isBlockdevRef() {} +func (BlockdevOptionsVariantCopyBeforeWrite) isBlockdevRef() {} +func (BlockdevOptionsVariantCopyOnRead) isBlockdevRef() {} +func (BlockdevOptionsVariantDmg) isBlockdevRef() {} +func (BlockdevOptionsVariantFile) isBlockdevRef() {} +func (BlockdevOptionsVariantFTP) isBlockdevRef() {} +func (BlockdevOptionsVariantFTPS) isBlockdevRef() {} +func (BlockdevOptionsVariantGluster) isBlockdevRef() {} +func (BlockdevOptionsVariantHostCdrom) isBlockdevRef() {} +func (BlockdevOptionsVariantHostDevice) isBlockdevRef() {} +func (BlockdevOptionsVariantHTTP) isBlockdevRef() {} +func (BlockdevOptionsVariantHTTPS) isBlockdevRef() {} +func (BlockdevOptionsVariantIscsi) isBlockdevRef() {} +func (BlockdevOptionsVariantLUKS) isBlockdevRef() {} +func (BlockdevOptionsVariantNBD) isBlockdevRef() {} +func (BlockdevOptionsVariantNfs) isBlockdevRef() {} +func (BlockdevOptionsVariantNullAIO) isBlockdevRef() {} +func (BlockdevOptionsVariantNullCo) isBlockdevRef() {} +func (BlockdevOptionsVariantNvme) isBlockdevRef() {} +func (BlockdevOptionsVariantParallels) isBlockdevRef() {} +func (BlockdevOptionsVariantPreallocate) isBlockdevRef() {} +func (BlockdevOptionsVariantQcow) isBlockdevRef() {} +func (BlockdevOptionsVariantQcow2) isBlockdevRef() {} +func (BlockdevOptionsVariantQed) isBlockdevRef() {} +func (BlockdevOptionsVariantQuorum) isBlockdevRef() {} +func (BlockdevOptionsVariantRaw) isBlockdevRef() {} +func (BlockdevOptionsVariantRbd) isBlockdevRef() {} +func (BlockdevOptionsVariantReplication) isBlockdevRef() {} +func (BlockdevOptionsVariantSnapshotAccess) isBlockdevRef() {} +func (BlockdevOptionsVariantSSH) isBlockdevRef() {} +func (BlockdevOptionsVariantThrottle) isBlockdevRef() {} +func (BlockdevOptionsVariantVdi) isBlockdevRef() {} +func (BlockdevOptionsVariantVhdx) isBlockdevRef() {} +func (BlockdevOptionsVariantVMDK) isBlockdevRef() {} +func (BlockdevOptionsVariantVpc) isBlockdevRef() {} +func (BlockdevOptionsVariantVvfat) isBlockdevRef() {} // BlockdevRefVariantReference is an implementation of BlockdevRef type BlockdevRefVariantReference string @@ -3008,12 +4555,22 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) { switch impl := definition.(type) { case BlockdevOptionsVariantBlkdebug: return impl, nil + case BlockdevOptionsVariantBlklogwrites: + return impl, nil + case BlockdevOptionsVariantBlkreplay: + return impl, nil case BlockdevOptionsVariantBlkverify: return impl, nil case BlockdevOptionsVariantBochs: return impl, nil case BlockdevOptionsVariantCloop: return impl, nil + case BlockdevOptionsVariantCompress: + return impl, nil + case BlockdevOptionsVariantCopyBeforeWrite: + return impl, nil + case BlockdevOptionsVariantCopyOnRead: + return impl, nil case BlockdevOptionsVariantDmg: return impl, nil case BlockdevOptionsVariantFile: @@ -3044,8 +4601,12 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) { return impl, nil case BlockdevOptionsVariantNullCo: return impl, nil + case BlockdevOptionsVariantNvme: + return impl, nil case BlockdevOptionsVariantParallels: return impl, nil + case BlockdevOptionsVariantPreallocate: + return impl, nil case BlockdevOptionsVariantQcow: return impl, nil case BlockdevOptionsVariantQcow2: @@ -3060,7 +4621,7 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) { return impl, nil case BlockdevOptionsVariantReplication: return impl, nil - case BlockdevOptionsVariantSheepdog: + case BlockdevOptionsVariantSnapshotAccess: return impl, nil case BlockdevOptionsVariantSSH: return impl, nil @@ -3076,8 +4637,6 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) { return impl, nil case BlockdevOptionsVariantVvfat: return impl, nil - case BlockdevOptionsVariantVxhs: - return impl, nil } } return nil, fmt.Errorf("unable to decode %q as a BlockdevRef", string(bs)) @@ -3098,42 +4657,48 @@ type BlockdevRefOrNull interface { // BlockdevRefOrNullVariantDefinition is an implementation of BlockdevRefOrNull type BlockdevRefOrNullVariantDefinition BlockdevOptions -func (BlockdevOptionsVariantBlkdebug) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantBlkverify) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantBochs) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantCloop) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantDmg) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantFile) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantFTP) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantFTPS) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantGluster) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantHostCdrom) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantHostDevice) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantHTTP) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantHTTPS) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantIscsi) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantLUKS) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantNBD) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantNfs) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantNullAIO) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantNullCo) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantParallels) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantQcow) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantQcow2) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantQed) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantQuorum) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantRaw) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantRbd) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantReplication) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantSheepdog) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantSSH) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantThrottle) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVdi) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVhdx) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVMDK) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVpc) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVvfat) isBlockdevRefOrNull() {} -func (BlockdevOptionsVariantVxhs) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantBlkdebug) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantBlklogwrites) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantBlkreplay) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantBlkverify) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantBochs) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantCloop) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantCompress) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantCopyBeforeWrite) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantCopyOnRead) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantDmg) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantFile) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantFTP) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantFTPS) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantGluster) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantHostCdrom) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantHostDevice) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantHTTP) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantHTTPS) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantIscsi) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantLUKS) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantNBD) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantNfs) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantNullAIO) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantNullCo) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantNvme) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantParallels) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantPreallocate) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantQcow) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantQcow2) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantQed) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantQuorum) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantRaw) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantRbd) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantReplication) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantSnapshotAccess) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantSSH) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantThrottle) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantVdi) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantVhdx) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantVMDK) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantVpc) isBlockdevRefOrNull() {} +func (BlockdevOptionsVariantVvfat) isBlockdevRefOrNull() {} // BlockdevRefOrNullVariantNull is a JSON null type, so it must // also implement the isNullable interface. @@ -3167,12 +4732,22 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) { switch impl := definition.(type) { case BlockdevOptionsVariantBlkdebug: return impl, nil + case BlockdevOptionsVariantBlklogwrites: + return impl, nil + case BlockdevOptionsVariantBlkreplay: + return impl, nil case BlockdevOptionsVariantBlkverify: return impl, nil case BlockdevOptionsVariantBochs: return impl, nil case BlockdevOptionsVariantCloop: return impl, nil + case BlockdevOptionsVariantCompress: + return impl, nil + case BlockdevOptionsVariantCopyBeforeWrite: + return impl, nil + case BlockdevOptionsVariantCopyOnRead: + return impl, nil case BlockdevOptionsVariantDmg: return impl, nil case BlockdevOptionsVariantFile: @@ -3203,8 +4778,12 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) { return impl, nil case BlockdevOptionsVariantNullCo: return impl, nil + case BlockdevOptionsVariantNvme: + return impl, nil case BlockdevOptionsVariantParallels: return impl, nil + case BlockdevOptionsVariantPreallocate: + return impl, nil case BlockdevOptionsVariantQcow: return impl, nil case BlockdevOptionsVariantQcow2: @@ -3219,7 +4798,7 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) { return impl, nil case BlockdevOptionsVariantReplication: return impl, nil - case BlockdevOptionsVariantSheepdog: + case BlockdevOptionsVariantSnapshotAccess: return impl, nil case BlockdevOptionsVariantSSH: return impl, nil @@ -3235,8 +4814,6 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) { return impl, nil case BlockdevOptionsVariantVvfat: return impl, nil - case BlockdevOptionsVariantVxhs: - return impl, nil } } return nil, fmt.Errorf("unable to decode %q as a BlockdevRefOrNull", string(bs)) @@ -3270,13 +4847,393 @@ type BlockdevSnapshotSync struct { Mode *NewImageMode `json:"mode,omitempty"` } -// ChardevBackend -> ChardevBackend (simple union) +// BlockdevVhdxSubformat -> BlockdevVhdxSubformat (enum) -// ChardevBackend implements the "ChardevBackend" QMP API type. -// +// BlockdevVhdxSubformat implements the "BlockdevVhdxSubformat" QMP API type. +type BlockdevVhdxSubformat int + +// Known values of BlockdevVhdxSubformat. +const ( + BlockdevVhdxSubformatDynamic BlockdevVhdxSubformat = iota + BlockdevVhdxSubformatFixed +) + +// String implements fmt.Stringer. +func (e BlockdevVhdxSubformat) String() string { + switch e { + case BlockdevVhdxSubformatDynamic: + return "dynamic" + case BlockdevVhdxSubformatFixed: + return "fixed" + default: + return fmt.Sprintf("BlockdevVhdxSubformat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevVhdxSubformat) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevVhdxSubformatDynamic: + return json.Marshal("dynamic") + case BlockdevVhdxSubformatFixed: + return json.Marshal("fixed") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevVhdxSubformat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevVhdxSubformat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "dynamic": + *e = BlockdevVhdxSubformatDynamic + case "fixed": + *e = BlockdevVhdxSubformatFixed + default: + return fmt.Errorf("unknown enum value %q for BlockdevVhdxSubformat", s) + } + return nil +} + +// BlockdevVmdkAdapterType -> BlockdevVMDKAdapterType (enum) + +// BlockdevVMDKAdapterType implements the "BlockdevVmdkAdapterType" QMP API type. +type BlockdevVMDKAdapterType int + +// Known values of BlockdevVMDKAdapterType. +const ( + BlockdevVMDKAdapterTypeIde BlockdevVMDKAdapterType = iota + BlockdevVMDKAdapterTypeBuslogic + BlockdevVMDKAdapterTypeLsilogic + BlockdevVMDKAdapterTypeLegacyEsx +) + +// String implements fmt.Stringer. +func (e BlockdevVMDKAdapterType) String() string { + switch e { + case BlockdevVMDKAdapterTypeIde: + return "ide" + case BlockdevVMDKAdapterTypeBuslogic: + return "buslogic" + case BlockdevVMDKAdapterTypeLsilogic: + return "lsilogic" + case BlockdevVMDKAdapterTypeLegacyEsx: + return "legacyESX" + default: + return fmt.Sprintf("BlockdevVMDKAdapterType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevVMDKAdapterType) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevVMDKAdapterTypeIde: + return json.Marshal("ide") + case BlockdevVMDKAdapterTypeBuslogic: + return json.Marshal("buslogic") + case BlockdevVMDKAdapterTypeLsilogic: + return json.Marshal("lsilogic") + case BlockdevVMDKAdapterTypeLegacyEsx: + return json.Marshal("legacyESX") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevVMDKAdapterType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevVMDKAdapterType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "ide": + *e = BlockdevVMDKAdapterTypeIde + case "buslogic": + *e = BlockdevVMDKAdapterTypeBuslogic + case "lsilogic": + *e = BlockdevVMDKAdapterTypeLsilogic + case "legacyESX": + *e = BlockdevVMDKAdapterTypeLegacyEsx + default: + return fmt.Errorf("unknown enum value %q for BlockdevVMDKAdapterType", s) + } + return nil +} + +// BlockdevVmdkSubformat -> BlockdevVMDKSubformat (enum) + +// BlockdevVMDKSubformat implements the "BlockdevVmdkSubformat" QMP API type. +type BlockdevVMDKSubformat int + +// Known values of BlockdevVMDKSubformat. +const ( + BlockdevVMDKSubformatMonolithicSparse BlockdevVMDKSubformat = iota + BlockdevVMDKSubformatMonolithicFlat + BlockdevVMDKSubformatTwoGbMaxExtentSparse + BlockdevVMDKSubformatTwoGbMaxExtentFlat + BlockdevVMDKSubformatStreamOptimized +) + +// String implements fmt.Stringer. +func (e BlockdevVMDKSubformat) String() string { + switch e { + case BlockdevVMDKSubformatMonolithicSparse: + return "monolithicSparse" + case BlockdevVMDKSubformatMonolithicFlat: + return "monolithicFlat" + case BlockdevVMDKSubformatTwoGbMaxExtentSparse: + return "twoGbMaxExtentSparse" + case BlockdevVMDKSubformatTwoGbMaxExtentFlat: + return "twoGbMaxExtentFlat" + case BlockdevVMDKSubformatStreamOptimized: + return "streamOptimized" + default: + return fmt.Sprintf("BlockdevVMDKSubformat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevVMDKSubformat) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevVMDKSubformatMonolithicSparse: + return json.Marshal("monolithicSparse") + case BlockdevVMDKSubformatMonolithicFlat: + return json.Marshal("monolithicFlat") + case BlockdevVMDKSubformatTwoGbMaxExtentSparse: + return json.Marshal("twoGbMaxExtentSparse") + case BlockdevVMDKSubformatTwoGbMaxExtentFlat: + return json.Marshal("twoGbMaxExtentFlat") + case BlockdevVMDKSubformatStreamOptimized: + return json.Marshal("streamOptimized") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevVMDKSubformat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevVMDKSubformat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "monolithicSparse": + *e = BlockdevVMDKSubformatMonolithicSparse + case "monolithicFlat": + *e = BlockdevVMDKSubformatMonolithicFlat + case "twoGbMaxExtentSparse": + *e = BlockdevVMDKSubformatTwoGbMaxExtentSparse + case "twoGbMaxExtentFlat": + *e = BlockdevVMDKSubformatTwoGbMaxExtentFlat + case "streamOptimized": + *e = BlockdevVMDKSubformatStreamOptimized + default: + return fmt.Errorf("unknown enum value %q for BlockdevVMDKSubformat", s) + } + return nil +} + +// BlockdevVpcSubformat -> BlockdevVpcSubformat (enum) + +// BlockdevVpcSubformat implements the "BlockdevVpcSubformat" QMP API type. +type BlockdevVpcSubformat int + +// Known values of BlockdevVpcSubformat. +const ( + BlockdevVpcSubformatDynamic BlockdevVpcSubformat = iota + BlockdevVpcSubformatFixed +) + +// String implements fmt.Stringer. +func (e BlockdevVpcSubformat) String() string { + switch e { + case BlockdevVpcSubformatDynamic: + return "dynamic" + case BlockdevVpcSubformatFixed: + return "fixed" + default: + return fmt.Sprintf("BlockdevVpcSubformat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e BlockdevVpcSubformat) MarshalJSON() ([]byte, error) { + switch e { + case BlockdevVpcSubformatDynamic: + return json.Marshal("dynamic") + case BlockdevVpcSubformatFixed: + return json.Marshal("fixed") + default: + return nil, fmt.Errorf("unknown enum value %q for BlockdevVpcSubformat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *BlockdevVpcSubformat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "dynamic": + *e = BlockdevVpcSubformatDynamic + case "fixed": + *e = BlockdevVpcSubformatFixed + default: + return fmt.Errorf("unknown enum value %q for BlockdevVpcSubformat", s) + } + return nil +} + +// COLOExitReason -> ColoExitReason (enum) + +// ColoExitReason implements the "COLOExitReason" QMP API type. +type ColoExitReason int + +// Known values of ColoExitReason. +const ( + ColoExitReasonNone ColoExitReason = iota + ColoExitReasonRequest + ColoExitReasonError + ColoExitReasonProcessing +) + +// String implements fmt.Stringer. +func (e ColoExitReason) String() string { + switch e { + case ColoExitReasonNone: + return "none" + case ColoExitReasonRequest: + return "request" + case ColoExitReasonError: + return "error" + case ColoExitReasonProcessing: + return "processing" + default: + return fmt.Sprintf("ColoExitReason(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ColoExitReason) MarshalJSON() ([]byte, error) { + switch e { + case ColoExitReasonNone: + return json.Marshal("none") + case ColoExitReasonRequest: + return json.Marshal("request") + case ColoExitReasonError: + return json.Marshal("error") + case ColoExitReasonProcessing: + return json.Marshal("processing") + default: + return nil, fmt.Errorf("unknown enum value %q for ColoExitReason", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ColoExitReason) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = ColoExitReasonNone + case "request": + *e = ColoExitReasonRequest + case "error": + *e = ColoExitReasonError + case "processing": + *e = ColoExitReasonProcessing + default: + return fmt.Errorf("unknown enum value %q for ColoExitReason", s) + } + return nil +} + +// COLOMode -> ColoMode (enum) + +// ColoMode implements the "COLOMode" QMP API type. +type ColoMode int + +// Known values of ColoMode. +const ( + ColoModeNone ColoMode = iota + ColoModePrimary + ColoModeSecondary +) + +// String implements fmt.Stringer. +func (e ColoMode) String() string { + switch e { + case ColoModeNone: + return "none" + case ColoModePrimary: + return "primary" + case ColoModeSecondary: + return "secondary" + default: + return fmt.Sprintf("ColoMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ColoMode) MarshalJSON() ([]byte, error) { + switch e { + case ColoModeNone: + return json.Marshal("none") + case ColoModePrimary: + return json.Marshal("primary") + case ColoModeSecondary: + return json.Marshal("secondary") + default: + return nil, fmt.Errorf("unknown enum value %q for ColoMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ColoMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = ColoModeNone + case "primary": + *e = ColoModePrimary + case "secondary": + *e = ColoModeSecondary + default: + return fmt.Errorf("unknown enum value %q for ColoMode", s) + } + return nil +} + +// COLOStatus -> ColoStatus (struct) + +// ColoStatus implements the "COLOStatus" QMP API type. +type ColoStatus struct { + Mode ColoMode `json:"mode"` + LastMode ColoMode `json:"last-mode"` + Reason ColoExitReason `json:"reason"` +} + +// EVENT COLO_EXIT + +// ChardevBackend -> ChardevBackend (flat union) + +// ChardevBackend implements the "ChardevBackend" QMP API type. +// // Can be one of: // - ChardevBackendVariantBraille // - ChardevBackendVariantConsole +// - ChardevBackendVariantDbus // - ChardevBackendVariantFile // - ChardevBackendVariantMemory // - ChardevBackendVariantMsmouse @@ -3285,6 +5242,7 @@ type BlockdevSnapshotSync struct { // - ChardevBackendVariantParallel // - ChardevBackendVariantPipe // - ChardevBackendVariantPty +// - ChardevBackendVariantQemuVdagent // - ChardevBackendVariantRingbuf // - ChardevBackendVariantSerial // - ChardevBackendVariantSocket @@ -3300,416 +5258,521 @@ type ChardevBackend interface { } // ChardevBackendVariantBraille is an implementation of ChardevBackend. -type ChardevBackendVariantBraille ChardevCommon +type ChardevBackendVariantBraille struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantBraille) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantBraille) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "braille", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantBraille + }{ + ChardevBackendKindBraille, + s, } return json.Marshal(v) } // ChardevBackendVariantConsole is an implementation of ChardevBackend. -type ChardevBackendVariantConsole ChardevCommon +type ChardevBackendVariantConsole struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantConsole) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantConsole) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "console", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantConsole + }{ + ChardevBackendKindConsole, + s, + } + return json.Marshal(v) +} + +// ChardevBackendVariantDbus is an implementation of ChardevBackend. +type ChardevBackendVariantDbus struct { + Data ChardevDBus `json:"data"` +} + +func (ChardevBackendVariantDbus) isChardevBackend() {} + +// MarshalJSON implements json.Marshaler. +func (s ChardevBackendVariantDbus) MarshalJSON() ([]byte, error) { + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantDbus + }{ + ChardevBackendKindDbus, + s, } return json.Marshal(v) } // ChardevBackendVariantFile is an implementation of ChardevBackend. -type ChardevBackendVariantFile ChardevFile +type ChardevBackendVariantFile struct { + Data ChardevFile `json:"data"` +} func (ChardevBackendVariantFile) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantFile) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "file", - "data": ChardevFile(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantFile + }{ + ChardevBackendKindFile, + s, } return json.Marshal(v) } // ChardevBackendVariantMemory is an implementation of ChardevBackend. -type ChardevBackendVariantMemory ChardevRingbuf +type ChardevBackendVariantMemory struct { + Data ChardevRingbuf `json:"data"` +} func (ChardevBackendVariantMemory) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantMemory) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "memory", - "data": ChardevRingbuf(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantMemory + }{ + ChardevBackendKindMemory, + s, } return json.Marshal(v) } // ChardevBackendVariantMsmouse is an implementation of ChardevBackend. -type ChardevBackendVariantMsmouse ChardevCommon +type ChardevBackendVariantMsmouse struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantMsmouse) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantMsmouse) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "msmouse", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantMsmouse + }{ + ChardevBackendKindMsmouse, + s, } return json.Marshal(v) } // ChardevBackendVariantMux is an implementation of ChardevBackend. -type ChardevBackendVariantMux ChardevMux +type ChardevBackendVariantMux struct { + Data ChardevMux `json:"data"` +} func (ChardevBackendVariantMux) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantMux) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "mux", - "data": ChardevMux(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantMux + }{ + ChardevBackendKindMux, + s, } return json.Marshal(v) } // ChardevBackendVariantNull is an implementation of ChardevBackend. -type ChardevBackendVariantNull ChardevCommon +type ChardevBackendVariantNull struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantNull) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantNull) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "null", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantNull + }{ + ChardevBackendKindNull, + s, } return json.Marshal(v) } // ChardevBackendVariantParallel is an implementation of ChardevBackend. -type ChardevBackendVariantParallel ChardevHostdev +type ChardevBackendVariantParallel struct { + Data ChardevHostdev `json:"data"` +} func (ChardevBackendVariantParallel) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantParallel) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "parallel", - "data": ChardevHostdev(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantParallel + }{ + ChardevBackendKindParallel, + s, } return json.Marshal(v) } // ChardevBackendVariantPipe is an implementation of ChardevBackend. -type ChardevBackendVariantPipe ChardevHostdev +type ChardevBackendVariantPipe struct { + Data ChardevHostdev `json:"data"` +} func (ChardevBackendVariantPipe) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantPipe) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "pipe", - "data": ChardevHostdev(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantPipe + }{ + ChardevBackendKindPipe, + s, } return json.Marshal(v) } // ChardevBackendVariantPty is an implementation of ChardevBackend. -type ChardevBackendVariantPty ChardevCommon +type ChardevBackendVariantPty struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantPty) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantPty) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "pty", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantPty + }{ + ChardevBackendKindPty, + s, + } + return json.Marshal(v) +} + +// ChardevBackendVariantQemuVdagent is an implementation of ChardevBackend. +type ChardevBackendVariantQemuVdagent struct { + Data ChardevQemuVdAgent `json:"data"` +} + +func (ChardevBackendVariantQemuVdagent) isChardevBackend() {} + +// MarshalJSON implements json.Marshaler. +func (s ChardevBackendVariantQemuVdagent) MarshalJSON() ([]byte, error) { + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantQemuVdagent + }{ + ChardevBackendKindQemuVdagent, + s, } return json.Marshal(v) } // ChardevBackendVariantRingbuf is an implementation of ChardevBackend. -type ChardevBackendVariantRingbuf ChardevRingbuf +type ChardevBackendVariantRingbuf struct { + Data ChardevRingbuf `json:"data"` +} func (ChardevBackendVariantRingbuf) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantRingbuf) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "ringbuf", - "data": ChardevRingbuf(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantRingbuf + }{ + ChardevBackendKindRingbuf, + s, } return json.Marshal(v) } // ChardevBackendVariantSerial is an implementation of ChardevBackend. -type ChardevBackendVariantSerial ChardevHostdev +type ChardevBackendVariantSerial struct { + Data ChardevHostdev `json:"data"` +} func (ChardevBackendVariantSerial) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantSerial) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "serial", - "data": ChardevHostdev(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantSerial + }{ + ChardevBackendKindSerial, + s, } return json.Marshal(v) } // ChardevBackendVariantSocket is an implementation of ChardevBackend. -type ChardevBackendVariantSocket ChardevSocket +type ChardevBackendVariantSocket struct { + Data ChardevSocket `json:"data"` +} func (ChardevBackendVariantSocket) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantSocket) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "socket", - "data": ChardevSocket(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantSocket + }{ + ChardevBackendKindSocket, + s, } return json.Marshal(v) } // ChardevBackendVariantSpiceport is an implementation of ChardevBackend. -type ChardevBackendVariantSpiceport ChardevSpicePort +type ChardevBackendVariantSpiceport struct { + Data ChardevSpicePort `json:"data"` +} func (ChardevBackendVariantSpiceport) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantSpiceport) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "spiceport", - "data": ChardevSpicePort(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantSpiceport + }{ + ChardevBackendKindSpiceport, + s, } return json.Marshal(v) } // ChardevBackendVariantSpicevmc is an implementation of ChardevBackend. -type ChardevBackendVariantSpicevmc ChardevSpiceChannel +type ChardevBackendVariantSpicevmc struct { + Data ChardevSpiceChannel `json:"data"` +} func (ChardevBackendVariantSpicevmc) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantSpicevmc) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "spicevmc", - "data": ChardevSpiceChannel(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantSpicevmc + }{ + ChardevBackendKindSpicevmc, + s, } return json.Marshal(v) } // ChardevBackendVariantStdio is an implementation of ChardevBackend. -type ChardevBackendVariantStdio ChardevStdio +type ChardevBackendVariantStdio struct { + Data ChardevStdio `json:"data"` +} func (ChardevBackendVariantStdio) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantStdio) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "stdio", - "data": ChardevStdio(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantStdio + }{ + ChardevBackendKindStdio, + s, } return json.Marshal(v) } // ChardevBackendVariantTestdev is an implementation of ChardevBackend. -type ChardevBackendVariantTestdev ChardevCommon +type ChardevBackendVariantTestdev struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantTestdev) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantTestdev) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "testdev", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantTestdev + }{ + ChardevBackendKindTestdev, + s, } return json.Marshal(v) } // ChardevBackendVariantUDP is an implementation of ChardevBackend. -type ChardevBackendVariantUDP ChardevUDP +type ChardevBackendVariantUDP struct { + Data ChardevUDP `json:"data"` +} func (ChardevBackendVariantUDP) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantUDP) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "udp", - "data": ChardevUDP(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantUDP + }{ + ChardevBackendKindUDP, + s, } return json.Marshal(v) } // ChardevBackendVariantVc is an implementation of ChardevBackend. -type ChardevBackendVariantVc ChardevVc +type ChardevBackendVariantVc struct { + Data ChardevVc `json:"data"` +} func (ChardevBackendVariantVc) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantVc) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "vc", - "data": ChardevVc(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantVc + }{ + ChardevBackendKindVc, + s, } return json.Marshal(v) } // ChardevBackendVariantWctablet is an implementation of ChardevBackend. -type ChardevBackendVariantWctablet ChardevCommon +type ChardevBackendVariantWctablet struct { + Data ChardevCommon `json:"data"` +} func (ChardevBackendVariantWctablet) isChardevBackend() {} // MarshalJSON implements json.Marshaler. func (s ChardevBackendVariantWctablet) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "wctablet", - "data": ChardevCommon(s), + v := struct { + Type ChardevBackendKind `json:"type"` + ChardevBackendVariantWctablet + }{ + ChardevBackendKindWctablet, + s, } return json.Marshal(v) } func decodeChardevBackend(bs json.RawMessage) (ChardevBackend, error) { v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` + Type ChardevBackendKind `json:"type"` }{} if err := json.Unmarshal([]byte(bs), &v); err != nil { return nil, err } - switch v.T { - case "braille": + switch v.Type { + case ChardevBackendKindBraille: var ret ChardevBackendVariantBraille - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "console": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindConsole: var ret ChardevBackendVariantConsole - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "file": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindDbus: + var ret ChardevBackendVariantDbus + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindFile: var ret ChardevBackendVariantFile - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "memory": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindMemory: var ret ChardevBackendVariantMemory - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "msmouse": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindMsmouse: var ret ChardevBackendVariantMsmouse - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "mux": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindMux: var ret ChardevBackendVariantMux - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "null": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindNull: var ret ChardevBackendVariantNull - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "parallel": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindParallel: var ret ChardevBackendVariantParallel - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "pipe": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindPipe: var ret ChardevBackendVariantPipe - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "pty": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindPty: var ret ChardevBackendVariantPty - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "ringbuf": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindQemuVdagent: + var ret ChardevBackendVariantQemuVdagent + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindRingbuf: var ret ChardevBackendVariantRingbuf - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "serial": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindSerial: var ret ChardevBackendVariantSerial - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "socket": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindSocket: var ret ChardevBackendVariantSocket - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "spiceport": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindSpiceport: var ret ChardevBackendVariantSpiceport - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "spicevmc": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindSpicevmc: var ret ChardevBackendVariantSpicevmc - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "stdio": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindStdio: var ret ChardevBackendVariantStdio - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "testdev": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindTestdev: var ret ChardevBackendVariantTestdev - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "udp": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindUDP: var ret ChardevBackendVariantUDP - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "vc": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindVc: var ret ChardevBackendVariantVc - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "wctablet": + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ChardevBackendKindWctablet: var ret ChardevBackendVariantWctablet - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil + err := json.Unmarshal([]byte(bs), &ret) + return ret, err default: - return nil, fmt.Errorf("unknown subtype %q for union ChardevBackend", v.T) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union ChardevBackend", v.Type) } } @@ -3720,6 +5783,198 @@ type ChardevBackendInfo struct { Name string `json:"name"` } +// ChardevBackendKind -> ChardevBackendKind (enum) + +// ChardevBackendKind implements the "ChardevBackendKind" QMP API type. +type ChardevBackendKind int + +// Known values of ChardevBackendKind. +const ( + ChardevBackendKindFile ChardevBackendKind = iota + ChardevBackendKindSerial + ChardevBackendKindParallel + ChardevBackendKindPipe + ChardevBackendKindSocket + ChardevBackendKindUDP + ChardevBackendKindPty + ChardevBackendKindNull + ChardevBackendKindMux + ChardevBackendKindMsmouse + ChardevBackendKindWctablet + ChardevBackendKindBraille + ChardevBackendKindTestdev + ChardevBackendKindStdio + ChardevBackendKindConsole + ChardevBackendKindSpicevmc + ChardevBackendKindSpiceport + ChardevBackendKindQemuVdagent + ChardevBackendKindDbus + ChardevBackendKindVc + ChardevBackendKindRingbuf + ChardevBackendKindMemory +) + +// String implements fmt.Stringer. +func (e ChardevBackendKind) String() string { + switch e { + case ChardevBackendKindFile: + return "file" + case ChardevBackendKindSerial: + return "serial" + case ChardevBackendKindParallel: + return "parallel" + case ChardevBackendKindPipe: + return "pipe" + case ChardevBackendKindSocket: + return "socket" + case ChardevBackendKindUDP: + return "udp" + case ChardevBackendKindPty: + return "pty" + case ChardevBackendKindNull: + return "null" + case ChardevBackendKindMux: + return "mux" + case ChardevBackendKindMsmouse: + return "msmouse" + case ChardevBackendKindWctablet: + return "wctablet" + case ChardevBackendKindBraille: + return "braille" + case ChardevBackendKindTestdev: + return "testdev" + case ChardevBackendKindStdio: + return "stdio" + case ChardevBackendKindConsole: + return "console" + case ChardevBackendKindSpicevmc: + return "spicevmc" + case ChardevBackendKindSpiceport: + return "spiceport" + case ChardevBackendKindQemuVdagent: + return "qemu-vdagent" + case ChardevBackendKindDbus: + return "dbus" + case ChardevBackendKindVc: + return "vc" + case ChardevBackendKindRingbuf: + return "ringbuf" + case ChardevBackendKindMemory: + return "memory" + default: + return fmt.Sprintf("ChardevBackendKind(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ChardevBackendKind) MarshalJSON() ([]byte, error) { + switch e { + case ChardevBackendKindFile: + return json.Marshal("file") + case ChardevBackendKindSerial: + return json.Marshal("serial") + case ChardevBackendKindParallel: + return json.Marshal("parallel") + case ChardevBackendKindPipe: + return json.Marshal("pipe") + case ChardevBackendKindSocket: + return json.Marshal("socket") + case ChardevBackendKindUDP: + return json.Marshal("udp") + case ChardevBackendKindPty: + return json.Marshal("pty") + case ChardevBackendKindNull: + return json.Marshal("null") + case ChardevBackendKindMux: + return json.Marshal("mux") + case ChardevBackendKindMsmouse: + return json.Marshal("msmouse") + case ChardevBackendKindWctablet: + return json.Marshal("wctablet") + case ChardevBackendKindBraille: + return json.Marshal("braille") + case ChardevBackendKindTestdev: + return json.Marshal("testdev") + case ChardevBackendKindStdio: + return json.Marshal("stdio") + case ChardevBackendKindConsole: + return json.Marshal("console") + case ChardevBackendKindSpicevmc: + return json.Marshal("spicevmc") + case ChardevBackendKindSpiceport: + return json.Marshal("spiceport") + case ChardevBackendKindQemuVdagent: + return json.Marshal("qemu-vdagent") + case ChardevBackendKindDbus: + return json.Marshal("dbus") + case ChardevBackendKindVc: + return json.Marshal("vc") + case ChardevBackendKindRingbuf: + return json.Marshal("ringbuf") + case ChardevBackendKindMemory: + return json.Marshal("memory") + default: + return nil, fmt.Errorf("unknown enum value %q for ChardevBackendKind", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ChardevBackendKind) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "file": + *e = ChardevBackendKindFile + case "serial": + *e = ChardevBackendKindSerial + case "parallel": + *e = ChardevBackendKindParallel + case "pipe": + *e = ChardevBackendKindPipe + case "socket": + *e = ChardevBackendKindSocket + case "udp": + *e = ChardevBackendKindUDP + case "pty": + *e = ChardevBackendKindPty + case "null": + *e = ChardevBackendKindNull + case "mux": + *e = ChardevBackendKindMux + case "msmouse": + *e = ChardevBackendKindMsmouse + case "wctablet": + *e = ChardevBackendKindWctablet + case "braille": + *e = ChardevBackendKindBraille + case "testdev": + *e = ChardevBackendKindTestdev + case "stdio": + *e = ChardevBackendKindStdio + case "console": + *e = ChardevBackendKindConsole + case "spicevmc": + *e = ChardevBackendKindSpicevmc + case "spiceport": + *e = ChardevBackendKindSpiceport + case "qemu-vdagent": + *e = ChardevBackendKindQemuVdagent + case "dbus": + *e = ChardevBackendKindDbus + case "vc": + *e = ChardevBackendKindVc + case "ringbuf": + *e = ChardevBackendKindRingbuf + case "memory": + *e = ChardevBackendKindMemory + default: + return fmt.Errorf("unknown enum value %q for ChardevBackendKind", s) + } + return nil +} + // ChardevCommon -> ChardevCommon (struct) // ChardevCommon implements the "ChardevCommon" QMP API type. @@ -3728,6 +5983,15 @@ type ChardevCommon struct { Logappend *bool `json:"logappend,omitempty"` } +// ChardevDBus -> ChardevDBus (struct) + +// ChardevDBus implements the "ChardevDBus" QMP API type. +type ChardevDBus struct { + Logfile *string `json:"logfile,omitempty"` + Logappend *bool `json:"logappend,omitempty"` + Name string `json:"name"` +} + // ChardevFile -> ChardevFile (struct) // ChardevFile implements the "ChardevFile" QMP API type. @@ -3766,6 +6030,16 @@ type ChardevMux struct { Chardev string `json:"chardev"` } +// ChardevQemuVDAgent -> ChardevQemuVdAgent (struct) + +// ChardevQemuVdAgent implements the "ChardevQemuVDAgent" QMP API type. +type ChardevQemuVdAgent struct { + Logfile *string `json:"logfile,omitempty"` + Logappend *bool `json:"logappend,omitempty"` + Mouse *bool `json:"mouse,omitempty"` + Clipboard *bool `json:"clipboard,omitempty"` +} + // ChardevReturn -> ChardevReturn (struct) // ChardevReturn implements the "ChardevReturn" QMP API type. @@ -3790,11 +6064,13 @@ type ChardevSocket struct { Logappend *bool `json:"logappend,omitempty"` Addr SocketAddressLegacy `json:"addr"` TLSCreds *string `json:"tls-creds,omitempty"` + TLSAuthz *string `json:"tls-authz,omitempty"` Server *bool `json:"server,omitempty"` Wait *bool `json:"wait,omitempty"` Nodelay *bool `json:"nodelay,omitempty"` Telnet *bool `json:"telnet,omitempty"` Tn3270 *bool `json:"tn3270,omitempty"` + Websocket *bool `json:"websocket,omitempty"` Reconnect *int64 `json:"reconnect,omitempty"` } @@ -3938,6 +6214,17 @@ func (e *CommandLineParameterType) UnmarshalJSON(bs []byte) error { return nil } +// CompressionStats -> CompressionStats (struct) + +// CompressionStats implements the "CompressionStats" QMP API type. +type CompressionStats struct { + Pages int64 `json:"pages"` + Busy int64 `json:"busy"` + BusyRate float64 `json:"busy-rate"` + CompressedSize int64 `json:"compressed-size"` + CompressionRate float64 `json:"compression-rate"` +} + // CpuDefinitionInfo -> CPUDefinitionInfo (struct) // CPUDefinitionInfo implements the "CpuDefinitionInfo" QMP API type. @@ -3947,327 +6234,99 @@ type CPUDefinitionInfo struct { Static bool `json:"static"` UnavailableFeatures []string `json:"unavailable-features,omitempty"` Typename string `json:"typename"` + AliasOf *string `json:"alias-of,omitempty"` + Deprecated bool `json:"deprecated"` } -// CpuInfo -> CPUInfo (flat union) +// CpuInfoFast -> CPUInfoFast (flat union) -// CPUInfo implements the "CpuInfo" QMP API type. +// CPUInfoFast implements the "CpuInfoFast" QMP API type. // // Can be one of: -// - CPUInfoVariantMIPS -// - CPUInfoVariantOther -// - CPUInfoVariantPPC -// - CPUInfoVariantSPARC -// - CPUInfoVariantTricore -// - CPUInfoVariantX86 -type CPUInfo interface { - isCPUInfo() -} - -// CPUInfoVariantMIPS is an implementation of CPUInfo. -type CPUInfoVariantMIPS struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` - Props *CPUInstanceProperties `json:"props,omitempty"` - Pc int64 `json:"PC"` -} - -func (CPUInfoVariantMIPS) isCPUInfo() {} - -// MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantMIPS) MarshalJSON() ([]byte, error) { - v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantMIPS - }{ - CPUInfoArchMIPS, - s, - } - return json.Marshal(v) +// - CPUInfoFastVariantS390X +type CPUInfoFast interface { + isCPUInfoFast() } -// CPUInfoVariantOther is an implementation of CPUInfo. -type CPUInfoVariantOther struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` +// CPUInfoFastVariantS390X is an implementation of CPUInfoFast. +type CPUInfoFastVariantS390X struct { + CPUIndex int64 `json:"cpu-index"` + QomPath string `json:"qom-path"` + ThreadID int64 `json:"thread-id"` Props *CPUInstanceProperties `json:"props,omitempty"` + CPUState CPUS390State `json:"cpu-state"` } -func (CPUInfoVariantOther) isCPUInfo() {} +func (CPUInfoFastVariantS390X) isCPUInfoFast() {} // MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantOther) MarshalJSON() ([]byte, error) { +func (s CPUInfoFastVariantS390X) MarshalJSON() ([]byte, error) { v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantOther + Target SysEmuTarget `json:"target"` + CPUInfoFastVariantS390X }{ - CPUInfoArchOther, + SysEmuTargetS390X, s, } return json.Marshal(v) } -// CPUInfoVariantPPC is an implementation of CPUInfo. -type CPUInfoVariantPPC struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` - Props *CPUInstanceProperties `json:"props,omitempty"` - Nip int64 `json:"nip"` -} - -func (CPUInfoVariantPPC) isCPUInfo() {} - -// MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantPPC) MarshalJSON() ([]byte, error) { +func decodeCPUInfoFast(bs json.RawMessage) (CPUInfoFast, error) { v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantPPC - }{ - CPUInfoArchPPC, - s, + Target SysEmuTarget `json:"target"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Target { + case SysEmuTargetS390X: + var ret CPUInfoFastVariantS390X + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union CPUInfoFast", v.Target) } - return json.Marshal(v) -} - -// CPUInfoVariantSPARC is an implementation of CPUInfo. -type CPUInfoVariantSPARC struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` - Props *CPUInstanceProperties `json:"props,omitempty"` - Pc int64 `json:"pc"` - Npc int64 `json:"npc"` } -func (CPUInfoVariantSPARC) isCPUInfo() {} +// CpuInstanceProperties -> CPUInstanceProperties (struct) -// MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantSPARC) MarshalJSON() ([]byte, error) { - v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantSPARC - }{ - CPUInfoArchSPARC, - s, - } - return json.Marshal(v) +// CPUInstanceProperties implements the "CpuInstanceProperties" QMP API type. +type CPUInstanceProperties struct { + NodeID *int64 `json:"node-id,omitempty"` + SocketID *int64 `json:"socket-id,omitempty"` + DieID *int64 `json:"die-id,omitempty"` + ClusterID *int64 `json:"cluster-id,omitempty"` + CoreID *int64 `json:"core-id,omitempty"` + ThreadID *int64 `json:"thread-id,omitempty"` } -// CPUInfoVariantTricore is an implementation of CPUInfo. -type CPUInfoVariantTricore struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` - Props *CPUInstanceProperties `json:"props,omitempty"` - Pc int64 `json:"PC"` +// CpuModelBaselineInfo -> CPUModelBaselineInfo (struct) + +// CPUModelBaselineInfo implements the "CpuModelBaselineInfo" QMP API type. +type CPUModelBaselineInfo struct { + Model CPUModelInfo `json:"model"` } -func (CPUInfoVariantTricore) isCPUInfo() {} +// CpuModelCompareInfo -> CPUModelCompareInfo (struct) -// MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantTricore) MarshalJSON() ([]byte, error) { - v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantTricore - }{ - CPUInfoArchTricore, - s, - } - return json.Marshal(v) +// CPUModelCompareInfo implements the "CpuModelCompareInfo" QMP API type. +type CPUModelCompareInfo struct { + Result CPUModelCompareResult `json:"result"` + ResponsibleProperties []string `json:"responsible-properties"` } -// CPUInfoVariantX86 is an implementation of CPUInfo. -type CPUInfoVariantX86 struct { - CPU int64 `json:"CPU"` - Current bool `json:"current"` - Halted bool `json:"halted"` - QomPath string `json:"qom_path"` - ThreadID int64 `json:"thread_id"` - Props *CPUInstanceProperties `json:"props,omitempty"` - Pc int64 `json:"pc"` -} +// CpuModelCompareResult -> CPUModelCompareResult (enum) -func (CPUInfoVariantX86) isCPUInfo() {} +// CPUModelCompareResult implements the "CpuModelCompareResult" QMP API type. +type CPUModelCompareResult int -// MarshalJSON implements json.Marshaler. -func (s CPUInfoVariantX86) MarshalJSON() ([]byte, error) { - v := struct { - Arch CPUInfoArch `json:"arch"` - CPUInfoVariantX86 - }{ - CPUInfoArchX86, - s, - } - return json.Marshal(v) -} - -func decodeCPUInfo(bs json.RawMessage) (CPUInfo, error) { - v := struct { - Arch CPUInfoArch `json:"arch"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err - } - switch v.Arch { - case CPUInfoArchMIPS: - var ret CPUInfoVariantMIPS - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case CPUInfoArchOther: - var ret CPUInfoVariantOther - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case CPUInfoArchPPC: - var ret CPUInfoVariantPPC - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case CPUInfoArchSPARC: - var ret CPUInfoVariantSPARC - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case CPUInfoArchTricore: - var ret CPUInfoVariantTricore - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case CPUInfoArchX86: - var ret CPUInfoVariantX86 - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - default: - return nil, fmt.Errorf("unknown flat union subtype %q for flat union CPUInfo", v.Arch) - } -} - -// CpuInfoArch -> CPUInfoArch (enum) - -// CPUInfoArch implements the "CpuInfoArch" QMP API type. -type CPUInfoArch int - -// Known values of CPUInfoArch. -const ( - CPUInfoArchX86 CPUInfoArch = iota - CPUInfoArchSPARC - CPUInfoArchPPC - CPUInfoArchMIPS - CPUInfoArchTricore - CPUInfoArchOther -) - -// String implements fmt.Stringer. -func (e CPUInfoArch) String() string { - switch e { - case CPUInfoArchX86: - return "x86" - case CPUInfoArchSPARC: - return "sparc" - case CPUInfoArchPPC: - return "ppc" - case CPUInfoArchMIPS: - return "mips" - case CPUInfoArchTricore: - return "tricore" - case CPUInfoArchOther: - return "other" - default: - return fmt.Sprintf("CPUInfoArch(%d)", e) - } -} - -// MarshalJSON implements json.Marshaler. -func (e CPUInfoArch) MarshalJSON() ([]byte, error) { - switch e { - case CPUInfoArchX86: - return json.Marshal("x86") - case CPUInfoArchSPARC: - return json.Marshal("sparc") - case CPUInfoArchPPC: - return json.Marshal("ppc") - case CPUInfoArchMIPS: - return json.Marshal("mips") - case CPUInfoArchTricore: - return json.Marshal("tricore") - case CPUInfoArchOther: - return json.Marshal("other") - default: - return nil, fmt.Errorf("unknown enum value %q for CPUInfoArch", e) - } -} - -// UnmarshalJSON implements json.Unmarshaler. -func (e *CPUInfoArch) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err - } - switch s { - case "x86": - *e = CPUInfoArchX86 - case "sparc": - *e = CPUInfoArchSPARC - case "ppc": - *e = CPUInfoArchPPC - case "mips": - *e = CPUInfoArchMIPS - case "tricore": - *e = CPUInfoArchTricore - case "other": - *e = CPUInfoArchOther - default: - return fmt.Errorf("unknown enum value %q for CPUInfoArch", s) - } - return nil -} - -// CpuInstanceProperties -> CPUInstanceProperties (struct) - -// CPUInstanceProperties implements the "CpuInstanceProperties" QMP API type. -type CPUInstanceProperties struct { - NodeID *int64 `json:"node-id,omitempty"` - SocketID *int64 `json:"socket-id,omitempty"` - CoreID *int64 `json:"core-id,omitempty"` - ThreadID *int64 `json:"thread-id,omitempty"` -} - -// CpuModelBaselineInfo -> CPUModelBaselineInfo (struct) - -// CPUModelBaselineInfo implements the "CpuModelBaselineInfo" QMP API type. -type CPUModelBaselineInfo struct { - Model CPUModelInfo `json:"model"` -} - -// CpuModelCompareInfo -> CPUModelCompareInfo (struct) - -// CPUModelCompareInfo implements the "CpuModelCompareInfo" QMP API type. -type CPUModelCompareInfo struct { - Result CPUModelCompareResult `json:"result"` - ResponsibleProperties []string `json:"responsible-properties"` -} - -// CpuModelCompareResult -> CPUModelCompareResult (enum) - -// CPUModelCompareResult implements the "CpuModelCompareResult" QMP API type. -type CPUModelCompareResult int - -// Known values of CPUModelCompareResult. -const ( - CPUModelCompareResultIncompatible CPUModelCompareResult = iota - CPUModelCompareResultIdentical - CPUModelCompareResultSuperset - CPUModelCompareResultSubset -) +// Known values of CPUModelCompareResult. +const ( + CPUModelCompareResultIncompatible CPUModelCompareResult = iota + CPUModelCompareResultIdentical + CPUModelCompareResultSuperset + CPUModelCompareResultSubset +) // String implements fmt.Stringer. func (e CPUModelCompareResult) String() string { @@ -4389,10 +6448,92 @@ type CPUModelInfo struct { Props *interface{} `json:"props,omitempty"` } +// CpuS390State -> CPUS390State (enum) + +// CPUS390State implements the "CpuS390State" QMP API type. +type CPUS390State int + +// Known values of CPUS390State. +const ( + CPUS390StateUninitialized CPUS390State = iota + CPUS390StateStopped + CPUS390StateCheckStop + CPUS390StateOperating + CPUS390StateLoad +) + +// String implements fmt.Stringer. +func (e CPUS390State) String() string { + switch e { + case CPUS390StateUninitialized: + return "uninitialized" + case CPUS390StateStopped: + return "stopped" + case CPUS390StateCheckStop: + return "check-stop" + case CPUS390StateOperating: + return "operating" + case CPUS390StateLoad: + return "load" + default: + return fmt.Sprintf("CPUS390State(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e CPUS390State) MarshalJSON() ([]byte, error) { + switch e { + case CPUS390StateUninitialized: + return json.Marshal("uninitialized") + case CPUS390StateStopped: + return json.Marshal("stopped") + case CPUS390StateCheckStop: + return json.Marshal("check-stop") + case CPUS390StateOperating: + return json.Marshal("operating") + case CPUS390StateLoad: + return json.Marshal("load") + default: + return nil, fmt.Errorf("unknown enum value %q for CPUS390State", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *CPUS390State) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "uninitialized": + *e = CPUS390StateUninitialized + case "stopped": + *e = CPUS390StateStopped + case "check-stop": + *e = CPUS390StateCheckStop + case "operating": + *e = CPUS390StateOperating + case "load": + *e = CPUS390StateLoad + default: + return fmt.Errorf("unknown enum value %q for CPUS390State", s) + } + return nil +} + +// CurrentMachineParams -> CurrentMachineParams (struct) + +// CurrentMachineParams implements the "CurrentMachineParams" QMP API type. +type CurrentMachineParams struct { + WakeupSuspendSupport bool `json:"wakeup-suspend-support"` +} + // EVENT DEVICE_DELETED // EVENT DEVICE_TRAY_MOVED +// EVENT DEVICE_UNPLUG_GUEST_ERROR + // EVENT DUMP_COMPLETED // DataFormat -> DataFormat (enum) @@ -4447,2763 +6588,8020 @@ func (e *DataFormat) UnmarshalJSON(bs []byte) error { return nil } -// DevicePropertyInfo -> DevicePropertyInfo (struct) +// DirtyLimitInfo -> DirtyLimitInfo (struct) -// DevicePropertyInfo implements the "DevicePropertyInfo" QMP API type. -type DevicePropertyInfo struct { - Name string `json:"name"` - Type string `json:"type"` - Description *string `json:"description,omitempty"` +// DirtyLimitInfo implements the "DirtyLimitInfo" QMP API type. +type DirtyLimitInfo struct { + CPUIndex int64 `json:"cpu-index"` + LimitRate uint64 `json:"limit-rate"` + CurrentRate uint64 `json:"current-rate"` } -// DirtyBitmapStatus -> DirtyBitmapStatus (enum) +// DirtyRateInfo -> DirtyRateInfo (struct) -// DirtyBitmapStatus implements the "DirtyBitmapStatus" QMP API type. -type DirtyBitmapStatus int +// DirtyRateInfo implements the "DirtyRateInfo" QMP API type. +type DirtyRateInfo struct { + DirtyRate *int64 `json:"dirty-rate,omitempty"` + Status DirtyRateStatus `json:"status"` + StartTime int64 `json:"start-time"` + CalcTime int64 `json:"calc-time"` + SamplePages uint64 `json:"sample-pages"` + Mode DirtyRateMeasureMode `json:"mode"` + VcpuDirtyRate []DirtyRateVcpu `json:"vcpu-dirty-rate,omitempty"` +} + +// DirtyRateMeasureMode -> DirtyRateMeasureMode (enum) -// Known values of DirtyBitmapStatus. +// DirtyRateMeasureMode implements the "DirtyRateMeasureMode" QMP API type. +type DirtyRateMeasureMode int + +// Known values of DirtyRateMeasureMode. const ( - DirtyBitmapStatusActive DirtyBitmapStatus = iota - DirtyBitmapStatusDisabled - DirtyBitmapStatusFrozen + DirtyRateMeasureModePageSampling DirtyRateMeasureMode = iota + DirtyRateMeasureModeDirtyRing + DirtyRateMeasureModeDirtyBitmap ) // String implements fmt.Stringer. -func (e DirtyBitmapStatus) String() string { +func (e DirtyRateMeasureMode) String() string { switch e { - case DirtyBitmapStatusActive: - return "active" - case DirtyBitmapStatusDisabled: - return "disabled" - case DirtyBitmapStatusFrozen: - return "frozen" + case DirtyRateMeasureModePageSampling: + return "page-sampling" + case DirtyRateMeasureModeDirtyRing: + return "dirty-ring" + case DirtyRateMeasureModeDirtyBitmap: + return "dirty-bitmap" default: - return fmt.Sprintf("DirtyBitmapStatus(%d)", e) + return fmt.Sprintf("DirtyRateMeasureMode(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e DirtyBitmapStatus) MarshalJSON() ([]byte, error) { +func (e DirtyRateMeasureMode) MarshalJSON() ([]byte, error) { switch e { - case DirtyBitmapStatusActive: - return json.Marshal("active") - case DirtyBitmapStatusDisabled: - return json.Marshal("disabled") - case DirtyBitmapStatusFrozen: - return json.Marshal("frozen") + case DirtyRateMeasureModePageSampling: + return json.Marshal("page-sampling") + case DirtyRateMeasureModeDirtyRing: + return json.Marshal("dirty-ring") + case DirtyRateMeasureModeDirtyBitmap: + return json.Marshal("dirty-bitmap") default: - return nil, fmt.Errorf("unknown enum value %q for DirtyBitmapStatus", e) + return nil, fmt.Errorf("unknown enum value %q for DirtyRateMeasureMode", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *DirtyBitmapStatus) UnmarshalJSON(bs []byte) error { +func (e *DirtyRateMeasureMode) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "active": - *e = DirtyBitmapStatusActive - case "disabled": - *e = DirtyBitmapStatusDisabled - case "frozen": - *e = DirtyBitmapStatusFrozen + case "page-sampling": + *e = DirtyRateMeasureModePageSampling + case "dirty-ring": + *e = DirtyRateMeasureModeDirtyRing + case "dirty-bitmap": + *e = DirtyRateMeasureModeDirtyBitmap default: - return fmt.Errorf("unknown enum value %q for DirtyBitmapStatus", s) + return fmt.Errorf("unknown enum value %q for DirtyRateMeasureMode", s) } return nil } -// DriveBackup -> DriveBackup (struct) - -// DriveBackup implements the "DriveBackup" QMP API type. -type DriveBackup struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Target string `json:"target"` - Format *string `json:"format,omitempty"` - Sync MirrorSyncMode `json:"sync"` - Mode *NewImageMode `json:"mode,omitempty"` - Speed *int64 `json:"speed,omitempty"` - Bitmap *string `json:"bitmap,omitempty"` - Compress *bool `json:"compress,omitempty"` - OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` - OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` -} - -// DriveMirror -> DriveMirror (struct) - -// DriveMirror implements the "DriveMirror" QMP API type. -type DriveMirror struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Target string `json:"target"` - Format *string `json:"format,omitempty"` - NodeName *string `json:"node-name,omitempty"` - Replaces *string `json:"replaces,omitempty"` - Sync MirrorSyncMode `json:"sync"` - Mode *NewImageMode `json:"mode,omitempty"` - Speed *int64 `json:"speed,omitempty"` - Granularity *uint32 `json:"granularity,omitempty"` - BufSize *int64 `json:"buf-size,omitempty"` - OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` - OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` - Unmap *bool `json:"unmap,omitempty"` -} - -// DumpGuestMemoryCapability -> DumpGuestMemoryCapability (struct) - -// DumpGuestMemoryCapability implements the "DumpGuestMemoryCapability" QMP API type. -type DumpGuestMemoryCapability struct { - Formats []DumpGuestMemoryFormat `json:"formats"` -} - -// DumpGuestMemoryFormat -> DumpGuestMemoryFormat (enum) +// DirtyRateStatus -> DirtyRateStatus (enum) -// DumpGuestMemoryFormat implements the "DumpGuestMemoryFormat" QMP API type. -type DumpGuestMemoryFormat int +// DirtyRateStatus implements the "DirtyRateStatus" QMP API type. +type DirtyRateStatus int -// Known values of DumpGuestMemoryFormat. +// Known values of DirtyRateStatus. const ( - DumpGuestMemoryFormatElf DumpGuestMemoryFormat = iota - DumpGuestMemoryFormatKdumpZlib - DumpGuestMemoryFormatKdumpLzo - DumpGuestMemoryFormatKdumpSnappy + DirtyRateStatusUnstarted DirtyRateStatus = iota + DirtyRateStatusMeasuring + DirtyRateStatusMeasured ) // String implements fmt.Stringer. -func (e DumpGuestMemoryFormat) String() string { +func (e DirtyRateStatus) String() string { switch e { - case DumpGuestMemoryFormatElf: - return "elf" - case DumpGuestMemoryFormatKdumpZlib: - return "kdump-zlib" - case DumpGuestMemoryFormatKdumpLzo: - return "kdump-lzo" - case DumpGuestMemoryFormatKdumpSnappy: - return "kdump-snappy" + case DirtyRateStatusUnstarted: + return "unstarted" + case DirtyRateStatusMeasuring: + return "measuring" + case DirtyRateStatusMeasured: + return "measured" default: - return fmt.Sprintf("DumpGuestMemoryFormat(%d)", e) + return fmt.Sprintf("DirtyRateStatus(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e DumpGuestMemoryFormat) MarshalJSON() ([]byte, error) { +func (e DirtyRateStatus) MarshalJSON() ([]byte, error) { switch e { - case DumpGuestMemoryFormatElf: - return json.Marshal("elf") - case DumpGuestMemoryFormatKdumpZlib: - return json.Marshal("kdump-zlib") - case DumpGuestMemoryFormatKdumpLzo: - return json.Marshal("kdump-lzo") - case DumpGuestMemoryFormatKdumpSnappy: - return json.Marshal("kdump-snappy") + case DirtyRateStatusUnstarted: + return json.Marshal("unstarted") + case DirtyRateStatusMeasuring: + return json.Marshal("measuring") + case DirtyRateStatusMeasured: + return json.Marshal("measured") default: - return nil, fmt.Errorf("unknown enum value %q for DumpGuestMemoryFormat", e) + return nil, fmt.Errorf("unknown enum value %q for DirtyRateStatus", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *DumpGuestMemoryFormat) UnmarshalJSON(bs []byte) error { +func (e *DirtyRateStatus) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "elf": - *e = DumpGuestMemoryFormatElf - case "kdump-zlib": - *e = DumpGuestMemoryFormatKdumpZlib - case "kdump-lzo": - *e = DumpGuestMemoryFormatKdumpLzo - case "kdump-snappy": - *e = DumpGuestMemoryFormatKdumpSnappy + case "unstarted": + *e = DirtyRateStatusUnstarted + case "measuring": + *e = DirtyRateStatusMeasuring + case "measured": + *e = DirtyRateStatusMeasured default: - return fmt.Errorf("unknown enum value %q for DumpGuestMemoryFormat", s) + return fmt.Errorf("unknown enum value %q for DirtyRateStatus", s) } return nil } -// DumpQueryResult -> DumpQueryResult (struct) +// DirtyRateVcpu -> DirtyRateVcpu (struct) -// DumpQueryResult implements the "DumpQueryResult" QMP API type. -type DumpQueryResult struct { - Status DumpStatus `json:"status"` - Completed int64 `json:"completed"` - Total int64 `json:"total"` +// DirtyRateVcpu implements the "DirtyRateVcpu" QMP API type. +type DirtyRateVcpu struct { + ID int64 `json:"id"` + DirtyRate int64 `json:"dirty-rate"` } -// DumpStatus -> DumpStatus (enum) +// DisplayGLMode -> DisplayGlMode (enum) -// DumpStatus implements the "DumpStatus" QMP API type. -type DumpStatus int +// DisplayGlMode implements the "DisplayGLMode" QMP API type. +type DisplayGlMode int -// Known values of DumpStatus. +// Known values of DisplayGlMode. const ( - DumpStatusNone DumpStatus = iota - DumpStatusActive - DumpStatusCompleted - DumpStatusFailed + DisplayGlModeOff DisplayGlMode = iota + DisplayGlModeOn + DisplayGlModeCore + DisplayGlModeEs ) // String implements fmt.Stringer. -func (e DumpStatus) String() string { +func (e DisplayGlMode) String() string { switch e { - case DumpStatusNone: - return "none" - case DumpStatusActive: - return "active" - case DumpStatusCompleted: - return "completed" - case DumpStatusFailed: - return "failed" + case DisplayGlModeOff: + return "off" + case DisplayGlModeOn: + return "on" + case DisplayGlModeCore: + return "core" + case DisplayGlModeEs: + return "es" default: - return fmt.Sprintf("DumpStatus(%d)", e) + return fmt.Sprintf("DisplayGlMode(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e DumpStatus) MarshalJSON() ([]byte, error) { +func (e DisplayGlMode) MarshalJSON() ([]byte, error) { switch e { - case DumpStatusNone: - return json.Marshal("none") - case DumpStatusActive: - return json.Marshal("active") - case DumpStatusCompleted: - return json.Marshal("completed") - case DumpStatusFailed: - return json.Marshal("failed") + case DisplayGlModeOff: + return json.Marshal("off") + case DisplayGlModeOn: + return json.Marshal("on") + case DisplayGlModeCore: + return json.Marshal("core") + case DisplayGlModeEs: + return json.Marshal("es") default: - return nil, fmt.Errorf("unknown enum value %q for DumpStatus", e) + return nil, fmt.Errorf("unknown enum value %q for DisplayGlMode", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *DumpStatus) UnmarshalJSON(bs []byte) error { +func (e *DisplayGlMode) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "none": - *e = DumpStatusNone - case "active": - *e = DumpStatusActive - case "completed": - *e = DumpStatusCompleted - case "failed": - *e = DumpStatusFailed + case "off": + *e = DisplayGlModeOff + case "on": + *e = DisplayGlModeOn + case "core": + *e = DisplayGlModeCore + case "es": + *e = DisplayGlModeEs default: - return fmt.Errorf("unknown enum value %q for DumpStatus", s) + return fmt.Errorf("unknown enum value %q for DisplayGlMode", s) } return nil } -// EventInfo -> EventInfo (struct) +// DisplayOptions -> DisplayOptions (flat union) -// EventInfo implements the "EventInfo" QMP API type. -type EventInfo struct { - Name string `json:"name"` +// DisplayOptions implements the "DisplayOptions" QMP API type. +// +// Can be one of: +// - DisplayOptionsVariantCocoa +// - DisplayOptionsVariantCurses +// - DisplayOptionsVariantDbus +// - DisplayOptionsVariantEglHeadless +// - DisplayOptionsVariantGtk +// - DisplayOptionsVariantSdl +type DisplayOptions interface { + isDisplayOptions() } -// FdsetFdInfo -> FdsetFDInfo (struct) +// DisplayOptionsVariantCocoa is an implementation of DisplayOptions. +type DisplayOptionsVariantCocoa struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + LeftCommandKey *bool `json:"left-command-key,omitempty"` + FullGrab *bool `json:"full-grab,omitempty"` + SwapOptCmd *bool `json:"swap-opt-cmd,omitempty"` +} -// FdsetFDInfo implements the "FdsetFdInfo" QMP API type. -type FdsetFDInfo struct { - FD int64 `json:"fd"` - Opaque *string `json:"opaque,omitempty"` +func (DisplayOptionsVariantCocoa) isDisplayOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantCocoa) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantCocoa + }{ + DisplayTypeCocoa, + s, + } + return json.Marshal(v) } -// FdsetInfo -> FdsetInfo (struct) +// DisplayOptionsVariantCurses is an implementation of DisplayOptions. +type DisplayOptionsVariantCurses struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + Charset *string `json:"charset,omitempty"` +} -// FdsetInfo implements the "FdsetInfo" QMP API type. -type FdsetInfo struct { - FdsetID int64 `json:"fdset-id"` - Fds []FdsetFDInfo `json:"fds"` +func (DisplayOptionsVariantCurses) isDisplayOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantCurses) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantCurses + }{ + DisplayTypeCurses, + s, + } + return json.Marshal(v) } -// GICCapability -> GicCapability (struct) +// DisplayOptionsVariantDbus is an implementation of DisplayOptions. +type DisplayOptionsVariantDbus struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + Rendernode *string `json:"rendernode,omitempty"` + Addr *string `json:"addr,omitempty"` + P2P *bool `json:"p2p,omitempty"` + Audiodev *string `json:"audiodev,omitempty"` +} -// GicCapability implements the "GICCapability" QMP API type. -type GicCapability struct { - Version int64 `json:"version"` - Emulated bool `json:"emulated"` - Kernel bool `json:"kernel"` +func (DisplayOptionsVariantDbus) isDisplayOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantDbus) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantDbus + }{ + DisplayTypeDbus, + s, + } + return json.Marshal(v) } -// EVENT GUEST_PANICKED +// DisplayOptionsVariantEglHeadless is an implementation of DisplayOptions. +type DisplayOptionsVariantEglHeadless struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + Rendernode *string `json:"rendernode,omitempty"` +} -// GuestPanicAction -> GuestPanicAction (enum) +func (DisplayOptionsVariantEglHeadless) isDisplayOptions() {} -// GuestPanicAction implements the "GuestPanicAction" QMP API type. -type GuestPanicAction int +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantEglHeadless) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantEglHeadless + }{ + DisplayTypeEglHeadless, + s, + } + return json.Marshal(v) +} -// Known values of GuestPanicAction. +// DisplayOptionsVariantGtk is an implementation of DisplayOptions. +type DisplayOptionsVariantGtk struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + GrabOnHover *bool `json:"grab-on-hover,omitempty"` + ZoomToFit *bool `json:"zoom-to-fit,omitempty"` + ShowTabs *bool `json:"show-tabs,omitempty"` +} + +func (DisplayOptionsVariantGtk) isDisplayOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantGtk) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantGtk + }{ + DisplayTypeGtk, + s, + } + return json.Marshal(v) +} + +// DisplayOptionsVariantSdl is an implementation of DisplayOptions. +type DisplayOptionsVariantSdl struct { + FullScreen *bool `json:"full-screen,omitempty"` + WindowClose *bool `json:"window-close,omitempty"` + ShowCursor *bool `json:"show-cursor,omitempty"` + Gl *DisplayGlMode `json:"gl,omitempty"` + GrabMod *HotKeyMod `json:"grab-mod,omitempty"` +} + +func (DisplayOptionsVariantSdl) isDisplayOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayOptionsVariantSdl) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayType `json:"type"` + DisplayOptionsVariantSdl + }{ + DisplayTypeSdl, + s, + } + return json.Marshal(v) +} + +func decodeDisplayOptions(bs json.RawMessage) (DisplayOptions, error) { + v := struct { + Type DisplayType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case DisplayTypeCocoa: + var ret DisplayOptionsVariantCocoa + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case DisplayTypeCurses: + var ret DisplayOptionsVariantCurses + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case DisplayTypeDbus: + var ret DisplayOptionsVariantDbus + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case DisplayTypeEglHeadless: + var ret DisplayOptionsVariantEglHeadless + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case DisplayTypeGtk: + var ret DisplayOptionsVariantGtk + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case DisplayTypeSdl: + var ret DisplayOptionsVariantSdl + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union DisplayOptions", v.Type) + } +} + +// DisplayProtocol -> DisplayProtocol (enum) + +// DisplayProtocol implements the "DisplayProtocol" QMP API type. +type DisplayProtocol int + +// Known values of DisplayProtocol. const ( - GuestPanicActionPause GuestPanicAction = iota - GuestPanicActionPoweroff + DisplayProtocolVNC DisplayProtocol = iota + DisplayProtocolSpice ) // String implements fmt.Stringer. -func (e GuestPanicAction) String() string { +func (e DisplayProtocol) String() string { switch e { - case GuestPanicActionPause: - return "pause" - case GuestPanicActionPoweroff: - return "poweroff" + case DisplayProtocolVNC: + return "vnc" + case DisplayProtocolSpice: + return "spice" default: - return fmt.Sprintf("GuestPanicAction(%d)", e) + return fmt.Sprintf("DisplayProtocol(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e GuestPanicAction) MarshalJSON() ([]byte, error) { +func (e DisplayProtocol) MarshalJSON() ([]byte, error) { switch e { - case GuestPanicActionPause: - return json.Marshal("pause") - case GuestPanicActionPoweroff: - return json.Marshal("poweroff") + case DisplayProtocolVNC: + return json.Marshal("vnc") + case DisplayProtocolSpice: + return json.Marshal("spice") default: - return nil, fmt.Errorf("unknown enum value %q for GuestPanicAction", e) + return nil, fmt.Errorf("unknown enum value %q for DisplayProtocol", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *GuestPanicAction) UnmarshalJSON(bs []byte) error { +func (e *DisplayProtocol) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "pause": - *e = GuestPanicActionPause - case "poweroff": - *e = GuestPanicActionPoweroff + case "vnc": + *e = DisplayProtocolVNC + case "spice": + *e = DisplayProtocolSpice default: - return fmt.Errorf("unknown enum value %q for GuestPanicAction", s) + return fmt.Errorf("unknown enum value %q for DisplayProtocol", s) } return nil } -// GuestPanicInformation -> GuestPanicInformation (flat union) +// DisplayReloadOptions -> DisplayReloadOptions (flat union) -// GuestPanicInformation implements the "GuestPanicInformation" QMP API type. +// DisplayReloadOptions implements the "DisplayReloadOptions" QMP API type. // // Can be one of: -// - GuestPanicInformationVariantHyperV -type GuestPanicInformation interface { - isGuestPanicInformation() +// - DisplayReloadOptionsVariantVNC +type DisplayReloadOptions interface { + isDisplayReloadOptions() } -// GuestPanicInformationVariantHyperV is an implementation of GuestPanicInformation. -type GuestPanicInformationVariantHyperV struct { - Arg1 uint64 `json:"arg1"` - Arg2 uint64 `json:"arg2"` - Arg3 uint64 `json:"arg3"` - Arg4 uint64 `json:"arg4"` - Arg5 uint64 `json:"arg5"` +// DisplayReloadOptionsVariantVNC is an implementation of DisplayReloadOptions. +type DisplayReloadOptionsVariantVNC struct { + TLSCerts *bool `json:"tls-certs,omitempty"` } -func (GuestPanicInformationVariantHyperV) isGuestPanicInformation() {} +func (DisplayReloadOptionsVariantVNC) isDisplayReloadOptions() {} // MarshalJSON implements json.Marshaler. -func (s GuestPanicInformationVariantHyperV) MarshalJSON() ([]byte, error) { +func (s DisplayReloadOptionsVariantVNC) MarshalJSON() ([]byte, error) { v := struct { - Type GuestPanicInformationType `json:"type"` - GuestPanicInformationVariantHyperV + Type DisplayReloadType `json:"type"` + DisplayReloadOptionsVariantVNC }{ - GuestPanicInformationTypeHyperV, + DisplayReloadTypeVNC, s, } return json.Marshal(v) } -func decodeGuestPanicInformation(bs json.RawMessage) (GuestPanicInformation, error) { +func decodeDisplayReloadOptions(bs json.RawMessage) (DisplayReloadOptions, error) { v := struct { - Type GuestPanicInformationType `json:"type"` + Type DisplayReloadType `json:"type"` }{} if err := json.Unmarshal([]byte(bs), &v); err != nil { return nil, err } switch v.Type { - case GuestPanicInformationTypeHyperV: - var ret GuestPanicInformationVariantHyperV + case DisplayReloadTypeVNC: + var ret DisplayReloadOptionsVariantVNC err := json.Unmarshal([]byte(bs), &ret) return ret, err default: - return nil, fmt.Errorf("unknown flat union subtype %q for flat union GuestPanicInformation", v.Type) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union DisplayReloadOptions", v.Type) } } -// GuestPanicInformationType -> GuestPanicInformationType (enum) +// DisplayReloadType -> DisplayReloadType (enum) -// GuestPanicInformationType implements the "GuestPanicInformationType" QMP API type. -type GuestPanicInformationType int +// DisplayReloadType implements the "DisplayReloadType" QMP API type. +type DisplayReloadType int -// Known values of GuestPanicInformationType. +// Known values of DisplayReloadType. const ( - GuestPanicInformationTypeHyperV GuestPanicInformationType = iota + DisplayReloadTypeVNC DisplayReloadType = iota ) // String implements fmt.Stringer. -func (e GuestPanicInformationType) String() string { +func (e DisplayReloadType) String() string { switch e { - case GuestPanicInformationTypeHyperV: - return "hyper-v" + case DisplayReloadTypeVNC: + return "vnc" default: - return fmt.Sprintf("GuestPanicInformationType(%d)", e) + return fmt.Sprintf("DisplayReloadType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e GuestPanicInformationType) MarshalJSON() ([]byte, error) { +func (e DisplayReloadType) MarshalJSON() ([]byte, error) { switch e { - case GuestPanicInformationTypeHyperV: - return json.Marshal("hyper-v") + case DisplayReloadTypeVNC: + return json.Marshal("vnc") default: - return nil, fmt.Errorf("unknown enum value %q for GuestPanicInformationType", e) + return nil, fmt.Errorf("unknown enum value %q for DisplayReloadType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *GuestPanicInformationType) UnmarshalJSON(bs []byte) error { +func (e *DisplayReloadType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "hyper-v": - *e = GuestPanicInformationTypeHyperV + case "vnc": + *e = DisplayReloadTypeVNC default: - return fmt.Errorf("unknown enum value %q for GuestPanicInformationType", s) + return fmt.Errorf("unknown enum value %q for DisplayReloadType", s) } return nil } -// GuidInfo -> GUIDInfo (struct) - -// GUIDInfo implements the "GuidInfo" QMP API type. -type GUIDInfo struct { - GUID string `json:"guid"` -} - -// HostMemPolicy -> HostMemPolicy (enum) +// DisplayType -> DisplayType (enum) -// HostMemPolicy implements the "HostMemPolicy" QMP API type. -type HostMemPolicy int +// DisplayType implements the "DisplayType" QMP API type. +type DisplayType int -// Known values of HostMemPolicy. +// Known values of DisplayType. const ( - HostMemPolicyDefault HostMemPolicy = iota - HostMemPolicyPreferred - HostMemPolicyBind - HostMemPolicyInterleave + DisplayTypeDefault DisplayType = iota + DisplayTypeNone + DisplayTypeGtk + DisplayTypeSdl + DisplayTypeEglHeadless + DisplayTypeCurses + DisplayTypeCocoa + DisplayTypeSpiceApp + DisplayTypeDbus ) // String implements fmt.Stringer. -func (e HostMemPolicy) String() string { +func (e DisplayType) String() string { switch e { - case HostMemPolicyDefault: + case DisplayTypeDefault: return "default" - case HostMemPolicyPreferred: - return "preferred" - case HostMemPolicyBind: - return "bind" - case HostMemPolicyInterleave: - return "interleave" + case DisplayTypeNone: + return "none" + case DisplayTypeGtk: + return "gtk" + case DisplayTypeSdl: + return "sdl" + case DisplayTypeEglHeadless: + return "egl-headless" + case DisplayTypeCurses: + return "curses" + case DisplayTypeCocoa: + return "cocoa" + case DisplayTypeSpiceApp: + return "spice-app" + case DisplayTypeDbus: + return "dbus" default: - return fmt.Sprintf("HostMemPolicy(%d)", e) + return fmt.Sprintf("DisplayType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e HostMemPolicy) MarshalJSON() ([]byte, error) { +func (e DisplayType) MarshalJSON() ([]byte, error) { switch e { - case HostMemPolicyDefault: + case DisplayTypeDefault: return json.Marshal("default") - case HostMemPolicyPreferred: - return json.Marshal("preferred") - case HostMemPolicyBind: - return json.Marshal("bind") - case HostMemPolicyInterleave: - return json.Marshal("interleave") + case DisplayTypeNone: + return json.Marshal("none") + case DisplayTypeGtk: + return json.Marshal("gtk") + case DisplayTypeSdl: + return json.Marshal("sdl") + case DisplayTypeEglHeadless: + return json.Marshal("egl-headless") + case DisplayTypeCurses: + return json.Marshal("curses") + case DisplayTypeCocoa: + return json.Marshal("cocoa") + case DisplayTypeSpiceApp: + return json.Marshal("spice-app") + case DisplayTypeDbus: + return json.Marshal("dbus") default: - return nil, fmt.Errorf("unknown enum value %q for HostMemPolicy", e) + return nil, fmt.Errorf("unknown enum value %q for DisplayType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *HostMemPolicy) UnmarshalJSON(bs []byte) error { +func (e *DisplayType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { case "default": - *e = HostMemPolicyDefault - case "preferred": - *e = HostMemPolicyPreferred - case "bind": - *e = HostMemPolicyBind - case "interleave": - *e = HostMemPolicyInterleave + *e = DisplayTypeDefault + case "none": + *e = DisplayTypeNone + case "gtk": + *e = DisplayTypeGtk + case "sdl": + *e = DisplayTypeSdl + case "egl-headless": + *e = DisplayTypeEglHeadless + case "curses": + *e = DisplayTypeCurses + case "cocoa": + *e = DisplayTypeCocoa + case "spice-app": + *e = DisplayTypeSpiceApp + case "dbus": + *e = DisplayTypeDbus default: - return fmt.Errorf("unknown enum value %q for HostMemPolicy", s) + return fmt.Errorf("unknown enum value %q for DisplayType", s) } return nil } -// HotpluggableCPU -> HotpluggableCPU (struct) +// DisplayUpdateOptions -> DisplayUpdateOptions (flat union) -// HotpluggableCPU implements the "HotpluggableCPU" QMP API type. -type HotpluggableCPU struct { - Type string `json:"type"` - VcpusCount int64 `json:"vcpus-count"` - Props CPUInstanceProperties `json:"props"` - QomPath *string `json:"qom-path,omitempty"` +// DisplayUpdateOptions implements the "DisplayUpdateOptions" QMP API type. +// +// Can be one of: +// - DisplayUpdateOptionsVariantVNC +type DisplayUpdateOptions interface { + isDisplayUpdateOptions() } -// IOThreadInfo -> IOThreadInfo (struct) +// DisplayUpdateOptionsVariantVNC is an implementation of DisplayUpdateOptions. +type DisplayUpdateOptionsVariantVNC struct { + Addresses []SocketAddress `json:"addresses,omitempty"` +} -// IOThreadInfo implements the "IOThreadInfo" QMP API type. -type IOThreadInfo struct { - ID string `json:"id"` - ThreadID int64 `json:"thread-id"` - PollMaxNs int64 `json:"poll-max-ns"` - PollGrow int64 `json:"poll-grow"` - PollShrink int64 `json:"poll-shrink"` +func (DisplayUpdateOptionsVariantVNC) isDisplayUpdateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s DisplayUpdateOptionsVariantVNC) MarshalJSON() ([]byte, error) { + v := struct { + Type DisplayUpdateType `json:"type"` + DisplayUpdateOptionsVariantVNC + }{ + DisplayUpdateTypeVNC, + s, + } + return json.Marshal(v) } -// ImageInfo -> ImageInfo (struct) +func decodeDisplayUpdateOptions(bs json.RawMessage) (DisplayUpdateOptions, error) { + v := struct { + Type DisplayUpdateType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case DisplayUpdateTypeVNC: + var ret DisplayUpdateOptionsVariantVNC + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union DisplayUpdateOptions", v.Type) + } +} -// ImageInfo implements the "ImageInfo" QMP API type. -type ImageInfo struct { - Filename string `json:"filename"` - Format string `json:"format"` - DirtyFlag *bool `json:"dirty-flag,omitempty"` - ActualSize *int64 `json:"actual-size,omitempty"` - VirtualSize int64 `json:"virtual-size"` - ClusterSize *int64 `json:"cluster-size,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - Compressed *bool `json:"compressed,omitempty"` - BackingFilename *string `json:"backing-filename,omitempty"` - FullBackingFilename *string `json:"full-backing-filename,omitempty"` - BackingFilenameFormat *string `json:"backing-filename-format,omitempty"` - Snapshots []SnapshotInfo `json:"snapshots,omitempty"` - BackingImage *ImageInfo `json:"backing-image,omitempty"` - FormatSpecific *ImageInfoSpecific `json:"format-specific,omitempty"` -} - -// ImageInfoSpecific -> ImageInfoSpecific (simple union) - -// ImageInfoSpecific implements the "ImageInfoSpecific" QMP API type. -// -// Can be one of: -// - ImageInfoSpecificVariantLUKS -// - ImageInfoSpecificVariantQcow2 -// - ImageInfoSpecificVariantVMDK -type ImageInfoSpecific interface { - isImageInfoSpecific() -} - -// ImageInfoSpecificVariantLUKS is an implementation of ImageInfoSpecific. -type ImageInfoSpecificVariantLUKS QCryptoBlockInfoLUKS - -func (ImageInfoSpecificVariantLUKS) isImageInfoSpecific() {} +// DisplayUpdateType -> DisplayUpdateType (enum) -// MarshalJSON implements json.Marshaler. -func (s ImageInfoSpecificVariantLUKS) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "luks", - "data": QCryptoBlockInfoLUKS(s), - } - return json.Marshal(v) -} - -// ImageInfoSpecificVariantQcow2 is an implementation of ImageInfoSpecific. -type ImageInfoSpecificVariantQcow2 ImageInfoSpecificQCow2 - -func (ImageInfoSpecificVariantQcow2) isImageInfoSpecific() {} - -// MarshalJSON implements json.Marshaler. -func (s ImageInfoSpecificVariantQcow2) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "qcow2", - "data": ImageInfoSpecificQCow2(s), - } - return json.Marshal(v) -} - -// ImageInfoSpecificVariantVMDK is an implementation of ImageInfoSpecific. -type ImageInfoSpecificVariantVMDK ImageInfoSpecificVMDK - -func (ImageInfoSpecificVariantVMDK) isImageInfoSpecific() {} +// DisplayUpdateType implements the "DisplayUpdateType" QMP API type. +type DisplayUpdateType int -// MarshalJSON implements json.Marshaler. -func (s ImageInfoSpecificVariantVMDK) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "vmdk", - "data": ImageInfoSpecificVMDK(s), - } - return json.Marshal(v) -} +// Known values of DisplayUpdateType. +const ( + DisplayUpdateTypeVNC DisplayUpdateType = iota +) -func decodeImageInfoSpecific(bs json.RawMessage) (ImageInfoSpecific, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err - } - switch v.T { - case "luks": - var ret ImageInfoSpecificVariantLUKS - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "qcow2": - var ret ImageInfoSpecificVariantQcow2 - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "vmdk": - var ret ImageInfoSpecificVariantVMDK - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil +// String implements fmt.Stringer. +func (e DisplayUpdateType) String() string { + switch e { + case DisplayUpdateTypeVNC: + return "vnc" default: - return nil, fmt.Errorf("unknown subtype %q for union ImageInfoSpecific", v.T) - } -} - -// ImageInfoSpecificQCow2 -> ImageInfoSpecificQCow2 (struct) - -// ImageInfoSpecificQCow2 implements the "ImageInfoSpecificQCow2" QMP API type. -type ImageInfoSpecificQCow2 struct { - Compat string `json:"compat"` - LazyRefcounts *bool `json:"lazy-refcounts,omitempty"` - Corrupt *bool `json:"corrupt,omitempty"` - RefcountBits int64 `json:"refcount-bits"` - Encrypt *ImageInfoSpecificQCow2Encryption `json:"encrypt,omitempty"` -} - -// ImageInfoSpecificQCow2Encryption -> ImageInfoSpecificQCow2Encryption (flat union) - -// ImageInfoSpecificQCow2Encryption implements the "ImageInfoSpecificQCow2Encryption" QMP API type. -// -// Can be one of: -// - ImageInfoSpecificQCow2EncryptionVariantAes -// - ImageInfoSpecificQCow2EncryptionVariantLUKS -type ImageInfoSpecificQCow2Encryption interface { - isImageInfoSpecificQCow2Encryption() -} - -// ImageInfoSpecificQCow2EncryptionVariantAes is an implementation of ImageInfoSpecificQCow2Encryption. -type ImageInfoSpecificQCow2EncryptionVariantAes struct { -} - -func (ImageInfoSpecificQCow2EncryptionVariantAes) isImageInfoSpecificQCow2Encryption() {} - -// MarshalJSON implements json.Marshaler. -func (s ImageInfoSpecificQCow2EncryptionVariantAes) MarshalJSON() ([]byte, error) { - v := struct { - Format BlockdevQcow2EncryptionFormat `json:"format"` - ImageInfoSpecificQCow2EncryptionVariantAes - }{ - BlockdevQcow2EncryptionFormatAes, - s, + return fmt.Sprintf("DisplayUpdateType(%d)", e) } - return json.Marshal(v) -} - -// ImageInfoSpecificQCow2EncryptionVariantLUKS is an implementation of ImageInfoSpecificQCow2Encryption. -type ImageInfoSpecificQCow2EncryptionVariantLUKS struct { - CipherAlg QCryptoCipherAlgorithm `json:"cipher-alg"` - CipherMode QCryptoCipherMode `json:"cipher-mode"` - IvgenAlg QCryptoIvGenAlgorithm `json:"ivgen-alg"` - IvgenHashAlg *QCryptoHashAlgorithm `json:"ivgen-hash-alg,omitempty"` - HashAlg QCryptoHashAlgorithm `json:"hash-alg"` - PayloadOffset int64 `json:"payload-offset"` - MasterKeyIters int64 `json:"master-key-iters"` - UUID string `json:"uuid"` - Slots []QCryptoBlockInfoLUKSSlot `json:"slots"` } -func (ImageInfoSpecificQCow2EncryptionVariantLUKS) isImageInfoSpecificQCow2Encryption() {} - // MarshalJSON implements json.Marshaler. -func (s ImageInfoSpecificQCow2EncryptionVariantLUKS) MarshalJSON() ([]byte, error) { - v := struct { - Format BlockdevQcow2EncryptionFormat `json:"format"` - ImageInfoSpecificQCow2EncryptionVariantLUKS - }{ - BlockdevQcow2EncryptionFormatLUKS, - s, +func (e DisplayUpdateType) MarshalJSON() ([]byte, error) { + switch e { + case DisplayUpdateTypeVNC: + return json.Marshal("vnc") + default: + return nil, fmt.Errorf("unknown enum value %q for DisplayUpdateType", e) } - return json.Marshal(v) } -func decodeImageInfoSpecificQCow2Encryption(bs json.RawMessage) (ImageInfoSpecificQCow2Encryption, error) { - v := struct { - Format BlockdevQcow2EncryptionFormat `json:"format"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err +// UnmarshalJSON implements json.Unmarshaler. +func (e *DisplayUpdateType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - switch v.Format { - case BlockdevQcow2EncryptionFormatAes: - var ret ImageInfoSpecificQCow2EncryptionVariantAes - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case BlockdevQcow2EncryptionFormatLUKS: - var ret ImageInfoSpecificQCow2EncryptionVariantLUKS - err := json.Unmarshal([]byte(bs), &ret) - return ret, err + switch s { + case "vnc": + *e = DisplayUpdateTypeVNC default: - return nil, fmt.Errorf("unknown flat union subtype %q for flat union ImageInfoSpecificQCow2Encryption", v.Format) + return fmt.Errorf("unknown enum value %q for DisplayUpdateType", s) } + return nil } -// ImageInfoSpecificVmdk -> ImageInfoSpecificVMDK (struct) +// DriveBackup -> DriveBackup (struct) -// ImageInfoSpecificVMDK implements the "ImageInfoSpecificVmdk" QMP API type. -type ImageInfoSpecificVMDK struct { - CreateType string `json:"create-type"` - Cid int64 `json:"cid"` - ParentCid int64 `json:"parent-cid"` - Extents []ImageInfo `json:"extents"` +// DriveBackup implements the "DriveBackup" QMP API type. +type DriveBackup struct { + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + Sync MirrorSyncMode `json:"sync"` + Speed *int64 `json:"speed,omitempty"` + Bitmap *string `json:"bitmap,omitempty"` + BitmapMode *BitmapSyncMode `json:"bitmap-mode,omitempty"` + Compress *bool `json:"compress,omitempty"` + OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` + OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` + FilterNodeName *string `json:"filter-node-name,omitempty"` + XPerf *BackupPerf `json:"x-perf,omitempty"` + Target string `json:"target"` + Format *string `json:"format,omitempty"` + Mode *NewImageMode `json:"mode,omitempty"` } -// InetSocketAddress -> InetSocketAddress (struct) +// DriveMirror -> DriveMirror (struct) -// InetSocketAddress implements the "InetSocketAddress" QMP API type. -type InetSocketAddress struct { - Host string `json:"host"` - Port string `json:"port"` - Numeric *bool `json:"numeric,omitempty"` - To *uint16 `json:"to,omitempty"` - Ipv4 *bool `json:"ipv4,omitempty"` - Ipv6 *bool `json:"ipv6,omitempty"` +// DriveMirror implements the "DriveMirror" QMP API type. +type DriveMirror struct { + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + Target string `json:"target"` + Format *string `json:"format,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Replaces *string `json:"replaces,omitempty"` + Sync MirrorSyncMode `json:"sync"` + Mode *NewImageMode `json:"mode,omitempty"` + Speed *int64 `json:"speed,omitempty"` + Granularity *uint32 `json:"granularity,omitempty"` + BufSize *int64 `json:"buf-size,omitempty"` + OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` + OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` + Unmap *bool `json:"unmap,omitempty"` + CopyMode *MirrorCopyMode `json:"copy-mode,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` } -// InetSocketAddressBase -> InetSocketAddressBase (struct) +// DumpGuestMemoryCapability -> DumpGuestMemoryCapability (struct) -// InetSocketAddressBase implements the "InetSocketAddressBase" QMP API type. -type InetSocketAddressBase struct { - Host string `json:"host"` - Port string `json:"port"` +// DumpGuestMemoryCapability implements the "DumpGuestMemoryCapability" QMP API type. +type DumpGuestMemoryCapability struct { + Formats []DumpGuestMemoryFormat `json:"formats"` } -// InputAxis -> InputAxis (enum) +// DumpGuestMemoryFormat -> DumpGuestMemoryFormat (enum) -// InputAxis implements the "InputAxis" QMP API type. -type InputAxis int +// DumpGuestMemoryFormat implements the "DumpGuestMemoryFormat" QMP API type. +type DumpGuestMemoryFormat int -// Known values of InputAxis. +// Known values of DumpGuestMemoryFormat. const ( - InputAxisX InputAxis = iota - InputAxisY + DumpGuestMemoryFormatElf DumpGuestMemoryFormat = iota + DumpGuestMemoryFormatKdumpZlib + DumpGuestMemoryFormatKdumpLzo + DumpGuestMemoryFormatKdumpSnappy + DumpGuestMemoryFormatWinDmp ) // String implements fmt.Stringer. -func (e InputAxis) String() string { +func (e DumpGuestMemoryFormat) String() string { switch e { - case InputAxisX: - return "x" - case InputAxisY: - return "y" + case DumpGuestMemoryFormatElf: + return "elf" + case DumpGuestMemoryFormatKdumpZlib: + return "kdump-zlib" + case DumpGuestMemoryFormatKdumpLzo: + return "kdump-lzo" + case DumpGuestMemoryFormatKdumpSnappy: + return "kdump-snappy" + case DumpGuestMemoryFormatWinDmp: + return "win-dmp" default: - return fmt.Sprintf("InputAxis(%d)", e) + return fmt.Sprintf("DumpGuestMemoryFormat(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e InputAxis) MarshalJSON() ([]byte, error) { +func (e DumpGuestMemoryFormat) MarshalJSON() ([]byte, error) { switch e { - case InputAxisX: - return json.Marshal("x") - case InputAxisY: - return json.Marshal("y") + case DumpGuestMemoryFormatElf: + return json.Marshal("elf") + case DumpGuestMemoryFormatKdumpZlib: + return json.Marshal("kdump-zlib") + case DumpGuestMemoryFormatKdumpLzo: + return json.Marshal("kdump-lzo") + case DumpGuestMemoryFormatKdumpSnappy: + return json.Marshal("kdump-snappy") + case DumpGuestMemoryFormatWinDmp: + return json.Marshal("win-dmp") default: - return nil, fmt.Errorf("unknown enum value %q for InputAxis", e) + return nil, fmt.Errorf("unknown enum value %q for DumpGuestMemoryFormat", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *InputAxis) UnmarshalJSON(bs []byte) error { +func (e *DumpGuestMemoryFormat) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "x": - *e = InputAxisX - case "y": - *e = InputAxisY + case "elf": + *e = DumpGuestMemoryFormatElf + case "kdump-zlib": + *e = DumpGuestMemoryFormatKdumpZlib + case "kdump-lzo": + *e = DumpGuestMemoryFormatKdumpLzo + case "kdump-snappy": + *e = DumpGuestMemoryFormatKdumpSnappy + case "win-dmp": + *e = DumpGuestMemoryFormatWinDmp default: - return fmt.Errorf("unknown enum value %q for InputAxis", s) + return fmt.Errorf("unknown enum value %q for DumpGuestMemoryFormat", s) } return nil } -// InputBtnEvent -> InputBtnEvent (struct) +// DumpQueryResult -> DumpQueryResult (struct) -// InputBtnEvent implements the "InputBtnEvent" QMP API type. -type InputBtnEvent struct { - Button InputButton `json:"button"` - Down bool `json:"down"` +// DumpQueryResult implements the "DumpQueryResult" QMP API type. +type DumpQueryResult struct { + Status DumpStatus `json:"status"` + Completed int64 `json:"completed"` + Total int64 `json:"total"` } -// InputButton -> InputButton (enum) +// DumpStatus -> DumpStatus (enum) -// InputButton implements the "InputButton" QMP API type. -type InputButton int +// DumpStatus implements the "DumpStatus" QMP API type. +type DumpStatus int -// Known values of InputButton. +// Known values of DumpStatus. const ( - InputButtonLeft InputButton = iota - InputButtonMiddle - InputButtonRight - InputButtonWheelUp - InputButtonWheelDown - InputButtonSide - InputButtonExtra + DumpStatusNone DumpStatus = iota + DumpStatusActive + DumpStatusCompleted + DumpStatusFailed ) // String implements fmt.Stringer. -func (e InputButton) String() string { +func (e DumpStatus) String() string { switch e { - case InputButtonLeft: - return "left" - case InputButtonMiddle: - return "middle" - case InputButtonRight: - return "right" - case InputButtonWheelUp: - return "wheel-up" - case InputButtonWheelDown: - return "wheel-down" - case InputButtonSide: - return "side" - case InputButtonExtra: - return "extra" + case DumpStatusNone: + return "none" + case DumpStatusActive: + return "active" + case DumpStatusCompleted: + return "completed" + case DumpStatusFailed: + return "failed" default: - return fmt.Sprintf("InputButton(%d)", e) + return fmt.Sprintf("DumpStatus(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e InputButton) MarshalJSON() ([]byte, error) { +func (e DumpStatus) MarshalJSON() ([]byte, error) { switch e { - case InputButtonLeft: - return json.Marshal("left") - case InputButtonMiddle: - return json.Marshal("middle") - case InputButtonRight: - return json.Marshal("right") - case InputButtonWheelUp: - return json.Marshal("wheel-up") - case InputButtonWheelDown: - return json.Marshal("wheel-down") - case InputButtonSide: - return json.Marshal("side") - case InputButtonExtra: - return json.Marshal("extra") + case DumpStatusNone: + return json.Marshal("none") + case DumpStatusActive: + return json.Marshal("active") + case DumpStatusCompleted: + return json.Marshal("completed") + case DumpStatusFailed: + return json.Marshal("failed") default: - return nil, fmt.Errorf("unknown enum value %q for InputButton", e) + return nil, fmt.Errorf("unknown enum value %q for DumpStatus", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *InputButton) UnmarshalJSON(bs []byte) error { +func (e *DumpStatus) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "left": - *e = InputButtonLeft - case "middle": - *e = InputButtonMiddle - case "right": - *e = InputButtonRight - case "wheel-up": - *e = InputButtonWheelUp - case "wheel-down": - *e = InputButtonWheelDown - case "side": - *e = InputButtonSide - case "extra": - *e = InputButtonExtra + case "none": + *e = DumpStatusNone + case "active": + *e = DumpStatusActive + case "completed": + *e = DumpStatusCompleted + case "failed": + *e = DumpStatusFailed default: - return fmt.Errorf("unknown enum value %q for InputButton", s) + return fmt.Errorf("unknown enum value %q for DumpStatus", s) } return nil } -// InputEvent -> InputEvent (simple union) +// ExpirePasswordOptions -> ExpirePasswordOptions (flat union) -// InputEvent implements the "InputEvent" QMP API type. +// ExpirePasswordOptions implements the "ExpirePasswordOptions" QMP API type. // // Can be one of: -// - InputEventVariantAbs -// - InputEventVariantBtn -// - InputEventVariantKey -// - InputEventVariantRel -type InputEvent interface { - isInputEvent() -} - -// InputEventVariantAbs is an implementation of InputEvent. -type InputEventVariantAbs InputMoveEvent - -func (InputEventVariantAbs) isInputEvent() {} - -// MarshalJSON implements json.Marshaler. -func (s InputEventVariantAbs) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "abs", - "data": InputMoveEvent(s), - } - return json.Marshal(v) -} - -// InputEventVariantBtn is an implementation of InputEvent. -type InputEventVariantBtn InputBtnEvent - -func (InputEventVariantBtn) isInputEvent() {} - -// MarshalJSON implements json.Marshaler. -func (s InputEventVariantBtn) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "btn", - "data": InputBtnEvent(s), - } - return json.Marshal(v) +// - ExpirePasswordOptionsVariantVNC +type ExpirePasswordOptions interface { + isExpirePasswordOptions() } -// InputEventVariantKey is an implementation of InputEvent. -type InputEventVariantKey InputKeyEvent - -func (InputEventVariantKey) isInputEvent() {} - -// MarshalJSON implements json.Marshaler. -func (s InputEventVariantKey) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "key", - "data": InputKeyEvent(s), - } - return json.Marshal(v) +// ExpirePasswordOptionsVariantVNC is an implementation of ExpirePasswordOptions. +type ExpirePasswordOptionsVariantVNC struct { + Time string `json:"time"` + Display *string `json:"display,omitempty"` } -// InputEventVariantRel is an implementation of InputEvent. -type InputEventVariantRel InputMoveEvent - -func (InputEventVariantRel) isInputEvent() {} +func (ExpirePasswordOptionsVariantVNC) isExpirePasswordOptions() {} // MarshalJSON implements json.Marshaler. -func (s InputEventVariantRel) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "rel", - "data": InputMoveEvent(s), +func (s ExpirePasswordOptionsVariantVNC) MarshalJSON() ([]byte, error) { + v := struct { + Protocol DisplayProtocol `json:"protocol"` + ExpirePasswordOptionsVariantVNC + }{ + DisplayProtocolVNC, + s, } return json.Marshal(v) } -func decodeInputEvent(bs json.RawMessage) (InputEvent, error) { +func decodeExpirePasswordOptions(bs json.RawMessage) (ExpirePasswordOptions, error) { v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` + Protocol DisplayProtocol `json:"protocol"` }{} if err := json.Unmarshal([]byte(bs), &v); err != nil { return nil, err } - switch v.T { - case "abs": - var ret InputEventVariantAbs - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "btn": - var ret InputEventVariantBtn - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "key": - var ret InputEventVariantKey - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "rel": - var ret InputEventVariantRel - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil + switch v.Protocol { + case DisplayProtocolVNC: + var ret ExpirePasswordOptionsVariantVNC + err := json.Unmarshal([]byte(bs), &ret) + return ret, err default: - return nil, fmt.Errorf("unknown subtype %q for union InputEvent", v.T) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union ExpirePasswordOptions", v.Protocol) } } -// InputKeyEvent -> InputKeyEvent (struct) +// EVENT FAILOVER_NEGOTIATED -// InputKeyEvent implements the "InputKeyEvent" QMP API type. -type InputKeyEvent struct { - Key KeyValue `json:"key"` - Down bool `json:"down"` +// FdsetFdInfo -> FdsetFDInfo (struct) + +// FdsetFDInfo implements the "FdsetFdInfo" QMP API type. +type FdsetFDInfo struct { + FD int64 `json:"fd"` + Opaque *string `json:"opaque,omitempty"` } -// InputMoveEvent -> InputMoveEvent (struct) +// FdsetInfo -> FdsetInfo (struct) -// InputMoveEvent implements the "InputMoveEvent" QMP API type. -type InputMoveEvent struct { - Axis InputAxis `json:"axis"` - Value int64 `json:"value"` +// FdsetInfo implements the "FdsetInfo" QMP API type. +type FdsetInfo struct { + FdsetID int64 `json:"fdset-id"` + Fds []FdsetFDInfo `json:"fds"` } -// IoOperationType -> IOOperationType (enum) +// FuseExportAllowOther -> FuseExportAllowOther (enum) -// IOOperationType implements the "IoOperationType" QMP API type. -type IOOperationType int +// FuseExportAllowOther implements the "FuseExportAllowOther" QMP API type. +type FuseExportAllowOther int -// Known values of IOOperationType. +// Known values of FuseExportAllowOther. const ( - IOOperationTypeRead IOOperationType = iota - IOOperationTypeWrite + FuseExportAllowOtherOff FuseExportAllowOther = iota + FuseExportAllowOtherOn + FuseExportAllowOtherAuto ) // String implements fmt.Stringer. -func (e IOOperationType) String() string { +func (e FuseExportAllowOther) String() string { switch e { - case IOOperationTypeRead: - return "read" - case IOOperationTypeWrite: - return "write" + case FuseExportAllowOtherOff: + return "off" + case FuseExportAllowOtherOn: + return "on" + case FuseExportAllowOtherAuto: + return "auto" default: - return fmt.Sprintf("IOOperationType(%d)", e) + return fmt.Sprintf("FuseExportAllowOther(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e IOOperationType) MarshalJSON() ([]byte, error) { +func (e FuseExportAllowOther) MarshalJSON() ([]byte, error) { switch e { - case IOOperationTypeRead: - return json.Marshal("read") - case IOOperationTypeWrite: - return json.Marshal("write") + case FuseExportAllowOtherOff: + return json.Marshal("off") + case FuseExportAllowOtherOn: + return json.Marshal("on") + case FuseExportAllowOtherAuto: + return json.Marshal("auto") default: - return nil, fmt.Errorf("unknown enum value %q for IOOperationType", e) + return nil, fmt.Errorf("unknown enum value %q for FuseExportAllowOther", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *IOOperationType) UnmarshalJSON(bs []byte) error { +func (e *FuseExportAllowOther) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "read": - *e = IOOperationTypeRead - case "write": - *e = IOOperationTypeWrite + case "off": + *e = FuseExportAllowOtherOff + case "on": + *e = FuseExportAllowOtherOn + case "auto": + *e = FuseExportAllowOtherAuto default: - return fmt.Errorf("unknown enum value %q for IOOperationType", s) + return fmt.Errorf("unknown enum value %q for FuseExportAllowOther", s) } return nil } -// IscsiHeaderDigest -> IscsiHeaderDigest (enum) +// GICCapability -> GicCapability (struct) -// IscsiHeaderDigest implements the "IscsiHeaderDigest" QMP API type. -type IscsiHeaderDigest int +// GicCapability implements the "GICCapability" QMP API type. +type GicCapability struct { + Version int64 `json:"version"` + Emulated bool `json:"emulated"` + Kernel bool `json:"kernel"` +} -// Known values of IscsiHeaderDigest. +// EVENT GUEST_CRASHLOADED + +// EVENT GUEST_PANICKED + +// GrabToggleKeys -> GrabToggleKeys (enum) + +// GrabToggleKeys implements the "GrabToggleKeys" QMP API type. +type GrabToggleKeys int + +// Known values of GrabToggleKeys. const ( - IscsiHeaderDigestCrc32C IscsiHeaderDigest = iota - IscsiHeaderDigestNone - IscsiHeaderDigestCrc32CNone - IscsiHeaderDigestNoneCrc32C + GrabToggleKeysCtrlCtrl GrabToggleKeys = iota + GrabToggleKeysAltAlt + GrabToggleKeysShiftShift + GrabToggleKeysMetaMeta + GrabToggleKeysScrolllock + GrabToggleKeysCtrlScrolllock ) // String implements fmt.Stringer. -func (e IscsiHeaderDigest) String() string { +func (e GrabToggleKeys) String() string { switch e { - case IscsiHeaderDigestCrc32C: - return "crc32c" - case IscsiHeaderDigestNone: - return "none" - case IscsiHeaderDigestCrc32CNone: - return "crc32c-none" - case IscsiHeaderDigestNoneCrc32C: - return "none-crc32c" + case GrabToggleKeysCtrlCtrl: + return "ctrl-ctrl" + case GrabToggleKeysAltAlt: + return "alt-alt" + case GrabToggleKeysShiftShift: + return "shift-shift" + case GrabToggleKeysMetaMeta: + return "meta-meta" + case GrabToggleKeysScrolllock: + return "scrolllock" + case GrabToggleKeysCtrlScrolllock: + return "ctrl-scrolllock" default: - return fmt.Sprintf("IscsiHeaderDigest(%d)", e) + return fmt.Sprintf("GrabToggleKeys(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e IscsiHeaderDigest) MarshalJSON() ([]byte, error) { +func (e GrabToggleKeys) MarshalJSON() ([]byte, error) { switch e { - case IscsiHeaderDigestCrc32C: - return json.Marshal("crc32c") - case IscsiHeaderDigestNone: - return json.Marshal("none") - case IscsiHeaderDigestCrc32CNone: - return json.Marshal("crc32c-none") - case IscsiHeaderDigestNoneCrc32C: - return json.Marshal("none-crc32c") + case GrabToggleKeysCtrlCtrl: + return json.Marshal("ctrl-ctrl") + case GrabToggleKeysAltAlt: + return json.Marshal("alt-alt") + case GrabToggleKeysShiftShift: + return json.Marshal("shift-shift") + case GrabToggleKeysMetaMeta: + return json.Marshal("meta-meta") + case GrabToggleKeysScrolllock: + return json.Marshal("scrolllock") + case GrabToggleKeysCtrlScrolllock: + return json.Marshal("ctrl-scrolllock") default: - return nil, fmt.Errorf("unknown enum value %q for IscsiHeaderDigest", e) + return nil, fmt.Errorf("unknown enum value %q for GrabToggleKeys", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *IscsiHeaderDigest) UnmarshalJSON(bs []byte) error { +func (e *GrabToggleKeys) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "crc32c": - *e = IscsiHeaderDigestCrc32C - case "none": - *e = IscsiHeaderDigestNone - case "crc32c-none": - *e = IscsiHeaderDigestCrc32CNone - case "none-crc32c": - *e = IscsiHeaderDigestNoneCrc32C + case "ctrl-ctrl": + *e = GrabToggleKeysCtrlCtrl + case "alt-alt": + *e = GrabToggleKeysAltAlt + case "shift-shift": + *e = GrabToggleKeysShiftShift + case "meta-meta": + *e = GrabToggleKeysMetaMeta + case "scrolllock": + *e = GrabToggleKeysScrolllock + case "ctrl-scrolllock": + *e = GrabToggleKeysCtrlScrolllock default: - return fmt.Errorf("unknown enum value %q for IscsiHeaderDigest", s) + return fmt.Errorf("unknown enum value %q for GrabToggleKeys", s) } return nil } -// IscsiTransport -> IscsiTransport (enum) +// GuestPanicAction -> GuestPanicAction (enum) -// IscsiTransport implements the "IscsiTransport" QMP API type. -type IscsiTransport int +// GuestPanicAction implements the "GuestPanicAction" QMP API type. +type GuestPanicAction int -// Known values of IscsiTransport. +// Known values of GuestPanicAction. const ( - IscsiTransportTCP IscsiTransport = iota - IscsiTransportIser + GuestPanicActionPause GuestPanicAction = iota + GuestPanicActionPoweroff + GuestPanicActionRun ) // String implements fmt.Stringer. -func (e IscsiTransport) String() string { +func (e GuestPanicAction) String() string { switch e { - case IscsiTransportTCP: - return "tcp" - case IscsiTransportIser: - return "iser" + case GuestPanicActionPause: + return "pause" + case GuestPanicActionPoweroff: + return "poweroff" + case GuestPanicActionRun: + return "run" default: - return fmt.Sprintf("IscsiTransport(%d)", e) + return fmt.Sprintf("GuestPanicAction(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e IscsiTransport) MarshalJSON() ([]byte, error) { +func (e GuestPanicAction) MarshalJSON() ([]byte, error) { switch e { - case IscsiTransportTCP: - return json.Marshal("tcp") - case IscsiTransportIser: - return json.Marshal("iser") + case GuestPanicActionPause: + return json.Marshal("pause") + case GuestPanicActionPoweroff: + return json.Marshal("poweroff") + case GuestPanicActionRun: + return json.Marshal("run") default: - return nil, fmt.Errorf("unknown enum value %q for IscsiTransport", e) + return nil, fmt.Errorf("unknown enum value %q for GuestPanicAction", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *IscsiTransport) UnmarshalJSON(bs []byte) error { +func (e *GuestPanicAction) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "tcp": - *e = IscsiTransportTCP - case "iser": - *e = IscsiTransportIser + case "pause": + *e = GuestPanicActionPause + case "poweroff": + *e = GuestPanicActionPoweroff + case "run": + *e = GuestPanicActionRun default: - return fmt.Errorf("unknown enum value %q for IscsiTransport", s) + return fmt.Errorf("unknown enum value %q for GuestPanicAction", s) } return nil } -// JSONType -> JSONType (enum) +// GuestPanicInformation -> GuestPanicInformation (flat union) -// JSONType implements the "JSONType" QMP API type. -type JSONType int +// GuestPanicInformation implements the "GuestPanicInformation" QMP API type. +// +// Can be one of: +// - GuestPanicInformationVariantHyperV +// - GuestPanicInformationVariantS390 +type GuestPanicInformation interface { + isGuestPanicInformation() +} -// Known values of JSONType. +// GuestPanicInformationVariantHyperV is an implementation of GuestPanicInformation. +type GuestPanicInformationVariantHyperV struct { + Arg1 uint64 `json:"arg1"` + Arg2 uint64 `json:"arg2"` + Arg3 uint64 `json:"arg3"` + Arg4 uint64 `json:"arg4"` + Arg5 uint64 `json:"arg5"` +} + +func (GuestPanicInformationVariantHyperV) isGuestPanicInformation() {} + +// MarshalJSON implements json.Marshaler. +func (s GuestPanicInformationVariantHyperV) MarshalJSON() ([]byte, error) { + v := struct { + Type GuestPanicInformationType `json:"type"` + GuestPanicInformationVariantHyperV + }{ + GuestPanicInformationTypeHyperV, + s, + } + return json.Marshal(v) +} + +// GuestPanicInformationVariantS390 is an implementation of GuestPanicInformation. +type GuestPanicInformationVariantS390 struct { + Core uint32 `json:"core"` + PswMask uint64 `json:"psw-mask"` + PswAddr uint64 `json:"psw-addr"` + Reason S390CrashReason `json:"reason"` +} + +func (GuestPanicInformationVariantS390) isGuestPanicInformation() {} + +// MarshalJSON implements json.Marshaler. +func (s GuestPanicInformationVariantS390) MarshalJSON() ([]byte, error) { + v := struct { + Type GuestPanicInformationType `json:"type"` + GuestPanicInformationVariantS390 + }{ + GuestPanicInformationTypeS390, + s, + } + return json.Marshal(v) +} + +func decodeGuestPanicInformation(bs json.RawMessage) (GuestPanicInformation, error) { + v := struct { + Type GuestPanicInformationType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case GuestPanicInformationTypeHyperV: + var ret GuestPanicInformationVariantHyperV + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case GuestPanicInformationTypeS390: + var ret GuestPanicInformationVariantS390 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union GuestPanicInformation", v.Type) + } +} + +// GuestPanicInformationType -> GuestPanicInformationType (enum) + +// GuestPanicInformationType implements the "GuestPanicInformationType" QMP API type. +type GuestPanicInformationType int + +// Known values of GuestPanicInformationType. const ( - JSONTypeString JSONType = iota - JSONTypefloat64 - JSONTypeint64 - JSONTypeBoolean - JSONTypeNull - JSONTypeObject - JSONTypeArray - JSONTypeValue + GuestPanicInformationTypeHyperV GuestPanicInformationType = iota + GuestPanicInformationTypeS390 ) // String implements fmt.Stringer. -func (e JSONType) String() string { +func (e GuestPanicInformationType) String() string { switch e { - case JSONTypeString: - return "string" - case JSONTypefloat64: - return "number" - case JSONTypeint64: - return "int" - case JSONTypeBoolean: - return "boolean" - case JSONTypeNull: - return "null" - case JSONTypeObject: - return "object" - case JSONTypeArray: - return "array" - case JSONTypeValue: - return "value" + case GuestPanicInformationTypeHyperV: + return "hyper-v" + case GuestPanicInformationTypeS390: + return "s390" default: - return fmt.Sprintf("JSONType(%d)", e) + return fmt.Sprintf("GuestPanicInformationType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e JSONType) MarshalJSON() ([]byte, error) { +func (e GuestPanicInformationType) MarshalJSON() ([]byte, error) { switch e { - case JSONTypeString: - return json.Marshal("string") - case JSONTypefloat64: - return json.Marshal("number") - case JSONTypeint64: - return json.Marshal("int") - case JSONTypeBoolean: - return json.Marshal("boolean") - case JSONTypeNull: - return json.Marshal("null") - case JSONTypeObject: - return json.Marshal("object") - case JSONTypeArray: - return json.Marshal("array") - case JSONTypeValue: - return json.Marshal("value") + case GuestPanicInformationTypeHyperV: + return json.Marshal("hyper-v") + case GuestPanicInformationTypeS390: + return json.Marshal("s390") default: - return nil, fmt.Errorf("unknown enum value %q for JSONType", e) + return nil, fmt.Errorf("unknown enum value %q for GuestPanicInformationType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *JSONType) UnmarshalJSON(bs []byte) error { +func (e *GuestPanicInformationType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "string": - *e = JSONTypeString - case "number": - *e = JSONTypefloat64 - case "int": - *e = JSONTypeint64 - case "boolean": - *e = JSONTypeBoolean - case "null": - *e = JSONTypeNull - case "object": - *e = JSONTypeObject - case "array": - *e = JSONTypeArray - case "value": - *e = JSONTypeValue + case "hyper-v": + *e = GuestPanicInformationTypeHyperV + case "s390": + *e = GuestPanicInformationTypeS390 default: - return fmt.Errorf("unknown enum value %q for JSONType", s) + return fmt.Errorf("unknown enum value %q for GuestPanicInformationType", s) } return nil } -// KeyValue -> KeyValue (simple union) +// GuidInfo -> GUIDInfo (struct) -// KeyValue implements the "KeyValue" QMP API type. -// -// Can be one of: -// - KeyValueVariantfloat64 -// - KeyValueVariantQcode -type KeyValue interface { - isKeyValue() +// GUIDInfo implements the "GuidInfo" QMP API type. +type GUIDInfo struct { + GUID string `json:"guid"` } -// KeyValueVariantfloat64 is an implementation of KeyValue. -type KeyValueVariantfloat64 int64 +// HmatCacheAssociativity -> HmatCacheAssociativity (enum) -func (KeyValueVariantfloat64) isKeyValue() {} +// HmatCacheAssociativity implements the "HmatCacheAssociativity" QMP API type. +type HmatCacheAssociativity int -// MarshalJSON implements json.Marshaler. -func (s KeyValueVariantfloat64) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "number", - "data": int64(s), +// Known values of HmatCacheAssociativity. +const ( + HmatCacheAssociativityNone HmatCacheAssociativity = iota + HmatCacheAssociativityDirect + HmatCacheAssociativityComplex +) + +// String implements fmt.Stringer. +func (e HmatCacheAssociativity) String() string { + switch e { + case HmatCacheAssociativityNone: + return "none" + case HmatCacheAssociativityDirect: + return "direct" + case HmatCacheAssociativityComplex: + return "complex" + default: + return fmt.Sprintf("HmatCacheAssociativity(%d)", e) } - return json.Marshal(v) } -// KeyValueVariantQcode is an implementation of KeyValue. -type KeyValueVariantQcode QKeyCode - -func (KeyValueVariantQcode) isKeyValue() {} - // MarshalJSON implements json.Marshaler. -func (s KeyValueVariantQcode) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "qcode", - "data": QKeyCode(s), +func (e HmatCacheAssociativity) MarshalJSON() ([]byte, error) { + switch e { + case HmatCacheAssociativityNone: + return json.Marshal("none") + case HmatCacheAssociativityDirect: + return json.Marshal("direct") + case HmatCacheAssociativityComplex: + return json.Marshal("complex") + default: + return nil, fmt.Errorf("unknown enum value %q for HmatCacheAssociativity", e) } - return json.Marshal(v) } -func decodeKeyValue(bs json.RawMessage) (KeyValue, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err +// UnmarshalJSON implements json.Unmarshaler. +func (e *HmatCacheAssociativity) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - switch v.T { - case "number": - var ret KeyValueVariantfloat64 - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "qcode": - var ret KeyValueVariantQcode - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil + switch s { + case "none": + *e = HmatCacheAssociativityNone + case "direct": + *e = HmatCacheAssociativityDirect + case "complex": + *e = HmatCacheAssociativityComplex default: - return nil, fmt.Errorf("unknown subtype %q for union KeyValue", v.T) + return fmt.Errorf("unknown enum value %q for HmatCacheAssociativity", s) } + return nil } -// KvmInfo -> KVMInfo (struct) - -// KVMInfo implements the "KvmInfo" QMP API type. -type KVMInfo struct { - Enabled bool `json:"enabled"` - Present bool `json:"present"` -} - -// EVENT MEM_UNPLUG_ERROR - -// EVENT MIGRATION - -// EVENT MIGRATION_PASS - -// MachineInfo -> MachineInfo (struct) - -// MachineInfo implements the "MachineInfo" QMP API type. -type MachineInfo struct { - Name string `json:"name"` - Alias *string `json:"alias,omitempty"` - IsDefault *bool `json:"is-default,omitempty"` - CPUMax int64 `json:"cpu-max"` - HotpluggableCpus bool `json:"hotpluggable-cpus"` -} +// HmatCacheWritePolicy -> HmatCacheWritePolicy (enum) -// Memdev -> Memdev (struct) - -// Memdev implements the "Memdev" QMP API type. -type Memdev struct { - ID *string `json:"id,omitempty"` - Size uint64 `json:"size"` - Merge bool `json:"merge"` - Dump bool `json:"dump"` - Prealloc bool `json:"prealloc"` - HostNodes []uint16 `json:"host-nodes"` - Policy HostMemPolicy `json:"policy"` -} +// HmatCacheWritePolicy implements the "HmatCacheWritePolicy" QMP API type. +type HmatCacheWritePolicy int -// MemoryDeviceInfo -> MemoryDeviceInfo (simple union) +// Known values of HmatCacheWritePolicy. +const ( + HmatCacheWritePolicyNone HmatCacheWritePolicy = iota + HmatCacheWritePolicyWriteBack + HmatCacheWritePolicyWriteThrough +) -// MemoryDeviceInfo implements the "MemoryDeviceInfo" QMP API type. -// -// Can be one of: -// - MemoryDeviceInfoVariantDimm -type MemoryDeviceInfo interface { - isMemoryDeviceInfo() +// String implements fmt.Stringer. +func (e HmatCacheWritePolicy) String() string { + switch e { + case HmatCacheWritePolicyNone: + return "none" + case HmatCacheWritePolicyWriteBack: + return "write-back" + case HmatCacheWritePolicyWriteThrough: + return "write-through" + default: + return fmt.Sprintf("HmatCacheWritePolicy(%d)", e) + } } -// MemoryDeviceInfoVariantDimm is an implementation of MemoryDeviceInfo. -type MemoryDeviceInfoVariantDimm PcdimmDeviceInfo - -func (MemoryDeviceInfoVariantDimm) isMemoryDeviceInfo() {} - // MarshalJSON implements json.Marshaler. -func (s MemoryDeviceInfoVariantDimm) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "dimm", - "data": PcdimmDeviceInfo(s), +func (e HmatCacheWritePolicy) MarshalJSON() ([]byte, error) { + switch e { + case HmatCacheWritePolicyNone: + return json.Marshal("none") + case HmatCacheWritePolicyWriteBack: + return json.Marshal("write-back") + case HmatCacheWritePolicyWriteThrough: + return json.Marshal("write-through") + default: + return nil, fmt.Errorf("unknown enum value %q for HmatCacheWritePolicy", e) } - return json.Marshal(v) } -func decodeMemoryDeviceInfo(bs json.RawMessage) (MemoryDeviceInfo, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err +// UnmarshalJSON implements json.Unmarshaler. +func (e *HmatCacheWritePolicy) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - switch v.T { - case "dimm": - var ret MemoryDeviceInfoVariantDimm - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil + switch s { + case "none": + *e = HmatCacheWritePolicyNone + case "write-back": + *e = HmatCacheWritePolicyWriteBack + case "write-through": + *e = HmatCacheWritePolicyWriteThrough default: - return nil, fmt.Errorf("unknown subtype %q for union MemoryDeviceInfo", v.T) + return fmt.Errorf("unknown enum value %q for HmatCacheWritePolicy", s) } + return nil } -// MemoryInfo -> MemoryInfo (struct) - -// MemoryInfo implements the "MemoryInfo" QMP API type. -type MemoryInfo struct { - BaseMemory uint64 `json:"base-memory"` - PluggedMemory *uint64 `json:"plugged-memory,omitempty"` -} - -// MigrateSetParameters -> MigrateSetParameters (struct) - -// MigrateSetParameters implements the "MigrateSetParameters" QMP API type. -type MigrateSetParameters struct { - CompressLevel *int64 `json:"compress-level,omitempty"` - CompressThreads *int64 `json:"compress-threads,omitempty"` - DecompressThreads *int64 `json:"decompress-threads,omitempty"` - CPUThrottleInitial *int64 `json:"cpu-throttle-initial,omitempty"` - CPUThrottleIncrement *int64 `json:"cpu-throttle-increment,omitempty"` - TLSCreds *StrOrNull `json:"tls-creds,omitempty"` - TLSHostname *StrOrNull `json:"tls-hostname,omitempty"` - MaxBandwidth *int64 `json:"max-bandwidth,omitempty"` - DowntimeLimit *int64 `json:"downtime-limit,omitempty"` - XCheckpointDelay *int64 `json:"x-checkpoint-delay,omitempty"` - BlockIncremental *bool `json:"block-incremental,omitempty"` - XMultifdChannels *int64 `json:"x-multifd-channels,omitempty"` - XMultifdPageCount *int64 `json:"x-multifd-page-count,omitempty"` - XbzrleCacheSize *uint64 `json:"xbzrle-cache-size,omitempty"` -} - -// MigrationCapability -> MigrationCapability (enum) +// HmatLBDataType -> HmatLbDataType (enum) -// MigrationCapability implements the "MigrationCapability" QMP API type. -type MigrationCapability int +// HmatLbDataType implements the "HmatLBDataType" QMP API type. +type HmatLbDataType int -// Known values of MigrationCapability. +// Known values of HmatLbDataType. const ( - MigrationCapabilityXbzrle MigrationCapability = iota - MigrationCapabilityRdmaPinAll - MigrationCapabilityAutoConverge - MigrationCapabilityZeroBlocks - MigrationCapabilityCompress - MigrationCapabilityEvents - MigrationCapabilityPostcopyRAM - MigrationCapabilityXColo - MigrationCapabilityReleaseRAM - MigrationCapabilityBlock - MigrationCapabilityReturnPath - MigrationCapabilityPauseBeforeSwitchover - MigrationCapabilityXMultifd + HmatLbDataTypeAccessLatency HmatLbDataType = iota + HmatLbDataTypeReadLatency + HmatLbDataTypeWriteLatency + HmatLbDataTypeAccessBandwidth + HmatLbDataTypeReadBandwidth + HmatLbDataTypeWriteBandwidth ) // String implements fmt.Stringer. -func (e MigrationCapability) String() string { +func (e HmatLbDataType) String() string { switch e { - case MigrationCapabilityXbzrle: - return "xbzrle" - case MigrationCapabilityRdmaPinAll: - return "rdma-pin-all" - case MigrationCapabilityAutoConverge: - return "auto-converge" - case MigrationCapabilityZeroBlocks: - return "zero-blocks" - case MigrationCapabilityCompress: - return "compress" - case MigrationCapabilityEvents: - return "events" - case MigrationCapabilityPostcopyRAM: - return "postcopy-ram" - case MigrationCapabilityXColo: - return "x-colo" - case MigrationCapabilityReleaseRAM: - return "release-ram" - case MigrationCapabilityBlock: - return "block" - case MigrationCapabilityReturnPath: - return "return-path" - case MigrationCapabilityPauseBeforeSwitchover: - return "pause-before-switchover" - case MigrationCapabilityXMultifd: - return "x-multifd" + case HmatLbDataTypeAccessLatency: + return "access-latency" + case HmatLbDataTypeReadLatency: + return "read-latency" + case HmatLbDataTypeWriteLatency: + return "write-latency" + case HmatLbDataTypeAccessBandwidth: + return "access-bandwidth" + case HmatLbDataTypeReadBandwidth: + return "read-bandwidth" + case HmatLbDataTypeWriteBandwidth: + return "write-bandwidth" default: - return fmt.Sprintf("MigrationCapability(%d)", e) + return fmt.Sprintf("HmatLbDataType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e MigrationCapability) MarshalJSON() ([]byte, error) { +func (e HmatLbDataType) MarshalJSON() ([]byte, error) { switch e { - case MigrationCapabilityXbzrle: - return json.Marshal("xbzrle") - case MigrationCapabilityRdmaPinAll: - return json.Marshal("rdma-pin-all") - case MigrationCapabilityAutoConverge: - return json.Marshal("auto-converge") - case MigrationCapabilityZeroBlocks: - return json.Marshal("zero-blocks") - case MigrationCapabilityCompress: - return json.Marshal("compress") - case MigrationCapabilityEvents: - return json.Marshal("events") - case MigrationCapabilityPostcopyRAM: - return json.Marshal("postcopy-ram") - case MigrationCapabilityXColo: - return json.Marshal("x-colo") - case MigrationCapabilityReleaseRAM: - return json.Marshal("release-ram") - case MigrationCapabilityBlock: - return json.Marshal("block") - case MigrationCapabilityReturnPath: - return json.Marshal("return-path") - case MigrationCapabilityPauseBeforeSwitchover: - return json.Marshal("pause-before-switchover") - case MigrationCapabilityXMultifd: - return json.Marshal("x-multifd") + case HmatLbDataTypeAccessLatency: + return json.Marshal("access-latency") + case HmatLbDataTypeReadLatency: + return json.Marshal("read-latency") + case HmatLbDataTypeWriteLatency: + return json.Marshal("write-latency") + case HmatLbDataTypeAccessBandwidth: + return json.Marshal("access-bandwidth") + case HmatLbDataTypeReadBandwidth: + return json.Marshal("read-bandwidth") + case HmatLbDataTypeWriteBandwidth: + return json.Marshal("write-bandwidth") default: - return nil, fmt.Errorf("unknown enum value %q for MigrationCapability", e) + return nil, fmt.Errorf("unknown enum value %q for HmatLbDataType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *MigrationCapability) UnmarshalJSON(bs []byte) error { +func (e *HmatLbDataType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "xbzrle": - *e = MigrationCapabilityXbzrle - case "rdma-pin-all": - *e = MigrationCapabilityRdmaPinAll - case "auto-converge": - *e = MigrationCapabilityAutoConverge - case "zero-blocks": - *e = MigrationCapabilityZeroBlocks - case "compress": - *e = MigrationCapabilityCompress - case "events": - *e = MigrationCapabilityEvents - case "postcopy-ram": - *e = MigrationCapabilityPostcopyRAM - case "x-colo": - *e = MigrationCapabilityXColo - case "release-ram": - *e = MigrationCapabilityReleaseRAM - case "block": - *e = MigrationCapabilityBlock - case "return-path": - *e = MigrationCapabilityReturnPath - case "pause-before-switchover": - *e = MigrationCapabilityPauseBeforeSwitchover - case "x-multifd": - *e = MigrationCapabilityXMultifd + case "access-latency": + *e = HmatLbDataTypeAccessLatency + case "read-latency": + *e = HmatLbDataTypeReadLatency + case "write-latency": + *e = HmatLbDataTypeWriteLatency + case "access-bandwidth": + *e = HmatLbDataTypeAccessBandwidth + case "read-bandwidth": + *e = HmatLbDataTypeReadBandwidth + case "write-bandwidth": + *e = HmatLbDataTypeWriteBandwidth default: - return fmt.Errorf("unknown enum value %q for MigrationCapability", s) + return fmt.Errorf("unknown enum value %q for HmatLbDataType", s) } return nil } -// MigrationCapabilityStatus -> MigrationCapabilityStatus (struct) +// HmatLBMemoryHierarchy -> HmatLbMemoryHierarchy (enum) -// MigrationCapabilityStatus implements the "MigrationCapabilityStatus" QMP API type. -type MigrationCapabilityStatus struct { - Capability MigrationCapability `json:"capability"` - State bool `json:"state"` -} +// HmatLbMemoryHierarchy implements the "HmatLBMemoryHierarchy" QMP API type. +type HmatLbMemoryHierarchy int -// MigrationInfo -> MigrationInfo (struct) +// Known values of HmatLbMemoryHierarchy. +const ( + HmatLbMemoryHierarchyMemory HmatLbMemoryHierarchy = iota + HmatLbMemoryHierarchyFirstLevel + HmatLbMemoryHierarchySecondLevel + HmatLbMemoryHierarchyThirdLevel +) -// MigrationInfo implements the "MigrationInfo" QMP API type. -type MigrationInfo struct { - Status *MigrationStatus `json:"status,omitempty"` - RAM *MigrationStats `json:"ram,omitempty"` - Disk *MigrationStats `json:"disk,omitempty"` - XbzrleCache *XbzrleCacheStats `json:"xbzrle-cache,omitempty"` - TotalTime *int64 `json:"total-time,omitempty"` - ExpectedDowntime *int64 `json:"expected-downtime,omitempty"` - Downtime *int64 `json:"downtime,omitempty"` - SetupTime *int64 `json:"setup-time,omitempty"` - CPUThrottlePercentage *int64 `json:"cpu-throttle-percentage,omitempty"` - ErrorDesc *string `json:"error-desc,omitempty"` +// String implements fmt.Stringer. +func (e HmatLbMemoryHierarchy) String() string { + switch e { + case HmatLbMemoryHierarchyMemory: + return "memory" + case HmatLbMemoryHierarchyFirstLevel: + return "first-level" + case HmatLbMemoryHierarchySecondLevel: + return "second-level" + case HmatLbMemoryHierarchyThirdLevel: + return "third-level" + default: + return fmt.Sprintf("HmatLbMemoryHierarchy(%d)", e) + } } -// MigrationParameters -> MigrationParameters (struct) - -// MigrationParameters implements the "MigrationParameters" QMP API type. -type MigrationParameters struct { - CompressLevel *int64 `json:"compress-level,omitempty"` - CompressThreads *int64 `json:"compress-threads,omitempty"` - DecompressThreads *int64 `json:"decompress-threads,omitempty"` - CPUThrottleInitial *int64 `json:"cpu-throttle-initial,omitempty"` - CPUThrottleIncrement *int64 `json:"cpu-throttle-increment,omitempty"` - TLSCreds *string `json:"tls-creds,omitempty"` - TLSHostname *string `json:"tls-hostname,omitempty"` - MaxBandwidth *int64 `json:"max-bandwidth,omitempty"` - DowntimeLimit *int64 `json:"downtime-limit,omitempty"` - XCheckpointDelay *int64 `json:"x-checkpoint-delay,omitempty"` - BlockIncremental *bool `json:"block-incremental,omitempty"` - XMultifdChannels *int64 `json:"x-multifd-channels,omitempty"` - XMultifdPageCount *int64 `json:"x-multifd-page-count,omitempty"` - XbzrleCacheSize *uint64 `json:"xbzrle-cache-size,omitempty"` +// MarshalJSON implements json.Marshaler. +func (e HmatLbMemoryHierarchy) MarshalJSON() ([]byte, error) { + switch e { + case HmatLbMemoryHierarchyMemory: + return json.Marshal("memory") + case HmatLbMemoryHierarchyFirstLevel: + return json.Marshal("first-level") + case HmatLbMemoryHierarchySecondLevel: + return json.Marshal("second-level") + case HmatLbMemoryHierarchyThirdLevel: + return json.Marshal("third-level") + default: + return nil, fmt.Errorf("unknown enum value %q for HmatLbMemoryHierarchy", e) + } } -// MigrationStats -> MigrationStats (struct) - -// MigrationStats implements the "MigrationStats" QMP API type. -type MigrationStats struct { - Transferred int64 `json:"transferred"` - Remaining int64 `json:"remaining"` - Total int64 `json:"total"` - Duplicate int64 `json:"duplicate"` - Skipped int64 `json:"skipped"` - Normal int64 `json:"normal"` - NormalBytes int64 `json:"normal-bytes"` - DirtyPagesRate int64 `json:"dirty-pages-rate"` - Mbps float64 `json:"mbps"` - DirtySyncCount int64 `json:"dirty-sync-count"` - PostcopyRequests int64 `json:"postcopy-requests"` - PageSize int64 `json:"page-size"` +// UnmarshalJSON implements json.Unmarshaler. +func (e *HmatLbMemoryHierarchy) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "memory": + *e = HmatLbMemoryHierarchyMemory + case "first-level": + *e = HmatLbMemoryHierarchyFirstLevel + case "second-level": + *e = HmatLbMemoryHierarchySecondLevel + case "third-level": + *e = HmatLbMemoryHierarchyThirdLevel + default: + return fmt.Errorf("unknown enum value %q for HmatLbMemoryHierarchy", s) + } + return nil } -// MigrationStatus -> MigrationStatus (enum) +// HostMemPolicy -> HostMemPolicy (enum) -// MigrationStatus implements the "MigrationStatus" QMP API type. -type MigrationStatus int +// HostMemPolicy implements the "HostMemPolicy" QMP API type. +type HostMemPolicy int -// Known values of MigrationStatus. +// Known values of HostMemPolicy. const ( - MigrationStatusNone MigrationStatus = iota - MigrationStatusSetup - MigrationStatusCancelling - MigrationStatusCancelled - MigrationStatusActive - MigrationStatusPostcopyActive - MigrationStatusCompleted - MigrationStatusFailed - MigrationStatusColo - MigrationStatusPreSwitchover - MigrationStatusDevice + HostMemPolicyDefault HostMemPolicy = iota + HostMemPolicyPreferred + HostMemPolicyBind + HostMemPolicyInterleave ) // String implements fmt.Stringer. -func (e MigrationStatus) String() string { +func (e HostMemPolicy) String() string { switch e { - case MigrationStatusNone: - return "none" - case MigrationStatusSetup: - return "setup" - case MigrationStatusCancelling: - return "cancelling" - case MigrationStatusCancelled: - return "cancelled" - case MigrationStatusActive: - return "active" - case MigrationStatusPostcopyActive: - return "postcopy-active" - case MigrationStatusCompleted: - return "completed" - case MigrationStatusFailed: - return "failed" - case MigrationStatusColo: - return "colo" - case MigrationStatusPreSwitchover: - return "pre-switchover" - case MigrationStatusDevice: - return "device" + case HostMemPolicyDefault: + return "default" + case HostMemPolicyPreferred: + return "preferred" + case HostMemPolicyBind: + return "bind" + case HostMemPolicyInterleave: + return "interleave" default: - return fmt.Sprintf("MigrationStatus(%d)", e) + return fmt.Sprintf("HostMemPolicy(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e MigrationStatus) MarshalJSON() ([]byte, error) { +func (e HostMemPolicy) MarshalJSON() ([]byte, error) { switch e { - case MigrationStatusNone: - return json.Marshal("none") - case MigrationStatusSetup: - return json.Marshal("setup") - case MigrationStatusCancelling: - return json.Marshal("cancelling") - case MigrationStatusCancelled: - return json.Marshal("cancelled") - case MigrationStatusActive: - return json.Marshal("active") - case MigrationStatusPostcopyActive: - return json.Marshal("postcopy-active") - case MigrationStatusCompleted: - return json.Marshal("completed") - case MigrationStatusFailed: - return json.Marshal("failed") - case MigrationStatusColo: - return json.Marshal("colo") - case MigrationStatusPreSwitchover: - return json.Marshal("pre-switchover") - case MigrationStatusDevice: - return json.Marshal("device") + case HostMemPolicyDefault: + return json.Marshal("default") + case HostMemPolicyPreferred: + return json.Marshal("preferred") + case HostMemPolicyBind: + return json.Marshal("bind") + case HostMemPolicyInterleave: + return json.Marshal("interleave") default: - return nil, fmt.Errorf("unknown enum value %q for MigrationStatus", e) + return nil, fmt.Errorf("unknown enum value %q for HostMemPolicy", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *MigrationStatus) UnmarshalJSON(bs []byte) error { +func (e *HostMemPolicy) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "none": - *e = MigrationStatusNone - case "setup": - *e = MigrationStatusSetup - case "cancelling": - *e = MigrationStatusCancelling - case "cancelled": - *e = MigrationStatusCancelled - case "active": - *e = MigrationStatusActive - case "postcopy-active": - *e = MigrationStatusPostcopyActive - case "completed": - *e = MigrationStatusCompleted - case "failed": - *e = MigrationStatusFailed - case "colo": - *e = MigrationStatusColo - case "pre-switchover": - *e = MigrationStatusPreSwitchover - case "device": - *e = MigrationStatusDevice + case "default": + *e = HostMemPolicyDefault + case "preferred": + *e = HostMemPolicyPreferred + case "bind": + *e = HostMemPolicyBind + case "interleave": + *e = HostMemPolicyInterleave default: - return fmt.Errorf("unknown enum value %q for MigrationStatus", s) + return fmt.Errorf("unknown enum value %q for HostMemPolicy", s) } return nil } -// MirrorSyncMode -> MirrorSyncMode (enum) +// HotKeyMod -> HotKeyMod (enum) -// MirrorSyncMode implements the "MirrorSyncMode" QMP API type. -type MirrorSyncMode int +// HotKeyMod implements the "HotKeyMod" QMP API type. +type HotKeyMod int -// Known values of MirrorSyncMode. +// Known values of HotKeyMod. const ( - MirrorSyncModeTop MirrorSyncMode = iota - MirrorSyncModeFull - MirrorSyncModeNone - MirrorSyncModeIncremental + HotKeyModLctrlLalt HotKeyMod = iota + HotKeyModLshiftLctrlLalt + HotKeyModRctrl ) // String implements fmt.Stringer. -func (e MirrorSyncMode) String() string { +func (e HotKeyMod) String() string { switch e { - case MirrorSyncModeTop: - return "top" - case MirrorSyncModeFull: - return "full" - case MirrorSyncModeNone: - return "none" - case MirrorSyncModeIncremental: - return "incremental" + case HotKeyModLctrlLalt: + return "lctrl-lalt" + case HotKeyModLshiftLctrlLalt: + return "lshift-lctrl-lalt" + case HotKeyModRctrl: + return "rctrl" default: - return fmt.Sprintf("MirrorSyncMode(%d)", e) + return fmt.Sprintf("HotKeyMod(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e MirrorSyncMode) MarshalJSON() ([]byte, error) { +func (e HotKeyMod) MarshalJSON() ([]byte, error) { switch e { - case MirrorSyncModeTop: - return json.Marshal("top") - case MirrorSyncModeFull: - return json.Marshal("full") - case MirrorSyncModeNone: - return json.Marshal("none") - case MirrorSyncModeIncremental: - return json.Marshal("incremental") + case HotKeyModLctrlLalt: + return json.Marshal("lctrl-lalt") + case HotKeyModLshiftLctrlLalt: + return json.Marshal("lshift-lctrl-lalt") + case HotKeyModRctrl: + return json.Marshal("rctrl") default: - return nil, fmt.Errorf("unknown enum value %q for MirrorSyncMode", e) + return nil, fmt.Errorf("unknown enum value %q for HotKeyMod", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *MirrorSyncMode) UnmarshalJSON(bs []byte) error { +func (e *HotKeyMod) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "top": - *e = MirrorSyncModeTop - case "full": - *e = MirrorSyncModeFull - case "none": - *e = MirrorSyncModeNone - case "incremental": - *e = MirrorSyncModeIncremental + case "lctrl-lalt": + *e = HotKeyModLctrlLalt + case "lshift-lctrl-lalt": + *e = HotKeyModLshiftLctrlLalt + case "rctrl": + *e = HotKeyModRctrl default: - return fmt.Errorf("unknown enum value %q for MirrorSyncMode", s) + return fmt.Errorf("unknown enum value %q for HotKeyMod", s) } return nil } -// MouseInfo -> MouseInfo (struct) +// HotpluggableCPU -> HotpluggableCPU (struct) -// MouseInfo implements the "MouseInfo" QMP API type. -type MouseInfo struct { - Name string `json:"name"` - Index int64 `json:"index"` - Current bool `json:"current"` - Absolute bool `json:"absolute"` +// HotpluggableCPU implements the "HotpluggableCPU" QMP API type. +type HotpluggableCPU struct { + Type string `json:"type"` + VcpusCount int64 `json:"vcpus-count"` + Props CPUInstanceProperties `json:"props"` + QomPath *string `json:"qom-path,omitempty"` } -// NFSServer -> NfsServer (struct) +// HumanReadableText -> HumanReadableText (struct) -// NfsServer implements the "NFSServer" QMP API type. -type NfsServer struct { - Type NfsTransport `json:"type"` - Host string `json:"host"` +// HumanReadableText implements the "HumanReadableText" QMP API type. +type HumanReadableText struct { + HumanReadableText string `json:"human-readable-text"` } -// NFSTransport -> NfsTransport (enum) +// IOThreadInfo -> IOThreadInfo (struct) -// NfsTransport implements the "NFSTransport" QMP API type. -type NfsTransport int +// IOThreadInfo implements the "IOThreadInfo" QMP API type. +type IOThreadInfo struct { + ID string `json:"id"` + ThreadID int64 `json:"thread-id"` + PollMaxNs int64 `json:"poll-max-ns"` + PollGrow int64 `json:"poll-grow"` + PollShrink int64 `json:"poll-shrink"` + AIOMaxBatch int64 `json:"aio-max-batch"` +} -// Known values of NfsTransport. +// ImageFormat -> ImageFormat (enum) + +// ImageFormat implements the "ImageFormat" QMP API type. +type ImageFormat int + +// Known values of ImageFormat. const ( - NfsTransportInet NfsTransport = iota + ImageFormatPpm ImageFormat = iota + ImageFormatPng ) // String implements fmt.Stringer. -func (e NfsTransport) String() string { +func (e ImageFormat) String() string { switch e { - case NfsTransportInet: - return "inet" + case ImageFormatPpm: + return "ppm" + case ImageFormatPng: + return "png" default: - return fmt.Sprintf("NfsTransport(%d)", e) + return fmt.Sprintf("ImageFormat(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e NfsTransport) MarshalJSON() ([]byte, error) { +func (e ImageFormat) MarshalJSON() ([]byte, error) { switch e { - case NfsTransportInet: - return json.Marshal("inet") + case ImageFormatPpm: + return json.Marshal("ppm") + case ImageFormatPng: + return json.Marshal("png") default: - return nil, fmt.Errorf("unknown enum value %q for NfsTransport", e) + return nil, fmt.Errorf("unknown enum value %q for ImageFormat", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *NfsTransport) UnmarshalJSON(bs []byte) error { +func (e *ImageFormat) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "inet": - *e = NfsTransportInet + case "ppm": + *e = ImageFormatPpm + case "png": + *e = ImageFormatPng default: - return fmt.Errorf("unknown enum value %q for NfsTransport", s) + return fmt.Errorf("unknown enum value %q for ImageFormat", s) } return nil } -// EVENT NIC_RX_FILTER_CHANGED - -// NameInfo -> NameInfo (struct) +// ImageInfo -> ImageInfo (struct) -// NameInfo implements the "NameInfo" QMP API type. -type NameInfo struct { - Name *string `json:"name,omitempty"` +// ImageInfo implements the "ImageInfo" QMP API type. +type ImageInfo struct { + Filename string `json:"filename"` + Format string `json:"format"` + DirtyFlag *bool `json:"dirty-flag,omitempty"` + ActualSize *int64 `json:"actual-size,omitempty"` + VirtualSize int64 `json:"virtual-size"` + ClusterSize *int64 `json:"cluster-size,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + Compressed *bool `json:"compressed,omitempty"` + BackingFilename *string `json:"backing-filename,omitempty"` + FullBackingFilename *string `json:"full-backing-filename,omitempty"` + BackingFilenameFormat *string `json:"backing-filename-format,omitempty"` + Snapshots []SnapshotInfo `json:"snapshots,omitempty"` + BackingImage *ImageInfo `json:"backing-image,omitempty"` + FormatSpecific *ImageInfoSpecific `json:"format-specific,omitempty"` } -// NetworkAddressFamily -> NetworkAddressFamily (enum) +// ImageInfoSpecific -> ImageInfoSpecific (flat union) -// NetworkAddressFamily implements the "NetworkAddressFamily" QMP API type. -type NetworkAddressFamily int +// ImageInfoSpecific implements the "ImageInfoSpecific" QMP API type. +// +// Can be one of: +// - ImageInfoSpecificVariantLUKS +// - ImageInfoSpecificVariantQcow2 +// - ImageInfoSpecificVariantRbd +// - ImageInfoSpecificVariantVMDK +type ImageInfoSpecific interface { + isImageInfoSpecific() +} -// Known values of NetworkAddressFamily. -const ( - NetworkAddressFamilyIpv4 NetworkAddressFamily = iota - NetworkAddressFamilyIpv6 - NetworkAddressFamilyUnix - NetworkAddressFamilyVsock - NetworkAddressFamilyUnknown -) +// ImageInfoSpecificVariantLUKS is an implementation of ImageInfoSpecific. +type ImageInfoSpecificVariantLUKS struct { + Data QCryptoBlockInfoLUKS `json:"data"` +} -// String implements fmt.Stringer. -func (e NetworkAddressFamily) String() string { - switch e { - case NetworkAddressFamilyIpv4: - return "ipv4" - case NetworkAddressFamilyIpv6: - return "ipv6" - case NetworkAddressFamilyUnix: - return "unix" - case NetworkAddressFamilyVsock: - return "vsock" - case NetworkAddressFamilyUnknown: - return "unknown" - default: - return fmt.Sprintf("NetworkAddressFamily(%d)", e) +func (ImageInfoSpecificVariantLUKS) isImageInfoSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s ImageInfoSpecificVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Type ImageInfoSpecificKind `json:"type"` + ImageInfoSpecificVariantLUKS + }{ + ImageInfoSpecificKindLUKS, + s, } + return json.Marshal(v) +} + +// ImageInfoSpecificVariantQcow2 is an implementation of ImageInfoSpecific. +type ImageInfoSpecificVariantQcow2 struct { + Data ImageInfoSpecificQCow2 `json:"data"` } +func (ImageInfoSpecificVariantQcow2) isImageInfoSpecific() {} + // MarshalJSON implements json.Marshaler. -func (e NetworkAddressFamily) MarshalJSON() ([]byte, error) { - switch e { - case NetworkAddressFamilyIpv4: - return json.Marshal("ipv4") - case NetworkAddressFamilyIpv6: - return json.Marshal("ipv6") - case NetworkAddressFamilyUnix: - return json.Marshal("unix") - case NetworkAddressFamilyVsock: - return json.Marshal("vsock") - case NetworkAddressFamilyUnknown: - return json.Marshal("unknown") - default: - return nil, fmt.Errorf("unknown enum value %q for NetworkAddressFamily", e) +func (s ImageInfoSpecificVariantQcow2) MarshalJSON() ([]byte, error) { + v := struct { + Type ImageInfoSpecificKind `json:"type"` + ImageInfoSpecificVariantQcow2 + }{ + ImageInfoSpecificKindQcow2, + s, } + return json.Marshal(v) } -// UnmarshalJSON implements json.Unmarshaler. -func (e *NetworkAddressFamily) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// ImageInfoSpecificVariantRbd is an implementation of ImageInfoSpecific. +type ImageInfoSpecificVariantRbd struct { + Data ImageInfoSpecificRbd `json:"data"` +} + +func (ImageInfoSpecificVariantRbd) isImageInfoSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s ImageInfoSpecificVariantRbd) MarshalJSON() ([]byte, error) { + v := struct { + Type ImageInfoSpecificKind `json:"type"` + ImageInfoSpecificVariantRbd + }{ + ImageInfoSpecificKindRbd, + s, } - switch s { - case "ipv4": - *e = NetworkAddressFamilyIpv4 - case "ipv6": - *e = NetworkAddressFamilyIpv6 - case "unix": - *e = NetworkAddressFamilyUnix - case "vsock": - *e = NetworkAddressFamilyVsock - case "unknown": - *e = NetworkAddressFamilyUnknown + return json.Marshal(v) +} + +// ImageInfoSpecificVariantVMDK is an implementation of ImageInfoSpecific. +type ImageInfoSpecificVariantVMDK struct { + Data ImageInfoSpecificVMDK `json:"data"` +} + +func (ImageInfoSpecificVariantVMDK) isImageInfoSpecific() {} + +// MarshalJSON implements json.Marshaler. +func (s ImageInfoSpecificVariantVMDK) MarshalJSON() ([]byte, error) { + v := struct { + Type ImageInfoSpecificKind `json:"type"` + ImageInfoSpecificVariantVMDK + }{ + ImageInfoSpecificKindVMDK, + s, + } + return json.Marshal(v) +} + +func decodeImageInfoSpecific(bs json.RawMessage) (ImageInfoSpecific, error) { + v := struct { + Type ImageInfoSpecificKind `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case ImageInfoSpecificKindLUKS: + var ret ImageInfoSpecificVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ImageInfoSpecificKindQcow2: + var ret ImageInfoSpecificVariantQcow2 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ImageInfoSpecificKindRbd: + var ret ImageInfoSpecificVariantRbd + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ImageInfoSpecificKindVMDK: + var ret ImageInfoSpecificVariantVMDK + err := json.Unmarshal([]byte(bs), &ret) + return ret, err default: - return fmt.Errorf("unknown enum value %q for NetworkAddressFamily", s) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union ImageInfoSpecific", v.Type) } - return nil } -// NewImageMode -> NewImageMode (enum) +// ImageInfoSpecificKind -> ImageInfoSpecificKind (enum) -// NewImageMode implements the "NewImageMode" QMP API type. -type NewImageMode int +// ImageInfoSpecificKind implements the "ImageInfoSpecificKind" QMP API type. +type ImageInfoSpecificKind int -// Known values of NewImageMode. +// Known values of ImageInfoSpecificKind. const ( - NewImageModeExisting NewImageMode = iota - NewImageModeAbsolutePaths + ImageInfoSpecificKindQcow2 ImageInfoSpecificKind = iota + ImageInfoSpecificKindVMDK + ImageInfoSpecificKindLUKS + ImageInfoSpecificKindRbd ) // String implements fmt.Stringer. -func (e NewImageMode) String() string { +func (e ImageInfoSpecificKind) String() string { switch e { - case NewImageModeExisting: - return "existing" - case NewImageModeAbsolutePaths: - return "absolute-paths" + case ImageInfoSpecificKindQcow2: + return "qcow2" + case ImageInfoSpecificKindVMDK: + return "vmdk" + case ImageInfoSpecificKindLUKS: + return "luks" + case ImageInfoSpecificKindRbd: + return "rbd" default: - return fmt.Sprintf("NewImageMode(%d)", e) + return fmt.Sprintf("ImageInfoSpecificKind(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e NewImageMode) MarshalJSON() ([]byte, error) { +func (e ImageInfoSpecificKind) MarshalJSON() ([]byte, error) { switch e { - case NewImageModeExisting: - return json.Marshal("existing") - case NewImageModeAbsolutePaths: - return json.Marshal("absolute-paths") + case ImageInfoSpecificKindQcow2: + return json.Marshal("qcow2") + case ImageInfoSpecificKindVMDK: + return json.Marshal("vmdk") + case ImageInfoSpecificKindLUKS: + return json.Marshal("luks") + case ImageInfoSpecificKindRbd: + return json.Marshal("rbd") default: - return nil, fmt.Errorf("unknown enum value %q for NewImageMode", e) + return nil, fmt.Errorf("unknown enum value %q for ImageInfoSpecificKind", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *NewImageMode) UnmarshalJSON(bs []byte) error { +func (e *ImageInfoSpecificKind) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "existing": - *e = NewImageModeExisting - case "absolute-paths": - *e = NewImageModeAbsolutePaths + case "qcow2": + *e = ImageInfoSpecificKindQcow2 + case "vmdk": + *e = ImageInfoSpecificKindVMDK + case "luks": + *e = ImageInfoSpecificKindLUKS + case "rbd": + *e = ImageInfoSpecificKindRbd default: - return fmt.Errorf("unknown enum value %q for NewImageMode", s) + return fmt.Errorf("unknown enum value %q for ImageInfoSpecificKind", s) } return nil } -// ObjectPropertyInfo -> ObjectPropertyInfo (struct) +// ImageInfoSpecificQCow2 -> ImageInfoSpecificQCow2 (struct) -// ObjectPropertyInfo implements the "ObjectPropertyInfo" QMP API type. -type ObjectPropertyInfo struct { - Name string `json:"name"` - Type string `json:"type"` +// ImageInfoSpecificQCow2 implements the "ImageInfoSpecificQCow2" QMP API type. +type ImageInfoSpecificQCow2 struct { + Compat string `json:"compat"` + DataFile *string `json:"data-file,omitempty"` + DataFileRaw *bool `json:"data-file-raw,omitempty"` + ExtendedL2 *bool `json:"extended-l2,omitempty"` + LazyRefcounts *bool `json:"lazy-refcounts,omitempty"` + Corrupt *bool `json:"corrupt,omitempty"` + RefcountBits int64 `json:"refcount-bits"` + Encrypt *ImageInfoSpecificQCow2Encryption `json:"encrypt,omitempty"` + Bitmaps []Qcow2BitmapInfo `json:"bitmaps,omitempty"` + CompressionType Qcow2CompressionType `json:"compression-type"` } -// ObjectTypeInfo -> ObjectTypeInfo (struct) +// ImageInfoSpecificQCow2Encryption -> ImageInfoSpecificQCow2Encryption (flat union) -// ObjectTypeInfo implements the "ObjectTypeInfo" QMP API type. -type ObjectTypeInfo struct { - Name string `json:"name"` - Abstract *bool `json:"abstract,omitempty"` - Parent *string `json:"parent,omitempty"` +// ImageInfoSpecificQCow2Encryption implements the "ImageInfoSpecificQCow2Encryption" QMP API type. +// +// Can be one of: +// - ImageInfoSpecificQCow2EncryptionVariantLUKS +type ImageInfoSpecificQCow2Encryption interface { + isImageInfoSpecificQCow2Encryption() } -// OnOffAuto -> OnOffAuto (enum) +// ImageInfoSpecificQCow2EncryptionVariantLUKS is an implementation of ImageInfoSpecificQCow2Encryption. +type ImageInfoSpecificQCow2EncryptionVariantLUKS struct { + CipherAlg QCryptoCipherAlgorithm `json:"cipher-alg"` + CipherMode QCryptoCipherMode `json:"cipher-mode"` + IvgenAlg QCryptoIvGenAlgorithm `json:"ivgen-alg"` + IvgenHashAlg *QCryptoHashAlgorithm `json:"ivgen-hash-alg,omitempty"` + HashAlg QCryptoHashAlgorithm `json:"hash-alg"` + PayloadOffset int64 `json:"payload-offset"` + MasterKeyIters int64 `json:"master-key-iters"` + UUID string `json:"uuid"` + Slots []QCryptoBlockInfoLUKSSlot `json:"slots"` +} -// OnOffAuto implements the "OnOffAuto" QMP API type. -type OnOffAuto int +func (ImageInfoSpecificQCow2EncryptionVariantLUKS) isImageInfoSpecificQCow2Encryption() {} -// Known values of OnOffAuto. +// MarshalJSON implements json.Marshaler. +func (s ImageInfoSpecificQCow2EncryptionVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Format BlockdevQcow2EncryptionFormat `json:"format"` + ImageInfoSpecificQCow2EncryptionVariantLUKS + }{ + BlockdevQcow2EncryptionFormatLUKS, + s, + } + return json.Marshal(v) +} + +func decodeImageInfoSpecificQCow2Encryption(bs json.RawMessage) (ImageInfoSpecificQCow2Encryption, error) { + v := struct { + Format BlockdevQcow2EncryptionFormat `json:"format"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Format { + case BlockdevQcow2EncryptionFormatLUKS: + var ret ImageInfoSpecificQCow2EncryptionVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union ImageInfoSpecificQCow2Encryption", v.Format) + } +} + +// ImageInfoSpecificRbd -> ImageInfoSpecificRbd (struct) + +// ImageInfoSpecificRbd implements the "ImageInfoSpecificRbd" QMP API type. +type ImageInfoSpecificRbd struct { + EncryptionFormat *RbdImageEncryptionFormat `json:"encryption-format,omitempty"` +} + +// ImageInfoSpecificVmdk -> ImageInfoSpecificVMDK (struct) + +// ImageInfoSpecificVMDK implements the "ImageInfoSpecificVmdk" QMP API type. +type ImageInfoSpecificVMDK struct { + CreateType string `json:"create-type"` + Cid int64 `json:"cid"` + ParentCid int64 `json:"parent-cid"` + Extents []ImageInfo `json:"extents"` +} + +// InetSocketAddress -> InetSocketAddress (struct) + +// InetSocketAddress implements the "InetSocketAddress" QMP API type. +type InetSocketAddress struct { + Host string `json:"host"` + Port string `json:"port"` + Numeric *bool `json:"numeric,omitempty"` + To *uint16 `json:"to,omitempty"` + Ipv4 *bool `json:"ipv4,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + KeepAlive *bool `json:"keep-alive,omitempty"` + Mptcp *bool `json:"mptcp,omitempty"` +} + +// InetSocketAddressBase -> InetSocketAddressBase (struct) + +// InetSocketAddressBase implements the "InetSocketAddressBase" QMP API type. +type InetSocketAddressBase struct { + Host string `json:"host"` + Port string `json:"port"` +} + +// InputAxis -> InputAxis (enum) + +// InputAxis implements the "InputAxis" QMP API type. +type InputAxis int + +// Known values of InputAxis. const ( - OnOffAutoAuto OnOffAuto = iota - OnOffAutoOn - OnOffAutoOff + InputAxisX InputAxis = iota + InputAxisY ) // String implements fmt.Stringer. -func (e OnOffAuto) String() string { +func (e InputAxis) String() string { switch e { - case OnOffAutoAuto: - return "auto" - case OnOffAutoOn: - return "on" - case OnOffAutoOff: - return "off" + case InputAxisX: + return "x" + case InputAxisY: + return "y" default: - return fmt.Sprintf("OnOffAuto(%d)", e) + return fmt.Sprintf("InputAxis(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e OnOffAuto) MarshalJSON() ([]byte, error) { +func (e InputAxis) MarshalJSON() ([]byte, error) { switch e { - case OnOffAutoAuto: - return json.Marshal("auto") - case OnOffAutoOn: - return json.Marshal("on") - case OnOffAutoOff: - return json.Marshal("off") + case InputAxisX: + return json.Marshal("x") + case InputAxisY: + return json.Marshal("y") default: - return nil, fmt.Errorf("unknown enum value %q for OnOffAuto", e) + return nil, fmt.Errorf("unknown enum value %q for InputAxis", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *OnOffAuto) UnmarshalJSON(bs []byte) error { +func (e *InputAxis) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "auto": - *e = OnOffAutoAuto - case "on": - *e = OnOffAutoOn - case "off": - *e = OnOffAutoOff + case "x": + *e = InputAxisX + case "y": + *e = InputAxisY default: - return fmt.Errorf("unknown enum value %q for OnOffAuto", s) + return fmt.Errorf("unknown enum value %q for InputAxis", s) } return nil } -// PCDIMMDeviceInfo -> PcdimmDeviceInfo (struct) +// InputBtnEvent -> InputBtnEvent (struct) -// PcdimmDeviceInfo implements the "PCDIMMDeviceInfo" QMP API type. -type PcdimmDeviceInfo struct { - ID *string `json:"id,omitempty"` - Addr int64 `json:"addr"` - Size int64 `json:"size"` - Slot int64 `json:"slot"` - Node int64 `json:"node"` - Memdev string `json:"memdev"` - Hotplugged bool `json:"hotplugged"` - Hotpluggable bool `json:"hotpluggable"` +// InputBtnEvent implements the "InputBtnEvent" QMP API type. +type InputBtnEvent struct { + Button InputButton `json:"button"` + Down bool `json:"down"` } -// EVENT POWERDOWN +// InputButton -> InputButton (enum) -// PciBridgeInfo -> PCIBridgeInfo (struct) +// InputButton implements the "InputButton" QMP API type. +type InputButton int -// PCIBridgeInfo implements the "PciBridgeInfo" QMP API type. -type PCIBridgeInfo struct { - Bus PCIBusInfo `json:"bus"` - Devices []PCIDeviceInfo `json:"devices,omitempty"` +// Known values of InputButton. +const ( + InputButtonLeft InputButton = iota + InputButtonMiddle + InputButtonRight + InputButtonWheelUp + InputButtonWheelDown + InputButtonSide + InputButtonExtra + InputButtonWheelLeft + InputButtonWheelRight +) + +// String implements fmt.Stringer. +func (e InputButton) String() string { + switch e { + case InputButtonLeft: + return "left" + case InputButtonMiddle: + return "middle" + case InputButtonRight: + return "right" + case InputButtonWheelUp: + return "wheel-up" + case InputButtonWheelDown: + return "wheel-down" + case InputButtonSide: + return "side" + case InputButtonExtra: + return "extra" + case InputButtonWheelLeft: + return "wheel-left" + case InputButtonWheelRight: + return "wheel-right" + default: + return fmt.Sprintf("InputButton(%d)", e) + } } -// PciBusInfo -> PCIBusInfo (struct) +// MarshalJSON implements json.Marshaler. +func (e InputButton) MarshalJSON() ([]byte, error) { + switch e { + case InputButtonLeft: + return json.Marshal("left") + case InputButtonMiddle: + return json.Marshal("middle") + case InputButtonRight: + return json.Marshal("right") + case InputButtonWheelUp: + return json.Marshal("wheel-up") + case InputButtonWheelDown: + return json.Marshal("wheel-down") + case InputButtonSide: + return json.Marshal("side") + case InputButtonExtra: + return json.Marshal("extra") + case InputButtonWheelLeft: + return json.Marshal("wheel-left") + case InputButtonWheelRight: + return json.Marshal("wheel-right") + default: + return nil, fmt.Errorf("unknown enum value %q for InputButton", e) + } +} -// PCIBusInfo implements the "PciBusInfo" QMP API type. -type PCIBusInfo struct { - Number int64 `json:"number"` - Secondary int64 `json:"secondary"` - Subordinate int64 `json:"subordinate"` - IORange PCIMemoryRange `json:"io_range"` - MemoryRange PCIMemoryRange `json:"memory_range"` - PrefetchableRange PCIMemoryRange `json:"prefetchable_range"` +// UnmarshalJSON implements json.Unmarshaler. +func (e *InputButton) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "left": + *e = InputButtonLeft + case "middle": + *e = InputButtonMiddle + case "right": + *e = InputButtonRight + case "wheel-up": + *e = InputButtonWheelUp + case "wheel-down": + *e = InputButtonWheelDown + case "side": + *e = InputButtonSide + case "extra": + *e = InputButtonExtra + case "wheel-left": + *e = InputButtonWheelLeft + case "wheel-right": + *e = InputButtonWheelRight + default: + return fmt.Errorf("unknown enum value %q for InputButton", s) + } + return nil } -// PciDeviceClass -> PCIDeviceClass (struct) +// InputEvent -> InputEvent (flat union) -// PCIDeviceClass implements the "PciDeviceClass" QMP API type. -type PCIDeviceClass struct { - Desc *string `json:"desc,omitempty"` - Class int64 `json:"class"` +// InputEvent implements the "InputEvent" QMP API type. +// +// Can be one of: +// - InputEventVariantAbs +// - InputEventVariantBtn +// - InputEventVariantKey +// - InputEventVariantRel +type InputEvent interface { + isInputEvent() } -// PciDeviceId -> PCIDeviceID (struct) - -// PCIDeviceID implements the "PciDeviceId" QMP API type. -type PCIDeviceID struct { - Device int64 `json:"device"` - Vendor int64 `json:"vendor"` +// InputEventVariantAbs is an implementation of InputEvent. +type InputEventVariantAbs struct { + Data InputMoveEvent `json:"data"` } -// PciDeviceInfo -> PCIDeviceInfo (struct) +func (InputEventVariantAbs) isInputEvent() {} -// PCIDeviceInfo implements the "PciDeviceInfo" QMP API type. -type PCIDeviceInfo struct { - Bus int64 `json:"bus"` - Slot int64 `json:"slot"` - Function int64 `json:"function"` - ClassInfo PCIDeviceClass `json:"class_info"` - ID PCIDeviceID `json:"id"` - Irq *int64 `json:"irq,omitempty"` - QdevID string `json:"qdev_id"` - PCIBridge *PCIBridgeInfo `json:"pci_bridge,omitempty"` - Regions []PCIMemoryRegion `json:"regions"` +// MarshalJSON implements json.Marshaler. +func (s InputEventVariantAbs) MarshalJSON() ([]byte, error) { + v := struct { + Type InputEventKind `json:"type"` + InputEventVariantAbs + }{ + InputEventKindAbs, + s, + } + return json.Marshal(v) } -// PciInfo -> PCIInfo (struct) - -// PCIInfo implements the "PciInfo" QMP API type. -type PCIInfo struct { - Bus int64 `json:"bus"` - Devices []PCIDeviceInfo `json:"devices"` +// InputEventVariantBtn is an implementation of InputEvent. +type InputEventVariantBtn struct { + Data InputBtnEvent `json:"data"` } -// PciMemoryRange -> PCIMemoryRange (struct) +func (InputEventVariantBtn) isInputEvent() {} -// PCIMemoryRange implements the "PciMemoryRange" QMP API type. -type PCIMemoryRange struct { - Base int64 `json:"base"` - Limit int64 `json:"limit"` +// MarshalJSON implements json.Marshaler. +func (s InputEventVariantBtn) MarshalJSON() ([]byte, error) { + v := struct { + Type InputEventKind `json:"type"` + InputEventVariantBtn + }{ + InputEventKindBtn, + s, + } + return json.Marshal(v) } -// PciMemoryRegion -> PCIMemoryRegion (struct) - -// PCIMemoryRegion implements the "PciMemoryRegion" QMP API type. -type PCIMemoryRegion struct { - Bar int64 `json:"bar"` - Type string `json:"type"` - Address int64 `json:"address"` - Size int64 `json:"size"` - Prefetch *bool `json:"prefetch,omitempty"` - MemType64 *bool `json:"mem_type_64,omitempty"` +// InputEventVariantKey is an implementation of InputEvent. +type InputEventVariantKey struct { + Data InputKeyEvent `json:"data"` } -// QCryptoBlockInfoLUKS -> QCryptoBlockInfoLUKS (struct) +func (InputEventVariantKey) isInputEvent() {} -// QCryptoBlockInfoLUKS implements the "QCryptoBlockInfoLUKS" QMP API type. -type QCryptoBlockInfoLUKS struct { - CipherAlg QCryptoCipherAlgorithm `json:"cipher-alg"` - CipherMode QCryptoCipherMode `json:"cipher-mode"` - IvgenAlg QCryptoIvGenAlgorithm `json:"ivgen-alg"` - IvgenHashAlg *QCryptoHashAlgorithm `json:"ivgen-hash-alg,omitempty"` - HashAlg QCryptoHashAlgorithm `json:"hash-alg"` - PayloadOffset int64 `json:"payload-offset"` - MasterKeyIters int64 `json:"master-key-iters"` - UUID string `json:"uuid"` - Slots []QCryptoBlockInfoLUKSSlot `json:"slots"` +// MarshalJSON implements json.Marshaler. +func (s InputEventVariantKey) MarshalJSON() ([]byte, error) { + v := struct { + Type InputEventKind `json:"type"` + InputEventVariantKey + }{ + InputEventKindKey, + s, + } + return json.Marshal(v) } -// QCryptoBlockInfoLUKSSlot -> QCryptoBlockInfoLUKSSlot (struct) +// InputEventVariantRel is an implementation of InputEvent. +type InputEventVariantRel struct { + Data InputMoveEvent `json:"data"` +} -// QCryptoBlockInfoLUKSSlot implements the "QCryptoBlockInfoLUKSSlot" QMP API type. -type QCryptoBlockInfoLUKSSlot struct { - Active bool `json:"active"` - Iters *int64 `json:"iters,omitempty"` - Stripes *int64 `json:"stripes,omitempty"` - KeyOffset int64 `json:"key-offset"` +func (InputEventVariantRel) isInputEvent() {} + +// MarshalJSON implements json.Marshaler. +func (s InputEventVariantRel) MarshalJSON() ([]byte, error) { + v := struct { + Type InputEventKind `json:"type"` + InputEventVariantRel + }{ + InputEventKindRel, + s, + } + return json.Marshal(v) } -// QCryptoCipherAlgorithm -> QCryptoCipherAlgorithm (enum) +func decodeInputEvent(bs json.RawMessage) (InputEvent, error) { + v := struct { + Type InputEventKind `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case InputEventKindAbs: + var ret InputEventVariantAbs + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case InputEventKindBtn: + var ret InputEventVariantBtn + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case InputEventKindKey: + var ret InputEventVariantKey + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case InputEventKindRel: + var ret InputEventVariantRel + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union InputEvent", v.Type) + } +} -// QCryptoCipherAlgorithm implements the "QCryptoCipherAlgorithm" QMP API type. -type QCryptoCipherAlgorithm int +// InputEventKind -> InputEventKind (enum) -// Known values of QCryptoCipherAlgorithm. +// InputEventKind implements the "InputEventKind" QMP API type. +type InputEventKind int + +// Known values of InputEventKind. const ( - QCryptoCipherAlgorithmAes128 QCryptoCipherAlgorithm = iota - QCryptoCipherAlgorithmAes192 - QCryptoCipherAlgorithmAes256 - QCryptoCipherAlgorithmDesRfb - QCryptoCipherAlgorithm3Des - QCryptoCipherAlgorithmCast5128 - QCryptoCipherAlgorithmSerpent128 - QCryptoCipherAlgorithmSerpent192 - QCryptoCipherAlgorithmSerpent256 - QCryptoCipherAlgorithmTwofish128 - QCryptoCipherAlgorithmTwofish192 - QCryptoCipherAlgorithmTwofish256 + InputEventKindKey InputEventKind = iota + InputEventKindBtn + InputEventKindRel + InputEventKindAbs ) // String implements fmt.Stringer. -func (e QCryptoCipherAlgorithm) String() string { +func (e InputEventKind) String() string { switch e { - case QCryptoCipherAlgorithmAes128: - return "aes-128" - case QCryptoCipherAlgorithmAes192: - return "aes-192" - case QCryptoCipherAlgorithmAes256: - return "aes-256" - case QCryptoCipherAlgorithmDesRfb: - return "des-rfb" - case QCryptoCipherAlgorithm3Des: - return "3des" - case QCryptoCipherAlgorithmCast5128: - return "cast5-128" - case QCryptoCipherAlgorithmSerpent128: - return "serpent-128" - case QCryptoCipherAlgorithmSerpent192: - return "serpent-192" - case QCryptoCipherAlgorithmSerpent256: - return "serpent-256" - case QCryptoCipherAlgorithmTwofish128: - return "twofish-128" - case QCryptoCipherAlgorithmTwofish192: - return "twofish-192" - case QCryptoCipherAlgorithmTwofish256: - return "twofish-256" + case InputEventKindKey: + return "key" + case InputEventKindBtn: + return "btn" + case InputEventKindRel: + return "rel" + case InputEventKindAbs: + return "abs" default: - return fmt.Sprintf("QCryptoCipherAlgorithm(%d)", e) + return fmt.Sprintf("InputEventKind(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QCryptoCipherAlgorithm) MarshalJSON() ([]byte, error) { +func (e InputEventKind) MarshalJSON() ([]byte, error) { switch e { - case QCryptoCipherAlgorithmAes128: - return json.Marshal("aes-128") - case QCryptoCipherAlgorithmAes192: - return json.Marshal("aes-192") - case QCryptoCipherAlgorithmAes256: - return json.Marshal("aes-256") - case QCryptoCipherAlgorithmDesRfb: - return json.Marshal("des-rfb") - case QCryptoCipherAlgorithm3Des: - return json.Marshal("3des") - case QCryptoCipherAlgorithmCast5128: - return json.Marshal("cast5-128") - case QCryptoCipherAlgorithmSerpent128: - return json.Marshal("serpent-128") - case QCryptoCipherAlgorithmSerpent192: - return json.Marshal("serpent-192") - case QCryptoCipherAlgorithmSerpent256: - return json.Marshal("serpent-256") - case QCryptoCipherAlgorithmTwofish128: - return json.Marshal("twofish-128") - case QCryptoCipherAlgorithmTwofish192: - return json.Marshal("twofish-192") - case QCryptoCipherAlgorithmTwofish256: - return json.Marshal("twofish-256") + case InputEventKindKey: + return json.Marshal("key") + case InputEventKindBtn: + return json.Marshal("btn") + case InputEventKindRel: + return json.Marshal("rel") + case InputEventKindAbs: + return json.Marshal("abs") default: - return nil, fmt.Errorf("unknown enum value %q for QCryptoCipherAlgorithm", e) + return nil, fmt.Errorf("unknown enum value %q for InputEventKind", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QCryptoCipherAlgorithm) UnmarshalJSON(bs []byte) error { +func (e *InputEventKind) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "aes-128": - *e = QCryptoCipherAlgorithmAes128 - case "aes-192": - *e = QCryptoCipherAlgorithmAes192 - case "aes-256": - *e = QCryptoCipherAlgorithmAes256 - case "des-rfb": - *e = QCryptoCipherAlgorithmDesRfb - case "3des": - *e = QCryptoCipherAlgorithm3Des - case "cast5-128": - *e = QCryptoCipherAlgorithmCast5128 - case "serpent-128": - *e = QCryptoCipherAlgorithmSerpent128 - case "serpent-192": - *e = QCryptoCipherAlgorithmSerpent192 - case "serpent-256": - *e = QCryptoCipherAlgorithmSerpent256 - case "twofish-128": - *e = QCryptoCipherAlgorithmTwofish128 - case "twofish-192": - *e = QCryptoCipherAlgorithmTwofish192 - case "twofish-256": - *e = QCryptoCipherAlgorithmTwofish256 + case "key": + *e = InputEventKindKey + case "btn": + *e = InputEventKindBtn + case "rel": + *e = InputEventKindRel + case "abs": + *e = InputEventKindAbs default: - return fmt.Errorf("unknown enum value %q for QCryptoCipherAlgorithm", s) + return fmt.Errorf("unknown enum value %q for InputEventKind", s) } return nil } -// QCryptoCipherMode -> QCryptoCipherMode (enum) +// InputKeyEvent -> InputKeyEvent (struct) -// QCryptoCipherMode implements the "QCryptoCipherMode" QMP API type. -type QCryptoCipherMode int +// InputKeyEvent implements the "InputKeyEvent" QMP API type. +type InputKeyEvent struct { + Key KeyValue `json:"key"` + Down bool `json:"down"` +} -// Known values of QCryptoCipherMode. +// InputMoveEvent -> InputMoveEvent (struct) + +// InputMoveEvent implements the "InputMoveEvent" QMP API type. +type InputMoveEvent struct { + Axis InputAxis `json:"axis"` + Value int64 `json:"value"` +} + +// IoOperationType -> IOOperationType (enum) + +// IOOperationType implements the "IoOperationType" QMP API type. +type IOOperationType int + +// Known values of IOOperationType. const ( - QCryptoCipherModeEcb QCryptoCipherMode = iota - QCryptoCipherModeCbc - QCryptoCipherModeXts - QCryptoCipherModeCtr + IOOperationTypeRead IOOperationType = iota + IOOperationTypeWrite ) // String implements fmt.Stringer. -func (e QCryptoCipherMode) String() string { +func (e IOOperationType) String() string { switch e { - case QCryptoCipherModeEcb: - return "ecb" - case QCryptoCipherModeCbc: - return "cbc" - case QCryptoCipherModeXts: - return "xts" - case QCryptoCipherModeCtr: - return "ctr" + case IOOperationTypeRead: + return "read" + case IOOperationTypeWrite: + return "write" default: - return fmt.Sprintf("QCryptoCipherMode(%d)", e) + return fmt.Sprintf("IOOperationType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QCryptoCipherMode) MarshalJSON() ([]byte, error) { +func (e IOOperationType) MarshalJSON() ([]byte, error) { switch e { - case QCryptoCipherModeEcb: - return json.Marshal("ecb") - case QCryptoCipherModeCbc: - return json.Marshal("cbc") - case QCryptoCipherModeXts: - return json.Marshal("xts") - case QCryptoCipherModeCtr: - return json.Marshal("ctr") + case IOOperationTypeRead: + return json.Marshal("read") + case IOOperationTypeWrite: + return json.Marshal("write") default: - return nil, fmt.Errorf("unknown enum value %q for QCryptoCipherMode", e) + return nil, fmt.Errorf("unknown enum value %q for IOOperationType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QCryptoCipherMode) UnmarshalJSON(bs []byte) error { +func (e *IOOperationType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "ecb": - *e = QCryptoCipherModeEcb - case "cbc": - *e = QCryptoCipherModeCbc - case "xts": - *e = QCryptoCipherModeXts - case "ctr": - *e = QCryptoCipherModeCtr + case "read": + *e = IOOperationTypeRead + case "write": + *e = IOOperationTypeWrite default: - return fmt.Errorf("unknown enum value %q for QCryptoCipherMode", s) + return fmt.Errorf("unknown enum value %q for IOOperationType", s) } return nil } -// QCryptoHashAlgorithm -> QCryptoHashAlgorithm (enum) +// IscsiHeaderDigest -> IscsiHeaderDigest (enum) -// QCryptoHashAlgorithm implements the "QCryptoHashAlgorithm" QMP API type. -type QCryptoHashAlgorithm int +// IscsiHeaderDigest implements the "IscsiHeaderDigest" QMP API type. +type IscsiHeaderDigest int -// Known values of QCryptoHashAlgorithm. +// Known values of IscsiHeaderDigest. const ( - QCryptoHashAlgorithmMd5 QCryptoHashAlgorithm = iota - QCryptoHashAlgorithmSha1 - QCryptoHashAlgorithmSha224 - QCryptoHashAlgorithmSha256 - QCryptoHashAlgorithmSha384 - QCryptoHashAlgorithmSha512 - QCryptoHashAlgorithmRipemd160 + IscsiHeaderDigestCrc32C IscsiHeaderDigest = iota + IscsiHeaderDigestNone + IscsiHeaderDigestCrc32CNone + IscsiHeaderDigestNoneCrc32C ) // String implements fmt.Stringer. -func (e QCryptoHashAlgorithm) String() string { +func (e IscsiHeaderDigest) String() string { switch e { - case QCryptoHashAlgorithmMd5: - return "md5" - case QCryptoHashAlgorithmSha1: - return "sha1" - case QCryptoHashAlgorithmSha224: - return "sha224" - case QCryptoHashAlgorithmSha256: - return "sha256" - case QCryptoHashAlgorithmSha384: - return "sha384" - case QCryptoHashAlgorithmSha512: - return "sha512" - case QCryptoHashAlgorithmRipemd160: - return "ripemd160" + case IscsiHeaderDigestCrc32C: + return "crc32c" + case IscsiHeaderDigestNone: + return "none" + case IscsiHeaderDigestCrc32CNone: + return "crc32c-none" + case IscsiHeaderDigestNoneCrc32C: + return "none-crc32c" default: - return fmt.Sprintf("QCryptoHashAlgorithm(%d)", e) + return fmt.Sprintf("IscsiHeaderDigest(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QCryptoHashAlgorithm) MarshalJSON() ([]byte, error) { +func (e IscsiHeaderDigest) MarshalJSON() ([]byte, error) { switch e { - case QCryptoHashAlgorithmMd5: - return json.Marshal("md5") - case QCryptoHashAlgorithmSha1: - return json.Marshal("sha1") - case QCryptoHashAlgorithmSha224: - return json.Marshal("sha224") - case QCryptoHashAlgorithmSha256: - return json.Marshal("sha256") - case QCryptoHashAlgorithmSha384: - return json.Marshal("sha384") - case QCryptoHashAlgorithmSha512: - return json.Marshal("sha512") - case QCryptoHashAlgorithmRipemd160: - return json.Marshal("ripemd160") + case IscsiHeaderDigestCrc32C: + return json.Marshal("crc32c") + case IscsiHeaderDigestNone: + return json.Marshal("none") + case IscsiHeaderDigestCrc32CNone: + return json.Marshal("crc32c-none") + case IscsiHeaderDigestNoneCrc32C: + return json.Marshal("none-crc32c") default: - return nil, fmt.Errorf("unknown enum value %q for QCryptoHashAlgorithm", e) + return nil, fmt.Errorf("unknown enum value %q for IscsiHeaderDigest", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QCryptoHashAlgorithm) UnmarshalJSON(bs []byte) error { +func (e *IscsiHeaderDigest) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "md5": - *e = QCryptoHashAlgorithmMd5 - case "sha1": - *e = QCryptoHashAlgorithmSha1 - case "sha224": - *e = QCryptoHashAlgorithmSha224 - case "sha256": - *e = QCryptoHashAlgorithmSha256 - case "sha384": - *e = QCryptoHashAlgorithmSha384 - case "sha512": - *e = QCryptoHashAlgorithmSha512 - case "ripemd160": - *e = QCryptoHashAlgorithmRipemd160 + case "crc32c": + *e = IscsiHeaderDigestCrc32C + case "none": + *e = IscsiHeaderDigestNone + case "crc32c-none": + *e = IscsiHeaderDigestCrc32CNone + case "none-crc32c": + *e = IscsiHeaderDigestNoneCrc32C default: - return fmt.Errorf("unknown enum value %q for QCryptoHashAlgorithm", s) + return fmt.Errorf("unknown enum value %q for IscsiHeaderDigest", s) } return nil } -// QCryptoIVGenAlgorithm -> QCryptoIvGenAlgorithm (enum) +// IscsiTransport -> IscsiTransport (enum) -// QCryptoIvGenAlgorithm implements the "QCryptoIVGenAlgorithm" QMP API type. -type QCryptoIvGenAlgorithm int +// IscsiTransport implements the "IscsiTransport" QMP API type. +type IscsiTransport int -// Known values of QCryptoIvGenAlgorithm. +// Known values of IscsiTransport. const ( - QCryptoIvGenAlgorithmPlain QCryptoIvGenAlgorithm = iota - QCryptoIvGenAlgorithmPlain64 - QCryptoIvGenAlgorithmEssiv + IscsiTransportTCP IscsiTransport = iota + IscsiTransportIser ) // String implements fmt.Stringer. -func (e QCryptoIvGenAlgorithm) String() string { +func (e IscsiTransport) String() string { switch e { - case QCryptoIvGenAlgorithmPlain: - return "plain" - case QCryptoIvGenAlgorithmPlain64: - return "plain64" - case QCryptoIvGenAlgorithmEssiv: - return "essiv" + case IscsiTransportTCP: + return "tcp" + case IscsiTransportIser: + return "iser" default: - return fmt.Sprintf("QCryptoIvGenAlgorithm(%d)", e) + return fmt.Sprintf("IscsiTransport(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QCryptoIvGenAlgorithm) MarshalJSON() ([]byte, error) { +func (e IscsiTransport) MarshalJSON() ([]byte, error) { switch e { - case QCryptoIvGenAlgorithmPlain: - return json.Marshal("plain") - case QCryptoIvGenAlgorithmPlain64: - return json.Marshal("plain64") - case QCryptoIvGenAlgorithmEssiv: - return json.Marshal("essiv") + case IscsiTransportTCP: + return json.Marshal("tcp") + case IscsiTransportIser: + return json.Marshal("iser") default: - return nil, fmt.Errorf("unknown enum value %q for QCryptoIvGenAlgorithm", e) + return nil, fmt.Errorf("unknown enum value %q for IscsiTransport", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QCryptoIvGenAlgorithm) UnmarshalJSON(bs []byte) error { +func (e *IscsiTransport) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "plain": - *e = QCryptoIvGenAlgorithmPlain - case "plain64": - *e = QCryptoIvGenAlgorithmPlain64 - case "essiv": - *e = QCryptoIvGenAlgorithmEssiv + case "tcp": + *e = IscsiTransportTCP + case "iser": + *e = IscsiTransportIser default: - return fmt.Errorf("unknown enum value %q for QCryptoIvGenAlgorithm", s) + return fmt.Errorf("unknown enum value %q for IscsiTransport", s) } return nil } -// QKeyCode -> QKeyCode (enum) +// EVENT JOB_STATUS_CHANGE -// QKeyCode implements the "QKeyCode" QMP API type. -type QKeyCode int +// JSONType -> JSONType (enum) -// Known values of QKeyCode. +// JSONType implements the "JSONType" QMP API type. +type JSONType int + +// Known values of JSONType. const ( - QKeyCodeUnmapped QKeyCode = iota - QKeyCodeShift - QKeyCodeShiftR - QKeyCodeAlt - QKeyCodeAltR - QKeyCodeCtrl - QKeyCodeCtrlR - QKeyCodeMenu - QKeyCodeEsc - QKeyCode1 - QKeyCode2 - QKeyCode3 - QKeyCode4 - QKeyCode5 - QKeyCode6 - QKeyCode7 - QKeyCode8 - QKeyCode9 - QKeyCode0 - QKeyCodeMinus - QKeyCodeEqual - QKeyCodeBackspace - QKeyCodeTab - QKeyCodeQ - QKeyCodeW - QKeyCodeE - QKeyCodeR - QKeyCodeT - QKeyCodeY - QKeyCodeU - QKeyCodeI - QKeyCodeO - QKeyCodeP - QKeyCodeBracketLeft - QKeyCodeBracketRight - QKeyCodeRet - QKeyCodeA - QKeyCodeS - QKeyCodeD - QKeyCodeF - QKeyCodeG - QKeyCodeH - QKeyCodeJ - QKeyCodeK - QKeyCodeL - QKeyCodeSemicolon - QKeyCodeApostrophe - QKeyCodeGraveAccent - QKeyCodeBackslash - QKeyCodeZ - QKeyCodeX - QKeyCodeC - QKeyCodeV - QKeyCodeB - QKeyCodeN - QKeyCodeM - QKeyCodeComma - QKeyCodeDot - QKeyCodeSlash - QKeyCodeAsterisk - QKeyCodeSpc - QKeyCodeCapsLock - QKeyCodeF1 - QKeyCodeF2 - QKeyCodeF3 - QKeyCodeF4 - QKeyCodeF5 - QKeyCodeF6 - QKeyCodeF7 - QKeyCodeF8 - QKeyCodeF9 - QKeyCodeF10 - QKeyCodeNumLock - QKeyCodeScrollLock - QKeyCodeKpDivide - QKeyCodeKpMultiply - QKeyCodeKpSubtract - QKeyCodeKpAdd - QKeyCodeKpEnter - QKeyCodeKpDecimal - QKeyCodeSysrq - QKeyCodeKp0 - QKeyCodeKp1 - QKeyCodeKp2 - QKeyCodeKp3 - QKeyCodeKp4 - QKeyCodeKp5 - QKeyCodeKp6 - QKeyCodeKp7 - QKeyCodeKp8 - QKeyCodeKp9 - QKeyCodeLess - QKeyCodeF11 - QKeyCodeF12 - QKeyCodePrint - QKeyCodeHome - QKeyCodePgup - QKeyCodePgdn - QKeyCodeEnd - QKeyCodeLeft - QKeyCodeUp - QKeyCodeDown - QKeyCodeRight - QKeyCodeInsert - QKeyCodeDelete - QKeyCodeStop - QKeyCodeAgain - QKeyCodeProps - QKeyCodeUndo - QKeyCodeFront - QKeyCodeCopy - QKeyCodeOpen - QKeyCodePaste - QKeyCodeFind - QKeyCodeCut - QKeyCodeLf - QKeyCodeHelp - QKeyCodeMetaL - QKeyCodeMetaR - QKeyCodeCompose - QKeyCodePause - QKeyCodeRo - QKeyCodeHiragana - QKeyCodeHenkan - QKeyCodeYen - QKeyCodeKpComma - QKeyCodeKpEquals - QKeyCodePower - QKeyCodeSleep - QKeyCodeWake - QKeyCodeAudionext - QKeyCodeAudioprev - QKeyCodeAudiostop - QKeyCodeAudioplay - QKeyCodeAudiomute - QKeyCodeVolumeup - QKeyCodeVolumedown - QKeyCodeMediaselect - QKeyCodeMail - QKeyCodeCalculator - QKeyCodeComputer - QKeyCodeAcHome - QKeyCodeAcBack - QKeyCodeAcForward - QKeyCodeAcRefresh - QKeyCodeAcBookmarks + JSONTypeString JSONType = iota + JSONTypefloat64 + JSONTypeint64 + JSONTypeBoolean + JSONTypeNull + JSONTypeObject + JSONTypeArray + JSONTypeValue ) // String implements fmt.Stringer. -func (e QKeyCode) String() string { +func (e JSONType) String() string { switch e { - case QKeyCodeUnmapped: - return "unmapped" - case QKeyCodeShift: - return "shift" - case QKeyCodeShiftR: - return "shift_r" - case QKeyCodeAlt: - return "alt" - case QKeyCodeAltR: - return "alt_r" - case QKeyCodeCtrl: - return "ctrl" - case QKeyCodeCtrlR: - return "ctrl_r" - case QKeyCodeMenu: - return "menu" - case QKeyCodeEsc: - return "esc" - case QKeyCode1: - return "1" - case QKeyCode2: - return "2" - case QKeyCode3: - return "3" - case QKeyCode4: - return "4" - case QKeyCode5: - return "5" - case QKeyCode6: - return "6" - case QKeyCode7: - return "7" - case QKeyCode8: - return "8" - case QKeyCode9: - return "9" - case QKeyCode0: - return "0" - case QKeyCodeMinus: + case JSONTypeString: + return "string" + case JSONTypefloat64: + return "number" + case JSONTypeint64: + return "int" + case JSONTypeBoolean: + return "boolean" + case JSONTypeNull: + return "null" + case JSONTypeObject: + return "object" + case JSONTypeArray: + return "array" + case JSONTypeValue: + return "value" + default: + return fmt.Sprintf("JSONType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e JSONType) MarshalJSON() ([]byte, error) { + switch e { + case JSONTypeString: + return json.Marshal("string") + case JSONTypefloat64: + return json.Marshal("number") + case JSONTypeint64: + return json.Marshal("int") + case JSONTypeBoolean: + return json.Marshal("boolean") + case JSONTypeNull: + return json.Marshal("null") + case JSONTypeObject: + return json.Marshal("object") + case JSONTypeArray: + return json.Marshal("array") + case JSONTypeValue: + return json.Marshal("value") + default: + return nil, fmt.Errorf("unknown enum value %q for JSONType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *JSONType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "string": + *e = JSONTypeString + case "number": + *e = JSONTypefloat64 + case "int": + *e = JSONTypeint64 + case "boolean": + *e = JSONTypeBoolean + case "null": + *e = JSONTypeNull + case "object": + *e = JSONTypeObject + case "array": + *e = JSONTypeArray + case "value": + *e = JSONTypeValue + default: + return fmt.Errorf("unknown enum value %q for JSONType", s) + } + return nil +} + +// JobInfo -> JobInfo (struct) + +// JobInfo implements the "JobInfo" QMP API type. +type JobInfo struct { + ID string `json:"id"` + Type JobType `json:"type"` + Status JobStatus `json:"status"` + CurrentProgress int64 `json:"current-progress"` + TotalProgress int64 `json:"total-progress"` + Error *string `json:"error,omitempty"` +} + +// JobStatus -> JobStatus (enum) + +// JobStatus implements the "JobStatus" QMP API type. +type JobStatus int + +// Known values of JobStatus. +const ( + JobStatusUndefined JobStatus = iota + JobStatusCreated + JobStatusRunning + JobStatusPaused + JobStatusReady + JobStatusStandby + JobStatusWaiting + JobStatusPending + JobStatusAborting + JobStatusConcluded + JobStatusNull +) + +// String implements fmt.Stringer. +func (e JobStatus) String() string { + switch e { + case JobStatusUndefined: + return "undefined" + case JobStatusCreated: + return "created" + case JobStatusRunning: + return "running" + case JobStatusPaused: + return "paused" + case JobStatusReady: + return "ready" + case JobStatusStandby: + return "standby" + case JobStatusWaiting: + return "waiting" + case JobStatusPending: + return "pending" + case JobStatusAborting: + return "aborting" + case JobStatusConcluded: + return "concluded" + case JobStatusNull: + return "null" + default: + return fmt.Sprintf("JobStatus(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e JobStatus) MarshalJSON() ([]byte, error) { + switch e { + case JobStatusUndefined: + return json.Marshal("undefined") + case JobStatusCreated: + return json.Marshal("created") + case JobStatusRunning: + return json.Marshal("running") + case JobStatusPaused: + return json.Marshal("paused") + case JobStatusReady: + return json.Marshal("ready") + case JobStatusStandby: + return json.Marshal("standby") + case JobStatusWaiting: + return json.Marshal("waiting") + case JobStatusPending: + return json.Marshal("pending") + case JobStatusAborting: + return json.Marshal("aborting") + case JobStatusConcluded: + return json.Marshal("concluded") + case JobStatusNull: + return json.Marshal("null") + default: + return nil, fmt.Errorf("unknown enum value %q for JobStatus", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *JobStatus) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "undefined": + *e = JobStatusUndefined + case "created": + *e = JobStatusCreated + case "running": + *e = JobStatusRunning + case "paused": + *e = JobStatusPaused + case "ready": + *e = JobStatusReady + case "standby": + *e = JobStatusStandby + case "waiting": + *e = JobStatusWaiting + case "pending": + *e = JobStatusPending + case "aborting": + *e = JobStatusAborting + case "concluded": + *e = JobStatusConcluded + case "null": + *e = JobStatusNull + default: + return fmt.Errorf("unknown enum value %q for JobStatus", s) + } + return nil +} + +// JobType -> JobType (enum) + +// JobType implements the "JobType" QMP API type. +type JobType int + +// Known values of JobType. +const ( + JobTypeCommit JobType = iota + JobTypeStream + JobTypeMirror + JobTypeBackup + JobTypeCreate + JobTypeAmend + JobTypeSnapshotLoad + JobTypeSnapshotSave + JobTypeSnapshotDelete +) + +// String implements fmt.Stringer. +func (e JobType) String() string { + switch e { + case JobTypeCommit: + return "commit" + case JobTypeStream: + return "stream" + case JobTypeMirror: + return "mirror" + case JobTypeBackup: + return "backup" + case JobTypeCreate: + return "create" + case JobTypeAmend: + return "amend" + case JobTypeSnapshotLoad: + return "snapshot-load" + case JobTypeSnapshotSave: + return "snapshot-save" + case JobTypeSnapshotDelete: + return "snapshot-delete" + default: + return fmt.Sprintf("JobType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e JobType) MarshalJSON() ([]byte, error) { + switch e { + case JobTypeCommit: + return json.Marshal("commit") + case JobTypeStream: + return json.Marshal("stream") + case JobTypeMirror: + return json.Marshal("mirror") + case JobTypeBackup: + return json.Marshal("backup") + case JobTypeCreate: + return json.Marshal("create") + case JobTypeAmend: + return json.Marshal("amend") + case JobTypeSnapshotLoad: + return json.Marshal("snapshot-load") + case JobTypeSnapshotSave: + return json.Marshal("snapshot-save") + case JobTypeSnapshotDelete: + return json.Marshal("snapshot-delete") + default: + return nil, fmt.Errorf("unknown enum value %q for JobType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *JobType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "commit": + *e = JobTypeCommit + case "stream": + *e = JobTypeStream + case "mirror": + *e = JobTypeMirror + case "backup": + *e = JobTypeBackup + case "create": + *e = JobTypeCreate + case "amend": + *e = JobTypeAmend + case "snapshot-load": + *e = JobTypeSnapshotLoad + case "snapshot-save": + *e = JobTypeSnapshotSave + case "snapshot-delete": + *e = JobTypeSnapshotDelete + default: + return fmt.Errorf("unknown enum value %q for JobType", s) + } + return nil +} + +// KeyValue -> KeyValue (flat union) + +// KeyValue implements the "KeyValue" QMP API type. +// +// Can be one of: +// - KeyValueVariantfloat64 +// - KeyValueVariantQcode +type KeyValue interface { + isKeyValue() +} + +// KeyValueVariantfloat64 is an implementation of KeyValue. +type KeyValueVariantfloat64 struct { + Data int64 `json:"data"` +} + +func (KeyValueVariantfloat64) isKeyValue() {} + +// MarshalJSON implements json.Marshaler. +func (s KeyValueVariantfloat64) MarshalJSON() ([]byte, error) { + v := struct { + Type KeyValueKind `json:"type"` + KeyValueVariantfloat64 + }{ + KeyValueKindfloat64, + s, + } + return json.Marshal(v) +} + +// KeyValueVariantQcode is an implementation of KeyValue. +type KeyValueVariantQcode struct { + Data QKeyCode `json:"data"` +} + +func (KeyValueVariantQcode) isKeyValue() {} + +// MarshalJSON implements json.Marshaler. +func (s KeyValueVariantQcode) MarshalJSON() ([]byte, error) { + v := struct { + Type KeyValueKind `json:"type"` + KeyValueVariantQcode + }{ + KeyValueKindQcode, + s, + } + return json.Marshal(v) +} + +func decodeKeyValue(bs json.RawMessage) (KeyValue, error) { + v := struct { + Type KeyValueKind `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case KeyValueKindfloat64: + var ret KeyValueVariantfloat64 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case KeyValueKindQcode: + var ret KeyValueVariantQcode + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union KeyValue", v.Type) + } +} + +// KeyValueKind -> KeyValueKind (enum) + +// KeyValueKind implements the "KeyValueKind" QMP API type. +type KeyValueKind int + +// Known values of KeyValueKind. +const ( + KeyValueKindfloat64 KeyValueKind = iota + KeyValueKindQcode +) + +// String implements fmt.Stringer. +func (e KeyValueKind) String() string { + switch e { + case KeyValueKindfloat64: + return "number" + case KeyValueKindQcode: + return "qcode" + default: + return fmt.Sprintf("KeyValueKind(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e KeyValueKind) MarshalJSON() ([]byte, error) { + switch e { + case KeyValueKindfloat64: + return json.Marshal("number") + case KeyValueKindQcode: + return json.Marshal("qcode") + default: + return nil, fmt.Errorf("unknown enum value %q for KeyValueKind", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *KeyValueKind) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "number": + *e = KeyValueKindfloat64 + case "qcode": + *e = KeyValueKindQcode + default: + return fmt.Errorf("unknown enum value %q for KeyValueKind", s) + } + return nil +} + +// KvmInfo -> KVMInfo (struct) + +// KVMInfo implements the "KvmInfo" QMP API type. +type KVMInfo struct { + Enabled bool `json:"enabled"` + Present bool `json:"present"` +} + +// EVENT MEMORY_DEVICE_SIZE_CHANGE + +// EVENT MEMORY_FAILURE + +// EVENT MEM_UNPLUG_ERROR + +// EVENT MIGRATION + +// EVENT MIGRATION_PASS + +// MachineInfo -> MachineInfo (struct) + +// MachineInfo implements the "MachineInfo" QMP API type. +type MachineInfo struct { + Name string `json:"name"` + Alias *string `json:"alias,omitempty"` + IsDefault *bool `json:"is-default,omitempty"` + CPUMax int64 `json:"cpu-max"` + HotpluggableCpus bool `json:"hotpluggable-cpus"` + NumaMemSupported bool `json:"numa-mem-supported"` + Deprecated bool `json:"deprecated"` + DefaultCPUType *string `json:"default-cpu-type,omitempty"` + DefaultRAMID *string `json:"default-ram-id,omitempty"` +} + +// Memdev -> Memdev (struct) + +// Memdev implements the "Memdev" QMP API type. +type Memdev struct { + ID *string `json:"id,omitempty"` + Size uint64 `json:"size"` + Merge bool `json:"merge"` + Dump bool `json:"dump"` + Prealloc bool `json:"prealloc"` + Share bool `json:"share"` + Reserve *bool `json:"reserve,omitempty"` + HostNodes []uint16 `json:"host-nodes"` + Policy HostMemPolicy `json:"policy"` +} + +// MemoryDeviceInfo -> MemoryDeviceInfo (flat union) + +// MemoryDeviceInfo implements the "MemoryDeviceInfo" QMP API type. +// +// Can be one of: +// - MemoryDeviceInfoVariantDimm +// - MemoryDeviceInfoVariantNvdimm +// - MemoryDeviceInfoVariantSgxEpc +// - MemoryDeviceInfoVariantVirtioMem +// - MemoryDeviceInfoVariantVirtioPmem +type MemoryDeviceInfo interface { + isMemoryDeviceInfo() +} + +// MemoryDeviceInfoVariantDimm is an implementation of MemoryDeviceInfo. +type MemoryDeviceInfoVariantDimm struct { + Data PcdimmDeviceInfo `json:"data"` +} + +func (MemoryDeviceInfoVariantDimm) isMemoryDeviceInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s MemoryDeviceInfoVariantDimm) MarshalJSON() ([]byte, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + MemoryDeviceInfoVariantDimm + }{ + MemoryDeviceInfoKindDimm, + s, + } + return json.Marshal(v) +} + +// MemoryDeviceInfoVariantNvdimm is an implementation of MemoryDeviceInfo. +type MemoryDeviceInfoVariantNvdimm struct { + Data PcdimmDeviceInfo `json:"data"` +} + +func (MemoryDeviceInfoVariantNvdimm) isMemoryDeviceInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s MemoryDeviceInfoVariantNvdimm) MarshalJSON() ([]byte, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + MemoryDeviceInfoVariantNvdimm + }{ + MemoryDeviceInfoKindNvdimm, + s, + } + return json.Marshal(v) +} + +// MemoryDeviceInfoVariantSgxEpc is an implementation of MemoryDeviceInfo. +type MemoryDeviceInfoVariantSgxEpc struct { + Data SgxEpcDeviceInfo `json:"data"` +} + +func (MemoryDeviceInfoVariantSgxEpc) isMemoryDeviceInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s MemoryDeviceInfoVariantSgxEpc) MarshalJSON() ([]byte, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + MemoryDeviceInfoVariantSgxEpc + }{ + MemoryDeviceInfoKindSgxEpc, + s, + } + return json.Marshal(v) +} + +// MemoryDeviceInfoVariantVirtioMem is an implementation of MemoryDeviceInfo. +type MemoryDeviceInfoVariantVirtioMem struct { + Data VirtioMemDeviceInfo `json:"data"` +} + +func (MemoryDeviceInfoVariantVirtioMem) isMemoryDeviceInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s MemoryDeviceInfoVariantVirtioMem) MarshalJSON() ([]byte, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + MemoryDeviceInfoVariantVirtioMem + }{ + MemoryDeviceInfoKindVirtioMem, + s, + } + return json.Marshal(v) +} + +// MemoryDeviceInfoVariantVirtioPmem is an implementation of MemoryDeviceInfo. +type MemoryDeviceInfoVariantVirtioPmem struct { + Data VirtioPmemDeviceInfo `json:"data"` +} + +func (MemoryDeviceInfoVariantVirtioPmem) isMemoryDeviceInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s MemoryDeviceInfoVariantVirtioPmem) MarshalJSON() ([]byte, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + MemoryDeviceInfoVariantVirtioPmem + }{ + MemoryDeviceInfoKindVirtioPmem, + s, + } + return json.Marshal(v) +} + +func decodeMemoryDeviceInfo(bs json.RawMessage) (MemoryDeviceInfo, error) { + v := struct { + Type MemoryDeviceInfoKind `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case MemoryDeviceInfoKindDimm: + var ret MemoryDeviceInfoVariantDimm + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case MemoryDeviceInfoKindNvdimm: + var ret MemoryDeviceInfoVariantNvdimm + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case MemoryDeviceInfoKindSgxEpc: + var ret MemoryDeviceInfoVariantSgxEpc + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case MemoryDeviceInfoKindVirtioMem: + var ret MemoryDeviceInfoVariantVirtioMem + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case MemoryDeviceInfoKindVirtioPmem: + var ret MemoryDeviceInfoVariantVirtioPmem + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union MemoryDeviceInfo", v.Type) + } +} + +// MemoryDeviceInfoKind -> MemoryDeviceInfoKind (enum) + +// MemoryDeviceInfoKind implements the "MemoryDeviceInfoKind" QMP API type. +type MemoryDeviceInfoKind int + +// Known values of MemoryDeviceInfoKind. +const ( + MemoryDeviceInfoKindDimm MemoryDeviceInfoKind = iota + MemoryDeviceInfoKindNvdimm + MemoryDeviceInfoKindVirtioPmem + MemoryDeviceInfoKindVirtioMem + MemoryDeviceInfoKindSgxEpc +) + +// String implements fmt.Stringer. +func (e MemoryDeviceInfoKind) String() string { + switch e { + case MemoryDeviceInfoKindDimm: + return "dimm" + case MemoryDeviceInfoKindNvdimm: + return "nvdimm" + case MemoryDeviceInfoKindVirtioPmem: + return "virtio-pmem" + case MemoryDeviceInfoKindVirtioMem: + return "virtio-mem" + case MemoryDeviceInfoKindSgxEpc: + return "sgx-epc" + default: + return fmt.Sprintf("MemoryDeviceInfoKind(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MemoryDeviceInfoKind) MarshalJSON() ([]byte, error) { + switch e { + case MemoryDeviceInfoKindDimm: + return json.Marshal("dimm") + case MemoryDeviceInfoKindNvdimm: + return json.Marshal("nvdimm") + case MemoryDeviceInfoKindVirtioPmem: + return json.Marshal("virtio-pmem") + case MemoryDeviceInfoKindVirtioMem: + return json.Marshal("virtio-mem") + case MemoryDeviceInfoKindSgxEpc: + return json.Marshal("sgx-epc") + default: + return nil, fmt.Errorf("unknown enum value %q for MemoryDeviceInfoKind", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MemoryDeviceInfoKind) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "dimm": + *e = MemoryDeviceInfoKindDimm + case "nvdimm": + *e = MemoryDeviceInfoKindNvdimm + case "virtio-pmem": + *e = MemoryDeviceInfoKindVirtioPmem + case "virtio-mem": + *e = MemoryDeviceInfoKindVirtioMem + case "sgx-epc": + *e = MemoryDeviceInfoKindSgxEpc + default: + return fmt.Errorf("unknown enum value %q for MemoryDeviceInfoKind", s) + } + return nil +} + +// MemoryFailureAction -> MemoryFailureAction (enum) + +// MemoryFailureAction implements the "MemoryFailureAction" QMP API type. +type MemoryFailureAction int + +// Known values of MemoryFailureAction. +const ( + MemoryFailureActionIgnore MemoryFailureAction = iota + MemoryFailureActionInject + MemoryFailureActionFatal + MemoryFailureActionReset +) + +// String implements fmt.Stringer. +func (e MemoryFailureAction) String() string { + switch e { + case MemoryFailureActionIgnore: + return "ignore" + case MemoryFailureActionInject: + return "inject" + case MemoryFailureActionFatal: + return "fatal" + case MemoryFailureActionReset: + return "reset" + default: + return fmt.Sprintf("MemoryFailureAction(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MemoryFailureAction) MarshalJSON() ([]byte, error) { + switch e { + case MemoryFailureActionIgnore: + return json.Marshal("ignore") + case MemoryFailureActionInject: + return json.Marshal("inject") + case MemoryFailureActionFatal: + return json.Marshal("fatal") + case MemoryFailureActionReset: + return json.Marshal("reset") + default: + return nil, fmt.Errorf("unknown enum value %q for MemoryFailureAction", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MemoryFailureAction) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "ignore": + *e = MemoryFailureActionIgnore + case "inject": + *e = MemoryFailureActionInject + case "fatal": + *e = MemoryFailureActionFatal + case "reset": + *e = MemoryFailureActionReset + default: + return fmt.Errorf("unknown enum value %q for MemoryFailureAction", s) + } + return nil +} + +// MemoryFailureFlags -> MemoryFailureFlags (struct) + +// MemoryFailureFlags implements the "MemoryFailureFlags" QMP API type. +type MemoryFailureFlags struct { + ActionRequired bool `json:"action-required"` + Recursive bool `json:"recursive"` +} + +// MemoryFailureRecipient -> MemoryFailureRecipient (enum) + +// MemoryFailureRecipient implements the "MemoryFailureRecipient" QMP API type. +type MemoryFailureRecipient int + +// Known values of MemoryFailureRecipient. +const ( + MemoryFailureRecipientHypervisor MemoryFailureRecipient = iota + MemoryFailureRecipientGuest +) + +// String implements fmt.Stringer. +func (e MemoryFailureRecipient) String() string { + switch e { + case MemoryFailureRecipientHypervisor: + return "hypervisor" + case MemoryFailureRecipientGuest: + return "guest" + default: + return fmt.Sprintf("MemoryFailureRecipient(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MemoryFailureRecipient) MarshalJSON() ([]byte, error) { + switch e { + case MemoryFailureRecipientHypervisor: + return json.Marshal("hypervisor") + case MemoryFailureRecipientGuest: + return json.Marshal("guest") + default: + return nil, fmt.Errorf("unknown enum value %q for MemoryFailureRecipient", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MemoryFailureRecipient) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "hypervisor": + *e = MemoryFailureRecipientHypervisor + case "guest": + *e = MemoryFailureRecipientGuest + default: + return fmt.Errorf("unknown enum value %q for MemoryFailureRecipient", s) + } + return nil +} + +// MemoryInfo -> MemoryInfo (struct) + +// MemoryInfo implements the "MemoryInfo" QMP API type. +type MemoryInfo struct { + BaseMemory uint64 `json:"base-memory"` + PluggedMemory *uint64 `json:"plugged-memory,omitempty"` +} + +// MigrateSetParameters -> MigrateSetParameters (struct) + +// MigrateSetParameters implements the "MigrateSetParameters" QMP API type. +type MigrateSetParameters struct { + AnnounceInitial *uint64 `json:"announce-initial,omitempty"` + AnnounceMax *uint64 `json:"announce-max,omitempty"` + AnnounceRounds *uint64 `json:"announce-rounds,omitempty"` + AnnounceStep *uint64 `json:"announce-step,omitempty"` + CompressLevel *uint8 `json:"compress-level,omitempty"` + CompressThreads *uint8 `json:"compress-threads,omitempty"` + CompressWaitThread *bool `json:"compress-wait-thread,omitempty"` + DecompressThreads *uint8 `json:"decompress-threads,omitempty"` + ThrottleTriggerThreshold *uint8 `json:"throttle-trigger-threshold,omitempty"` + CPUThrottleInitial *uint8 `json:"cpu-throttle-initial,omitempty"` + CPUThrottleIncrement *uint8 `json:"cpu-throttle-increment,omitempty"` + CPUThrottleTailslow *bool `json:"cpu-throttle-tailslow,omitempty"` + TLSCreds *StrOrNull `json:"tls-creds,omitempty"` + TLSHostname *StrOrNull `json:"tls-hostname,omitempty"` + TLSAuthz *StrOrNull `json:"tls-authz,omitempty"` + MaxBandwidth *uint64 `json:"max-bandwidth,omitempty"` + DowntimeLimit *uint64 `json:"downtime-limit,omitempty"` + XCheckpointDelay *uint32 `json:"x-checkpoint-delay,omitempty"` + BlockIncremental *bool `json:"block-incremental,omitempty"` + MultifdChannels *uint8 `json:"multifd-channels,omitempty"` + XbzrleCacheSize *uint64 `json:"xbzrle-cache-size,omitempty"` + MaxPostcopyBandwidth *uint64 `json:"max-postcopy-bandwidth,omitempty"` + MaxCPUThrottle *uint8 `json:"max-cpu-throttle,omitempty"` + MultifdCompression *MultiFDCompression `json:"multifd-compression,omitempty"` + MultifdZlibLevel *uint8 `json:"multifd-zlib-level,omitempty"` + MultifdZstdLevel *uint8 `json:"multifd-zstd-level,omitempty"` + BlockBitmapMapping []BitmapMigrationNodeAlias `json:"block-bitmap-mapping,omitempty"` +} + +// MigrationCapability -> MigrationCapability (enum) + +// MigrationCapability implements the "MigrationCapability" QMP API type. +type MigrationCapability int + +// Known values of MigrationCapability. +const ( + MigrationCapabilityXbzrle MigrationCapability = iota + MigrationCapabilityRdmaPinAll + MigrationCapabilityAutoConverge + MigrationCapabilityZeroBlocks + MigrationCapabilityCompress + MigrationCapabilityEvents + MigrationCapabilityPostcopyRAM + MigrationCapabilityXColo + MigrationCapabilityReleaseRAM + MigrationCapabilityBlock + MigrationCapabilityReturnPath + MigrationCapabilityPauseBeforeSwitchover + MigrationCapabilityMultifd + MigrationCapabilityDirtyBitmaps + MigrationCapabilityPostcopyBlocktime + MigrationCapabilityLateBlockActivate + MigrationCapabilityXIgnoreShared + MigrationCapabilityValidateUUID + MigrationCapabilityBackgroundSnapshot + MigrationCapabilityZeroCopySend + MigrationCapabilityPostcopyPreempt +) + +// String implements fmt.Stringer. +func (e MigrationCapability) String() string { + switch e { + case MigrationCapabilityXbzrle: + return "xbzrle" + case MigrationCapabilityRdmaPinAll: + return "rdma-pin-all" + case MigrationCapabilityAutoConverge: + return "auto-converge" + case MigrationCapabilityZeroBlocks: + return "zero-blocks" + case MigrationCapabilityCompress: + return "compress" + case MigrationCapabilityEvents: + return "events" + case MigrationCapabilityPostcopyRAM: + return "postcopy-ram" + case MigrationCapabilityXColo: + return "x-colo" + case MigrationCapabilityReleaseRAM: + return "release-ram" + case MigrationCapabilityBlock: + return "block" + case MigrationCapabilityReturnPath: + return "return-path" + case MigrationCapabilityPauseBeforeSwitchover: + return "pause-before-switchover" + case MigrationCapabilityMultifd: + return "multifd" + case MigrationCapabilityDirtyBitmaps: + return "dirty-bitmaps" + case MigrationCapabilityPostcopyBlocktime: + return "postcopy-blocktime" + case MigrationCapabilityLateBlockActivate: + return "late-block-activate" + case MigrationCapabilityXIgnoreShared: + return "x-ignore-shared" + case MigrationCapabilityValidateUUID: + return "validate-uuid" + case MigrationCapabilityBackgroundSnapshot: + return "background-snapshot" + case MigrationCapabilityZeroCopySend: + return "zero-copy-send" + case MigrationCapabilityPostcopyPreempt: + return "postcopy-preempt" + default: + return fmt.Sprintf("MigrationCapability(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MigrationCapability) MarshalJSON() ([]byte, error) { + switch e { + case MigrationCapabilityXbzrle: + return json.Marshal("xbzrle") + case MigrationCapabilityRdmaPinAll: + return json.Marshal("rdma-pin-all") + case MigrationCapabilityAutoConverge: + return json.Marshal("auto-converge") + case MigrationCapabilityZeroBlocks: + return json.Marshal("zero-blocks") + case MigrationCapabilityCompress: + return json.Marshal("compress") + case MigrationCapabilityEvents: + return json.Marshal("events") + case MigrationCapabilityPostcopyRAM: + return json.Marshal("postcopy-ram") + case MigrationCapabilityXColo: + return json.Marshal("x-colo") + case MigrationCapabilityReleaseRAM: + return json.Marshal("release-ram") + case MigrationCapabilityBlock: + return json.Marshal("block") + case MigrationCapabilityReturnPath: + return json.Marshal("return-path") + case MigrationCapabilityPauseBeforeSwitchover: + return json.Marshal("pause-before-switchover") + case MigrationCapabilityMultifd: + return json.Marshal("multifd") + case MigrationCapabilityDirtyBitmaps: + return json.Marshal("dirty-bitmaps") + case MigrationCapabilityPostcopyBlocktime: + return json.Marshal("postcopy-blocktime") + case MigrationCapabilityLateBlockActivate: + return json.Marshal("late-block-activate") + case MigrationCapabilityXIgnoreShared: + return json.Marshal("x-ignore-shared") + case MigrationCapabilityValidateUUID: + return json.Marshal("validate-uuid") + case MigrationCapabilityBackgroundSnapshot: + return json.Marshal("background-snapshot") + case MigrationCapabilityZeroCopySend: + return json.Marshal("zero-copy-send") + case MigrationCapabilityPostcopyPreempt: + return json.Marshal("postcopy-preempt") + default: + return nil, fmt.Errorf("unknown enum value %q for MigrationCapability", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MigrationCapability) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "xbzrle": + *e = MigrationCapabilityXbzrle + case "rdma-pin-all": + *e = MigrationCapabilityRdmaPinAll + case "auto-converge": + *e = MigrationCapabilityAutoConverge + case "zero-blocks": + *e = MigrationCapabilityZeroBlocks + case "compress": + *e = MigrationCapabilityCompress + case "events": + *e = MigrationCapabilityEvents + case "postcopy-ram": + *e = MigrationCapabilityPostcopyRAM + case "x-colo": + *e = MigrationCapabilityXColo + case "release-ram": + *e = MigrationCapabilityReleaseRAM + case "block": + *e = MigrationCapabilityBlock + case "return-path": + *e = MigrationCapabilityReturnPath + case "pause-before-switchover": + *e = MigrationCapabilityPauseBeforeSwitchover + case "multifd": + *e = MigrationCapabilityMultifd + case "dirty-bitmaps": + *e = MigrationCapabilityDirtyBitmaps + case "postcopy-blocktime": + *e = MigrationCapabilityPostcopyBlocktime + case "late-block-activate": + *e = MigrationCapabilityLateBlockActivate + case "x-ignore-shared": + *e = MigrationCapabilityXIgnoreShared + case "validate-uuid": + *e = MigrationCapabilityValidateUUID + case "background-snapshot": + *e = MigrationCapabilityBackgroundSnapshot + case "zero-copy-send": + *e = MigrationCapabilityZeroCopySend + case "postcopy-preempt": + *e = MigrationCapabilityPostcopyPreempt + default: + return fmt.Errorf("unknown enum value %q for MigrationCapability", s) + } + return nil +} + +// MigrationCapabilityStatus -> MigrationCapabilityStatus (struct) + +// MigrationCapabilityStatus implements the "MigrationCapabilityStatus" QMP API type. +type MigrationCapabilityStatus struct { + Capability MigrationCapability `json:"capability"` + State bool `json:"state"` +} + +// MigrationInfo -> MigrationInfo (struct) + +// MigrationInfo implements the "MigrationInfo" QMP API type. +type MigrationInfo struct { + Status *MigrationStatus `json:"status,omitempty"` + RAM *MigrationStats `json:"ram,omitempty"` + Disk *MigrationStats `json:"disk,omitempty"` + Vfio *VfioStats `json:"vfio,omitempty"` + XbzrleCache *XbzrleCacheStats `json:"xbzrle-cache,omitempty"` + TotalTime *int64 `json:"total-time,omitempty"` + ExpectedDowntime *int64 `json:"expected-downtime,omitempty"` + Downtime *int64 `json:"downtime,omitempty"` + SetupTime *int64 `json:"setup-time,omitempty"` + CPUThrottlePercentage *int64 `json:"cpu-throttle-percentage,omitempty"` + ErrorDesc *string `json:"error-desc,omitempty"` + BlockedReasons []string `json:"blocked-reasons,omitempty"` + PostcopyBlocktime *uint32 `json:"postcopy-blocktime,omitempty"` + PostcopyVcpuBlocktime []uint32 `json:"postcopy-vcpu-blocktime,omitempty"` + Compression *CompressionStats `json:"compression,omitempty"` + SocketAddress []SocketAddress `json:"socket-address,omitempty"` +} + +// MigrationParameters -> MigrationParameters (struct) + +// MigrationParameters implements the "MigrationParameters" QMP API type. +type MigrationParameters struct { + AnnounceInitial *uint64 `json:"announce-initial,omitempty"` + AnnounceMax *uint64 `json:"announce-max,omitempty"` + AnnounceRounds *uint64 `json:"announce-rounds,omitempty"` + AnnounceStep *uint64 `json:"announce-step,omitempty"` + CompressLevel *uint8 `json:"compress-level,omitempty"` + CompressThreads *uint8 `json:"compress-threads,omitempty"` + CompressWaitThread *bool `json:"compress-wait-thread,omitempty"` + DecompressThreads *uint8 `json:"decompress-threads,omitempty"` + ThrottleTriggerThreshold *uint8 `json:"throttle-trigger-threshold,omitempty"` + CPUThrottleInitial *uint8 `json:"cpu-throttle-initial,omitempty"` + CPUThrottleIncrement *uint8 `json:"cpu-throttle-increment,omitempty"` + CPUThrottleTailslow *bool `json:"cpu-throttle-tailslow,omitempty"` + TLSCreds *string `json:"tls-creds,omitempty"` + TLSHostname *string `json:"tls-hostname,omitempty"` + TLSAuthz *string `json:"tls-authz,omitempty"` + MaxBandwidth *uint64 `json:"max-bandwidth,omitempty"` + DowntimeLimit *uint64 `json:"downtime-limit,omitempty"` + XCheckpointDelay *uint32 `json:"x-checkpoint-delay,omitempty"` + BlockIncremental *bool `json:"block-incremental,omitempty"` + MultifdChannels *uint8 `json:"multifd-channels,omitempty"` + XbzrleCacheSize *uint64 `json:"xbzrle-cache-size,omitempty"` + MaxPostcopyBandwidth *uint64 `json:"max-postcopy-bandwidth,omitempty"` + MaxCPUThrottle *uint8 `json:"max-cpu-throttle,omitempty"` + MultifdCompression *MultiFDCompression `json:"multifd-compression,omitempty"` + MultifdZlibLevel *uint8 `json:"multifd-zlib-level,omitempty"` + MultifdZstdLevel *uint8 `json:"multifd-zstd-level,omitempty"` + BlockBitmapMapping []BitmapMigrationNodeAlias `json:"block-bitmap-mapping,omitempty"` +} + +// MigrationStats -> MigrationStats (struct) + +// MigrationStats implements the "MigrationStats" QMP API type. +type MigrationStats struct { + Transferred int64 `json:"transferred"` + Remaining int64 `json:"remaining"` + Total int64 `json:"total"` + Duplicate int64 `json:"duplicate"` + Skipped int64 `json:"skipped"` + Normal int64 `json:"normal"` + NormalBytes int64 `json:"normal-bytes"` + DirtyPagesRate int64 `json:"dirty-pages-rate"` + Mbps float64 `json:"mbps"` + DirtySyncCount int64 `json:"dirty-sync-count"` + PostcopyRequests int64 `json:"postcopy-requests"` + PageSize int64 `json:"page-size"` + MultifdBytes uint64 `json:"multifd-bytes"` + PagesPerSecond uint64 `json:"pages-per-second"` + PrecopyBytes uint64 `json:"precopy-bytes"` + DowntimeBytes uint64 `json:"downtime-bytes"` + PostcopyBytes uint64 `json:"postcopy-bytes"` + DirtySyncMissedZeroCopy uint64 `json:"dirty-sync-missed-zero-copy"` +} + +// MigrationStatus -> MigrationStatus (enum) + +// MigrationStatus implements the "MigrationStatus" QMP API type. +type MigrationStatus int + +// Known values of MigrationStatus. +const ( + MigrationStatusNone MigrationStatus = iota + MigrationStatusSetup + MigrationStatusCancelling + MigrationStatusCancelled + MigrationStatusActive + MigrationStatusPostcopyActive + MigrationStatusPostcopyPaused + MigrationStatusPostcopyRecover + MigrationStatusCompleted + MigrationStatusFailed + MigrationStatusColo + MigrationStatusPreSwitchover + MigrationStatusDevice + MigrationStatusWaitUnplug +) + +// String implements fmt.Stringer. +func (e MigrationStatus) String() string { + switch e { + case MigrationStatusNone: + return "none" + case MigrationStatusSetup: + return "setup" + case MigrationStatusCancelling: + return "cancelling" + case MigrationStatusCancelled: + return "cancelled" + case MigrationStatusActive: + return "active" + case MigrationStatusPostcopyActive: + return "postcopy-active" + case MigrationStatusPostcopyPaused: + return "postcopy-paused" + case MigrationStatusPostcopyRecover: + return "postcopy-recover" + case MigrationStatusCompleted: + return "completed" + case MigrationStatusFailed: + return "failed" + case MigrationStatusColo: + return "colo" + case MigrationStatusPreSwitchover: + return "pre-switchover" + case MigrationStatusDevice: + return "device" + case MigrationStatusWaitUnplug: + return "wait-unplug" + default: + return fmt.Sprintf("MigrationStatus(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MigrationStatus) MarshalJSON() ([]byte, error) { + switch e { + case MigrationStatusNone: + return json.Marshal("none") + case MigrationStatusSetup: + return json.Marshal("setup") + case MigrationStatusCancelling: + return json.Marshal("cancelling") + case MigrationStatusCancelled: + return json.Marshal("cancelled") + case MigrationStatusActive: + return json.Marshal("active") + case MigrationStatusPostcopyActive: + return json.Marshal("postcopy-active") + case MigrationStatusPostcopyPaused: + return json.Marshal("postcopy-paused") + case MigrationStatusPostcopyRecover: + return json.Marshal("postcopy-recover") + case MigrationStatusCompleted: + return json.Marshal("completed") + case MigrationStatusFailed: + return json.Marshal("failed") + case MigrationStatusColo: + return json.Marshal("colo") + case MigrationStatusPreSwitchover: + return json.Marshal("pre-switchover") + case MigrationStatusDevice: + return json.Marshal("device") + case MigrationStatusWaitUnplug: + return json.Marshal("wait-unplug") + default: + return nil, fmt.Errorf("unknown enum value %q for MigrationStatus", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MigrationStatus) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = MigrationStatusNone + case "setup": + *e = MigrationStatusSetup + case "cancelling": + *e = MigrationStatusCancelling + case "cancelled": + *e = MigrationStatusCancelled + case "active": + *e = MigrationStatusActive + case "postcopy-active": + *e = MigrationStatusPostcopyActive + case "postcopy-paused": + *e = MigrationStatusPostcopyPaused + case "postcopy-recover": + *e = MigrationStatusPostcopyRecover + case "completed": + *e = MigrationStatusCompleted + case "failed": + *e = MigrationStatusFailed + case "colo": + *e = MigrationStatusColo + case "pre-switchover": + *e = MigrationStatusPreSwitchover + case "device": + *e = MigrationStatusDevice + case "wait-unplug": + *e = MigrationStatusWaitUnplug + default: + return fmt.Errorf("unknown enum value %q for MigrationStatus", s) + } + return nil +} + +// MirrorCopyMode -> MirrorCopyMode (enum) + +// MirrorCopyMode implements the "MirrorCopyMode" QMP API type. +type MirrorCopyMode int + +// Known values of MirrorCopyMode. +const ( + MirrorCopyModeBackground MirrorCopyMode = iota + MirrorCopyModeWriteBlocking +) + +// String implements fmt.Stringer. +func (e MirrorCopyMode) String() string { + switch e { + case MirrorCopyModeBackground: + return "background" + case MirrorCopyModeWriteBlocking: + return "write-blocking" + default: + return fmt.Sprintf("MirrorCopyMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MirrorCopyMode) MarshalJSON() ([]byte, error) { + switch e { + case MirrorCopyModeBackground: + return json.Marshal("background") + case MirrorCopyModeWriteBlocking: + return json.Marshal("write-blocking") + default: + return nil, fmt.Errorf("unknown enum value %q for MirrorCopyMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MirrorCopyMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "background": + *e = MirrorCopyModeBackground + case "write-blocking": + *e = MirrorCopyModeWriteBlocking + default: + return fmt.Errorf("unknown enum value %q for MirrorCopyMode", s) + } + return nil +} + +// MirrorSyncMode -> MirrorSyncMode (enum) + +// MirrorSyncMode implements the "MirrorSyncMode" QMP API type. +type MirrorSyncMode int + +// Known values of MirrorSyncMode. +const ( + MirrorSyncModeTop MirrorSyncMode = iota + MirrorSyncModeFull + MirrorSyncModeNone + MirrorSyncModeIncremental + MirrorSyncModeBitmap +) + +// String implements fmt.Stringer. +func (e MirrorSyncMode) String() string { + switch e { + case MirrorSyncModeTop: + return "top" + case MirrorSyncModeFull: + return "full" + case MirrorSyncModeNone: + return "none" + case MirrorSyncModeIncremental: + return "incremental" + case MirrorSyncModeBitmap: + return "bitmap" + default: + return fmt.Sprintf("MirrorSyncMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MirrorSyncMode) MarshalJSON() ([]byte, error) { + switch e { + case MirrorSyncModeTop: + return json.Marshal("top") + case MirrorSyncModeFull: + return json.Marshal("full") + case MirrorSyncModeNone: + return json.Marshal("none") + case MirrorSyncModeIncremental: + return json.Marshal("incremental") + case MirrorSyncModeBitmap: + return json.Marshal("bitmap") + default: + return nil, fmt.Errorf("unknown enum value %q for MirrorSyncMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MirrorSyncMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "top": + *e = MirrorSyncModeTop + case "full": + *e = MirrorSyncModeFull + case "none": + *e = MirrorSyncModeNone + case "incremental": + *e = MirrorSyncModeIncremental + case "bitmap": + *e = MirrorSyncModeBitmap + default: + return fmt.Errorf("unknown enum value %q for MirrorSyncMode", s) + } + return nil +} + +// MouseInfo -> MouseInfo (struct) + +// MouseInfo implements the "MouseInfo" QMP API type. +type MouseInfo struct { + Name string `json:"name"` + Index int64 `json:"index"` + Current bool `json:"current"` + Absolute bool `json:"absolute"` +} + +// MultiFDCompression -> MultiFDCompression (enum) + +// MultiFDCompression implements the "MultiFDCompression" QMP API type. +type MultiFDCompression int + +// Known values of MultiFDCompression. +const ( + MultiFDCompressionNone MultiFDCompression = iota + MultiFDCompressionZlib + MultiFDCompressionZstd +) + +// String implements fmt.Stringer. +func (e MultiFDCompression) String() string { + switch e { + case MultiFDCompressionNone: + return "none" + case MultiFDCompressionZlib: + return "zlib" + case MultiFDCompressionZstd: + return "zstd" + default: + return fmt.Sprintf("MultiFDCompression(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e MultiFDCompression) MarshalJSON() ([]byte, error) { + switch e { + case MultiFDCompressionNone: + return json.Marshal("none") + case MultiFDCompressionZlib: + return json.Marshal("zlib") + case MultiFDCompressionZstd: + return json.Marshal("zstd") + default: + return nil, fmt.Errorf("unknown enum value %q for MultiFDCompression", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *MultiFDCompression) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = MultiFDCompressionNone + case "zlib": + *e = MultiFDCompressionZlib + case "zstd": + *e = MultiFDCompressionZstd + default: + return fmt.Errorf("unknown enum value %q for MultiFDCompression", s) + } + return nil +} + +// NFSServer -> NfsServer (struct) + +// NfsServer implements the "NFSServer" QMP API type. +type NfsServer struct { + Type NfsTransport `json:"type"` + Host string `json:"host"` +} + +// NFSTransport -> NfsTransport (enum) + +// NfsTransport implements the "NFSTransport" QMP API type. +type NfsTransport int + +// Known values of NfsTransport. +const ( + NfsTransportInet NfsTransport = iota +) + +// String implements fmt.Stringer. +func (e NfsTransport) String() string { + switch e { + case NfsTransportInet: + return "inet" + default: + return fmt.Sprintf("NfsTransport(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NfsTransport) MarshalJSON() ([]byte, error) { + switch e { + case NfsTransportInet: + return json.Marshal("inet") + default: + return nil, fmt.Errorf("unknown enum value %q for NfsTransport", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NfsTransport) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "inet": + *e = NfsTransportInet + default: + return fmt.Errorf("unknown enum value %q for NfsTransport", s) + } + return nil +} + +// EVENT NIC_RX_FILTER_CHANGED + +// NameInfo -> NameInfo (struct) + +// NameInfo implements the "NameInfo" QMP API type. +type NameInfo struct { + Name *string `json:"name,omitempty"` +} + +// NbdServerAddOptions -> NBDServerAddOptions (struct) + +// NBDServerAddOptions implements the "NbdServerAddOptions" QMP API type. +type NBDServerAddOptions struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Device string `json:"device"` + Writable *bool `json:"writable,omitempty"` + Bitmap *string `json:"bitmap,omitempty"` +} + +// NetClientDriver -> NetClientDriver (enum) + +// NetClientDriver implements the "NetClientDriver" QMP API type. +type NetClientDriver int + +// Known values of NetClientDriver. +const ( + NetClientDriverNone NetClientDriver = iota + NetClientDriverNic + NetClientDriverUser + NetClientDriverTap + NetClientDriverL2Tpv3 + NetClientDriverSocket + NetClientDriverVde + NetClientDriverBridge + NetClientDriverHubport + NetClientDriverNetmap + NetClientDriverVhostUser + NetClientDriverVhostVdpa + NetClientDriverVmnetHost + NetClientDriverVmnetShared + NetClientDriverVmnetBridged +) + +// String implements fmt.Stringer. +func (e NetClientDriver) String() string { + switch e { + case NetClientDriverNone: + return "none" + case NetClientDriverNic: + return "nic" + case NetClientDriverUser: + return "user" + case NetClientDriverTap: + return "tap" + case NetClientDriverL2Tpv3: + return "l2tpv3" + case NetClientDriverSocket: + return "socket" + case NetClientDriverVde: + return "vde" + case NetClientDriverBridge: + return "bridge" + case NetClientDriverHubport: + return "hubport" + case NetClientDriverNetmap: + return "netmap" + case NetClientDriverVhostUser: + return "vhost-user" + case NetClientDriverVhostVdpa: + return "vhost-vdpa" + case NetClientDriverVmnetHost: + return "vmnet-host" + case NetClientDriverVmnetShared: + return "vmnet-shared" + case NetClientDriverVmnetBridged: + return "vmnet-bridged" + default: + return fmt.Sprintf("NetClientDriver(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NetClientDriver) MarshalJSON() ([]byte, error) { + switch e { + case NetClientDriverNone: + return json.Marshal("none") + case NetClientDriverNic: + return json.Marshal("nic") + case NetClientDriverUser: + return json.Marshal("user") + case NetClientDriverTap: + return json.Marshal("tap") + case NetClientDriverL2Tpv3: + return json.Marshal("l2tpv3") + case NetClientDriverSocket: + return json.Marshal("socket") + case NetClientDriverVde: + return json.Marshal("vde") + case NetClientDriverBridge: + return json.Marshal("bridge") + case NetClientDriverHubport: + return json.Marshal("hubport") + case NetClientDriverNetmap: + return json.Marshal("netmap") + case NetClientDriverVhostUser: + return json.Marshal("vhost-user") + case NetClientDriverVhostVdpa: + return json.Marshal("vhost-vdpa") + case NetClientDriverVmnetHost: + return json.Marshal("vmnet-host") + case NetClientDriverVmnetShared: + return json.Marshal("vmnet-shared") + case NetClientDriverVmnetBridged: + return json.Marshal("vmnet-bridged") + default: + return nil, fmt.Errorf("unknown enum value %q for NetClientDriver", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NetClientDriver) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = NetClientDriverNone + case "nic": + *e = NetClientDriverNic + case "user": + *e = NetClientDriverUser + case "tap": + *e = NetClientDriverTap + case "l2tpv3": + *e = NetClientDriverL2Tpv3 + case "socket": + *e = NetClientDriverSocket + case "vde": + *e = NetClientDriverVde + case "bridge": + *e = NetClientDriverBridge + case "hubport": + *e = NetClientDriverHubport + case "netmap": + *e = NetClientDriverNetmap + case "vhost-user": + *e = NetClientDriverVhostUser + case "vhost-vdpa": + *e = NetClientDriverVhostVdpa + case "vmnet-host": + *e = NetClientDriverVmnetHost + case "vmnet-shared": + *e = NetClientDriverVmnetShared + case "vmnet-bridged": + *e = NetClientDriverVmnetBridged + default: + return fmt.Errorf("unknown enum value %q for NetClientDriver", s) + } + return nil +} + +// NetFilterDirection -> NetFilterDirection (enum) + +// NetFilterDirection implements the "NetFilterDirection" QMP API type. +type NetFilterDirection int + +// Known values of NetFilterDirection. +const ( + NetFilterDirectionAll NetFilterDirection = iota + NetFilterDirectionRx + NetFilterDirectionTx +) + +// String implements fmt.Stringer. +func (e NetFilterDirection) String() string { + switch e { + case NetFilterDirectionAll: + return "all" + case NetFilterDirectionRx: + return "rx" + case NetFilterDirectionTx: + return "tx" + default: + return fmt.Sprintf("NetFilterDirection(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NetFilterDirection) MarshalJSON() ([]byte, error) { + switch e { + case NetFilterDirectionAll: + return json.Marshal("all") + case NetFilterDirectionRx: + return json.Marshal("rx") + case NetFilterDirectionTx: + return json.Marshal("tx") + default: + return nil, fmt.Errorf("unknown enum value %q for NetFilterDirection", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NetFilterDirection) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "all": + *e = NetFilterDirectionAll + case "rx": + *e = NetFilterDirectionRx + case "tx": + *e = NetFilterDirectionTx + default: + return fmt.Errorf("unknown enum value %q for NetFilterDirection", s) + } + return nil +} + +// Netdev -> Netdev (flat union) + +// Netdev implements the "Netdev" QMP API type. +// +// Can be one of: +// - NetdevVariantBridge +// - NetdevVariantHubport +// - NetdevVariantL2Tpv3 +// - NetdevVariantNetmap +// - NetdevVariantNic +// - NetdevVariantSocket +// - NetdevVariantTap +// - NetdevVariantUser +// - NetdevVariantVde +// - NetdevVariantVhostUser +// - NetdevVariantVhostVdpa +// - NetdevVariantVmnetBridged +// - NetdevVariantVmnetHost +// - NetdevVariantVmnetShared +type Netdev interface { + isNetdev() +} + +// NetdevVariantBridge is an implementation of Netdev. +type NetdevVariantBridge struct { + ID string `json:"id"` + Br *string `json:"br,omitempty"` + Helper *string `json:"helper,omitempty"` +} + +func (NetdevVariantBridge) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantBridge) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantBridge + }{ + NetClientDriverBridge, + s, + } + return json.Marshal(v) +} + +// NetdevVariantHubport is an implementation of Netdev. +type NetdevVariantHubport struct { + ID string `json:"id"` + Hubid int32 `json:"hubid"` + Netdev *string `json:"netdev,omitempty"` +} + +func (NetdevVariantHubport) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantHubport) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantHubport + }{ + NetClientDriverHubport, + s, + } + return json.Marshal(v) +} + +// NetdevVariantL2Tpv3 is an implementation of Netdev. +type NetdevVariantL2Tpv3 struct { + ID string `json:"id"` + Src string `json:"src"` + Dst string `json:"dst"` + Srcport *string `json:"srcport,omitempty"` + Dstport *string `json:"dstport,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + UDP *bool `json:"udp,omitempty"` + Cookie64 *bool `json:"cookie64,omitempty"` + Counter *bool `json:"counter,omitempty"` + Pincounter *bool `json:"pincounter,omitempty"` + Txcookie *uint64 `json:"txcookie,omitempty"` + Rxcookie *uint64 `json:"rxcookie,omitempty"` + Txsession uint32 `json:"txsession"` + Rxsession *uint32 `json:"rxsession,omitempty"` + Offset *uint32 `json:"offset,omitempty"` +} + +func (NetdevVariantL2Tpv3) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantL2Tpv3) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantL2Tpv3 + }{ + NetClientDriverL2Tpv3, + s, + } + return json.Marshal(v) +} + +// NetdevVariantNetmap is an implementation of Netdev. +type NetdevVariantNetmap struct { + ID string `json:"id"` + Ifname string `json:"ifname"` + Devname *string `json:"devname,omitempty"` +} + +func (NetdevVariantNetmap) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantNetmap) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantNetmap + }{ + NetClientDriverNetmap, + s, + } + return json.Marshal(v) +} + +// NetdevVariantNic is an implementation of Netdev. +type NetdevVariantNic struct { + ID string `json:"id"` + Netdev *string `json:"netdev,omitempty"` + Macaddr *string `json:"macaddr,omitempty"` + Model *string `json:"model,omitempty"` + Addr *string `json:"addr,omitempty"` + Vectors *uint32 `json:"vectors,omitempty"` +} + +func (NetdevVariantNic) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantNic) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantNic + }{ + NetClientDriverNic, + s, + } + return json.Marshal(v) +} + +// NetdevVariantSocket is an implementation of Netdev. +type NetdevVariantSocket struct { + ID string `json:"id"` + FD *string `json:"fd,omitempty"` + Listen *string `json:"listen,omitempty"` + Connect *string `json:"connect,omitempty"` + Mcast *string `json:"mcast,omitempty"` + Localaddr *string `json:"localaddr,omitempty"` + UDP *string `json:"udp,omitempty"` +} + +func (NetdevVariantSocket) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantSocket) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantSocket + }{ + NetClientDriverSocket, + s, + } + return json.Marshal(v) +} + +// NetdevVariantTap is an implementation of Netdev. +type NetdevVariantTap struct { + ID string `json:"id"` + Ifname *string `json:"ifname,omitempty"` + FD *string `json:"fd,omitempty"` + Fds *string `json:"fds,omitempty"` + Script *string `json:"script,omitempty"` + Downscript *string `json:"downscript,omitempty"` + Br *string `json:"br,omitempty"` + Helper *string `json:"helper,omitempty"` + Sndbuf *uint64 `json:"sndbuf,omitempty"` + VnetHdr *bool `json:"vnet_hdr,omitempty"` + Vhost *bool `json:"vhost,omitempty"` + Vhostfd *string `json:"vhostfd,omitempty"` + Vhostfds *string `json:"vhostfds,omitempty"` + Vhostforce *bool `json:"vhostforce,omitempty"` + Queues *uint32 `json:"queues,omitempty"` + PollUs *uint32 `json:"poll-us,omitempty"` +} + +func (NetdevVariantTap) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantTap) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantTap + }{ + NetClientDriverTap, + s, + } + return json.Marshal(v) +} + +// NetdevVariantUser is an implementation of Netdev. +type NetdevVariantUser struct { + ID string `json:"id"` + Hostname *string `json:"hostname,omitempty"` + Restrict *bool `json:"restrict,omitempty"` + Ipv4 *bool `json:"ipv4,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + IP *string `json:"ip,omitempty"` + Net *string `json:"net,omitempty"` + Host *string `json:"host,omitempty"` + Tftp *string `json:"tftp,omitempty"` + Bootfile *string `json:"bootfile,omitempty"` + Dhcpstart *string `json:"dhcpstart,omitempty"` + Dns *string `json:"dns,omitempty"` + Dnssearch []String `json:"dnssearch,omitempty"` + Domainname *string `json:"domainname,omitempty"` + Ipv6Prefix *string `json:"ipv6-prefix,omitempty"` + Ipv6Prefixlen *int64 `json:"ipv6-prefixlen,omitempty"` + Ipv6Host *string `json:"ipv6-host,omitempty"` + Ipv6Dns *string `json:"ipv6-dns,omitempty"` + Smb *string `json:"smb,omitempty"` + Smbserver *string `json:"smbserver,omitempty"` + Hostfwd []String `json:"hostfwd,omitempty"` + Guestfwd []String `json:"guestfwd,omitempty"` + TftpServerName *string `json:"tftp-server-name,omitempty"` +} + +func (NetdevVariantUser) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantUser) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantUser + }{ + NetClientDriverUser, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVde is an implementation of Netdev. +type NetdevVariantVde struct { + ID string `json:"id"` + Sock *string `json:"sock,omitempty"` + Port *uint16 `json:"port,omitempty"` + Group *string `json:"group,omitempty"` + Mode *uint16 `json:"mode,omitempty"` +} + +func (NetdevVariantVde) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVde) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVde + }{ + NetClientDriverVde, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVhostUser is an implementation of Netdev. +type NetdevVariantVhostUser struct { + ID string `json:"id"` + Chardev string `json:"chardev"` + Vhostforce *bool `json:"vhostforce,omitempty"` + Queues *int64 `json:"queues,omitempty"` +} + +func (NetdevVariantVhostUser) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVhostUser) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVhostUser + }{ + NetClientDriverVhostUser, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVhostVdpa is an implementation of Netdev. +type NetdevVariantVhostVdpa struct { + ID string `json:"id"` + Vhostdev *string `json:"vhostdev,omitempty"` + Queues *int64 `json:"queues,omitempty"` + XSvq *bool `json:"x-svq,omitempty"` +} + +func (NetdevVariantVhostVdpa) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVhostVdpa) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVhostVdpa + }{ + NetClientDriverVhostVdpa, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVmnetBridged is an implementation of Netdev. +type NetdevVariantVmnetBridged struct { + ID string `json:"id"` + Ifname string `json:"ifname"` + Isolated *bool `json:"isolated,omitempty"` +} + +func (NetdevVariantVmnetBridged) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVmnetBridged) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVmnetBridged + }{ + NetClientDriverVmnetBridged, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVmnetHost is an implementation of Netdev. +type NetdevVariantVmnetHost struct { + ID string `json:"id"` + StartAddress *string `json:"start-address,omitempty"` + EndAddress *string `json:"end-address,omitempty"` + SubnetMask *string `json:"subnet-mask,omitempty"` + Isolated *bool `json:"isolated,omitempty"` + NetUUID *string `json:"net-uuid,omitempty"` +} + +func (NetdevVariantVmnetHost) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVmnetHost) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVmnetHost + }{ + NetClientDriverVmnetHost, + s, + } + return json.Marshal(v) +} + +// NetdevVariantVmnetShared is an implementation of Netdev. +type NetdevVariantVmnetShared struct { + ID string `json:"id"` + StartAddress *string `json:"start-address,omitempty"` + EndAddress *string `json:"end-address,omitempty"` + SubnetMask *string `json:"subnet-mask,omitempty"` + Isolated *bool `json:"isolated,omitempty"` + Nat66Prefix *string `json:"nat66-prefix,omitempty"` +} + +func (NetdevVariantVmnetShared) isNetdev() {} + +// MarshalJSON implements json.Marshaler. +func (s NetdevVariantVmnetShared) MarshalJSON() ([]byte, error) { + v := struct { + Type NetClientDriver `json:"type"` + NetdevVariantVmnetShared + }{ + NetClientDriverVmnetShared, + s, + } + return json.Marshal(v) +} + +func decodeNetdev(bs json.RawMessage) (Netdev, error) { + v := struct { + Type NetClientDriver `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case NetClientDriverBridge: + var ret NetdevVariantBridge + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverHubport: + var ret NetdevVariantHubport + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverL2Tpv3: + var ret NetdevVariantL2Tpv3 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverNetmap: + var ret NetdevVariantNetmap + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverNic: + var ret NetdevVariantNic + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverSocket: + var ret NetdevVariantSocket + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverTap: + var ret NetdevVariantTap + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverUser: + var ret NetdevVariantUser + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVde: + var ret NetdevVariantVde + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVhostUser: + var ret NetdevVariantVhostUser + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVhostVdpa: + var ret NetdevVariantVhostVdpa + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVmnetBridged: + var ret NetdevVariantVmnetBridged + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVmnetHost: + var ret NetdevVariantVmnetHost + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NetClientDriverVmnetShared: + var ret NetdevVariantVmnetShared + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union Netdev", v.Type) + } +} + +// NetfilterInsert -> NetfilterInsert (enum) + +// NetfilterInsert implements the "NetfilterInsert" QMP API type. +type NetfilterInsert int + +// Known values of NetfilterInsert. +const ( + NetfilterInsertBefore NetfilterInsert = iota + NetfilterInsertBehind +) + +// String implements fmt.Stringer. +func (e NetfilterInsert) String() string { + switch e { + case NetfilterInsertBefore: + return "before" + case NetfilterInsertBehind: + return "behind" + default: + return fmt.Sprintf("NetfilterInsert(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NetfilterInsert) MarshalJSON() ([]byte, error) { + switch e { + case NetfilterInsertBefore: + return json.Marshal("before") + case NetfilterInsertBehind: + return json.Marshal("behind") + default: + return nil, fmt.Errorf("unknown enum value %q for NetfilterInsert", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NetfilterInsert) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "before": + *e = NetfilterInsertBefore + case "behind": + *e = NetfilterInsertBehind + default: + return fmt.Errorf("unknown enum value %q for NetfilterInsert", s) + } + return nil +} + +// NetworkAddressFamily -> NetworkAddressFamily (enum) + +// NetworkAddressFamily implements the "NetworkAddressFamily" QMP API type. +type NetworkAddressFamily int + +// Known values of NetworkAddressFamily. +const ( + NetworkAddressFamilyIpv4 NetworkAddressFamily = iota + NetworkAddressFamilyIpv6 + NetworkAddressFamilyUnix + NetworkAddressFamilyVsock + NetworkAddressFamilyUnknown +) + +// String implements fmt.Stringer. +func (e NetworkAddressFamily) String() string { + switch e { + case NetworkAddressFamilyIpv4: + return "ipv4" + case NetworkAddressFamilyIpv6: + return "ipv6" + case NetworkAddressFamilyUnix: + return "unix" + case NetworkAddressFamilyVsock: + return "vsock" + case NetworkAddressFamilyUnknown: + return "unknown" + default: + return fmt.Sprintf("NetworkAddressFamily(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NetworkAddressFamily) MarshalJSON() ([]byte, error) { + switch e { + case NetworkAddressFamilyIpv4: + return json.Marshal("ipv4") + case NetworkAddressFamilyIpv6: + return json.Marshal("ipv6") + case NetworkAddressFamilyUnix: + return json.Marshal("unix") + case NetworkAddressFamilyVsock: + return json.Marshal("vsock") + case NetworkAddressFamilyUnknown: + return json.Marshal("unknown") + default: + return nil, fmt.Errorf("unknown enum value %q for NetworkAddressFamily", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NetworkAddressFamily) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "ipv4": + *e = NetworkAddressFamilyIpv4 + case "ipv6": + *e = NetworkAddressFamilyIpv6 + case "unix": + *e = NetworkAddressFamilyUnix + case "vsock": + *e = NetworkAddressFamilyVsock + case "unknown": + *e = NetworkAddressFamilyUnknown + default: + return fmt.Errorf("unknown enum value %q for NetworkAddressFamily", s) + } + return nil +} + +// NewImageMode -> NewImageMode (enum) + +// NewImageMode implements the "NewImageMode" QMP API type. +type NewImageMode int + +// Known values of NewImageMode. +const ( + NewImageModeExisting NewImageMode = iota + NewImageModeAbsolutePaths +) + +// String implements fmt.Stringer. +func (e NewImageMode) String() string { + switch e { + case NewImageModeExisting: + return "existing" + case NewImageModeAbsolutePaths: + return "absolute-paths" + default: + return fmt.Sprintf("NewImageMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NewImageMode) MarshalJSON() ([]byte, error) { + switch e { + case NewImageModeExisting: + return json.Marshal("existing") + case NewImageModeAbsolutePaths: + return json.Marshal("absolute-paths") + default: + return nil, fmt.Errorf("unknown enum value %q for NewImageMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NewImageMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "existing": + *e = NewImageModeExisting + case "absolute-paths": + *e = NewImageModeAbsolutePaths + default: + return fmt.Errorf("unknown enum value %q for NewImageMode", s) + } + return nil +} + +// NumaOptions -> NumaOptions (flat union) + +// NumaOptions implements the "NumaOptions" QMP API type. +// +// Can be one of: +// - NumaOptionsVariantCPU +// - NumaOptionsVariantDist +// - NumaOptionsVariantHmatCache +// - NumaOptionsVariantHmatLb +// - NumaOptionsVariantNode +type NumaOptions interface { + isNumaOptions() +} + +// NumaOptionsVariantCPU is an implementation of NumaOptions. +type NumaOptionsVariantCPU struct { +} + +func (NumaOptionsVariantCPU) isNumaOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s NumaOptionsVariantCPU) MarshalJSON() ([]byte, error) { + v := struct { + Type NumaOptionsType `json:"type"` + NumaOptionsVariantCPU + }{ + NumaOptionsTypeCPU, + s, + } + return json.Marshal(v) +} + +// NumaOptionsVariantDist is an implementation of NumaOptions. +type NumaOptionsVariantDist struct { + Src uint16 `json:"src"` + Dst uint16 `json:"dst"` + Val uint8 `json:"val"` +} + +func (NumaOptionsVariantDist) isNumaOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s NumaOptionsVariantDist) MarshalJSON() ([]byte, error) { + v := struct { + Type NumaOptionsType `json:"type"` + NumaOptionsVariantDist + }{ + NumaOptionsTypeDist, + s, + } + return json.Marshal(v) +} + +// NumaOptionsVariantHmatCache is an implementation of NumaOptions. +type NumaOptionsVariantHmatCache struct { + NodeID uint32 `json:"node-id"` + Size uint64 `json:"size"` + Level uint8 `json:"level"` + Associativity HmatCacheAssociativity `json:"associativity"` + Policy HmatCacheWritePolicy `json:"policy"` + Line uint16 `json:"line"` +} + +func (NumaOptionsVariantHmatCache) isNumaOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s NumaOptionsVariantHmatCache) MarshalJSON() ([]byte, error) { + v := struct { + Type NumaOptionsType `json:"type"` + NumaOptionsVariantHmatCache + }{ + NumaOptionsTypeHmatCache, + s, + } + return json.Marshal(v) +} + +// NumaOptionsVariantHmatLb is an implementation of NumaOptions. +type NumaOptionsVariantHmatLb struct { + Initiator uint16 `json:"initiator"` + Target uint16 `json:"target"` + Hierarchy HmatLbMemoryHierarchy `json:"hierarchy"` + DataType HmatLbDataType `json:"data-type"` + Latency *uint64 `json:"latency,omitempty"` + Bandwidth *uint64 `json:"bandwidth,omitempty"` +} + +func (NumaOptionsVariantHmatLb) isNumaOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s NumaOptionsVariantHmatLb) MarshalJSON() ([]byte, error) { + v := struct { + Type NumaOptionsType `json:"type"` + NumaOptionsVariantHmatLb + }{ + NumaOptionsTypeHmatLb, + s, + } + return json.Marshal(v) +} + +// NumaOptionsVariantNode is an implementation of NumaOptions. +type NumaOptionsVariantNode struct { + Nodeid *uint16 `json:"nodeid,omitempty"` + Cpus []uint16 `json:"cpus,omitempty"` + Mem *uint64 `json:"mem,omitempty"` + Memdev *string `json:"memdev,omitempty"` + Initiator *uint16 `json:"initiator,omitempty"` +} + +func (NumaOptionsVariantNode) isNumaOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s NumaOptionsVariantNode) MarshalJSON() ([]byte, error) { + v := struct { + Type NumaOptionsType `json:"type"` + NumaOptionsVariantNode + }{ + NumaOptionsTypeNode, + s, + } + return json.Marshal(v) +} + +func decodeNumaOptions(bs json.RawMessage) (NumaOptions, error) { + v := struct { + Type NumaOptionsType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case NumaOptionsTypeCPU: + var ret NumaOptionsVariantCPU + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NumaOptionsTypeDist: + var ret NumaOptionsVariantDist + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NumaOptionsTypeHmatCache: + var ret NumaOptionsVariantHmatCache + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NumaOptionsTypeHmatLb: + var ret NumaOptionsVariantHmatLb + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case NumaOptionsTypeNode: + var ret NumaOptionsVariantNode + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union NumaOptions", v.Type) + } +} + +// NumaOptionsType -> NumaOptionsType (enum) + +// NumaOptionsType implements the "NumaOptionsType" QMP API type. +type NumaOptionsType int + +// Known values of NumaOptionsType. +const ( + NumaOptionsTypeNode NumaOptionsType = iota + NumaOptionsTypeDist + NumaOptionsTypeCPU + NumaOptionsTypeHmatLb + NumaOptionsTypeHmatCache +) + +// String implements fmt.Stringer. +func (e NumaOptionsType) String() string { + switch e { + case NumaOptionsTypeNode: + return "node" + case NumaOptionsTypeDist: + return "dist" + case NumaOptionsTypeCPU: + return "cpu" + case NumaOptionsTypeHmatLb: + return "hmat-lb" + case NumaOptionsTypeHmatCache: + return "hmat-cache" + default: + return fmt.Sprintf("NumaOptionsType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e NumaOptionsType) MarshalJSON() ([]byte, error) { + switch e { + case NumaOptionsTypeNode: + return json.Marshal("node") + case NumaOptionsTypeDist: + return json.Marshal("dist") + case NumaOptionsTypeCPU: + return json.Marshal("cpu") + case NumaOptionsTypeHmatLb: + return json.Marshal("hmat-lb") + case NumaOptionsTypeHmatCache: + return json.Marshal("hmat-cache") + default: + return nil, fmt.Errorf("unknown enum value %q for NumaOptionsType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *NumaOptionsType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "node": + *e = NumaOptionsTypeNode + case "dist": + *e = NumaOptionsTypeDist + case "cpu": + *e = NumaOptionsTypeCPU + case "hmat-lb": + *e = NumaOptionsTypeHmatLb + case "hmat-cache": + *e = NumaOptionsTypeHmatCache + default: + return fmt.Errorf("unknown enum value %q for NumaOptionsType", s) + } + return nil +} + +// ObjectOptions -> ObjectOptions (flat union) + +// ObjectOptions implements the "ObjectOptions" QMP API type. +// +// Can be one of: +// - ObjectOptionsVariantAuthzList +// - ObjectOptionsVariantAuthzListfile +// - ObjectOptionsVariantAuthzPam +// - ObjectOptionsVariantAuthzSimple +// - ObjectOptionsVariantCanHostSocketcan +// - ObjectOptionsVariantColoCompare +// - ObjectOptionsVariantCryptodevBackend +// - ObjectOptionsVariantCryptodevBackendBuiltin +// - ObjectOptionsVariantCryptodevVhostUser +// - ObjectOptionsVariantDbusVmstate +// - ObjectOptionsVariantFilterBuffer +// - ObjectOptionsVariantFilterDump +// - ObjectOptionsVariantFilterMirror +// - ObjectOptionsVariantFilterRedirector +// - ObjectOptionsVariantFilterReplay +// - ObjectOptionsVariantFilterRewriter +// - ObjectOptionsVariantInputBarrier +// - ObjectOptionsVariantInputLinux +// - ObjectOptionsVariantIothread +// - ObjectOptionsVariantMainLoop +// - ObjectOptionsVariantMemoryBackendEpc +// - ObjectOptionsVariantMemoryBackendFile +// - ObjectOptionsVariantMemoryBackendMemfd +// - ObjectOptionsVariantMemoryBackendRAM +// - ObjectOptionsVariantPrManagerHelper +// - ObjectOptionsVariantQtest +// - ObjectOptionsVariantRngBuiltin +// - ObjectOptionsVariantRngEgd +// - ObjectOptionsVariantRngRandom +// - ObjectOptionsVariantSecret +// - ObjectOptionsVariantSecretKeyring +// - ObjectOptionsVariantSevGuest +// - ObjectOptionsVariantThrottleGroup +// - ObjectOptionsVariantTLSCipherSuites +// - ObjectOptionsVariantTLSCredsAnon +// - ObjectOptionsVariantTLSCredsPsk +// - ObjectOptionsVariantTLSCredsX509 +// - ObjectOptionsVariantXRemoteObject +// - ObjectOptionsVariantXVfioUserServer +type ObjectOptions interface { + isObjectOptions() +} + +// ObjectOptionsVariantAuthzList is an implementation of ObjectOptions. +type ObjectOptionsVariantAuthzList struct { + ID string `json:"id"` + Policy *QAuthZListPolicy `json:"policy,omitempty"` + Rules []QAuthZListRule `json:"rules,omitempty"` +} + +func (ObjectOptionsVariantAuthzList) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantAuthzList) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantAuthzList + }{ + ObjectTypeAuthzList, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantAuthzListfile is an implementation of ObjectOptions. +type ObjectOptionsVariantAuthzListfile struct { + ID string `json:"id"` + Filename string `json:"filename"` + Refresh *bool `json:"refresh,omitempty"` +} + +func (ObjectOptionsVariantAuthzListfile) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantAuthzListfile) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantAuthzListfile + }{ + ObjectTypeAuthzListfile, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantAuthzPam is an implementation of ObjectOptions. +type ObjectOptionsVariantAuthzPam struct { + ID string `json:"id"` + Service string `json:"service"` +} + +func (ObjectOptionsVariantAuthzPam) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantAuthzPam) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantAuthzPam + }{ + ObjectTypeAuthzPam, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantAuthzSimple is an implementation of ObjectOptions. +type ObjectOptionsVariantAuthzSimple struct { + ID string `json:"id"` + Identity string `json:"identity"` +} + +func (ObjectOptionsVariantAuthzSimple) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantAuthzSimple) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantAuthzSimple + }{ + ObjectTypeAuthzSimple, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantCanHostSocketcan is an implementation of ObjectOptions. +type ObjectOptionsVariantCanHostSocketcan struct { + ID string `json:"id"` + If string `json:"if"` + Canbus string `json:"canbus"` +} + +func (ObjectOptionsVariantCanHostSocketcan) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantCanHostSocketcan) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantCanHostSocketcan + }{ + ObjectTypeCanHostSocketcan, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantColoCompare is an implementation of ObjectOptions. +type ObjectOptionsVariantColoCompare struct { + ID string `json:"id"` + PrimaryIn string `json:"primary_in"` + SecondaryIn string `json:"secondary_in"` + Outdev string `json:"outdev"` + Iothread string `json:"iothread"` + NotifyDev *string `json:"notify_dev,omitempty"` + CompareTimeout *uint64 `json:"compare_timeout,omitempty"` + ExpiredScanCycle *uint32 `json:"expired_scan_cycle,omitempty"` + MaxQueueSize *uint32 `json:"max_queue_size,omitempty"` + VnetHdrSupport *bool `json:"vnet_hdr_support,omitempty"` +} + +func (ObjectOptionsVariantColoCompare) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantColoCompare) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantColoCompare + }{ + ObjectTypeColoCompare, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantCryptodevBackend is an implementation of ObjectOptions. +type ObjectOptionsVariantCryptodevBackend struct { + ID string `json:"id"` + Queues *uint32 `json:"queues,omitempty"` +} + +func (ObjectOptionsVariantCryptodevBackend) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantCryptodevBackend) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantCryptodevBackend + }{ + ObjectTypeCryptodevBackend, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantCryptodevBackendBuiltin is an implementation of ObjectOptions. +type ObjectOptionsVariantCryptodevBackendBuiltin struct { + ID string `json:"id"` + Queues *uint32 `json:"queues,omitempty"` +} + +func (ObjectOptionsVariantCryptodevBackendBuiltin) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantCryptodevBackendBuiltin) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantCryptodevBackendBuiltin + }{ + ObjectTypeCryptodevBackendBuiltin, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantCryptodevVhostUser is an implementation of ObjectOptions. +type ObjectOptionsVariantCryptodevVhostUser struct { + ID string `json:"id"` + Chardev string `json:"chardev"` +} + +func (ObjectOptionsVariantCryptodevVhostUser) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantCryptodevVhostUser) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantCryptodevVhostUser + }{ + ObjectTypeCryptodevVhostUser, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantDbusVmstate is an implementation of ObjectOptions. +type ObjectOptionsVariantDbusVmstate struct { + ID string `json:"id"` + Addr string `json:"addr"` + IDList *string `json:"id-list,omitempty"` +} + +func (ObjectOptionsVariantDbusVmstate) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantDbusVmstate) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantDbusVmstate + }{ + ObjectTypeDbusVmstate, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterBuffer is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterBuffer struct { + ID string `json:"id"` + Interval uint32 `json:"interval"` +} + +func (ObjectOptionsVariantFilterBuffer) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterBuffer) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterBuffer + }{ + ObjectTypeFilterBuffer, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterDump is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterDump struct { + ID string `json:"id"` + File string `json:"file"` + Maxlen *uint32 `json:"maxlen,omitempty"` +} + +func (ObjectOptionsVariantFilterDump) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterDump) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterDump + }{ + ObjectTypeFilterDump, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterMirror is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterMirror struct { + ID string `json:"id"` + Outdev string `json:"outdev"` + VnetHdrSupport *bool `json:"vnet_hdr_support,omitempty"` +} + +func (ObjectOptionsVariantFilterMirror) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterMirror) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterMirror + }{ + ObjectTypeFilterMirror, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterRedirector is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterRedirector struct { + ID string `json:"id"` + Indev *string `json:"indev,omitempty"` + Outdev *string `json:"outdev,omitempty"` + VnetHdrSupport *bool `json:"vnet_hdr_support,omitempty"` +} + +func (ObjectOptionsVariantFilterRedirector) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterRedirector) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterRedirector + }{ + ObjectTypeFilterRedirector, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterReplay is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterReplay struct { + ID string `json:"id"` + Netdev string `json:"netdev"` + Queue *NetFilterDirection `json:"queue,omitempty"` + Status *string `json:"status,omitempty"` + Position *string `json:"position,omitempty"` + Insert *NetfilterInsert `json:"insert,omitempty"` +} + +func (ObjectOptionsVariantFilterReplay) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterReplay) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterReplay + }{ + ObjectTypeFilterReplay, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantFilterRewriter is an implementation of ObjectOptions. +type ObjectOptionsVariantFilterRewriter struct { + ID string `json:"id"` + VnetHdrSupport *bool `json:"vnet_hdr_support,omitempty"` +} + +func (ObjectOptionsVariantFilterRewriter) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantFilterRewriter) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantFilterRewriter + }{ + ObjectTypeFilterRewriter, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantInputBarrier is an implementation of ObjectOptions. +type ObjectOptionsVariantInputBarrier struct { + ID string `json:"id"` + Name string `json:"name"` + Server *string `json:"server,omitempty"` + Port *string `json:"port,omitempty"` + XOrigin *string `json:"x-origin,omitempty"` + YOrigin *string `json:"y-origin,omitempty"` + Width *string `json:"width,omitempty"` + Height *string `json:"height,omitempty"` +} + +func (ObjectOptionsVariantInputBarrier) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantInputBarrier) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantInputBarrier + }{ + ObjectTypeInputBarrier, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantInputLinux is an implementation of ObjectOptions. +type ObjectOptionsVariantInputLinux struct { + ID string `json:"id"` + Evdev string `json:"evdev"` + GrabAll *bool `json:"grab_all,omitempty"` + Repeat *bool `json:"repeat,omitempty"` + GrabToggle *GrabToggleKeys `json:"grab-toggle,omitempty"` +} + +func (ObjectOptionsVariantInputLinux) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantInputLinux) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantInputLinux + }{ + ObjectTypeInputLinux, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantIothread is an implementation of ObjectOptions. +type ObjectOptionsVariantIothread struct { + ID string `json:"id"` + PollMaxNs *int64 `json:"poll-max-ns,omitempty"` + PollGrow *int64 `json:"poll-grow,omitempty"` + PollShrink *int64 `json:"poll-shrink,omitempty"` +} + +func (ObjectOptionsVariantIothread) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantIothread) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantIothread + }{ + ObjectTypeIothread, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantMainLoop is an implementation of ObjectOptions. +type ObjectOptionsVariantMainLoop struct { + ID string `json:"id"` +} + +func (ObjectOptionsVariantMainLoop) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantMainLoop) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantMainLoop + }{ + ObjectTypeMainLoop, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantMemoryBackendEpc is an implementation of ObjectOptions. +type ObjectOptionsVariantMemoryBackendEpc struct { + ID string `json:"id"` +} + +func (ObjectOptionsVariantMemoryBackendEpc) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantMemoryBackendEpc) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantMemoryBackendEpc + }{ + ObjectTypeMemoryBackendEpc, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantMemoryBackendFile is an implementation of ObjectOptions. +type ObjectOptionsVariantMemoryBackendFile struct { + ID string `json:"id"` + Align *uint64 `json:"align,omitempty"` + DiscardData *bool `json:"discard-data,omitempty"` + MemPath string `json:"mem-path"` + Pmem *bool `json:"pmem,omitempty"` + Readonly *bool `json:"readonly,omitempty"` +} + +func (ObjectOptionsVariantMemoryBackendFile) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantMemoryBackendFile) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantMemoryBackendFile + }{ + ObjectTypeMemoryBackendFile, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantMemoryBackendMemfd is an implementation of ObjectOptions. +type ObjectOptionsVariantMemoryBackendMemfd struct { + ID string `json:"id"` + Hugetlb *bool `json:"hugetlb,omitempty"` + Hugetlbsize *uint64 `json:"hugetlbsize,omitempty"` + Seal *bool `json:"seal,omitempty"` +} + +func (ObjectOptionsVariantMemoryBackendMemfd) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantMemoryBackendMemfd) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantMemoryBackendMemfd + }{ + ObjectTypeMemoryBackendMemfd, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantMemoryBackendRAM is an implementation of ObjectOptions. +type ObjectOptionsVariantMemoryBackendRAM struct { + ID string `json:"id"` + Dump *bool `json:"dump,omitempty"` + HostNodes []uint16 `json:"host-nodes,omitempty"` + Merge *bool `json:"merge,omitempty"` + Policy *HostMemPolicy `json:"policy,omitempty"` + Prealloc *bool `json:"prealloc,omitempty"` + PreallocThreads *uint32 `json:"prealloc-threads,omitempty"` + Share *bool `json:"share,omitempty"` + Reserve *bool `json:"reserve,omitempty"` + Size uint64 `json:"size"` + XUseCanonicalPathForRamblockID *bool `json:"x-use-canonical-path-for-ramblock-id,omitempty"` +} + +func (ObjectOptionsVariantMemoryBackendRAM) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantMemoryBackendRAM) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantMemoryBackendRAM + }{ + ObjectTypeMemoryBackendRAM, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantPrManagerHelper is an implementation of ObjectOptions. +type ObjectOptionsVariantPrManagerHelper struct { + ID string `json:"id"` + Path string `json:"path"` +} + +func (ObjectOptionsVariantPrManagerHelper) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantPrManagerHelper) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantPrManagerHelper + }{ + ObjectTypePrManagerHelper, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantQtest is an implementation of ObjectOptions. +type ObjectOptionsVariantQtest struct { + ID string `json:"id"` + Chardev string `json:"chardev"` + Log *string `json:"log,omitempty"` +} + +func (ObjectOptionsVariantQtest) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantQtest) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantQtest + }{ + ObjectTypeQtest, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantRngBuiltin is an implementation of ObjectOptions. +type ObjectOptionsVariantRngBuiltin struct { + ID string `json:"id"` + Opened *bool `json:"opened,omitempty"` +} + +func (ObjectOptionsVariantRngBuiltin) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantRngBuiltin) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantRngBuiltin + }{ + ObjectTypeRngBuiltin, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantRngEgd is an implementation of ObjectOptions. +type ObjectOptionsVariantRngEgd struct { + ID string `json:"id"` + Chardev string `json:"chardev"` +} + +func (ObjectOptionsVariantRngEgd) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantRngEgd) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantRngEgd + }{ + ObjectTypeRngEgd, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantRngRandom is an implementation of ObjectOptions. +type ObjectOptionsVariantRngRandom struct { + ID string `json:"id"` + Filename *string `json:"filename,omitempty"` +} + +func (ObjectOptionsVariantRngRandom) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantRngRandom) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantRngRandom + }{ + ObjectTypeRngRandom, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantSecret is an implementation of ObjectOptions. +type ObjectOptionsVariantSecret struct { + ID string `json:"id"` + Data *string `json:"data,omitempty"` + File *string `json:"file,omitempty"` +} + +func (ObjectOptionsVariantSecret) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantSecret) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantSecret + }{ + ObjectTypeSecret, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantSecretKeyring is an implementation of ObjectOptions. +type ObjectOptionsVariantSecretKeyring struct { + ID string `json:"id"` + Serial int32 `json:"serial"` +} + +func (ObjectOptionsVariantSecretKeyring) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantSecretKeyring) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantSecretKeyring + }{ + ObjectTypeSecretKeyring, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantSevGuest is an implementation of ObjectOptions. +type ObjectOptionsVariantSevGuest struct { + ID string `json:"id"` + SevDevice *string `json:"sev-device,omitempty"` + DhCertFile *string `json:"dh-cert-file,omitempty"` + SessionFile *string `json:"session-file,omitempty"` + Policy *uint32 `json:"policy,omitempty"` + Handle *uint32 `json:"handle,omitempty"` + Cbitpos *uint32 `json:"cbitpos,omitempty"` + ReducedPhysBits uint32 `json:"reduced-phys-bits"` + KernelHashes *bool `json:"kernel-hashes,omitempty"` +} + +func (ObjectOptionsVariantSevGuest) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantSevGuest) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantSevGuest + }{ + ObjectTypeSevGuest, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantThrottleGroup is an implementation of ObjectOptions. +type ObjectOptionsVariantThrottleGroup struct { + ID string `json:"id"` + Limits *ThrottleLimits `json:"limits,omitempty"` + XIopsTotal *int64 `json:"x-iops-total,omitempty"` + XIopsTotalMax *int64 `json:"x-iops-total-max,omitempty"` + XIopsTotalMaxLength *int64 `json:"x-iops-total-max-length,omitempty"` + XIopsRead *int64 `json:"x-iops-read,omitempty"` + XIopsReadMax *int64 `json:"x-iops-read-max,omitempty"` + XIopsReadMaxLength *int64 `json:"x-iops-read-max-length,omitempty"` + XIopsWrite *int64 `json:"x-iops-write,omitempty"` + XIopsWriteMax *int64 `json:"x-iops-write-max,omitempty"` + XIopsWriteMaxLength *int64 `json:"x-iops-write-max-length,omitempty"` + XBpsTotal *int64 `json:"x-bps-total,omitempty"` + XBpsTotalMax *int64 `json:"x-bps-total-max,omitempty"` + XBpsTotalMaxLength *int64 `json:"x-bps-total-max-length,omitempty"` + XBpsRead *int64 `json:"x-bps-read,omitempty"` + XBpsReadMax *int64 `json:"x-bps-read-max,omitempty"` + XBpsReadMaxLength *int64 `json:"x-bps-read-max-length,omitempty"` + XBpsWrite *int64 `json:"x-bps-write,omitempty"` + XBpsWriteMax *int64 `json:"x-bps-write-max,omitempty"` + XBpsWriteMaxLength *int64 `json:"x-bps-write-max-length,omitempty"` + XIopsSize *int64 `json:"x-iops-size,omitempty"` +} + +func (ObjectOptionsVariantThrottleGroup) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantThrottleGroup) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantThrottleGroup + }{ + ObjectTypeThrottleGroup, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantTLSCipherSuites is an implementation of ObjectOptions. +type ObjectOptionsVariantTLSCipherSuites struct { + ID string `json:"id"` + VerifyPeer *bool `json:"verify-peer,omitempty"` + Dir *string `json:"dir,omitempty"` + Endpoint *QCryptoTLSCredsEndpoint `json:"endpoint,omitempty"` + Priority *string `json:"priority,omitempty"` +} + +func (ObjectOptionsVariantTLSCipherSuites) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantTLSCipherSuites) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantTLSCipherSuites + }{ + ObjectTypeTLSCipherSuites, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantTLSCredsAnon is an implementation of ObjectOptions. +type ObjectOptionsVariantTLSCredsAnon struct { + ID string `json:"id"` + Loaded *bool `json:"loaded,omitempty"` +} + +func (ObjectOptionsVariantTLSCredsAnon) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantTLSCredsAnon) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantTLSCredsAnon + }{ + ObjectTypeTLSCredsAnon, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantTLSCredsPsk is an implementation of ObjectOptions. +type ObjectOptionsVariantTLSCredsPsk struct { + ID string `json:"id"` + Loaded *bool `json:"loaded,omitempty"` + Username *string `json:"username,omitempty"` +} + +func (ObjectOptionsVariantTLSCredsPsk) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantTLSCredsPsk) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantTLSCredsPsk + }{ + ObjectTypeTLSCredsPsk, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantTLSCredsX509 is an implementation of ObjectOptions. +type ObjectOptionsVariantTLSCredsX509 struct { + ID string `json:"id"` + Loaded *bool `json:"loaded,omitempty"` + SanityCheck *bool `json:"sanity-check,omitempty"` + Passwordid *string `json:"passwordid,omitempty"` +} + +func (ObjectOptionsVariantTLSCredsX509) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantTLSCredsX509) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantTLSCredsX509 + }{ + ObjectTypeTLSCredsX509, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantXRemoteObject is an implementation of ObjectOptions. +type ObjectOptionsVariantXRemoteObject struct { + ID string `json:"id"` + FD string `json:"fd"` + Devid string `json:"devid"` +} + +func (ObjectOptionsVariantXRemoteObject) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantXRemoteObject) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantXRemoteObject + }{ + ObjectTypeXRemoteObject, + s, + } + return json.Marshal(v) +} + +// ObjectOptionsVariantXVfioUserServer is an implementation of ObjectOptions. +type ObjectOptionsVariantXVfioUserServer struct { + ID string `json:"id"` + Socket SocketAddress `json:"socket"` + Device string `json:"device"` +} + +func (ObjectOptionsVariantXVfioUserServer) isObjectOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s ObjectOptionsVariantXVfioUserServer) MarshalJSON() ([]byte, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + ObjectOptionsVariantXVfioUserServer + }{ + ObjectTypeXVfioUserServer, + s, + } + return json.Marshal(v) +} + +func decodeObjectOptions(bs json.RawMessage) (ObjectOptions, error) { + v := struct { + QomType ObjectType `json:"qom-type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.QomType { + case ObjectTypeAuthzList: + var ret ObjectOptionsVariantAuthzList + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeAuthzListfile: + var ret ObjectOptionsVariantAuthzListfile + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeAuthzPam: + var ret ObjectOptionsVariantAuthzPam + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeAuthzSimple: + var ret ObjectOptionsVariantAuthzSimple + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeCanHostSocketcan: + var ret ObjectOptionsVariantCanHostSocketcan + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeColoCompare: + var ret ObjectOptionsVariantColoCompare + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeCryptodevBackend: + var ret ObjectOptionsVariantCryptodevBackend + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeCryptodevBackendBuiltin: + var ret ObjectOptionsVariantCryptodevBackendBuiltin + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeCryptodevVhostUser: + var ret ObjectOptionsVariantCryptodevVhostUser + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeDbusVmstate: + var ret ObjectOptionsVariantDbusVmstate + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterBuffer: + var ret ObjectOptionsVariantFilterBuffer + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterDump: + var ret ObjectOptionsVariantFilterDump + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterMirror: + var ret ObjectOptionsVariantFilterMirror + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterRedirector: + var ret ObjectOptionsVariantFilterRedirector + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterReplay: + var ret ObjectOptionsVariantFilterReplay + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeFilterRewriter: + var ret ObjectOptionsVariantFilterRewriter + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeInputBarrier: + var ret ObjectOptionsVariantInputBarrier + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeInputLinux: + var ret ObjectOptionsVariantInputLinux + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeIothread: + var ret ObjectOptionsVariantIothread + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeMainLoop: + var ret ObjectOptionsVariantMainLoop + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeMemoryBackendEpc: + var ret ObjectOptionsVariantMemoryBackendEpc + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeMemoryBackendFile: + var ret ObjectOptionsVariantMemoryBackendFile + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeMemoryBackendMemfd: + var ret ObjectOptionsVariantMemoryBackendMemfd + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeMemoryBackendRAM: + var ret ObjectOptionsVariantMemoryBackendRAM + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypePrManagerHelper: + var ret ObjectOptionsVariantPrManagerHelper + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeQtest: + var ret ObjectOptionsVariantQtest + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeRngBuiltin: + var ret ObjectOptionsVariantRngBuiltin + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeRngEgd: + var ret ObjectOptionsVariantRngEgd + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeRngRandom: + var ret ObjectOptionsVariantRngRandom + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeSecret: + var ret ObjectOptionsVariantSecret + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeSecretKeyring: + var ret ObjectOptionsVariantSecretKeyring + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeSevGuest: + var ret ObjectOptionsVariantSevGuest + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeThrottleGroup: + var ret ObjectOptionsVariantThrottleGroup + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeTLSCipherSuites: + var ret ObjectOptionsVariantTLSCipherSuites + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeTLSCredsAnon: + var ret ObjectOptionsVariantTLSCredsAnon + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeTLSCredsPsk: + var ret ObjectOptionsVariantTLSCredsPsk + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeTLSCredsX509: + var ret ObjectOptionsVariantTLSCredsX509 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeXRemoteObject: + var ret ObjectOptionsVariantXRemoteObject + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case ObjectTypeXVfioUserServer: + var ret ObjectOptionsVariantXVfioUserServer + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union ObjectOptions", v.QomType) + } +} + +// ObjectPropertyInfo -> ObjectPropertyInfo (struct) + +// ObjectPropertyInfo implements the "ObjectPropertyInfo" QMP API type. +type ObjectPropertyInfo struct { + Name string `json:"name"` + Type string `json:"type"` + Description *string `json:"description,omitempty"` + DefaultValue *interface{} `json:"default-value,omitempty"` +} + +// ObjectType -> ObjectType (enum) + +// ObjectType implements the "ObjectType" QMP API type. +type ObjectType int + +// Known values of ObjectType. +const ( + ObjectTypeAuthzList ObjectType = iota + ObjectTypeAuthzListfile + ObjectTypeAuthzPam + ObjectTypeAuthzSimple + ObjectTypeCanBus + ObjectTypeCanHostSocketcan + ObjectTypeColoCompare + ObjectTypeCryptodevBackend + ObjectTypeCryptodevBackendBuiltin + ObjectTypeCryptodevVhostUser + ObjectTypeDbusVmstate + ObjectTypeFilterBuffer + ObjectTypeFilterDump + ObjectTypeFilterMirror + ObjectTypeFilterRedirector + ObjectTypeFilterReplay + ObjectTypeFilterRewriter + ObjectTypeInputBarrier + ObjectTypeInputLinux + ObjectTypeIothread + ObjectTypeMainLoop + ObjectTypeMemoryBackendEpc + ObjectTypeMemoryBackendFile + ObjectTypeMemoryBackendMemfd + ObjectTypeMemoryBackendRAM + ObjectTypePefGuest + ObjectTypePrManagerHelper + ObjectTypeQtest + ObjectTypeRngBuiltin + ObjectTypeRngEgd + ObjectTypeRngRandom + ObjectTypeSecret + ObjectTypeSecretKeyring + ObjectTypeSevGuest + ObjectTypeS390PvGuest + ObjectTypeThrottleGroup + ObjectTypeTLSCredsAnon + ObjectTypeTLSCredsPsk + ObjectTypeTLSCredsX509 + ObjectTypeTLSCipherSuites + ObjectTypeXRemoteObject + ObjectTypeXVfioUserServer +) + +// String implements fmt.Stringer. +func (e ObjectType) String() string { + switch e { + case ObjectTypeAuthzList: + return "authz-list" + case ObjectTypeAuthzListfile: + return "authz-listfile" + case ObjectTypeAuthzPam: + return "authz-pam" + case ObjectTypeAuthzSimple: + return "authz-simple" + case ObjectTypeCanBus: + return "can-bus" + case ObjectTypeCanHostSocketcan: + return "can-host-socketcan" + case ObjectTypeColoCompare: + return "colo-compare" + case ObjectTypeCryptodevBackend: + return "cryptodev-backend" + case ObjectTypeCryptodevBackendBuiltin: + return "cryptodev-backend-builtin" + case ObjectTypeCryptodevVhostUser: + return "cryptodev-vhost-user" + case ObjectTypeDbusVmstate: + return "dbus-vmstate" + case ObjectTypeFilterBuffer: + return "filter-buffer" + case ObjectTypeFilterDump: + return "filter-dump" + case ObjectTypeFilterMirror: + return "filter-mirror" + case ObjectTypeFilterRedirector: + return "filter-redirector" + case ObjectTypeFilterReplay: + return "filter-replay" + case ObjectTypeFilterRewriter: + return "filter-rewriter" + case ObjectTypeInputBarrier: + return "input-barrier" + case ObjectTypeInputLinux: + return "input-linux" + case ObjectTypeIothread: + return "iothread" + case ObjectTypeMainLoop: + return "main-loop" + case ObjectTypeMemoryBackendEpc: + return "memory-backend-epc" + case ObjectTypeMemoryBackendFile: + return "memory-backend-file" + case ObjectTypeMemoryBackendMemfd: + return "memory-backend-memfd" + case ObjectTypeMemoryBackendRAM: + return "memory-backend-ram" + case ObjectTypePefGuest: + return "pef-guest" + case ObjectTypePrManagerHelper: + return "pr-manager-helper" + case ObjectTypeQtest: + return "qtest" + case ObjectTypeRngBuiltin: + return "rng-builtin" + case ObjectTypeRngEgd: + return "rng-egd" + case ObjectTypeRngRandom: + return "rng-random" + case ObjectTypeSecret: + return "secret" + case ObjectTypeSecretKeyring: + return "secret_keyring" + case ObjectTypeSevGuest: + return "sev-guest" + case ObjectTypeS390PvGuest: + return "s390-pv-guest" + case ObjectTypeThrottleGroup: + return "throttle-group" + case ObjectTypeTLSCredsAnon: + return "tls-creds-anon" + case ObjectTypeTLSCredsPsk: + return "tls-creds-psk" + case ObjectTypeTLSCredsX509: + return "tls-creds-x509" + case ObjectTypeTLSCipherSuites: + return "tls-cipher-suites" + case ObjectTypeXRemoteObject: + return "x-remote-object" + case ObjectTypeXVfioUserServer: + return "x-vfio-user-server" + default: + return fmt.Sprintf("ObjectType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ObjectType) MarshalJSON() ([]byte, error) { + switch e { + case ObjectTypeAuthzList: + return json.Marshal("authz-list") + case ObjectTypeAuthzListfile: + return json.Marshal("authz-listfile") + case ObjectTypeAuthzPam: + return json.Marshal("authz-pam") + case ObjectTypeAuthzSimple: + return json.Marshal("authz-simple") + case ObjectTypeCanBus: + return json.Marshal("can-bus") + case ObjectTypeCanHostSocketcan: + return json.Marshal("can-host-socketcan") + case ObjectTypeColoCompare: + return json.Marshal("colo-compare") + case ObjectTypeCryptodevBackend: + return json.Marshal("cryptodev-backend") + case ObjectTypeCryptodevBackendBuiltin: + return json.Marshal("cryptodev-backend-builtin") + case ObjectTypeCryptodevVhostUser: + return json.Marshal("cryptodev-vhost-user") + case ObjectTypeDbusVmstate: + return json.Marshal("dbus-vmstate") + case ObjectTypeFilterBuffer: + return json.Marshal("filter-buffer") + case ObjectTypeFilterDump: + return json.Marshal("filter-dump") + case ObjectTypeFilterMirror: + return json.Marshal("filter-mirror") + case ObjectTypeFilterRedirector: + return json.Marshal("filter-redirector") + case ObjectTypeFilterReplay: + return json.Marshal("filter-replay") + case ObjectTypeFilterRewriter: + return json.Marshal("filter-rewriter") + case ObjectTypeInputBarrier: + return json.Marshal("input-barrier") + case ObjectTypeInputLinux: + return json.Marshal("input-linux") + case ObjectTypeIothread: + return json.Marshal("iothread") + case ObjectTypeMainLoop: + return json.Marshal("main-loop") + case ObjectTypeMemoryBackendEpc: + return json.Marshal("memory-backend-epc") + case ObjectTypeMemoryBackendFile: + return json.Marshal("memory-backend-file") + case ObjectTypeMemoryBackendMemfd: + return json.Marshal("memory-backend-memfd") + case ObjectTypeMemoryBackendRAM: + return json.Marshal("memory-backend-ram") + case ObjectTypePefGuest: + return json.Marshal("pef-guest") + case ObjectTypePrManagerHelper: + return json.Marshal("pr-manager-helper") + case ObjectTypeQtest: + return json.Marshal("qtest") + case ObjectTypeRngBuiltin: + return json.Marshal("rng-builtin") + case ObjectTypeRngEgd: + return json.Marshal("rng-egd") + case ObjectTypeRngRandom: + return json.Marshal("rng-random") + case ObjectTypeSecret: + return json.Marshal("secret") + case ObjectTypeSecretKeyring: + return json.Marshal("secret_keyring") + case ObjectTypeSevGuest: + return json.Marshal("sev-guest") + case ObjectTypeS390PvGuest: + return json.Marshal("s390-pv-guest") + case ObjectTypeThrottleGroup: + return json.Marshal("throttle-group") + case ObjectTypeTLSCredsAnon: + return json.Marshal("tls-creds-anon") + case ObjectTypeTLSCredsPsk: + return json.Marshal("tls-creds-psk") + case ObjectTypeTLSCredsX509: + return json.Marshal("tls-creds-x509") + case ObjectTypeTLSCipherSuites: + return json.Marshal("tls-cipher-suites") + case ObjectTypeXRemoteObject: + return json.Marshal("x-remote-object") + case ObjectTypeXVfioUserServer: + return json.Marshal("x-vfio-user-server") + default: + return nil, fmt.Errorf("unknown enum value %q for ObjectType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ObjectType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "authz-list": + *e = ObjectTypeAuthzList + case "authz-listfile": + *e = ObjectTypeAuthzListfile + case "authz-pam": + *e = ObjectTypeAuthzPam + case "authz-simple": + *e = ObjectTypeAuthzSimple + case "can-bus": + *e = ObjectTypeCanBus + case "can-host-socketcan": + *e = ObjectTypeCanHostSocketcan + case "colo-compare": + *e = ObjectTypeColoCompare + case "cryptodev-backend": + *e = ObjectTypeCryptodevBackend + case "cryptodev-backend-builtin": + *e = ObjectTypeCryptodevBackendBuiltin + case "cryptodev-vhost-user": + *e = ObjectTypeCryptodevVhostUser + case "dbus-vmstate": + *e = ObjectTypeDbusVmstate + case "filter-buffer": + *e = ObjectTypeFilterBuffer + case "filter-dump": + *e = ObjectTypeFilterDump + case "filter-mirror": + *e = ObjectTypeFilterMirror + case "filter-redirector": + *e = ObjectTypeFilterRedirector + case "filter-replay": + *e = ObjectTypeFilterReplay + case "filter-rewriter": + *e = ObjectTypeFilterRewriter + case "input-barrier": + *e = ObjectTypeInputBarrier + case "input-linux": + *e = ObjectTypeInputLinux + case "iothread": + *e = ObjectTypeIothread + case "main-loop": + *e = ObjectTypeMainLoop + case "memory-backend-epc": + *e = ObjectTypeMemoryBackendEpc + case "memory-backend-file": + *e = ObjectTypeMemoryBackendFile + case "memory-backend-memfd": + *e = ObjectTypeMemoryBackendMemfd + case "memory-backend-ram": + *e = ObjectTypeMemoryBackendRAM + case "pef-guest": + *e = ObjectTypePefGuest + case "pr-manager-helper": + *e = ObjectTypePrManagerHelper + case "qtest": + *e = ObjectTypeQtest + case "rng-builtin": + *e = ObjectTypeRngBuiltin + case "rng-egd": + *e = ObjectTypeRngEgd + case "rng-random": + *e = ObjectTypeRngRandom + case "secret": + *e = ObjectTypeSecret + case "secret_keyring": + *e = ObjectTypeSecretKeyring + case "sev-guest": + *e = ObjectTypeSevGuest + case "s390-pv-guest": + *e = ObjectTypeS390PvGuest + case "throttle-group": + *e = ObjectTypeThrottleGroup + case "tls-creds-anon": + *e = ObjectTypeTLSCredsAnon + case "tls-creds-psk": + *e = ObjectTypeTLSCredsPsk + case "tls-creds-x509": + *e = ObjectTypeTLSCredsX509 + case "tls-cipher-suites": + *e = ObjectTypeTLSCipherSuites + case "x-remote-object": + *e = ObjectTypeXRemoteObject + case "x-vfio-user-server": + *e = ObjectTypeXVfioUserServer + default: + return fmt.Errorf("unknown enum value %q for ObjectType", s) + } + return nil +} + +// ObjectTypeInfo -> ObjectTypeInfo (struct) + +// ObjectTypeInfo implements the "ObjectTypeInfo" QMP API type. +type ObjectTypeInfo struct { + Name string `json:"name"` + Abstract *bool `json:"abstract,omitempty"` + Parent *string `json:"parent,omitempty"` +} + +// OnCbwError -> OnCbwError (enum) + +// OnCbwError implements the "OnCbwError" QMP API type. +type OnCbwError int + +// Known values of OnCbwError. +const ( + OnCbwErrorBreakGuestWrite OnCbwError = iota + OnCbwErrorBreakSnapshot +) + +// String implements fmt.Stringer. +func (e OnCbwError) String() string { + switch e { + case OnCbwErrorBreakGuestWrite: + return "break-guest-write" + case OnCbwErrorBreakSnapshot: + return "break-snapshot" + default: + return fmt.Sprintf("OnCbwError(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e OnCbwError) MarshalJSON() ([]byte, error) { + switch e { + case OnCbwErrorBreakGuestWrite: + return json.Marshal("break-guest-write") + case OnCbwErrorBreakSnapshot: + return json.Marshal("break-snapshot") + default: + return nil, fmt.Errorf("unknown enum value %q for OnCbwError", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *OnCbwError) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "break-guest-write": + *e = OnCbwErrorBreakGuestWrite + case "break-snapshot": + *e = OnCbwErrorBreakSnapshot + default: + return fmt.Errorf("unknown enum value %q for OnCbwError", s) + } + return nil +} + +// OnOffAuto -> OnOffAuto (enum) + +// OnOffAuto implements the "OnOffAuto" QMP API type. +type OnOffAuto int + +// Known values of OnOffAuto. +const ( + OnOffAutoAuto OnOffAuto = iota + OnOffAutoOn + OnOffAutoOff +) + +// String implements fmt.Stringer. +func (e OnOffAuto) String() string { + switch e { + case OnOffAutoAuto: + return "auto" + case OnOffAutoOn: + return "on" + case OnOffAutoOff: + return "off" + default: + return fmt.Sprintf("OnOffAuto(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e OnOffAuto) MarshalJSON() ([]byte, error) { + switch e { + case OnOffAutoAuto: + return json.Marshal("auto") + case OnOffAutoOn: + return json.Marshal("on") + case OnOffAutoOff: + return json.Marshal("off") + default: + return nil, fmt.Errorf("unknown enum value %q for OnOffAuto", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *OnOffAuto) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "auto": + *e = OnOffAutoAuto + case "on": + *e = OnOffAutoOn + case "off": + *e = OnOffAutoOff + default: + return fmt.Errorf("unknown enum value %q for OnOffAuto", s) + } + return nil +} + +// PCDIMMDeviceInfo -> PcdimmDeviceInfo (struct) + +// PcdimmDeviceInfo implements the "PCDIMMDeviceInfo" QMP API type. +type PcdimmDeviceInfo struct { + ID *string `json:"id,omitempty"` + Addr int64 `json:"addr"` + Size int64 `json:"size"` + Slot int64 `json:"slot"` + Node int64 `json:"node"` + Memdev string `json:"memdev"` + Hotplugged bool `json:"hotplugged"` + Hotpluggable bool `json:"hotpluggable"` +} + +// EVENT POWERDOWN + +// PRManagerInfo -> PrManagerInfo (struct) + +// PrManagerInfo implements the "PRManagerInfo" QMP API type. +type PrManagerInfo struct { + ID string `json:"id"` + Connected bool `json:"connected"` +} + +// EVENT PR_MANAGER_STATUS_CHANGED + +// PanicAction -> PanicAction (enum) + +// PanicAction implements the "PanicAction" QMP API type. +type PanicAction int + +// Known values of PanicAction. +const ( + PanicActionPause PanicAction = iota + PanicActionShutdown + PanicActionExitFailure + PanicActionNone +) + +// String implements fmt.Stringer. +func (e PanicAction) String() string { + switch e { + case PanicActionPause: + return "pause" + case PanicActionShutdown: + return "shutdown" + case PanicActionExitFailure: + return "exit-failure" + case PanicActionNone: + return "none" + default: + return fmt.Sprintf("PanicAction(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e PanicAction) MarshalJSON() ([]byte, error) { + switch e { + case PanicActionPause: + return json.Marshal("pause") + case PanicActionShutdown: + return json.Marshal("shutdown") + case PanicActionExitFailure: + return json.Marshal("exit-failure") + case PanicActionNone: + return json.Marshal("none") + default: + return nil, fmt.Errorf("unknown enum value %q for PanicAction", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *PanicAction) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "pause": + *e = PanicActionPause + case "shutdown": + *e = PanicActionShutdown + case "exit-failure": + *e = PanicActionExitFailure + case "none": + *e = PanicActionNone + default: + return fmt.Errorf("unknown enum value %q for PanicAction", s) + } + return nil +} + +// PciBridgeInfo -> PCIBridgeInfo (struct) + +// PCIBridgeInfo implements the "PciBridgeInfo" QMP API type. +type PCIBridgeInfo struct { + Bus PCIBusInfo `json:"bus"` + Devices []PCIDeviceInfo `json:"devices,omitempty"` +} + +// PciBusInfo -> PCIBusInfo (struct) + +// PCIBusInfo implements the "PciBusInfo" QMP API type. +type PCIBusInfo struct { + Number int64 `json:"number"` + Secondary int64 `json:"secondary"` + Subordinate int64 `json:"subordinate"` + IORange PCIMemoryRange `json:"io_range"` + MemoryRange PCIMemoryRange `json:"memory_range"` + PrefetchableRange PCIMemoryRange `json:"prefetchable_range"` +} + +// PciDeviceClass -> PCIDeviceClass (struct) + +// PCIDeviceClass implements the "PciDeviceClass" QMP API type. +type PCIDeviceClass struct { + Desc *string `json:"desc,omitempty"` + Class int64 `json:"class"` +} + +// PciDeviceId -> PCIDeviceID (struct) + +// PCIDeviceID implements the "PciDeviceId" QMP API type. +type PCIDeviceID struct { + Device int64 `json:"device"` + Vendor int64 `json:"vendor"` + Subsystem *int64 `json:"subsystem,omitempty"` + SubsystemVendor *int64 `json:"subsystem-vendor,omitempty"` +} + +// PciDeviceInfo -> PCIDeviceInfo (struct) + +// PCIDeviceInfo implements the "PciDeviceInfo" QMP API type. +type PCIDeviceInfo struct { + Bus int64 `json:"bus"` + Slot int64 `json:"slot"` + Function int64 `json:"function"` + ClassInfo PCIDeviceClass `json:"class_info"` + ID PCIDeviceID `json:"id"` + Irq *int64 `json:"irq,omitempty"` + IrqPin int64 `json:"irq_pin"` + QdevID string `json:"qdev_id"` + PCIBridge *PCIBridgeInfo `json:"pci_bridge,omitempty"` + Regions []PCIMemoryRegion `json:"regions"` +} + +// PciInfo -> PCIInfo (struct) + +// PCIInfo implements the "PciInfo" QMP API type. +type PCIInfo struct { + Bus int64 `json:"bus"` + Devices []PCIDeviceInfo `json:"devices"` +} + +// PciMemoryRange -> PCIMemoryRange (struct) + +// PCIMemoryRange implements the "PciMemoryRange" QMP API type. +type PCIMemoryRange struct { + Base int64 `json:"base"` + Limit int64 `json:"limit"` +} + +// PciMemoryRegion -> PCIMemoryRegion (struct) + +// PCIMemoryRegion implements the "PciMemoryRegion" QMP API type. +type PCIMemoryRegion struct { + Bar int64 `json:"bar"` + Type string `json:"type"` + Address int64 `json:"address"` + Size int64 `json:"size"` + Prefetch *bool `json:"prefetch,omitempty"` + MemType64 *bool `json:"mem_type_64,omitempty"` +} + +// PreallocMode -> PreallocMode (enum) + +// PreallocMode implements the "PreallocMode" QMP API type. +type PreallocMode int + +// Known values of PreallocMode. +const ( + PreallocModeOff PreallocMode = iota + PreallocModeMetadata + PreallocModeFalloc + PreallocModeFull +) + +// String implements fmt.Stringer. +func (e PreallocMode) String() string { + switch e { + case PreallocModeOff: + return "off" + case PreallocModeMetadata: + return "metadata" + case PreallocModeFalloc: + return "falloc" + case PreallocModeFull: + return "full" + default: + return fmt.Sprintf("PreallocMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e PreallocMode) MarshalJSON() ([]byte, error) { + switch e { + case PreallocModeOff: + return json.Marshal("off") + case PreallocModeMetadata: + return json.Marshal("metadata") + case PreallocModeFalloc: + return json.Marshal("falloc") + case PreallocModeFull: + return json.Marshal("full") + default: + return nil, fmt.Errorf("unknown enum value %q for PreallocMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *PreallocMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "off": + *e = PreallocModeOff + case "metadata": + *e = PreallocModeMetadata + case "falloc": + *e = PreallocModeFalloc + case "full": + *e = PreallocModeFull + default: + return fmt.Errorf("unknown enum value %q for PreallocMode", s) + } + return nil +} + +// QAuthZListFormat -> QAuthZListFormat (enum) + +// QAuthZListFormat implements the "QAuthZListFormat" QMP API type. +type QAuthZListFormat int + +// Known values of QAuthZListFormat. +const ( + QAuthZListFormatExact QAuthZListFormat = iota + QAuthZListFormatGlob +) + +// String implements fmt.Stringer. +func (e QAuthZListFormat) String() string { + switch e { + case QAuthZListFormatExact: + return "exact" + case QAuthZListFormatGlob: + return "glob" + default: + return fmt.Sprintf("QAuthZListFormat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QAuthZListFormat) MarshalJSON() ([]byte, error) { + switch e { + case QAuthZListFormatExact: + return json.Marshal("exact") + case QAuthZListFormatGlob: + return json.Marshal("glob") + default: + return nil, fmt.Errorf("unknown enum value %q for QAuthZListFormat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QAuthZListFormat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "exact": + *e = QAuthZListFormatExact + case "glob": + *e = QAuthZListFormatGlob + default: + return fmt.Errorf("unknown enum value %q for QAuthZListFormat", s) + } + return nil +} + +// QAuthZListPolicy -> QAuthZListPolicy (enum) + +// QAuthZListPolicy implements the "QAuthZListPolicy" QMP API type. +type QAuthZListPolicy int + +// Known values of QAuthZListPolicy. +const ( + QAuthZListPolicyDeny QAuthZListPolicy = iota + QAuthZListPolicyAllow +) + +// String implements fmt.Stringer. +func (e QAuthZListPolicy) String() string { + switch e { + case QAuthZListPolicyDeny: + return "deny" + case QAuthZListPolicyAllow: + return "allow" + default: + return fmt.Sprintf("QAuthZListPolicy(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QAuthZListPolicy) MarshalJSON() ([]byte, error) { + switch e { + case QAuthZListPolicyDeny: + return json.Marshal("deny") + case QAuthZListPolicyAllow: + return json.Marshal("allow") + default: + return nil, fmt.Errorf("unknown enum value %q for QAuthZListPolicy", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QAuthZListPolicy) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "deny": + *e = QAuthZListPolicyDeny + case "allow": + *e = QAuthZListPolicyAllow + default: + return fmt.Errorf("unknown enum value %q for QAuthZListPolicy", s) + } + return nil +} + +// QAuthZListRule -> QAuthZListRule (struct) + +// QAuthZListRule implements the "QAuthZListRule" QMP API type. +type QAuthZListRule struct { + Match string `json:"match"` + Policy QAuthZListPolicy `json:"policy"` + Format *QAuthZListFormat `json:"format,omitempty"` +} + +// QCryptoBlockAmendOptions -> QCryptoBlockAmendOptions (flat union) + +// QCryptoBlockAmendOptions implements the "QCryptoBlockAmendOptions" QMP API type. +// +// Can be one of: +// - QCryptoBlockAmendOptionsVariantLUKS +type QCryptoBlockAmendOptions interface { + isQCryptoBlockAmendOptions() +} + +// QCryptoBlockAmendOptionsVariantLUKS is an implementation of QCryptoBlockAmendOptions. +type QCryptoBlockAmendOptionsVariantLUKS struct { + State QCryptoBlockLUKSKeyslotState `json:"state"` + NewSecret *string `json:"new-secret,omitempty"` + OldSecret *string `json:"old-secret,omitempty"` + Keyslot *int64 `json:"keyslot,omitempty"` + IterTime *int64 `json:"iter-time,omitempty"` + Secret *string `json:"secret,omitempty"` +} + +func (QCryptoBlockAmendOptionsVariantLUKS) isQCryptoBlockAmendOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s QCryptoBlockAmendOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Format QCryptoBlockFormat `json:"format"` + QCryptoBlockAmendOptionsVariantLUKS + }{ + QCryptoBlockFormatLUKS, + s, + } + return json.Marshal(v) +} + +func decodeQCryptoBlockAmendOptions(bs json.RawMessage) (QCryptoBlockAmendOptions, error) { + v := struct { + Format QCryptoBlockFormat `json:"format"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Format { + case QCryptoBlockFormatLUKS: + var ret QCryptoBlockAmendOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union QCryptoBlockAmendOptions", v.Format) + } +} + +// QCryptoBlockCreateOptions -> QCryptoBlockCreateOptions (flat union) + +// QCryptoBlockCreateOptions implements the "QCryptoBlockCreateOptions" QMP API type. +// +// Can be one of: +// - QCryptoBlockCreateOptionsVariantLUKS +// - QCryptoBlockCreateOptionsVariantQcow +type QCryptoBlockCreateOptions interface { + isQCryptoBlockCreateOptions() +} + +// QCryptoBlockCreateOptionsVariantLUKS is an implementation of QCryptoBlockCreateOptions. +type QCryptoBlockCreateOptionsVariantLUKS struct { + CipherAlg *QCryptoCipherAlgorithm `json:"cipher-alg,omitempty"` + CipherMode *QCryptoCipherMode `json:"cipher-mode,omitempty"` + IvgenAlg *QCryptoIvGenAlgorithm `json:"ivgen-alg,omitempty"` + IvgenHashAlg *QCryptoHashAlgorithm `json:"ivgen-hash-alg,omitempty"` + HashAlg *QCryptoHashAlgorithm `json:"hash-alg,omitempty"` + IterTime *int64 `json:"iter-time,omitempty"` +} + +func (QCryptoBlockCreateOptionsVariantLUKS) isQCryptoBlockCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s QCryptoBlockCreateOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Format QCryptoBlockFormat `json:"format"` + QCryptoBlockCreateOptionsVariantLUKS + }{ + QCryptoBlockFormatLUKS, + s, + } + return json.Marshal(v) +} + +// QCryptoBlockCreateOptionsVariantQcow is an implementation of QCryptoBlockCreateOptions. +type QCryptoBlockCreateOptionsVariantQcow struct { + KeySecret *string `json:"key-secret,omitempty"` +} + +func (QCryptoBlockCreateOptionsVariantQcow) isQCryptoBlockCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s QCryptoBlockCreateOptionsVariantQcow) MarshalJSON() ([]byte, error) { + v := struct { + Format QCryptoBlockFormat `json:"format"` + QCryptoBlockCreateOptionsVariantQcow + }{ + QCryptoBlockFormatQcow, + s, + } + return json.Marshal(v) +} + +func decodeQCryptoBlockCreateOptions(bs json.RawMessage) (QCryptoBlockCreateOptions, error) { + v := struct { + Format QCryptoBlockFormat `json:"format"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Format { + case QCryptoBlockFormatLUKS: + var ret QCryptoBlockCreateOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case QCryptoBlockFormatQcow: + var ret QCryptoBlockCreateOptionsVariantQcow + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union QCryptoBlockCreateOptions", v.Format) + } +} + +// QCryptoBlockFormat -> QCryptoBlockFormat (enum) + +// QCryptoBlockFormat implements the "QCryptoBlockFormat" QMP API type. +type QCryptoBlockFormat int + +// Known values of QCryptoBlockFormat. +const ( + QCryptoBlockFormatQcow QCryptoBlockFormat = iota + QCryptoBlockFormatLUKS +) + +// String implements fmt.Stringer. +func (e QCryptoBlockFormat) String() string { + switch e { + case QCryptoBlockFormatQcow: + return "qcow" + case QCryptoBlockFormatLUKS: + return "luks" + default: + return fmt.Sprintf("QCryptoBlockFormat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoBlockFormat) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoBlockFormatQcow: + return json.Marshal("qcow") + case QCryptoBlockFormatLUKS: + return json.Marshal("luks") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoBlockFormat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoBlockFormat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "qcow": + *e = QCryptoBlockFormatQcow + case "luks": + *e = QCryptoBlockFormatLUKS + default: + return fmt.Errorf("unknown enum value %q for QCryptoBlockFormat", s) + } + return nil +} + +// QCryptoBlockInfoLUKS -> QCryptoBlockInfoLUKS (struct) + +// QCryptoBlockInfoLUKS implements the "QCryptoBlockInfoLUKS" QMP API type. +type QCryptoBlockInfoLUKS struct { + CipherAlg QCryptoCipherAlgorithm `json:"cipher-alg"` + CipherMode QCryptoCipherMode `json:"cipher-mode"` + IvgenAlg QCryptoIvGenAlgorithm `json:"ivgen-alg"` + IvgenHashAlg *QCryptoHashAlgorithm `json:"ivgen-hash-alg,omitempty"` + HashAlg QCryptoHashAlgorithm `json:"hash-alg"` + PayloadOffset int64 `json:"payload-offset"` + MasterKeyIters int64 `json:"master-key-iters"` + UUID string `json:"uuid"` + Slots []QCryptoBlockInfoLUKSSlot `json:"slots"` +} + +// QCryptoBlockInfoLUKSSlot -> QCryptoBlockInfoLUKSSlot (struct) + +// QCryptoBlockInfoLUKSSlot implements the "QCryptoBlockInfoLUKSSlot" QMP API type. +type QCryptoBlockInfoLUKSSlot struct { + Active bool `json:"active"` + Iters *int64 `json:"iters,omitempty"` + Stripes *int64 `json:"stripes,omitempty"` + KeyOffset int64 `json:"key-offset"` +} + +// QCryptoBlockLUKSKeyslotState -> QCryptoBlockLUKSKeyslotState (enum) + +// QCryptoBlockLUKSKeyslotState implements the "QCryptoBlockLUKSKeyslotState" QMP API type. +type QCryptoBlockLUKSKeyslotState int + +// Known values of QCryptoBlockLUKSKeyslotState. +const ( + QCryptoBlockLUKSKeyslotStateActive QCryptoBlockLUKSKeyslotState = iota + QCryptoBlockLUKSKeyslotStateInactive +) + +// String implements fmt.Stringer. +func (e QCryptoBlockLUKSKeyslotState) String() string { + switch e { + case QCryptoBlockLUKSKeyslotStateActive: + return "active" + case QCryptoBlockLUKSKeyslotStateInactive: + return "inactive" + default: + return fmt.Sprintf("QCryptoBlockLUKSKeyslotState(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoBlockLUKSKeyslotState) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoBlockLUKSKeyslotStateActive: + return json.Marshal("active") + case QCryptoBlockLUKSKeyslotStateInactive: + return json.Marshal("inactive") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoBlockLUKSKeyslotState", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoBlockLUKSKeyslotState) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "active": + *e = QCryptoBlockLUKSKeyslotStateActive + case "inactive": + *e = QCryptoBlockLUKSKeyslotStateInactive + default: + return fmt.Errorf("unknown enum value %q for QCryptoBlockLUKSKeyslotState", s) + } + return nil +} + +// QCryptoCipherAlgorithm -> QCryptoCipherAlgorithm (enum) + +// QCryptoCipherAlgorithm implements the "QCryptoCipherAlgorithm" QMP API type. +type QCryptoCipherAlgorithm int + +// Known values of QCryptoCipherAlgorithm. +const ( + QCryptoCipherAlgorithmAes128 QCryptoCipherAlgorithm = iota + QCryptoCipherAlgorithmAes192 + QCryptoCipherAlgorithmAes256 + QCryptoCipherAlgorithmDes + QCryptoCipherAlgorithm3Des + QCryptoCipherAlgorithmCast5128 + QCryptoCipherAlgorithmSerpent128 + QCryptoCipherAlgorithmSerpent192 + QCryptoCipherAlgorithmSerpent256 + QCryptoCipherAlgorithmTwofish128 + QCryptoCipherAlgorithmTwofish192 + QCryptoCipherAlgorithmTwofish256 +) + +// String implements fmt.Stringer. +func (e QCryptoCipherAlgorithm) String() string { + switch e { + case QCryptoCipherAlgorithmAes128: + return "aes-128" + case QCryptoCipherAlgorithmAes192: + return "aes-192" + case QCryptoCipherAlgorithmAes256: + return "aes-256" + case QCryptoCipherAlgorithmDes: + return "des" + case QCryptoCipherAlgorithm3Des: + return "3des" + case QCryptoCipherAlgorithmCast5128: + return "cast5-128" + case QCryptoCipherAlgorithmSerpent128: + return "serpent-128" + case QCryptoCipherAlgorithmSerpent192: + return "serpent-192" + case QCryptoCipherAlgorithmSerpent256: + return "serpent-256" + case QCryptoCipherAlgorithmTwofish128: + return "twofish-128" + case QCryptoCipherAlgorithmTwofish192: + return "twofish-192" + case QCryptoCipherAlgorithmTwofish256: + return "twofish-256" + default: + return fmt.Sprintf("QCryptoCipherAlgorithm(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoCipherAlgorithm) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoCipherAlgorithmAes128: + return json.Marshal("aes-128") + case QCryptoCipherAlgorithmAes192: + return json.Marshal("aes-192") + case QCryptoCipherAlgorithmAes256: + return json.Marshal("aes-256") + case QCryptoCipherAlgorithmDes: + return json.Marshal("des") + case QCryptoCipherAlgorithm3Des: + return json.Marshal("3des") + case QCryptoCipherAlgorithmCast5128: + return json.Marshal("cast5-128") + case QCryptoCipherAlgorithmSerpent128: + return json.Marshal("serpent-128") + case QCryptoCipherAlgorithmSerpent192: + return json.Marshal("serpent-192") + case QCryptoCipherAlgorithmSerpent256: + return json.Marshal("serpent-256") + case QCryptoCipherAlgorithmTwofish128: + return json.Marshal("twofish-128") + case QCryptoCipherAlgorithmTwofish192: + return json.Marshal("twofish-192") + case QCryptoCipherAlgorithmTwofish256: + return json.Marshal("twofish-256") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoCipherAlgorithm", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoCipherAlgorithm) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "aes-128": + *e = QCryptoCipherAlgorithmAes128 + case "aes-192": + *e = QCryptoCipherAlgorithmAes192 + case "aes-256": + *e = QCryptoCipherAlgorithmAes256 + case "des": + *e = QCryptoCipherAlgorithmDes + case "3des": + *e = QCryptoCipherAlgorithm3Des + case "cast5-128": + *e = QCryptoCipherAlgorithmCast5128 + case "serpent-128": + *e = QCryptoCipherAlgorithmSerpent128 + case "serpent-192": + *e = QCryptoCipherAlgorithmSerpent192 + case "serpent-256": + *e = QCryptoCipherAlgorithmSerpent256 + case "twofish-128": + *e = QCryptoCipherAlgorithmTwofish128 + case "twofish-192": + *e = QCryptoCipherAlgorithmTwofish192 + case "twofish-256": + *e = QCryptoCipherAlgorithmTwofish256 + default: + return fmt.Errorf("unknown enum value %q for QCryptoCipherAlgorithm", s) + } + return nil +} + +// QCryptoCipherMode -> QCryptoCipherMode (enum) + +// QCryptoCipherMode implements the "QCryptoCipherMode" QMP API type. +type QCryptoCipherMode int + +// Known values of QCryptoCipherMode. +const ( + QCryptoCipherModeEcb QCryptoCipherMode = iota + QCryptoCipherModeCbc + QCryptoCipherModeXts + QCryptoCipherModeCtr +) + +// String implements fmt.Stringer. +func (e QCryptoCipherMode) String() string { + switch e { + case QCryptoCipherModeEcb: + return "ecb" + case QCryptoCipherModeCbc: + return "cbc" + case QCryptoCipherModeXts: + return "xts" + case QCryptoCipherModeCtr: + return "ctr" + default: + return fmt.Sprintf("QCryptoCipherMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoCipherMode) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoCipherModeEcb: + return json.Marshal("ecb") + case QCryptoCipherModeCbc: + return json.Marshal("cbc") + case QCryptoCipherModeXts: + return json.Marshal("xts") + case QCryptoCipherModeCtr: + return json.Marshal("ctr") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoCipherMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoCipherMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "ecb": + *e = QCryptoCipherModeEcb + case "cbc": + *e = QCryptoCipherModeCbc + case "xts": + *e = QCryptoCipherModeXts + case "ctr": + *e = QCryptoCipherModeCtr + default: + return fmt.Errorf("unknown enum value %q for QCryptoCipherMode", s) + } + return nil +} + +// QCryptoHashAlgorithm -> QCryptoHashAlgorithm (enum) + +// QCryptoHashAlgorithm implements the "QCryptoHashAlgorithm" QMP API type. +type QCryptoHashAlgorithm int + +// Known values of QCryptoHashAlgorithm. +const ( + QCryptoHashAlgorithmMd5 QCryptoHashAlgorithm = iota + QCryptoHashAlgorithmSha1 + QCryptoHashAlgorithmSha224 + QCryptoHashAlgorithmSha256 + QCryptoHashAlgorithmSha384 + QCryptoHashAlgorithmSha512 + QCryptoHashAlgorithmRipemd160 +) + +// String implements fmt.Stringer. +func (e QCryptoHashAlgorithm) String() string { + switch e { + case QCryptoHashAlgorithmMd5: + return "md5" + case QCryptoHashAlgorithmSha1: + return "sha1" + case QCryptoHashAlgorithmSha224: + return "sha224" + case QCryptoHashAlgorithmSha256: + return "sha256" + case QCryptoHashAlgorithmSha384: + return "sha384" + case QCryptoHashAlgorithmSha512: + return "sha512" + case QCryptoHashAlgorithmRipemd160: + return "ripemd160" + default: + return fmt.Sprintf("QCryptoHashAlgorithm(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoHashAlgorithm) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoHashAlgorithmMd5: + return json.Marshal("md5") + case QCryptoHashAlgorithmSha1: + return json.Marshal("sha1") + case QCryptoHashAlgorithmSha224: + return json.Marshal("sha224") + case QCryptoHashAlgorithmSha256: + return json.Marshal("sha256") + case QCryptoHashAlgorithmSha384: + return json.Marshal("sha384") + case QCryptoHashAlgorithmSha512: + return json.Marshal("sha512") + case QCryptoHashAlgorithmRipemd160: + return json.Marshal("ripemd160") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoHashAlgorithm", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoHashAlgorithm) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "md5": + *e = QCryptoHashAlgorithmMd5 + case "sha1": + *e = QCryptoHashAlgorithmSha1 + case "sha224": + *e = QCryptoHashAlgorithmSha224 + case "sha256": + *e = QCryptoHashAlgorithmSha256 + case "sha384": + *e = QCryptoHashAlgorithmSha384 + case "sha512": + *e = QCryptoHashAlgorithmSha512 + case "ripemd160": + *e = QCryptoHashAlgorithmRipemd160 + default: + return fmt.Errorf("unknown enum value %q for QCryptoHashAlgorithm", s) + } + return nil +} + +// QCryptoIVGenAlgorithm -> QCryptoIvGenAlgorithm (enum) + +// QCryptoIvGenAlgorithm implements the "QCryptoIVGenAlgorithm" QMP API type. +type QCryptoIvGenAlgorithm int + +// Known values of QCryptoIvGenAlgorithm. +const ( + QCryptoIvGenAlgorithmPlain QCryptoIvGenAlgorithm = iota + QCryptoIvGenAlgorithmPlain64 + QCryptoIvGenAlgorithmEssiv +) + +// String implements fmt.Stringer. +func (e QCryptoIvGenAlgorithm) String() string { + switch e { + case QCryptoIvGenAlgorithmPlain: + return "plain" + case QCryptoIvGenAlgorithmPlain64: + return "plain64" + case QCryptoIvGenAlgorithmEssiv: + return "essiv" + default: + return fmt.Sprintf("QCryptoIvGenAlgorithm(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoIvGenAlgorithm) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoIvGenAlgorithmPlain: + return json.Marshal("plain") + case QCryptoIvGenAlgorithmPlain64: + return json.Marshal("plain64") + case QCryptoIvGenAlgorithmEssiv: + return json.Marshal("essiv") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoIvGenAlgorithm", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoIvGenAlgorithm) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "plain": + *e = QCryptoIvGenAlgorithmPlain + case "plain64": + *e = QCryptoIvGenAlgorithmPlain64 + case "essiv": + *e = QCryptoIvGenAlgorithmEssiv + default: + return fmt.Errorf("unknown enum value %q for QCryptoIvGenAlgorithm", s) + } + return nil +} + +// QCryptoTLSCredsEndpoint -> QCryptoTLSCredsEndpoint (enum) + +// QCryptoTLSCredsEndpoint implements the "QCryptoTLSCredsEndpoint" QMP API type. +type QCryptoTLSCredsEndpoint int + +// Known values of QCryptoTLSCredsEndpoint. +const ( + QCryptoTLSCredsEndpointClient QCryptoTLSCredsEndpoint = iota + QCryptoTLSCredsEndpointServer +) + +// String implements fmt.Stringer. +func (e QCryptoTLSCredsEndpoint) String() string { + switch e { + case QCryptoTLSCredsEndpointClient: + return "client" + case QCryptoTLSCredsEndpointServer: + return "server" + default: + return fmt.Sprintf("QCryptoTLSCredsEndpoint(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QCryptoTLSCredsEndpoint) MarshalJSON() ([]byte, error) { + switch e { + case QCryptoTLSCredsEndpointClient: + return json.Marshal("client") + case QCryptoTLSCredsEndpointServer: + return json.Marshal("server") + default: + return nil, fmt.Errorf("unknown enum value %q for QCryptoTLSCredsEndpoint", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QCryptoTLSCredsEndpoint) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "client": + *e = QCryptoTLSCredsEndpointClient + case "server": + *e = QCryptoTLSCredsEndpointServer + default: + return fmt.Errorf("unknown enum value %q for QCryptoTLSCredsEndpoint", s) + } + return nil +} + +// QKeyCode -> QKeyCode (enum) + +// QKeyCode implements the "QKeyCode" QMP API type. +type QKeyCode int + +// Known values of QKeyCode. +const ( + QKeyCodeUnmapped QKeyCode = iota + QKeyCodeShift + QKeyCodeShiftR + QKeyCodeAlt + QKeyCodeAltR + QKeyCodeCtrl + QKeyCodeCtrlR + QKeyCodeMenu + QKeyCodeEsc + QKeyCode1 + QKeyCode2 + QKeyCode3 + QKeyCode4 + QKeyCode5 + QKeyCode6 + QKeyCode7 + QKeyCode8 + QKeyCode9 + QKeyCode0 + QKeyCodeMinus + QKeyCodeEqual + QKeyCodeBackspace + QKeyCodeTab + QKeyCodeQ + QKeyCodeW + QKeyCodeE + QKeyCodeR + QKeyCodeT + QKeyCodeY + QKeyCodeU + QKeyCodeI + QKeyCodeO + QKeyCodeP + QKeyCodeBracketLeft + QKeyCodeBracketRight + QKeyCodeRet + QKeyCodeA + QKeyCodeS + QKeyCodeD + QKeyCodeF + QKeyCodeG + QKeyCodeH + QKeyCodeJ + QKeyCodeK + QKeyCodeL + QKeyCodeSemicolon + QKeyCodeApostrophe + QKeyCodeGraveAccent + QKeyCodeBackslash + QKeyCodeZ + QKeyCodeX + QKeyCodeC + QKeyCodeV + QKeyCodeB + QKeyCodeN + QKeyCodeM + QKeyCodeComma + QKeyCodeDot + QKeyCodeSlash + QKeyCodeAsterisk + QKeyCodeSpc + QKeyCodeCapsLock + QKeyCodeF1 + QKeyCodeF2 + QKeyCodeF3 + QKeyCodeF4 + QKeyCodeF5 + QKeyCodeF6 + QKeyCodeF7 + QKeyCodeF8 + QKeyCodeF9 + QKeyCodeF10 + QKeyCodeNumLock + QKeyCodeScrollLock + QKeyCodeKpDivide + QKeyCodeKpMultiply + QKeyCodeKpSubtract + QKeyCodeKpAdd + QKeyCodeKpEnter + QKeyCodeKpDecimal + QKeyCodeSysrq + QKeyCodeKp0 + QKeyCodeKp1 + QKeyCodeKp2 + QKeyCodeKp3 + QKeyCodeKp4 + QKeyCodeKp5 + QKeyCodeKp6 + QKeyCodeKp7 + QKeyCodeKp8 + QKeyCodeKp9 + QKeyCodeLess + QKeyCodeF11 + QKeyCodeF12 + QKeyCodePrint + QKeyCodeHome + QKeyCodePgup + QKeyCodePgdn + QKeyCodeEnd + QKeyCodeLeft + QKeyCodeUp + QKeyCodeDown + QKeyCodeRight + QKeyCodeInsert + QKeyCodeDelete + QKeyCodeStop + QKeyCodeAgain + QKeyCodeProps + QKeyCodeUndo + QKeyCodeFront + QKeyCodeCopy + QKeyCodeOpen + QKeyCodePaste + QKeyCodeFind + QKeyCodeCut + QKeyCodeLf + QKeyCodeHelp + QKeyCodeMetaL + QKeyCodeMetaR + QKeyCodeCompose + QKeyCodePause + QKeyCodeRo + QKeyCodeHiragana + QKeyCodeHenkan + QKeyCodeYen + QKeyCodeMuhenkan + QKeyCodeKatakanahiragana + QKeyCodeKpComma + QKeyCodeKpEquals + QKeyCodePower + QKeyCodeSleep + QKeyCodeWake + QKeyCodeAudionext + QKeyCodeAudioprev + QKeyCodeAudiostop + QKeyCodeAudioplay + QKeyCodeAudiomute + QKeyCodeVolumeup + QKeyCodeVolumedown + QKeyCodeMediaselect + QKeyCodeMail + QKeyCodeCalculator + QKeyCodeComputer + QKeyCodeAcHome + QKeyCodeAcBack + QKeyCodeAcForward + QKeyCodeAcRefresh + QKeyCodeAcBookmarks + QKeyCodeLang1 + QKeyCodeLang2 +) + +// String implements fmt.Stringer. +func (e QKeyCode) String() string { + switch e { + case QKeyCodeUnmapped: + return "unmapped" + case QKeyCodeShift: + return "shift" + case QKeyCodeShiftR: + return "shift_r" + case QKeyCodeAlt: + return "alt" + case QKeyCodeAltR: + return "alt_r" + case QKeyCodeCtrl: + return "ctrl" + case QKeyCodeCtrlR: + return "ctrl_r" + case QKeyCodeMenu: + return "menu" + case QKeyCodeEsc: + return "esc" + case QKeyCode1: + return "1" + case QKeyCode2: + return "2" + case QKeyCode3: + return "3" + case QKeyCode4: + return "4" + case QKeyCode5: + return "5" + case QKeyCode6: + return "6" + case QKeyCode7: + return "7" + case QKeyCode8: + return "8" + case QKeyCode9: + return "9" + case QKeyCode0: + return "0" + case QKeyCodeMinus: return "minus" case QKeyCodeEqual: return "equal" @@ -7415,6 +14813,10 @@ func (e QKeyCode) String() string { return "henkan" case QKeyCodeYen: return "yen" + case QKeyCodeMuhenkan: + return "muhenkan" + case QKeyCodeKatakanahiragana: + return "katakanahiragana" case QKeyCodeKpComma: return "kp_comma" case QKeyCodeKpEquals: @@ -7457,6 +14859,10 @@ func (e QKeyCode) String() string { return "ac_refresh" case QKeyCodeAcBookmarks: return "ac_bookmarks" + case QKeyCodeLang1: + return "lang1" + case QKeyCodeLang2: + return "lang2" default: return fmt.Sprintf("QKeyCode(%d)", e) } @@ -7715,6 +15121,10 @@ func (e QKeyCode) MarshalJSON() ([]byte, error) { return json.Marshal("henkan") case QKeyCodeYen: return json.Marshal("yen") + case QKeyCodeMuhenkan: + return json.Marshal("muhenkan") + case QKeyCodeKatakanahiragana: + return json.Marshal("katakanahiragana") case QKeyCodeKpComma: return json.Marshal("kp_comma") case QKeyCodeKpEquals: @@ -7757,2728 +15167,6469 @@ func (e QKeyCode) MarshalJSON() ([]byte, error) { return json.Marshal("ac_refresh") case QKeyCodeAcBookmarks: return json.Marshal("ac_bookmarks") + case QKeyCodeLang1: + return json.Marshal("lang1") + case QKeyCodeLang2: + return json.Marshal("lang2") + default: + return nil, fmt.Errorf("unknown enum value %q for QKeyCode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QKeyCode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "unmapped": + *e = QKeyCodeUnmapped + case "shift": + *e = QKeyCodeShift + case "shift_r": + *e = QKeyCodeShiftR + case "alt": + *e = QKeyCodeAlt + case "alt_r": + *e = QKeyCodeAltR + case "ctrl": + *e = QKeyCodeCtrl + case "ctrl_r": + *e = QKeyCodeCtrlR + case "menu": + *e = QKeyCodeMenu + case "esc": + *e = QKeyCodeEsc + case "1": + *e = QKeyCode1 + case "2": + *e = QKeyCode2 + case "3": + *e = QKeyCode3 + case "4": + *e = QKeyCode4 + case "5": + *e = QKeyCode5 + case "6": + *e = QKeyCode6 + case "7": + *e = QKeyCode7 + case "8": + *e = QKeyCode8 + case "9": + *e = QKeyCode9 + case "0": + *e = QKeyCode0 + case "minus": + *e = QKeyCodeMinus + case "equal": + *e = QKeyCodeEqual + case "backspace": + *e = QKeyCodeBackspace + case "tab": + *e = QKeyCodeTab + case "q": + *e = QKeyCodeQ + case "w": + *e = QKeyCodeW + case "e": + *e = QKeyCodeE + case "r": + *e = QKeyCodeR + case "t": + *e = QKeyCodeT + case "y": + *e = QKeyCodeY + case "u": + *e = QKeyCodeU + case "i": + *e = QKeyCodeI + case "o": + *e = QKeyCodeO + case "p": + *e = QKeyCodeP + case "bracket_left": + *e = QKeyCodeBracketLeft + case "bracket_right": + *e = QKeyCodeBracketRight + case "ret": + *e = QKeyCodeRet + case "a": + *e = QKeyCodeA + case "s": + *e = QKeyCodeS + case "d": + *e = QKeyCodeD + case "f": + *e = QKeyCodeF + case "g": + *e = QKeyCodeG + case "h": + *e = QKeyCodeH + case "j": + *e = QKeyCodeJ + case "k": + *e = QKeyCodeK + case "l": + *e = QKeyCodeL + case "semicolon": + *e = QKeyCodeSemicolon + case "apostrophe": + *e = QKeyCodeApostrophe + case "grave_accent": + *e = QKeyCodeGraveAccent + case "backslash": + *e = QKeyCodeBackslash + case "z": + *e = QKeyCodeZ + case "x": + *e = QKeyCodeX + case "c": + *e = QKeyCodeC + case "v": + *e = QKeyCodeV + case "b": + *e = QKeyCodeB + case "n": + *e = QKeyCodeN + case "m": + *e = QKeyCodeM + case "comma": + *e = QKeyCodeComma + case "dot": + *e = QKeyCodeDot + case "slash": + *e = QKeyCodeSlash + case "asterisk": + *e = QKeyCodeAsterisk + case "spc": + *e = QKeyCodeSpc + case "caps_lock": + *e = QKeyCodeCapsLock + case "f1": + *e = QKeyCodeF1 + case "f2": + *e = QKeyCodeF2 + case "f3": + *e = QKeyCodeF3 + case "f4": + *e = QKeyCodeF4 + case "f5": + *e = QKeyCodeF5 + case "f6": + *e = QKeyCodeF6 + case "f7": + *e = QKeyCodeF7 + case "f8": + *e = QKeyCodeF8 + case "f9": + *e = QKeyCodeF9 + case "f10": + *e = QKeyCodeF10 + case "num_lock": + *e = QKeyCodeNumLock + case "scroll_lock": + *e = QKeyCodeScrollLock + case "kp_divide": + *e = QKeyCodeKpDivide + case "kp_multiply": + *e = QKeyCodeKpMultiply + case "kp_subtract": + *e = QKeyCodeKpSubtract + case "kp_add": + *e = QKeyCodeKpAdd + case "kp_enter": + *e = QKeyCodeKpEnter + case "kp_decimal": + *e = QKeyCodeKpDecimal + case "sysrq": + *e = QKeyCodeSysrq + case "kp_0": + *e = QKeyCodeKp0 + case "kp_1": + *e = QKeyCodeKp1 + case "kp_2": + *e = QKeyCodeKp2 + case "kp_3": + *e = QKeyCodeKp3 + case "kp_4": + *e = QKeyCodeKp4 + case "kp_5": + *e = QKeyCodeKp5 + case "kp_6": + *e = QKeyCodeKp6 + case "kp_7": + *e = QKeyCodeKp7 + case "kp_8": + *e = QKeyCodeKp8 + case "kp_9": + *e = QKeyCodeKp9 + case "less": + *e = QKeyCodeLess + case "f11": + *e = QKeyCodeF11 + case "f12": + *e = QKeyCodeF12 + case "print": + *e = QKeyCodePrint + case "home": + *e = QKeyCodeHome + case "pgup": + *e = QKeyCodePgup + case "pgdn": + *e = QKeyCodePgdn + case "end": + *e = QKeyCodeEnd + case "left": + *e = QKeyCodeLeft + case "up": + *e = QKeyCodeUp + case "down": + *e = QKeyCodeDown + case "right": + *e = QKeyCodeRight + case "insert": + *e = QKeyCodeInsert + case "delete": + *e = QKeyCodeDelete + case "stop": + *e = QKeyCodeStop + case "again": + *e = QKeyCodeAgain + case "props": + *e = QKeyCodeProps + case "undo": + *e = QKeyCodeUndo + case "front": + *e = QKeyCodeFront + case "copy": + *e = QKeyCodeCopy + case "open": + *e = QKeyCodeOpen + case "paste": + *e = QKeyCodePaste + case "find": + *e = QKeyCodeFind + case "cut": + *e = QKeyCodeCut + case "lf": + *e = QKeyCodeLf + case "help": + *e = QKeyCodeHelp + case "meta_l": + *e = QKeyCodeMetaL + case "meta_r": + *e = QKeyCodeMetaR + case "compose": + *e = QKeyCodeCompose + case "pause": + *e = QKeyCodePause + case "ro": + *e = QKeyCodeRo + case "hiragana": + *e = QKeyCodeHiragana + case "henkan": + *e = QKeyCodeHenkan + case "yen": + *e = QKeyCodeYen + case "muhenkan": + *e = QKeyCodeMuhenkan + case "katakanahiragana": + *e = QKeyCodeKatakanahiragana + case "kp_comma": + *e = QKeyCodeKpComma + case "kp_equals": + *e = QKeyCodeKpEquals + case "power": + *e = QKeyCodePower + case "sleep": + *e = QKeyCodeSleep + case "wake": + *e = QKeyCodeWake + case "audionext": + *e = QKeyCodeAudionext + case "audioprev": + *e = QKeyCodeAudioprev + case "audiostop": + *e = QKeyCodeAudiostop + case "audioplay": + *e = QKeyCodeAudioplay + case "audiomute": + *e = QKeyCodeAudiomute + case "volumeup": + *e = QKeyCodeVolumeup + case "volumedown": + *e = QKeyCodeVolumedown + case "mediaselect": + *e = QKeyCodeMediaselect + case "mail": + *e = QKeyCodeMail + case "calculator": + *e = QKeyCodeCalculator + case "computer": + *e = QKeyCodeComputer + case "ac_home": + *e = QKeyCodeAcHome + case "ac_back": + *e = QKeyCodeAcBack + case "ac_forward": + *e = QKeyCodeAcForward + case "ac_refresh": + *e = QKeyCodeAcRefresh + case "ac_bookmarks": + *e = QKeyCodeAcBookmarks + case "lang1": + *e = QKeyCodeLang1 + case "lang2": + *e = QKeyCodeLang2 + default: + return fmt.Errorf("unknown enum value %q for QKeyCode", s) + } + return nil +} + +// QMPCapability -> QMPCapability (enum) + +// QMPCapability implements the "QMPCapability" QMP API type. +type QMPCapability int + +// Known values of QMPCapability. +const ( + QMPCapabilityOob QMPCapability = iota +) + +// String implements fmt.Stringer. +func (e QMPCapability) String() string { + switch e { + case QMPCapabilityOob: + return "oob" + default: + return fmt.Sprintf("QMPCapability(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QMPCapability) MarshalJSON() ([]byte, error) { + switch e { + case QMPCapabilityOob: + return json.Marshal("oob") + default: + return nil, fmt.Errorf("unknown enum value %q for QMPCapability", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QMPCapability) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "oob": + *e = QMPCapabilityOob + default: + return fmt.Errorf("unknown enum value %q for QMPCapability", s) + } + return nil +} + +// EVENT QUORUM_FAILURE + +// EVENT QUORUM_REPORT_BAD + +// Qcow2BitmapInfo -> Qcow2BitmapInfo (struct) + +// Qcow2BitmapInfo implements the "Qcow2BitmapInfo" QMP API type. +type Qcow2BitmapInfo struct { + Name string `json:"name"` + Granularity uint32 `json:"granularity"` + Flags []Qcow2BitmapInfoFlags `json:"flags"` +} + +// Qcow2BitmapInfoFlags -> Qcow2BitmapInfoFlags (enum) + +// Qcow2BitmapInfoFlags implements the "Qcow2BitmapInfoFlags" QMP API type. +type Qcow2BitmapInfoFlags int + +// Known values of Qcow2BitmapInfoFlags. +const ( + Qcow2BitmapInfoFlagsInUse Qcow2BitmapInfoFlags = iota + Qcow2BitmapInfoFlagsAuto +) + +// String implements fmt.Stringer. +func (e Qcow2BitmapInfoFlags) String() string { + switch e { + case Qcow2BitmapInfoFlagsInUse: + return "in-use" + case Qcow2BitmapInfoFlagsAuto: + return "auto" + default: + return fmt.Sprintf("Qcow2BitmapInfoFlags(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e Qcow2BitmapInfoFlags) MarshalJSON() ([]byte, error) { + switch e { + case Qcow2BitmapInfoFlagsInUse: + return json.Marshal("in-use") + case Qcow2BitmapInfoFlagsAuto: + return json.Marshal("auto") + default: + return nil, fmt.Errorf("unknown enum value %q for Qcow2BitmapInfoFlags", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *Qcow2BitmapInfoFlags) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "in-use": + *e = Qcow2BitmapInfoFlagsInUse + case "auto": + *e = Qcow2BitmapInfoFlagsAuto + default: + return fmt.Errorf("unknown enum value %q for Qcow2BitmapInfoFlags", s) + } + return nil +} + +// Qcow2CompressionType -> Qcow2CompressionType (enum) + +// Qcow2CompressionType implements the "Qcow2CompressionType" QMP API type. +type Qcow2CompressionType int + +// Known values of Qcow2CompressionType. +const ( + Qcow2CompressionTypeZlib Qcow2CompressionType = iota + Qcow2CompressionTypeZstd +) + +// String implements fmt.Stringer. +func (e Qcow2CompressionType) String() string { + switch e { + case Qcow2CompressionTypeZlib: + return "zlib" + case Qcow2CompressionTypeZstd: + return "zstd" + default: + return fmt.Sprintf("Qcow2CompressionType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e Qcow2CompressionType) MarshalJSON() ([]byte, error) { + switch e { + case Qcow2CompressionTypeZlib: + return json.Marshal("zlib") + case Qcow2CompressionTypeZstd: + return json.Marshal("zstd") + default: + return nil, fmt.Errorf("unknown enum value %q for Qcow2CompressionType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *Qcow2CompressionType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "zlib": + *e = Qcow2CompressionTypeZlib + case "zstd": + *e = Qcow2CompressionTypeZstd + default: + return fmt.Errorf("unknown enum value %q for Qcow2CompressionType", s) + } + return nil +} + +// Qcow2OverlapCheckFlags -> Qcow2OverlapCheckFlags (struct) + +// Qcow2OverlapCheckFlags implements the "Qcow2OverlapCheckFlags" QMP API type. +type Qcow2OverlapCheckFlags struct { + Template *Qcow2OverlapCheckMode `json:"template,omitempty"` + MainHeader *bool `json:"main-header,omitempty"` + ActiveL1 *bool `json:"active-l1,omitempty"` + ActiveL2 *bool `json:"active-l2,omitempty"` + RefcountTable *bool `json:"refcount-table,omitempty"` + RefcountBlock *bool `json:"refcount-block,omitempty"` + SnapshotTable *bool `json:"snapshot-table,omitempty"` + InactiveL1 *bool `json:"inactive-l1,omitempty"` + InactiveL2 *bool `json:"inactive-l2,omitempty"` + BitmapDirectory *bool `json:"bitmap-directory,omitempty"` +} + +// Qcow2OverlapCheckMode -> Qcow2OverlapCheckMode (enum) + +// Qcow2OverlapCheckMode implements the "Qcow2OverlapCheckMode" QMP API type. +type Qcow2OverlapCheckMode int + +// Known values of Qcow2OverlapCheckMode. +const ( + Qcow2OverlapCheckModeNone Qcow2OverlapCheckMode = iota + Qcow2OverlapCheckModeConstant + Qcow2OverlapCheckModeCached + Qcow2OverlapCheckModeAll +) + +// String implements fmt.Stringer. +func (e Qcow2OverlapCheckMode) String() string { + switch e { + case Qcow2OverlapCheckModeNone: + return "none" + case Qcow2OverlapCheckModeConstant: + return "constant" + case Qcow2OverlapCheckModeCached: + return "cached" + case Qcow2OverlapCheckModeAll: + return "all" + default: + return fmt.Sprintf("Qcow2OverlapCheckMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e Qcow2OverlapCheckMode) MarshalJSON() ([]byte, error) { + switch e { + case Qcow2OverlapCheckModeNone: + return json.Marshal("none") + case Qcow2OverlapCheckModeConstant: + return json.Marshal("constant") + case Qcow2OverlapCheckModeCached: + return json.Marshal("cached") + case Qcow2OverlapCheckModeAll: + return json.Marshal("all") + default: + return nil, fmt.Errorf("unknown enum value %q for Qcow2OverlapCheckMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *Qcow2OverlapCheckMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = Qcow2OverlapCheckModeNone + case "constant": + *e = Qcow2OverlapCheckModeConstant + case "cached": + *e = Qcow2OverlapCheckModeCached + case "all": + *e = Qcow2OverlapCheckModeAll + default: + return fmt.Errorf("unknown enum value %q for Qcow2OverlapCheckMode", s) + } + return nil +} + +// Qcow2OverlapChecks -> Qcow2OverlapChecks (alternate) + +// Qcow2OverlapChecks implements the "Qcow2OverlapChecks" QMP API type. +// +// Can be one of: +// - Qcow2OverlapChecksVariantFlags +// - Qcow2OverlapChecksVariantMode +type Qcow2OverlapChecks interface { + isQcow2OverlapChecks() +} + +// Qcow2OverlapChecksVariantFlags is an implementation of Qcow2OverlapChecks +type Qcow2OverlapChecksVariantFlags Qcow2OverlapCheckFlags + +func (Qcow2OverlapChecksVariantFlags) isQcow2OverlapChecks() {} + +// Qcow2OverlapChecksVariantMode is an implementation of Qcow2OverlapChecks +type Qcow2OverlapChecksVariantMode Qcow2OverlapCheckMode + +func (Qcow2OverlapChecksVariantMode) isQcow2OverlapChecks() {} + +func decodeQcow2OverlapChecks(bs json.RawMessage) (Qcow2OverlapChecks, error) { + + var flags Qcow2OverlapChecksVariantFlags + if err := json.Unmarshal([]byte(bs), &flags); err == nil { + return flags, nil + } + + var mode Qcow2OverlapChecksVariantMode + if err := json.Unmarshal([]byte(bs), &mode); err == nil { + return mode, nil + } + return nil, fmt.Errorf("unable to decode %q as a Qcow2OverlapChecks", string(bs)) +} + +// QuorumOpType -> QuorumOpType (enum) + +// QuorumOpType implements the "QuorumOpType" QMP API type. +type QuorumOpType int + +// Known values of QuorumOpType. +const ( + QuorumOpTypeRead QuorumOpType = iota + QuorumOpTypeWrite + QuorumOpTypeFlush +) + +// String implements fmt.Stringer. +func (e QuorumOpType) String() string { + switch e { + case QuorumOpTypeRead: + return "read" + case QuorumOpTypeWrite: + return "write" + case QuorumOpTypeFlush: + return "flush" + default: + return fmt.Sprintf("QuorumOpType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QuorumOpType) MarshalJSON() ([]byte, error) { + switch e { + case QuorumOpTypeRead: + return json.Marshal("read") + case QuorumOpTypeWrite: + return json.Marshal("write") + case QuorumOpTypeFlush: + return json.Marshal("flush") + default: + return nil, fmt.Errorf("unknown enum value %q for QuorumOpType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QuorumOpType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "read": + *e = QuorumOpTypeRead + case "write": + *e = QuorumOpTypeWrite + case "flush": + *e = QuorumOpTypeFlush + default: + return fmt.Errorf("unknown enum value %q for QuorumOpType", s) + } + return nil +} + +// QuorumReadPattern -> QuorumReadPattern (enum) + +// QuorumReadPattern implements the "QuorumReadPattern" QMP API type. +type QuorumReadPattern int + +// Known values of QuorumReadPattern. +const ( + QuorumReadPatternQuorum QuorumReadPattern = iota + QuorumReadPatternFifo +) + +// String implements fmt.Stringer. +func (e QuorumReadPattern) String() string { + switch e { + case QuorumReadPatternQuorum: + return "quorum" + case QuorumReadPatternFifo: + return "fifo" + default: + return fmt.Sprintf("QuorumReadPattern(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e QuorumReadPattern) MarshalJSON() ([]byte, error) { + switch e { + case QuorumReadPatternQuorum: + return json.Marshal("quorum") + case QuorumReadPatternFifo: + return json.Marshal("fifo") + default: + return nil, fmt.Errorf("unknown enum value %q for QuorumReadPattern", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *QuorumReadPattern) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "quorum": + *e = QuorumReadPatternQuorum + case "fifo": + *e = QuorumReadPatternFifo + default: + return fmt.Errorf("unknown enum value %q for QuorumReadPattern", s) + } + return nil +} + +// EVENT RDMA_GID_STATUS_CHANGED + +// EVENT RESET + +// EVENT RESUME + +// EVENT RTC_CHANGE + +// RbdAuthMode -> RbdAuthMode (enum) + +// RbdAuthMode implements the "RbdAuthMode" QMP API type. +type RbdAuthMode int + +// Known values of RbdAuthMode. +const ( + RbdAuthModeCephx RbdAuthMode = iota + RbdAuthModeNone +) + +// String implements fmt.Stringer. +func (e RbdAuthMode) String() string { + switch e { + case RbdAuthModeCephx: + return "cephx" + case RbdAuthModeNone: + return "none" + default: + return fmt.Sprintf("RbdAuthMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RbdAuthMode) MarshalJSON() ([]byte, error) { + switch e { + case RbdAuthModeCephx: + return json.Marshal("cephx") + case RbdAuthModeNone: + return json.Marshal("none") + default: + return nil, fmt.Errorf("unknown enum value %q for RbdAuthMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RbdAuthMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "cephx": + *e = RbdAuthModeCephx + case "none": + *e = RbdAuthModeNone + default: + return fmt.Errorf("unknown enum value %q for RbdAuthMode", s) + } + return nil +} + +// RbdEncryptionCreateOptions -> RbdEncryptionCreateOptions (flat union) + +// RbdEncryptionCreateOptions implements the "RbdEncryptionCreateOptions" QMP API type. +// +// Can be one of: +// - RbdEncryptionCreateOptionsVariantLUKS +// - RbdEncryptionCreateOptionsVariantLUKS2 +type RbdEncryptionCreateOptions interface { + isRbdEncryptionCreateOptions() +} + +// RbdEncryptionCreateOptionsVariantLUKS is an implementation of RbdEncryptionCreateOptions. +type RbdEncryptionCreateOptionsVariantLUKS struct { +} + +func (RbdEncryptionCreateOptionsVariantLUKS) isRbdEncryptionCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s RbdEncryptionCreateOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + RbdEncryptionCreateOptionsVariantLUKS + }{ + RbdImageEncryptionFormatLUKS, + s, + } + return json.Marshal(v) +} + +// RbdEncryptionCreateOptionsVariantLUKS2 is an implementation of RbdEncryptionCreateOptions. +type RbdEncryptionCreateOptionsVariantLUKS2 struct { +} + +func (RbdEncryptionCreateOptionsVariantLUKS2) isRbdEncryptionCreateOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s RbdEncryptionCreateOptionsVariantLUKS2) MarshalJSON() ([]byte, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + RbdEncryptionCreateOptionsVariantLUKS2 + }{ + RbdImageEncryptionFormatLUKS2, + s, + } + return json.Marshal(v) +} + +func decodeRbdEncryptionCreateOptions(bs json.RawMessage) (RbdEncryptionCreateOptions, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Format { + case RbdImageEncryptionFormatLUKS: + var ret RbdEncryptionCreateOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case RbdImageEncryptionFormatLUKS2: + var ret RbdEncryptionCreateOptionsVariantLUKS2 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union RbdEncryptionCreateOptions", v.Format) + } +} + +// RbdEncryptionOptions -> RbdEncryptionOptions (flat union) + +// RbdEncryptionOptions implements the "RbdEncryptionOptions" QMP API type. +// +// Can be one of: +// - RbdEncryptionOptionsVariantLUKS +// - RbdEncryptionOptionsVariantLUKS2 +type RbdEncryptionOptions interface { + isRbdEncryptionOptions() +} + +// RbdEncryptionOptionsVariantLUKS is an implementation of RbdEncryptionOptions. +type RbdEncryptionOptionsVariantLUKS struct { +} + +func (RbdEncryptionOptionsVariantLUKS) isRbdEncryptionOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s RbdEncryptionOptionsVariantLUKS) MarshalJSON() ([]byte, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + RbdEncryptionOptionsVariantLUKS + }{ + RbdImageEncryptionFormatLUKS, + s, + } + return json.Marshal(v) +} + +// RbdEncryptionOptionsVariantLUKS2 is an implementation of RbdEncryptionOptions. +type RbdEncryptionOptionsVariantLUKS2 struct { +} + +func (RbdEncryptionOptionsVariantLUKS2) isRbdEncryptionOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s RbdEncryptionOptionsVariantLUKS2) MarshalJSON() ([]byte, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + RbdEncryptionOptionsVariantLUKS2 + }{ + RbdImageEncryptionFormatLUKS2, + s, + } + return json.Marshal(v) +} + +func decodeRbdEncryptionOptions(bs json.RawMessage) (RbdEncryptionOptions, error) { + v := struct { + Format RbdImageEncryptionFormat `json:"format"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Format { + case RbdImageEncryptionFormatLUKS: + var ret RbdEncryptionOptionsVariantLUKS + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case RbdImageEncryptionFormatLUKS2: + var ret RbdEncryptionOptionsVariantLUKS2 + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union RbdEncryptionOptions", v.Format) + } +} + +// RbdImageEncryptionFormat -> RbdImageEncryptionFormat (enum) + +// RbdImageEncryptionFormat implements the "RbdImageEncryptionFormat" QMP API type. +type RbdImageEncryptionFormat int + +// Known values of RbdImageEncryptionFormat. +const ( + RbdImageEncryptionFormatLUKS RbdImageEncryptionFormat = iota + RbdImageEncryptionFormatLUKS2 +) + +// String implements fmt.Stringer. +func (e RbdImageEncryptionFormat) String() string { + switch e { + case RbdImageEncryptionFormatLUKS: + return "luks" + case RbdImageEncryptionFormatLUKS2: + return "luks2" + default: + return fmt.Sprintf("RbdImageEncryptionFormat(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RbdImageEncryptionFormat) MarshalJSON() ([]byte, error) { + switch e { + case RbdImageEncryptionFormatLUKS: + return json.Marshal("luks") + case RbdImageEncryptionFormatLUKS2: + return json.Marshal("luks2") + default: + return nil, fmt.Errorf("unknown enum value %q for RbdImageEncryptionFormat", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RbdImageEncryptionFormat) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "luks": + *e = RbdImageEncryptionFormatLUKS + case "luks2": + *e = RbdImageEncryptionFormatLUKS2 + default: + return fmt.Errorf("unknown enum value %q for RbdImageEncryptionFormat", s) + } + return nil +} + +// RebootAction -> RebootAction (enum) + +// RebootAction implements the "RebootAction" QMP API type. +type RebootAction int + +// Known values of RebootAction. +const ( + RebootActionReset RebootAction = iota + RebootActionShutdown +) + +// String implements fmt.Stringer. +func (e RebootAction) String() string { + switch e { + case RebootActionReset: + return "reset" + case RebootActionShutdown: + return "shutdown" + default: + return fmt.Sprintf("RebootAction(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RebootAction) MarshalJSON() ([]byte, error) { + switch e { + case RebootActionReset: + return json.Marshal("reset") + case RebootActionShutdown: + return json.Marshal("shutdown") + default: + return nil, fmt.Errorf("unknown enum value %q for RebootAction", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RebootAction) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "reset": + *e = RebootActionReset + case "shutdown": + *e = RebootActionShutdown + default: + return fmt.Errorf("unknown enum value %q for RebootAction", s) + } + return nil +} + +// ReplayInfo -> ReplayInfo (struct) + +// ReplayInfo implements the "ReplayInfo" QMP API type. +type ReplayInfo struct { + Mode ReplayMode `json:"mode"` + Filename *string `json:"filename,omitempty"` + Icount int64 `json:"icount"` +} + +// ReplayMode -> ReplayMode (enum) + +// ReplayMode implements the "ReplayMode" QMP API type. +type ReplayMode int + +// Known values of ReplayMode. +const ( + ReplayModeNone ReplayMode = iota + ReplayModeRecord + ReplayModePlay +) + +// String implements fmt.Stringer. +func (e ReplayMode) String() string { + switch e { + case ReplayModeNone: + return "none" + case ReplayModeRecord: + return "record" + case ReplayModePlay: + return "play" + default: + return fmt.Sprintf("ReplayMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ReplayMode) MarshalJSON() ([]byte, error) { + switch e { + case ReplayModeNone: + return json.Marshal("none") + case ReplayModeRecord: + return json.Marshal("record") + case ReplayModePlay: + return json.Marshal("play") + default: + return nil, fmt.Errorf("unknown enum value %q for ReplayMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ReplayMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = ReplayModeNone + case "record": + *e = ReplayModeRecord + case "play": + *e = ReplayModePlay + default: + return fmt.Errorf("unknown enum value %q for ReplayMode", s) + } + return nil +} + +// ReplicationMode -> ReplicationMode (enum) + +// ReplicationMode implements the "ReplicationMode" QMP API type. +type ReplicationMode int + +// Known values of ReplicationMode. +const ( + ReplicationModePrimary ReplicationMode = iota + ReplicationModeSecondary +) + +// String implements fmt.Stringer. +func (e ReplicationMode) String() string { + switch e { + case ReplicationModePrimary: + return "primary" + case ReplicationModeSecondary: + return "secondary" + default: + return fmt.Sprintf("ReplicationMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ReplicationMode) MarshalJSON() ([]byte, error) { + switch e { + case ReplicationModePrimary: + return json.Marshal("primary") + case ReplicationModeSecondary: + return json.Marshal("secondary") + default: + return nil, fmt.Errorf("unknown enum value %q for ReplicationMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ReplicationMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "primary": + *e = ReplicationModePrimary + case "secondary": + *e = ReplicationModeSecondary + default: + return fmt.Errorf("unknown enum value %q for ReplicationMode", s) + } + return nil +} + +// ReplicationStatus -> ReplicationStatus (struct) + +// ReplicationStatus implements the "ReplicationStatus" QMP API type. +type ReplicationStatus struct { + Error bool `json:"error"` + Desc *string `json:"desc,omitempty"` +} + +// RockerOfDpaFlow -> RockerOfDpaFlow (struct) + +// RockerOfDpaFlow implements the "RockerOfDpaFlow" QMP API type. +type RockerOfDpaFlow struct { + Cookie uint64 `json:"cookie"` + Hits uint64 `json:"hits"` + Key RockerOfDpaFlowKey `json:"key"` + Mask RockerOfDpaFlowMask `json:"mask"` + Action RockerOfDpaFlowAction `json:"action"` +} + +// RockerOfDpaFlowAction -> RockerOfDpaFlowAction (struct) + +// RockerOfDpaFlowAction implements the "RockerOfDpaFlowAction" QMP API type. +type RockerOfDpaFlowAction struct { + GotoTbl *uint32 `json:"goto-tbl,omitempty"` + GroupID *uint32 `json:"group-id,omitempty"` + TunnelLport *uint32 `json:"tunnel-lport,omitempty"` + VlanID *uint16 `json:"vlan-id,omitempty"` + NewVlanID *uint16 `json:"new-vlan-id,omitempty"` + OutPport *uint32 `json:"out-pport,omitempty"` +} + +// RockerOfDpaFlowKey -> RockerOfDpaFlowKey (struct) + +// RockerOfDpaFlowKey implements the "RockerOfDpaFlowKey" QMP API type. +type RockerOfDpaFlowKey struct { + Priority uint32 `json:"priority"` + TblID uint32 `json:"tbl-id"` + InPport *uint32 `json:"in-pport,omitempty"` + TunnelID *uint32 `json:"tunnel-id,omitempty"` + VlanID *uint16 `json:"vlan-id,omitempty"` + EthType *uint16 `json:"eth-type,omitempty"` + EthSrc *string `json:"eth-src,omitempty"` + EthDst *string `json:"eth-dst,omitempty"` + IPProto *uint8 `json:"ip-proto,omitempty"` + IPTos *uint8 `json:"ip-tos,omitempty"` + IPDst *string `json:"ip-dst,omitempty"` +} + +// RockerOfDpaFlowMask -> RockerOfDpaFlowMask (struct) + +// RockerOfDpaFlowMask implements the "RockerOfDpaFlowMask" QMP API type. +type RockerOfDpaFlowMask struct { + InPport *uint32 `json:"in-pport,omitempty"` + TunnelID *uint32 `json:"tunnel-id,omitempty"` + VlanID *uint16 `json:"vlan-id,omitempty"` + EthSrc *string `json:"eth-src,omitempty"` + EthDst *string `json:"eth-dst,omitempty"` + IPProto *uint8 `json:"ip-proto,omitempty"` + IPTos *uint8 `json:"ip-tos,omitempty"` +} + +// RockerOfDpaGroup -> RockerOfDpaGroup (struct) + +// RockerOfDpaGroup implements the "RockerOfDpaGroup" QMP API type. +type RockerOfDpaGroup struct { + ID uint32 `json:"id"` + Type uint8 `json:"type"` + VlanID *uint16 `json:"vlan-id,omitempty"` + Pport *uint32 `json:"pport,omitempty"` + Index *uint32 `json:"index,omitempty"` + OutPport *uint32 `json:"out-pport,omitempty"` + GroupID *uint32 `json:"group-id,omitempty"` + SetVlanID *uint16 `json:"set-vlan-id,omitempty"` + PopVlan *uint8 `json:"pop-vlan,omitempty"` + GroupIds []uint32 `json:"group-ids,omitempty"` + SetEthSrc *string `json:"set-eth-src,omitempty"` + SetEthDst *string `json:"set-eth-dst,omitempty"` + TTLCheck *uint8 `json:"ttl-check,omitempty"` +} + +// RockerPort -> RockerPort (struct) + +// RockerPort implements the "RockerPort" QMP API type. +type RockerPort struct { + Name string `json:"name"` + Enabled bool `json:"enabled"` + LinkUp bool `json:"link-up"` + Speed uint32 `json:"speed"` + Duplex RockerPortDuplex `json:"duplex"` + Autoneg RockerPortAutoneg `json:"autoneg"` +} + +// RockerPortAutoneg -> RockerPortAutoneg (enum) + +// RockerPortAutoneg implements the "RockerPortAutoneg" QMP API type. +type RockerPortAutoneg int + +// Known values of RockerPortAutoneg. +const ( + RockerPortAutonegOff RockerPortAutoneg = iota + RockerPortAutonegOn +) + +// String implements fmt.Stringer. +func (e RockerPortAutoneg) String() string { + switch e { + case RockerPortAutonegOff: + return "off" + case RockerPortAutonegOn: + return "on" + default: + return fmt.Sprintf("RockerPortAutoneg(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RockerPortAutoneg) MarshalJSON() ([]byte, error) { + switch e { + case RockerPortAutonegOff: + return json.Marshal("off") + case RockerPortAutonegOn: + return json.Marshal("on") + default: + return nil, fmt.Errorf("unknown enum value %q for RockerPortAutoneg", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RockerPortAutoneg) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "off": + *e = RockerPortAutonegOff + case "on": + *e = RockerPortAutonegOn + default: + return fmt.Errorf("unknown enum value %q for RockerPortAutoneg", s) + } + return nil +} + +// RockerPortDuplex -> RockerPortDuplex (enum) + +// RockerPortDuplex implements the "RockerPortDuplex" QMP API type. +type RockerPortDuplex int + +// Known values of RockerPortDuplex. +const ( + RockerPortDuplexHalf RockerPortDuplex = iota + RockerPortDuplexFull +) + +// String implements fmt.Stringer. +func (e RockerPortDuplex) String() string { + switch e { + case RockerPortDuplexHalf: + return "half" + case RockerPortDuplexFull: + return "full" + default: + return fmt.Sprintf("RockerPortDuplex(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RockerPortDuplex) MarshalJSON() ([]byte, error) { + switch e { + case RockerPortDuplexHalf: + return json.Marshal("half") + case RockerPortDuplexFull: + return json.Marshal("full") + default: + return nil, fmt.Errorf("unknown enum value %q for RockerPortDuplex", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RockerPortDuplex) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "half": + *e = RockerPortDuplexHalf + case "full": + *e = RockerPortDuplexFull + default: + return fmt.Errorf("unknown enum value %q for RockerPortDuplex", s) + } + return nil +} + +// RockerSwitch -> RockerSwitch (struct) + +// RockerSwitch implements the "RockerSwitch" QMP API type. +type RockerSwitch struct { + Name string `json:"name"` + ID uint64 `json:"id"` + Ports uint32 `json:"ports"` +} + +// RunState -> RunState (enum) + +// RunState implements the "RunState" QMP API type. +type RunState int + +// Known values of RunState. +const ( + RunStateDebug RunState = iota + RunStateInmigrate + RunStateInternalError + RunStateIOError + RunStatePaused + RunStatePostmigrate + RunStatePrelaunch + RunStateFinishMigrate + RunStateRestoreVM + RunStateRunning + RunStateSaveVM + RunStateShutdown + RunStateSuspended + RunStateWatchdog + RunStateGuestPanicked + RunStateColo +) + +// String implements fmt.Stringer. +func (e RunState) String() string { + switch e { + case RunStateDebug: + return "debug" + case RunStateInmigrate: + return "inmigrate" + case RunStateInternalError: + return "internal-error" + case RunStateIOError: + return "io-error" + case RunStatePaused: + return "paused" + case RunStatePostmigrate: + return "postmigrate" + case RunStatePrelaunch: + return "prelaunch" + case RunStateFinishMigrate: + return "finish-migrate" + case RunStateRestoreVM: + return "restore-vm" + case RunStateRunning: + return "running" + case RunStateSaveVM: + return "save-vm" + case RunStateShutdown: + return "shutdown" + case RunStateSuspended: + return "suspended" + case RunStateWatchdog: + return "watchdog" + case RunStateGuestPanicked: + return "guest-panicked" + case RunStateColo: + return "colo" + default: + return fmt.Sprintf("RunState(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RunState) MarshalJSON() ([]byte, error) { + switch e { + case RunStateDebug: + return json.Marshal("debug") + case RunStateInmigrate: + return json.Marshal("inmigrate") + case RunStateInternalError: + return json.Marshal("internal-error") + case RunStateIOError: + return json.Marshal("io-error") + case RunStatePaused: + return json.Marshal("paused") + case RunStatePostmigrate: + return json.Marshal("postmigrate") + case RunStatePrelaunch: + return json.Marshal("prelaunch") + case RunStateFinishMigrate: + return json.Marshal("finish-migrate") + case RunStateRestoreVM: + return json.Marshal("restore-vm") + case RunStateRunning: + return json.Marshal("running") + case RunStateSaveVM: + return json.Marshal("save-vm") + case RunStateShutdown: + return json.Marshal("shutdown") + case RunStateSuspended: + return json.Marshal("suspended") + case RunStateWatchdog: + return json.Marshal("watchdog") + case RunStateGuestPanicked: + return json.Marshal("guest-panicked") + case RunStateColo: + return json.Marshal("colo") + default: + return nil, fmt.Errorf("unknown enum value %q for RunState", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RunState) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "debug": + *e = RunStateDebug + case "inmigrate": + *e = RunStateInmigrate + case "internal-error": + *e = RunStateInternalError + case "io-error": + *e = RunStateIOError + case "paused": + *e = RunStatePaused + case "postmigrate": + *e = RunStatePostmigrate + case "prelaunch": + *e = RunStatePrelaunch + case "finish-migrate": + *e = RunStateFinishMigrate + case "restore-vm": + *e = RunStateRestoreVM + case "running": + *e = RunStateRunning + case "save-vm": + *e = RunStateSaveVM + case "shutdown": + *e = RunStateShutdown + case "suspended": + *e = RunStateSuspended + case "watchdog": + *e = RunStateWatchdog + case "guest-panicked": + *e = RunStateGuestPanicked + case "colo": + *e = RunStateColo + default: + return fmt.Errorf("unknown enum value %q for RunState", s) + } + return nil +} + +// RxFilterInfo -> RxFilterInfo (struct) + +// RxFilterInfo implements the "RxFilterInfo" QMP API type. +type RxFilterInfo struct { + Name string `json:"name"` + Promiscuous bool `json:"promiscuous"` + Multicast RxState `json:"multicast"` + Unicast RxState `json:"unicast"` + Vlan RxState `json:"vlan"` + BroadcastAllowed bool `json:"broadcast-allowed"` + MulticastOverflow bool `json:"multicast-overflow"` + UnicastOverflow bool `json:"unicast-overflow"` + MainMac string `json:"main-mac"` + VlanTable []int64 `json:"vlan-table"` + UnicastTable []string `json:"unicast-table"` + MulticastTable []string `json:"multicast-table"` +} + +// RxState -> RxState (enum) + +// RxState implements the "RxState" QMP API type. +type RxState int + +// Known values of RxState. +const ( + RxStateNormal RxState = iota + RxStateNone + RxStateAll +) + +// String implements fmt.Stringer. +func (e RxState) String() string { + switch e { + case RxStateNormal: + return "normal" + case RxStateNone: + return "none" + case RxStateAll: + return "all" + default: + return fmt.Sprintf("RxState(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e RxState) MarshalJSON() ([]byte, error) { + switch e { + case RxStateNormal: + return json.Marshal("normal") + case RxStateNone: + return json.Marshal("none") + case RxStateAll: + return json.Marshal("all") + default: + return nil, fmt.Errorf("unknown enum value %q for RxState", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *RxState) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "normal": + *e = RxStateNormal + case "none": + *e = RxStateNone + case "all": + *e = RxStateAll + default: + return fmt.Errorf("unknown enum value %q for RxState", s) + } + return nil +} + +// S390CrashReason -> S390CrashReason (enum) + +// S390CrashReason implements the "S390CrashReason" QMP API type. +type S390CrashReason int + +// Known values of S390CrashReason. +const ( + S390CrashReasonUnknown S390CrashReason = iota + S390CrashReasonDisabledWait + S390CrashReasonExtintLoop + S390CrashReasonPgmintLoop + S390CrashReasonOpintLoop +) + +// String implements fmt.Stringer. +func (e S390CrashReason) String() string { + switch e { + case S390CrashReasonUnknown: + return "unknown" + case S390CrashReasonDisabledWait: + return "disabled-wait" + case S390CrashReasonExtintLoop: + return "extint-loop" + case S390CrashReasonPgmintLoop: + return "pgmint-loop" + case S390CrashReasonOpintLoop: + return "opint-loop" + default: + return fmt.Sprintf("S390CrashReason(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e S390CrashReason) MarshalJSON() ([]byte, error) { + switch e { + case S390CrashReasonUnknown: + return json.Marshal("unknown") + case S390CrashReasonDisabledWait: + return json.Marshal("disabled-wait") + case S390CrashReasonExtintLoop: + return json.Marshal("extint-loop") + case S390CrashReasonPgmintLoop: + return json.Marshal("pgmint-loop") + case S390CrashReasonOpintLoop: + return json.Marshal("opint-loop") + default: + return nil, fmt.Errorf("unknown enum value %q for S390CrashReason", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *S390CrashReason) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "unknown": + *e = S390CrashReasonUnknown + case "disabled-wait": + *e = S390CrashReasonDisabledWait + case "extint-loop": + *e = S390CrashReasonExtintLoop + case "pgmint-loop": + *e = S390CrashReasonPgmintLoop + case "opint-loop": + *e = S390CrashReasonOpintLoop + default: + return fmt.Errorf("unknown enum value %q for S390CrashReason", s) + } + return nil +} + +// SGXEPCSection -> SgxepcSection (struct) + +// SgxepcSection implements the "SGXEPCSection" QMP API type. +type SgxepcSection struct { + Node int64 `json:"node"` + Size uint64 `json:"size"` +} + +// SGXInfo -> SgxInfo (struct) + +// SgxInfo implements the "SGXInfo" QMP API type. +type SgxInfo struct { + Sgx bool `json:"sgx"` + Sgx1 bool `json:"sgx1"` + Sgx2 bool `json:"sgx2"` + Flc bool `json:"flc"` + SectionSize uint64 `json:"section-size"` + Sections []SgxepcSection `json:"sections"` +} + +// EVENT SHUTDOWN + +// EVENT SPICE_CONNECTED + +// EVENT SPICE_DISCONNECTED + +// EVENT SPICE_INITIALIZED + +// EVENT SPICE_MIGRATE_COMPLETED + +// EVENT STOP + +// EVENT SUSPEND + +// EVENT SUSPEND_DISK + +// SchemaInfo -> SchemaInfo (flat union) + +// SchemaInfo implements the "SchemaInfo" QMP API type. +// +// Can be one of: +// - SchemaInfoVariantAlternate +// - SchemaInfoVariantArray +// - SchemaInfoVariantBuiltin +// - SchemaInfoVariantCommand +// - SchemaInfoVariantEnum +// - SchemaInfoVariantEvent +// - SchemaInfoVariantObject +type SchemaInfo interface { + isSchemaInfo() +} + +// SchemaInfoVariantAlternate is an implementation of SchemaInfo. +type SchemaInfoVariantAlternate struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + Members []SchemaInfoAlternateMember `json:"members"` +} + +func (SchemaInfoVariantAlternate) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantAlternate) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantAlternate + }{ + SchemaMetaTypeAlternate, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantArray is an implementation of SchemaInfo. +type SchemaInfoVariantArray struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + ElementType string `json:"element-type"` +} + +func (SchemaInfoVariantArray) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantArray) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantArray + }{ + SchemaMetaTypeArray, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantBuiltin is an implementation of SchemaInfo. +type SchemaInfoVariantBuiltin struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + JSONType JSONType `json:"json-type"` +} + +func (SchemaInfoVariantBuiltin) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantBuiltin) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantBuiltin + }{ + SchemaMetaTypeBuiltin, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantCommand is an implementation of SchemaInfo. +type SchemaInfoVariantCommand struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + ArgType string `json:"arg-type"` + RetType string `json:"ret-type"` + AllowOob *bool `json:"allow-oob,omitempty"` +} + +func (SchemaInfoVariantCommand) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantCommand) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantCommand + }{ + SchemaMetaTypeCommand, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantEnum is an implementation of SchemaInfo. +type SchemaInfoVariantEnum struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + Members []SchemaInfoEnumMember `json:"members"` + Values []string `json:"values"` +} + +func (SchemaInfoVariantEnum) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantEnum) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantEnum + }{ + SchemaMetaTypeEnum, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantEvent is an implementation of SchemaInfo. +type SchemaInfoVariantEvent struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + ArgType string `json:"arg-type"` +} + +func (SchemaInfoVariantEvent) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantEvent) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantEvent + }{ + SchemaMetaTypeEvent, + s, + } + return json.Marshal(v) +} + +// SchemaInfoVariantObject is an implementation of SchemaInfo. +type SchemaInfoVariantObject struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` + Members []SchemaInfoObjectMember `json:"members"` + Tag *string `json:"tag,omitempty"` + Variants []SchemaInfoObjectVariant `json:"variants,omitempty"` +} + +func (SchemaInfoVariantObject) isSchemaInfo() {} + +// MarshalJSON implements json.Marshaler. +func (s SchemaInfoVariantObject) MarshalJSON() ([]byte, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + SchemaInfoVariantObject + }{ + SchemaMetaTypeObject, + s, + } + return json.Marshal(v) +} + +func decodeSchemaInfo(bs json.RawMessage) (SchemaInfo, error) { + v := struct { + MetaType SchemaMetaType `json:"meta-type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.MetaType { + case SchemaMetaTypeAlternate: + var ret SchemaInfoVariantAlternate + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeArray: + var ret SchemaInfoVariantArray + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeBuiltin: + var ret SchemaInfoVariantBuiltin + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeCommand: + var ret SchemaInfoVariantCommand + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeEnum: + var ret SchemaInfoVariantEnum + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeEvent: + var ret SchemaInfoVariantEvent + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SchemaMetaTypeObject: + var ret SchemaInfoVariantObject + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union SchemaInfo", v.MetaType) + } +} + +// SchemaInfoAlternateMember -> SchemaInfoAlternateMember (struct) + +// SchemaInfoAlternateMember implements the "SchemaInfoAlternateMember" QMP API type. +type SchemaInfoAlternateMember struct { + Type string `json:"type"` +} + +// SchemaInfoEnumMember -> SchemaInfoEnumMember (struct) + +// SchemaInfoEnumMember implements the "SchemaInfoEnumMember" QMP API type. +type SchemaInfoEnumMember struct { + Name string `json:"name"` + Features []string `json:"features,omitempty"` +} + +// SchemaInfoObjectMember -> SchemaInfoObjectMember (struct) + +// SchemaInfoObjectMember implements the "SchemaInfoObjectMember" QMP API type. +type SchemaInfoObjectMember struct { + Name string `json:"name"` + Type string `json:"type"` + Default *interface{} `json:"default,omitempty"` + Features []string `json:"features,omitempty"` +} + +// SchemaInfoObjectVariant -> SchemaInfoObjectVariant (struct) + +// SchemaInfoObjectVariant implements the "SchemaInfoObjectVariant" QMP API type. +type SchemaInfoObjectVariant struct { + Case string `json:"case"` + Type string `json:"type"` +} + +// SchemaMetaType -> SchemaMetaType (enum) + +// SchemaMetaType implements the "SchemaMetaType" QMP API type. +type SchemaMetaType int + +// Known values of SchemaMetaType. +const ( + SchemaMetaTypeBuiltin SchemaMetaType = iota + SchemaMetaTypeEnum + SchemaMetaTypeArray + SchemaMetaTypeObject + SchemaMetaTypeAlternate + SchemaMetaTypeCommand + SchemaMetaTypeEvent +) + +// String implements fmt.Stringer. +func (e SchemaMetaType) String() string { + switch e { + case SchemaMetaTypeBuiltin: + return "builtin" + case SchemaMetaTypeEnum: + return "enum" + case SchemaMetaTypeArray: + return "array" + case SchemaMetaTypeObject: + return "object" + case SchemaMetaTypeAlternate: + return "alternate" + case SchemaMetaTypeCommand: + return "command" + case SchemaMetaTypeEvent: + return "event" + default: + return fmt.Sprintf("SchemaMetaType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SchemaMetaType) MarshalJSON() ([]byte, error) { + switch e { + case SchemaMetaTypeBuiltin: + return json.Marshal("builtin") + case SchemaMetaTypeEnum: + return json.Marshal("enum") + case SchemaMetaTypeArray: + return json.Marshal("array") + case SchemaMetaTypeObject: + return json.Marshal("object") + case SchemaMetaTypeAlternate: + return json.Marshal("alternate") + case SchemaMetaTypeCommand: + return json.Marshal("command") + case SchemaMetaTypeEvent: + return json.Marshal("event") + default: + return nil, fmt.Errorf("unknown enum value %q for SchemaMetaType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SchemaMetaType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "builtin": + *e = SchemaMetaTypeBuiltin + case "enum": + *e = SchemaMetaTypeEnum + case "array": + *e = SchemaMetaTypeArray + case "object": + *e = SchemaMetaTypeObject + case "alternate": + *e = SchemaMetaTypeAlternate + case "command": + *e = SchemaMetaTypeCommand + case "event": + *e = SchemaMetaTypeEvent + default: + return fmt.Errorf("unknown enum value %q for SchemaMetaType", s) + } + return nil +} + +// SetPasswordAction -> SetPasswordAction (enum) + +// SetPasswordAction implements the "SetPasswordAction" QMP API type. +type SetPasswordAction int + +// Known values of SetPasswordAction. +const ( + SetPasswordActionKeep SetPasswordAction = iota + SetPasswordActionFail + SetPasswordActionDisconnect +) + +// String implements fmt.Stringer. +func (e SetPasswordAction) String() string { + switch e { + case SetPasswordActionKeep: + return "keep" + case SetPasswordActionFail: + return "fail" + case SetPasswordActionDisconnect: + return "disconnect" + default: + return fmt.Sprintf("SetPasswordAction(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SetPasswordAction) MarshalJSON() ([]byte, error) { + switch e { + case SetPasswordActionKeep: + return json.Marshal("keep") + case SetPasswordActionFail: + return json.Marshal("fail") + case SetPasswordActionDisconnect: + return json.Marshal("disconnect") + default: + return nil, fmt.Errorf("unknown enum value %q for SetPasswordAction", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SetPasswordAction) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "keep": + *e = SetPasswordActionKeep + case "fail": + *e = SetPasswordActionFail + case "disconnect": + *e = SetPasswordActionDisconnect + default: + return fmt.Errorf("unknown enum value %q for SetPasswordAction", s) + } + return nil +} + +// SetPasswordOptions -> SetPasswordOptions (flat union) + +// SetPasswordOptions implements the "SetPasswordOptions" QMP API type. +// +// Can be one of: +// - SetPasswordOptionsVariantVNC +type SetPasswordOptions interface { + isSetPasswordOptions() +} + +// SetPasswordOptionsVariantVNC is an implementation of SetPasswordOptions. +type SetPasswordOptionsVariantVNC struct { + Password string `json:"password"` + Connected *SetPasswordAction `json:"connected,omitempty"` + Display *string `json:"display,omitempty"` +} + +func (SetPasswordOptionsVariantVNC) isSetPasswordOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s SetPasswordOptionsVariantVNC) MarshalJSON() ([]byte, error) { + v := struct { + Protocol DisplayProtocol `json:"protocol"` + SetPasswordOptionsVariantVNC + }{ + DisplayProtocolVNC, + s, + } + return json.Marshal(v) +} + +func decodeSetPasswordOptions(bs json.RawMessage) (SetPasswordOptions, error) { + v := struct { + Protocol DisplayProtocol `json:"protocol"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Protocol { + case DisplayProtocolVNC: + var ret SetPasswordOptionsVariantVNC + err := json.Unmarshal([]byte(bs), &ret) + return ret, err default: - return nil, fmt.Errorf("unknown enum value %q for QKeyCode", e) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union SetPasswordOptions", v.Protocol) } } -// UnmarshalJSON implements json.Unmarshaler. -func (e *QKeyCode) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err - } - switch s { - case "unmapped": - *e = QKeyCodeUnmapped - case "shift": - *e = QKeyCodeShift - case "shift_r": - *e = QKeyCodeShiftR - case "alt": - *e = QKeyCodeAlt - case "alt_r": - *e = QKeyCodeAltR - case "ctrl": - *e = QKeyCodeCtrl - case "ctrl_r": - *e = QKeyCodeCtrlR - case "menu": - *e = QKeyCodeMenu - case "esc": - *e = QKeyCodeEsc - case "1": - *e = QKeyCode1 - case "2": - *e = QKeyCode2 - case "3": - *e = QKeyCode3 - case "4": - *e = QKeyCode4 - case "5": - *e = QKeyCode5 - case "6": - *e = QKeyCode6 - case "7": - *e = QKeyCode7 - case "8": - *e = QKeyCode8 - case "9": - *e = QKeyCode9 - case "0": - *e = QKeyCode0 - case "minus": - *e = QKeyCodeMinus - case "equal": - *e = QKeyCodeEqual - case "backspace": - *e = QKeyCodeBackspace - case "tab": - *e = QKeyCodeTab - case "q": - *e = QKeyCodeQ - case "w": - *e = QKeyCodeW - case "e": - *e = QKeyCodeE - case "r": - *e = QKeyCodeR - case "t": - *e = QKeyCodeT - case "y": - *e = QKeyCodeY - case "u": - *e = QKeyCodeU - case "i": - *e = QKeyCodeI - case "o": - *e = QKeyCodeO - case "p": - *e = QKeyCodeP - case "bracket_left": - *e = QKeyCodeBracketLeft - case "bracket_right": - *e = QKeyCodeBracketRight - case "ret": - *e = QKeyCodeRet - case "a": - *e = QKeyCodeA - case "s": - *e = QKeyCodeS - case "d": - *e = QKeyCodeD - case "f": - *e = QKeyCodeF - case "g": - *e = QKeyCodeG - case "h": - *e = QKeyCodeH - case "j": - *e = QKeyCodeJ - case "k": - *e = QKeyCodeK - case "l": - *e = QKeyCodeL - case "semicolon": - *e = QKeyCodeSemicolon - case "apostrophe": - *e = QKeyCodeApostrophe - case "grave_accent": - *e = QKeyCodeGraveAccent - case "backslash": - *e = QKeyCodeBackslash - case "z": - *e = QKeyCodeZ - case "x": - *e = QKeyCodeX - case "c": - *e = QKeyCodeC - case "v": - *e = QKeyCodeV - case "b": - *e = QKeyCodeB - case "n": - *e = QKeyCodeN - case "m": - *e = QKeyCodeM - case "comma": - *e = QKeyCodeComma - case "dot": - *e = QKeyCodeDot - case "slash": - *e = QKeyCodeSlash - case "asterisk": - *e = QKeyCodeAsterisk - case "spc": - *e = QKeyCodeSpc - case "caps_lock": - *e = QKeyCodeCapsLock - case "f1": - *e = QKeyCodeF1 - case "f2": - *e = QKeyCodeF2 - case "f3": - *e = QKeyCodeF3 - case "f4": - *e = QKeyCodeF4 - case "f5": - *e = QKeyCodeF5 - case "f6": - *e = QKeyCodeF6 - case "f7": - *e = QKeyCodeF7 - case "f8": - *e = QKeyCodeF8 - case "f9": - *e = QKeyCodeF9 - case "f10": - *e = QKeyCodeF10 - case "num_lock": - *e = QKeyCodeNumLock - case "scroll_lock": - *e = QKeyCodeScrollLock - case "kp_divide": - *e = QKeyCodeKpDivide - case "kp_multiply": - *e = QKeyCodeKpMultiply - case "kp_subtract": - *e = QKeyCodeKpSubtract - case "kp_add": - *e = QKeyCodeKpAdd - case "kp_enter": - *e = QKeyCodeKpEnter - case "kp_decimal": - *e = QKeyCodeKpDecimal - case "sysrq": - *e = QKeyCodeSysrq - case "kp_0": - *e = QKeyCodeKp0 - case "kp_1": - *e = QKeyCodeKp1 - case "kp_2": - *e = QKeyCodeKp2 - case "kp_3": - *e = QKeyCodeKp3 - case "kp_4": - *e = QKeyCodeKp4 - case "kp_5": - *e = QKeyCodeKp5 - case "kp_6": - *e = QKeyCodeKp6 - case "kp_7": - *e = QKeyCodeKp7 - case "kp_8": - *e = QKeyCodeKp8 - case "kp_9": - *e = QKeyCodeKp9 - case "less": - *e = QKeyCodeLess - case "f11": - *e = QKeyCodeF11 - case "f12": - *e = QKeyCodeF12 - case "print": - *e = QKeyCodePrint - case "home": - *e = QKeyCodeHome - case "pgup": - *e = QKeyCodePgup - case "pgdn": - *e = QKeyCodePgdn - case "end": - *e = QKeyCodeEnd - case "left": - *e = QKeyCodeLeft - case "up": - *e = QKeyCodeUp - case "down": - *e = QKeyCodeDown - case "right": - *e = QKeyCodeRight - case "insert": - *e = QKeyCodeInsert - case "delete": - *e = QKeyCodeDelete - case "stop": - *e = QKeyCodeStop - case "again": - *e = QKeyCodeAgain - case "props": - *e = QKeyCodeProps - case "undo": - *e = QKeyCodeUndo - case "front": - *e = QKeyCodeFront - case "copy": - *e = QKeyCodeCopy - case "open": - *e = QKeyCodeOpen - case "paste": - *e = QKeyCodePaste - case "find": - *e = QKeyCodeFind - case "cut": - *e = QKeyCodeCut - case "lf": - *e = QKeyCodeLf - case "help": - *e = QKeyCodeHelp - case "meta_l": - *e = QKeyCodeMetaL - case "meta_r": - *e = QKeyCodeMetaR - case "compose": - *e = QKeyCodeCompose +// SevAttestationReport -> SevAttestationReport (struct) + +// SevAttestationReport implements the "SevAttestationReport" QMP API type. +type SevAttestationReport struct { + Data string `json:"data"` +} + +// SevCapability -> SevCapability (struct) + +// SevCapability implements the "SevCapability" QMP API type. +type SevCapability struct { + Pdh string `json:"pdh"` + CertChain string `json:"cert-chain"` + CPU0ID string `json:"cpu0-id"` + Cbitpos int64 `json:"cbitpos"` + ReducedPhysBits int64 `json:"reduced-phys-bits"` +} + +// SevInfo -> SevInfo (struct) + +// SevInfo implements the "SevInfo" QMP API type. +type SevInfo struct { + Enabled bool `json:"enabled"` + ApiMajor uint8 `json:"api-major"` + ApiMinor uint8 `json:"api-minor"` + BuildID uint8 `json:"build-id"` + Policy uint32 `json:"policy"` + State SevState `json:"state"` + Handle uint32 `json:"handle"` +} + +// SevLaunchMeasureInfo -> SevLaunchMeasureInfo (struct) + +// SevLaunchMeasureInfo implements the "SevLaunchMeasureInfo" QMP API type. +type SevLaunchMeasureInfo struct { + Data string `json:"data"` +} + +// SevState -> SevState (enum) + +// SevState implements the "SevState" QMP API type. +type SevState int + +// Known values of SevState. +const ( + SevStateUninit SevState = iota + SevStateLaunchUpdate + SevStateLaunchSecret + SevStateRunning + SevStateSendUpdate + SevStateReceiveUpdate +) + +// String implements fmt.Stringer. +func (e SevState) String() string { + switch e { + case SevStateUninit: + return "uninit" + case SevStateLaunchUpdate: + return "launch-update" + case SevStateLaunchSecret: + return "launch-secret" + case SevStateRunning: + return "running" + case SevStateSendUpdate: + return "send-update" + case SevStateReceiveUpdate: + return "receive-update" + default: + return fmt.Sprintf("SevState(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SevState) MarshalJSON() ([]byte, error) { + switch e { + case SevStateUninit: + return json.Marshal("uninit") + case SevStateLaunchUpdate: + return json.Marshal("launch-update") + case SevStateLaunchSecret: + return json.Marshal("launch-secret") + case SevStateRunning: + return json.Marshal("running") + case SevStateSendUpdate: + return json.Marshal("send-update") + case SevStateReceiveUpdate: + return json.Marshal("receive-update") + default: + return nil, fmt.Errorf("unknown enum value %q for SevState", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SevState) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "uninit": + *e = SevStateUninit + case "launch-update": + *e = SevStateLaunchUpdate + case "launch-secret": + *e = SevStateLaunchSecret + case "running": + *e = SevStateRunning + case "send-update": + *e = SevStateSendUpdate + case "receive-update": + *e = SevStateReceiveUpdate + default: + return fmt.Errorf("unknown enum value %q for SevState", s) + } + return nil +} + +// SgxEPCDeviceInfo -> SgxEpcDeviceInfo (struct) + +// SgxEpcDeviceInfo implements the "SgxEPCDeviceInfo" QMP API type. +type SgxEpcDeviceInfo struct { + ID *string `json:"id,omitempty"` + Memaddr uint64 `json:"memaddr"` + Size uint64 `json:"size"` + Node int64 `json:"node"` + Memdev string `json:"memdev"` +} + +// ShutdownAction -> ShutdownAction (enum) + +// ShutdownAction implements the "ShutdownAction" QMP API type. +type ShutdownAction int + +// Known values of ShutdownAction. +const ( + ShutdownActionPoweroff ShutdownAction = iota + ShutdownActionPause +) + +// String implements fmt.Stringer. +func (e ShutdownAction) String() string { + switch e { + case ShutdownActionPoweroff: + return "poweroff" + case ShutdownActionPause: + return "pause" + default: + return fmt.Sprintf("ShutdownAction(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ShutdownAction) MarshalJSON() ([]byte, error) { + switch e { + case ShutdownActionPoweroff: + return json.Marshal("poweroff") + case ShutdownActionPause: + return json.Marshal("pause") + default: + return nil, fmt.Errorf("unknown enum value %q for ShutdownAction", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ShutdownAction) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "poweroff": + *e = ShutdownActionPoweroff case "pause": - *e = QKeyCodePause - case "ro": - *e = QKeyCodeRo - case "hiragana": - *e = QKeyCodeHiragana - case "henkan": - *e = QKeyCodeHenkan - case "yen": - *e = QKeyCodeYen - case "kp_comma": - *e = QKeyCodeKpComma - case "kp_equals": - *e = QKeyCodeKpEquals - case "power": - *e = QKeyCodePower - case "sleep": - *e = QKeyCodeSleep - case "wake": - *e = QKeyCodeWake - case "audionext": - *e = QKeyCodeAudionext - case "audioprev": - *e = QKeyCodeAudioprev - case "audiostop": - *e = QKeyCodeAudiostop - case "audioplay": - *e = QKeyCodeAudioplay - case "audiomute": - *e = QKeyCodeAudiomute - case "volumeup": - *e = QKeyCodeVolumeup - case "volumedown": - *e = QKeyCodeVolumedown - case "mediaselect": - *e = QKeyCodeMediaselect - case "mail": - *e = QKeyCodeMail - case "calculator": - *e = QKeyCodeCalculator - case "computer": - *e = QKeyCodeComputer - case "ac_home": - *e = QKeyCodeAcHome - case "ac_back": - *e = QKeyCodeAcBack - case "ac_forward": - *e = QKeyCodeAcForward - case "ac_refresh": - *e = QKeyCodeAcRefresh - case "ac_bookmarks": - *e = QKeyCodeAcBookmarks + *e = ShutdownActionPause + default: + return fmt.Errorf("unknown enum value %q for ShutdownAction", s) + } + return nil +} + +// ShutdownCause -> ShutdownCause (enum) + +// ShutdownCause implements the "ShutdownCause" QMP API type. +type ShutdownCause int + +// Known values of ShutdownCause. +const ( + ShutdownCauseNone ShutdownCause = iota + ShutdownCauseHostError + ShutdownCauseHostQMPQuit + ShutdownCauseHostQMPSystemReset + ShutdownCauseHostSignal + ShutdownCauseHostUi + ShutdownCauseGuestShutdown + ShutdownCauseGuestReset + ShutdownCauseGuestPanic + ShutdownCauseSubsystemReset +) + +// String implements fmt.Stringer. +func (e ShutdownCause) String() string { + switch e { + case ShutdownCauseNone: + return "none" + case ShutdownCauseHostError: + return "host-error" + case ShutdownCauseHostQMPQuit: + return "host-qmp-quit" + case ShutdownCauseHostQMPSystemReset: + return "host-qmp-system-reset" + case ShutdownCauseHostSignal: + return "host-signal" + case ShutdownCauseHostUi: + return "host-ui" + case ShutdownCauseGuestShutdown: + return "guest-shutdown" + case ShutdownCauseGuestReset: + return "guest-reset" + case ShutdownCauseGuestPanic: + return "guest-panic" + case ShutdownCauseSubsystemReset: + return "subsystem-reset" + default: + return fmt.Sprintf("ShutdownCause(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e ShutdownCause) MarshalJSON() ([]byte, error) { + switch e { + case ShutdownCauseNone: + return json.Marshal("none") + case ShutdownCauseHostError: + return json.Marshal("host-error") + case ShutdownCauseHostQMPQuit: + return json.Marshal("host-qmp-quit") + case ShutdownCauseHostQMPSystemReset: + return json.Marshal("host-qmp-system-reset") + case ShutdownCauseHostSignal: + return json.Marshal("host-signal") + case ShutdownCauseHostUi: + return json.Marshal("host-ui") + case ShutdownCauseGuestShutdown: + return json.Marshal("guest-shutdown") + case ShutdownCauseGuestReset: + return json.Marshal("guest-reset") + case ShutdownCauseGuestPanic: + return json.Marshal("guest-panic") + case ShutdownCauseSubsystemReset: + return json.Marshal("subsystem-reset") + default: + return nil, fmt.Errorf("unknown enum value %q for ShutdownCause", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *ShutdownCause) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "none": + *e = ShutdownCauseNone + case "host-error": + *e = ShutdownCauseHostError + case "host-qmp-quit": + *e = ShutdownCauseHostQMPQuit + case "host-qmp-system-reset": + *e = ShutdownCauseHostQMPSystemReset + case "host-signal": + *e = ShutdownCauseHostSignal + case "host-ui": + *e = ShutdownCauseHostUi + case "guest-shutdown": + *e = ShutdownCauseGuestShutdown + case "guest-reset": + *e = ShutdownCauseGuestReset + case "guest-panic": + *e = ShutdownCauseGuestPanic + case "subsystem-reset": + *e = ShutdownCauseSubsystemReset + default: + return fmt.Errorf("unknown enum value %q for ShutdownCause", s) + } + return nil +} + +// SnapshotInfo -> SnapshotInfo (struct) + +// SnapshotInfo implements the "SnapshotInfo" QMP API type. +type SnapshotInfo struct { + ID string `json:"id"` + Name string `json:"name"` + VMStateSize int64 `json:"vm-state-size"` + DateSec int64 `json:"date-sec"` + DateNsec int64 `json:"date-nsec"` + VMClockSec int64 `json:"vm-clock-sec"` + VMClockNsec int64 `json:"vm-clock-nsec"` + Icount *int64 `json:"icount,omitempty"` +} + +// SocketAddress -> SocketAddress (flat union) + +// SocketAddress implements the "SocketAddress" QMP API type. +// +// Can be one of: +// - SocketAddressVariantFD +// - SocketAddressVariantInet +// - SocketAddressVariantUnix +// - SocketAddressVariantVsock +type SocketAddress interface { + isSocketAddress() +} + +// SocketAddressVariantFD is an implementation of SocketAddress. +type SocketAddressVariantFD struct { + Str string `json:"str"` +} + +func (SocketAddressVariantFD) isSocketAddress() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressVariantFD) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressVariantFD + }{ + SocketAddressTypeFD, + s, + } + return json.Marshal(v) +} + +// SocketAddressVariantInet is an implementation of SocketAddress. +type SocketAddressVariantInet struct { + Numeric *bool `json:"numeric,omitempty"` + To *uint16 `json:"to,omitempty"` + Ipv4 *bool `json:"ipv4,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + KeepAlive *bool `json:"keep-alive,omitempty"` + Mptcp *bool `json:"mptcp,omitempty"` +} + +func (SocketAddressVariantInet) isSocketAddress() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressVariantInet) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressVariantInet + }{ + SocketAddressTypeInet, + s, + } + return json.Marshal(v) +} + +// SocketAddressVariantUnix is an implementation of SocketAddress. +type SocketAddressVariantUnix struct { + Path string `json:"path"` + Abstract *bool `json:"abstract,omitempty"` + Tight *bool `json:"tight,omitempty"` +} + +func (SocketAddressVariantUnix) isSocketAddress() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressVariantUnix) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressVariantUnix + }{ + SocketAddressTypeUnix, + s, + } + return json.Marshal(v) +} + +// SocketAddressVariantVsock is an implementation of SocketAddress. +type SocketAddressVariantVsock struct { + Cid string `json:"cid"` + Port string `json:"port"` +} + +func (SocketAddressVariantVsock) isSocketAddress() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressVariantVsock) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressVariantVsock + }{ + SocketAddressTypeVsock, + s, + } + return json.Marshal(v) +} + +func decodeSocketAddress(bs json.RawMessage) (SocketAddress, error) { + v := struct { + Type SocketAddressType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case SocketAddressTypeFD: + var ret SocketAddressVariantFD + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeInet: + var ret SocketAddressVariantInet + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeUnix: + var ret SocketAddressVariantUnix + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeVsock: + var ret SocketAddressVariantVsock + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union SocketAddress", v.Type) + } +} + +// SocketAddressLegacy -> SocketAddressLegacy (flat union) + +// SocketAddressLegacy implements the "SocketAddressLegacy" QMP API type. +// +// Can be one of: +// - SocketAddressLegacyVariantFD +// - SocketAddressLegacyVariantInet +// - SocketAddressLegacyVariantUnix +// - SocketAddressLegacyVariantVsock +type SocketAddressLegacy interface { + isSocketAddressLegacy() +} + +// SocketAddressLegacyVariantFD is an implementation of SocketAddressLegacy. +type SocketAddressLegacyVariantFD struct { + Data String `json:"data"` +} + +func (SocketAddressLegacyVariantFD) isSocketAddressLegacy() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressLegacyVariantFD) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressLegacyVariantFD + }{ + SocketAddressTypeFD, + s, + } + return json.Marshal(v) +} + +// SocketAddressLegacyVariantInet is an implementation of SocketAddressLegacy. +type SocketAddressLegacyVariantInet struct { + Data InetSocketAddress `json:"data"` +} + +func (SocketAddressLegacyVariantInet) isSocketAddressLegacy() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressLegacyVariantInet) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressLegacyVariantInet + }{ + SocketAddressTypeInet, + s, + } + return json.Marshal(v) +} + +// SocketAddressLegacyVariantUnix is an implementation of SocketAddressLegacy. +type SocketAddressLegacyVariantUnix struct { + Data UnixSocketAddress `json:"data"` +} + +func (SocketAddressLegacyVariantUnix) isSocketAddressLegacy() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressLegacyVariantUnix) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressLegacyVariantUnix + }{ + SocketAddressTypeUnix, + s, + } + return json.Marshal(v) +} + +// SocketAddressLegacyVariantVsock is an implementation of SocketAddressLegacy. +type SocketAddressLegacyVariantVsock struct { + Data VsockSocketAddress `json:"data"` +} + +func (SocketAddressLegacyVariantVsock) isSocketAddressLegacy() {} + +// MarshalJSON implements json.Marshaler. +func (s SocketAddressLegacyVariantVsock) MarshalJSON() ([]byte, error) { + v := struct { + Type SocketAddressType `json:"type"` + SocketAddressLegacyVariantVsock + }{ + SocketAddressTypeVsock, + s, + } + return json.Marshal(v) +} + +func decodeSocketAddressLegacy(bs json.RawMessage) (SocketAddressLegacy, error) { + v := struct { + Type SocketAddressType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case SocketAddressTypeFD: + var ret SocketAddressLegacyVariantFD + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeInet: + var ret SocketAddressLegacyVariantInet + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeUnix: + var ret SocketAddressLegacyVariantUnix + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case SocketAddressTypeVsock: + var ret SocketAddressLegacyVariantVsock + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union SocketAddressLegacy", v.Type) + } +} + +// SocketAddressType -> SocketAddressType (enum) + +// SocketAddressType implements the "SocketAddressType" QMP API type. +type SocketAddressType int + +// Known values of SocketAddressType. +const ( + SocketAddressTypeInet SocketAddressType = iota + SocketAddressTypeUnix + SocketAddressTypeVsock + SocketAddressTypeFD +) + +// String implements fmt.Stringer. +func (e SocketAddressType) String() string { + switch e { + case SocketAddressTypeInet: + return "inet" + case SocketAddressTypeUnix: + return "unix" + case SocketAddressTypeVsock: + return "vsock" + case SocketAddressTypeFD: + return "fd" + default: + return fmt.Sprintf("SocketAddressType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SocketAddressType) MarshalJSON() ([]byte, error) { + switch e { + case SocketAddressTypeInet: + return json.Marshal("inet") + case SocketAddressTypeUnix: + return json.Marshal("unix") + case SocketAddressTypeVsock: + return json.Marshal("vsock") + case SocketAddressTypeFD: + return json.Marshal("fd") + default: + return nil, fmt.Errorf("unknown enum value %q for SocketAddressType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SocketAddressType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "inet": + *e = SocketAddressTypeInet + case "unix": + *e = SocketAddressTypeUnix + case "vsock": + *e = SocketAddressTypeVsock + case "fd": + *e = SocketAddressTypeFD + default: + return fmt.Errorf("unknown enum value %q for SocketAddressType", s) + } + return nil +} + +// SpiceBasicInfo -> SpiceBasicInfo (struct) + +// SpiceBasicInfo implements the "SpiceBasicInfo" QMP API type. +type SpiceBasicInfo struct { + Host string `json:"host"` + Port string `json:"port"` + Family NetworkAddressFamily `json:"family"` +} + +// SpiceChannel -> SpiceChannel (struct) + +// SpiceChannel implements the "SpiceChannel" QMP API type. +type SpiceChannel struct { + Host string `json:"host"` + Port string `json:"port"` + Family NetworkAddressFamily `json:"family"` + ConnectionID int64 `json:"connection-id"` + ChannelType int64 `json:"channel-type"` + ChannelID int64 `json:"channel-id"` + TLS bool `json:"tls"` +} + +// SpiceInfo -> SpiceInfo (struct) + +// SpiceInfo implements the "SpiceInfo" QMP API type. +type SpiceInfo struct { + Enabled bool `json:"enabled"` + Migrated bool `json:"migrated"` + Host *string `json:"host,omitempty"` + Port *int64 `json:"port,omitempty"` + TLSPort *int64 `json:"tls-port,omitempty"` + Auth *string `json:"auth,omitempty"` + CompiledVersion *string `json:"compiled-version,omitempty"` + MouseMode SpiceQueryMouseMode `json:"mouse-mode"` + Channels []SpiceChannel `json:"channels,omitempty"` +} + +// SpiceQueryMouseMode -> SpiceQueryMouseMode (enum) + +// SpiceQueryMouseMode implements the "SpiceQueryMouseMode" QMP API type. +type SpiceQueryMouseMode int + +// Known values of SpiceQueryMouseMode. +const ( + SpiceQueryMouseModeClient SpiceQueryMouseMode = iota + SpiceQueryMouseModeServer + SpiceQueryMouseModeUnknown +) + +// String implements fmt.Stringer. +func (e SpiceQueryMouseMode) String() string { + switch e { + case SpiceQueryMouseModeClient: + return "client" + case SpiceQueryMouseModeServer: + return "server" + case SpiceQueryMouseModeUnknown: + return "unknown" default: - return fmt.Errorf("unknown enum value %q for QKeyCode", s) + return fmt.Sprintf("SpiceQueryMouseMode(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SpiceQueryMouseMode) MarshalJSON() ([]byte, error) { + switch e { + case SpiceQueryMouseModeClient: + return json.Marshal("client") + case SpiceQueryMouseModeServer: + return json.Marshal("server") + case SpiceQueryMouseModeUnknown: + return json.Marshal("unknown") + default: + return nil, fmt.Errorf("unknown enum value %q for SpiceQueryMouseMode", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SpiceQueryMouseMode) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "client": + *e = SpiceQueryMouseModeClient + case "server": + *e = SpiceQueryMouseModeServer + case "unknown": + *e = SpiceQueryMouseModeUnknown + default: + return fmt.Errorf("unknown enum value %q for SpiceQueryMouseMode", s) } return nil } -// EVENT QUORUM_FAILURE +// SpiceServerInfo -> SpiceServerInfo (struct) -// EVENT QUORUM_REPORT_BAD +// SpiceServerInfo implements the "SpiceServerInfo" QMP API type. +type SpiceServerInfo struct { + Host string `json:"host"` + Port string `json:"port"` + Family NetworkAddressFamily `json:"family"` + Auth *string `json:"auth,omitempty"` +} -// Qcow2OverlapCheckFlags -> Qcow2OverlapCheckFlags (struct) +// SshHostKeyCheck -> SSHHostKeyCheck (flat union) -// Qcow2OverlapCheckFlags implements the "Qcow2OverlapCheckFlags" QMP API type. -type Qcow2OverlapCheckFlags struct { - Template *Qcow2OverlapCheckMode `json:"template,omitempty"` - MainHeader *bool `json:"main-header,omitempty"` - ActiveL1 *bool `json:"active-l1,omitempty"` - ActiveL2 *bool `json:"active-l2,omitempty"` - RefcountTable *bool `json:"refcount-table,omitempty"` - RefcountBlock *bool `json:"refcount-block,omitempty"` - SnapshotTable *bool `json:"snapshot-table,omitempty"` - InactiveL1 *bool `json:"inactive-l1,omitempty"` - InactiveL2 *bool `json:"inactive-l2,omitempty"` +// SSHHostKeyCheck implements the "SshHostKeyCheck" QMP API type. +// +// Can be one of: +// - SSHHostKeyCheckVariantHash +type SSHHostKeyCheck interface { + isSSHHostKeyCheck() } -// Qcow2OverlapCheckMode -> Qcow2OverlapCheckMode (enum) +// SSHHostKeyCheckVariantHash is an implementation of SSHHostKeyCheck. +type SSHHostKeyCheckVariantHash struct { + Type SSHHostKeyCheckHashType `json:"type"` + Hash string `json:"hash"` +} -// Qcow2OverlapCheckMode implements the "Qcow2OverlapCheckMode" QMP API type. -type Qcow2OverlapCheckMode int +func (SSHHostKeyCheckVariantHash) isSSHHostKeyCheck() {} -// Known values of Qcow2OverlapCheckMode. +// MarshalJSON implements json.Marshaler. +func (s SSHHostKeyCheckVariantHash) MarshalJSON() ([]byte, error) { + v := struct { + Mode SSHHostKeyCheckMode `json:"mode"` + SSHHostKeyCheckVariantHash + }{ + SSHHostKeyCheckModeHash, + s, + } + return json.Marshal(v) +} + +func decodeSSHHostKeyCheck(bs json.RawMessage) (SSHHostKeyCheck, error) { + v := struct { + Mode SSHHostKeyCheckMode `json:"mode"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Mode { + case SSHHostKeyCheckModeHash: + var ret SSHHostKeyCheckVariantHash + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union SSHHostKeyCheck", v.Mode) + } +} + +// SshHostKeyCheckHashType -> SSHHostKeyCheckHashType (enum) + +// SSHHostKeyCheckHashType implements the "SshHostKeyCheckHashType" QMP API type. +type SSHHostKeyCheckHashType int + +// Known values of SSHHostKeyCheckHashType. const ( - Qcow2OverlapCheckModeNone Qcow2OverlapCheckMode = iota - Qcow2OverlapCheckModeConstant - Qcow2OverlapCheckModeCached - Qcow2OverlapCheckModeAll + SSHHostKeyCheckHashTypeMd5 SSHHostKeyCheckHashType = iota + SSHHostKeyCheckHashTypeSha1 + SSHHostKeyCheckHashTypeSha256 ) // String implements fmt.Stringer. -func (e Qcow2OverlapCheckMode) String() string { +func (e SSHHostKeyCheckHashType) String() string { switch e { - case Qcow2OverlapCheckModeNone: + case SSHHostKeyCheckHashTypeMd5: + return "md5" + case SSHHostKeyCheckHashTypeSha1: + return "sha1" + case SSHHostKeyCheckHashTypeSha256: + return "sha256" + default: + return fmt.Sprintf("SSHHostKeyCheckHashType(%d)", e) + } +} + +// MarshalJSON implements json.Marshaler. +func (e SSHHostKeyCheckHashType) MarshalJSON() ([]byte, error) { + switch e { + case SSHHostKeyCheckHashTypeMd5: + return json.Marshal("md5") + case SSHHostKeyCheckHashTypeSha1: + return json.Marshal("sha1") + case SSHHostKeyCheckHashTypeSha256: + return json.Marshal("sha256") + default: + return nil, fmt.Errorf("unknown enum value %q for SSHHostKeyCheckHashType", e) + } +} + +// UnmarshalJSON implements json.Unmarshaler. +func (e *SSHHostKeyCheckHashType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "md5": + *e = SSHHostKeyCheckHashTypeMd5 + case "sha1": + *e = SSHHostKeyCheckHashTypeSha1 + case "sha256": + *e = SSHHostKeyCheckHashTypeSha256 + default: + return fmt.Errorf("unknown enum value %q for SSHHostKeyCheckHashType", s) + } + return nil +} + +// SshHostKeyCheckMode -> SSHHostKeyCheckMode (enum) + +// SSHHostKeyCheckMode implements the "SshHostKeyCheckMode" QMP API type. +type SSHHostKeyCheckMode int + +// Known values of SSHHostKeyCheckMode. +const ( + SSHHostKeyCheckModeNone SSHHostKeyCheckMode = iota + SSHHostKeyCheckModeHash + SSHHostKeyCheckModeKnownHosts +) + +// String implements fmt.Stringer. +func (e SSHHostKeyCheckMode) String() string { + switch e { + case SSHHostKeyCheckModeNone: return "none" - case Qcow2OverlapCheckModeConstant: - return "constant" - case Qcow2OverlapCheckModeCached: - return "cached" - case Qcow2OverlapCheckModeAll: - return "all" + case SSHHostKeyCheckModeHash: + return "hash" + case SSHHostKeyCheckModeKnownHosts: + return "known_hosts" default: - return fmt.Sprintf("Qcow2OverlapCheckMode(%d)", e) + return fmt.Sprintf("SSHHostKeyCheckMode(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e Qcow2OverlapCheckMode) MarshalJSON() ([]byte, error) { +func (e SSHHostKeyCheckMode) MarshalJSON() ([]byte, error) { switch e { - case Qcow2OverlapCheckModeNone: + case SSHHostKeyCheckModeNone: return json.Marshal("none") - case Qcow2OverlapCheckModeConstant: - return json.Marshal("constant") - case Qcow2OverlapCheckModeCached: - return json.Marshal("cached") - case Qcow2OverlapCheckModeAll: - return json.Marshal("all") + case SSHHostKeyCheckModeHash: + return json.Marshal("hash") + case SSHHostKeyCheckModeKnownHosts: + return json.Marshal("known_hosts") default: - return nil, fmt.Errorf("unknown enum value %q for Qcow2OverlapCheckMode", e) + return nil, fmt.Errorf("unknown enum value %q for SSHHostKeyCheckMode", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *Qcow2OverlapCheckMode) UnmarshalJSON(bs []byte) error { +func (e *SSHHostKeyCheckMode) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { case "none": - *e = Qcow2OverlapCheckModeNone - case "constant": - *e = Qcow2OverlapCheckModeConstant - case "cached": - *e = Qcow2OverlapCheckModeCached - case "all": - *e = Qcow2OverlapCheckModeAll + *e = SSHHostKeyCheckModeNone + case "hash": + *e = SSHHostKeyCheckModeHash + case "known_hosts": + *e = SSHHostKeyCheckModeKnownHosts default: - return fmt.Errorf("unknown enum value %q for Qcow2OverlapCheckMode", s) + return fmt.Errorf("unknown enum value %q for SSHHostKeyCheckMode", s) } return nil } -// Qcow2OverlapChecks -> Qcow2OverlapChecks (alternate) +// Stats -> Stats (struct) -// Qcow2OverlapChecks implements the "Qcow2OverlapChecks" QMP API type. +// Stats implements the "Stats" QMP API type. +type Stats struct { + Name string `json:"name"` + Value StatsValue `json:"value"` +} + +// StatsFilter -> StatsFilter (flat union) + +// StatsFilter implements the "StatsFilter" QMP API type. // // Can be one of: -// - Qcow2OverlapChecksVariantFlags -// - Qcow2OverlapChecksVariantMode -type Qcow2OverlapChecks interface { - isQcow2OverlapChecks() +// - StatsFilterVariantVcpu +type StatsFilter interface { + isStatsFilter() } -// Qcow2OverlapChecksVariantFlags is an implementation of Qcow2OverlapChecks -type Qcow2OverlapChecksVariantFlags Qcow2OverlapCheckFlags +// StatsFilterVariantVcpu is an implementation of StatsFilter. +type StatsFilterVariantVcpu struct { + Providers []StatsRequest `json:"providers,omitempty"` + Vcpus []string `json:"vcpus,omitempty"` +} -func (Qcow2OverlapChecksVariantFlags) isQcow2OverlapChecks() {} +func (StatsFilterVariantVcpu) isStatsFilter() {} -// Qcow2OverlapChecksVariantMode is an implementation of Qcow2OverlapChecks -type Qcow2OverlapChecksVariantMode Qcow2OverlapCheckMode +// MarshalJSON implements json.Marshaler. +func (s StatsFilterVariantVcpu) MarshalJSON() ([]byte, error) { + v := struct { + Target StatsTarget `json:"target"` + StatsFilterVariantVcpu + }{ + StatsTargetVcpu, + s, + } + return json.Marshal(v) +} -func (Qcow2OverlapChecksVariantMode) isQcow2OverlapChecks() {} +func decodeStatsFilter(bs json.RawMessage) (StatsFilter, error) { + v := struct { + Target StatsTarget `json:"target"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Target { + case StatsTargetVcpu: + var ret StatsFilterVariantVcpu + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union StatsFilter", v.Target) + } +} -func decodeQcow2OverlapChecks(bs json.RawMessage) (Qcow2OverlapChecks, error) { +// StatsProvider -> StatsProvider (enum) - var flags Qcow2OverlapChecksVariantFlags - if err := json.Unmarshal([]byte(bs), &flags); err == nil { - return flags, nil +// StatsProvider implements the "StatsProvider" QMP API type. +type StatsProvider int + +// Known values of StatsProvider. +const ( + StatsProviderKVM StatsProvider = iota +) + +// String implements fmt.Stringer. +func (e StatsProvider) String() string { + switch e { + case StatsProviderKVM: + return "kvm" + default: + return fmt.Sprintf("StatsProvider(%d)", e) } +} - var mode Qcow2OverlapChecksVariantMode - if err := json.Unmarshal([]byte(bs), &mode); err == nil { - return mode, nil +// MarshalJSON implements json.Marshaler. +func (e StatsProvider) MarshalJSON() ([]byte, error) { + switch e { + case StatsProviderKVM: + return json.Marshal("kvm") + default: + return nil, fmt.Errorf("unknown enum value %q for StatsProvider", e) } - return nil, fmt.Errorf("unable to decode %q as a Qcow2OverlapChecks", string(bs)) } -// QuorumOpType -> QuorumOpType (enum) +// UnmarshalJSON implements json.Unmarshaler. +func (e *StatsProvider) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err + } + switch s { + case "kvm": + *e = StatsProviderKVM + default: + return fmt.Errorf("unknown enum value %q for StatsProvider", s) + } + return nil +} -// QuorumOpType implements the "QuorumOpType" QMP API type. -type QuorumOpType int +// StatsRequest -> StatsRequest (struct) -// Known values of QuorumOpType. +// StatsRequest implements the "StatsRequest" QMP API type. +type StatsRequest struct { + Provider StatsProvider `json:"provider"` + Names []string `json:"names,omitempty"` +} + +// StatsResult -> StatsResult (struct) + +// StatsResult implements the "StatsResult" QMP API type. +type StatsResult struct { + Provider StatsProvider `json:"provider"` + QomPath *string `json:"qom-path,omitempty"` + Stats []Stats `json:"stats"` +} + +// StatsSchema -> StatsSchema (struct) + +// StatsSchema implements the "StatsSchema" QMP API type. +type StatsSchema struct { + Provider StatsProvider `json:"provider"` + Target StatsTarget `json:"target"` + Stats []StatsSchemaValue `json:"stats"` +} + +// StatsSchemaValue -> StatsSchemaValue (struct) + +// StatsSchemaValue implements the "StatsSchemaValue" QMP API type. +type StatsSchemaValue struct { + Name string `json:"name"` + Type StatsType `json:"type"` + Unit *StatsUnit `json:"unit,omitempty"` + Base *int8 `json:"base,omitempty"` + Exponent int16 `json:"exponent"` + BucketSize *uint32 `json:"bucket-size,omitempty"` +} + +// StatsTarget -> StatsTarget (enum) + +// StatsTarget implements the "StatsTarget" QMP API type. +type StatsTarget int + +// Known values of StatsTarget. const ( - QuorumOpTypeRead QuorumOpType = iota - QuorumOpTypeWrite - QuorumOpTypeFlush + StatsTargetVM StatsTarget = iota + StatsTargetVcpu ) // String implements fmt.Stringer. -func (e QuorumOpType) String() string { +func (e StatsTarget) String() string { switch e { - case QuorumOpTypeRead: - return "read" - case QuorumOpTypeWrite: - return "write" - case QuorumOpTypeFlush: - return "flush" + case StatsTargetVM: + return "vm" + case StatsTargetVcpu: + return "vcpu" default: - return fmt.Sprintf("QuorumOpType(%d)", e) + return fmt.Sprintf("StatsTarget(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QuorumOpType) MarshalJSON() ([]byte, error) { +func (e StatsTarget) MarshalJSON() ([]byte, error) { switch e { - case QuorumOpTypeRead: - return json.Marshal("read") - case QuorumOpTypeWrite: - return json.Marshal("write") - case QuorumOpTypeFlush: - return json.Marshal("flush") + case StatsTargetVM: + return json.Marshal("vm") + case StatsTargetVcpu: + return json.Marshal("vcpu") default: - return nil, fmt.Errorf("unknown enum value %q for QuorumOpType", e) + return nil, fmt.Errorf("unknown enum value %q for StatsTarget", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QuorumOpType) UnmarshalJSON(bs []byte) error { +func (e *StatsTarget) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "read": - *e = QuorumOpTypeRead - case "write": - *e = QuorumOpTypeWrite - case "flush": - *e = QuorumOpTypeFlush + case "vm": + *e = StatsTargetVM + case "vcpu": + *e = StatsTargetVcpu default: - return fmt.Errorf("unknown enum value %q for QuorumOpType", s) + return fmt.Errorf("unknown enum value %q for StatsTarget", s) } return nil } -// QuorumReadPattern -> QuorumReadPattern (enum) +// StatsType -> StatsType (enum) -// QuorumReadPattern implements the "QuorumReadPattern" QMP API type. -type QuorumReadPattern int +// StatsType implements the "StatsType" QMP API type. +type StatsType int -// Known values of QuorumReadPattern. +// Known values of StatsType. const ( - QuorumReadPatternQuorum QuorumReadPattern = iota - QuorumReadPatternFifo + StatsTypeCumulative StatsType = iota + StatsTypeInstant + StatsTypePeak + StatsTypeLinearHistogram + StatsTypeLog2Histogram ) // String implements fmt.Stringer. -func (e QuorumReadPattern) String() string { +func (e StatsType) String() string { switch e { - case QuorumReadPatternQuorum: - return "quorum" - case QuorumReadPatternFifo: - return "fifo" + case StatsTypeCumulative: + return "cumulative" + case StatsTypeInstant: + return "instant" + case StatsTypePeak: + return "peak" + case StatsTypeLinearHistogram: + return "linear-histogram" + case StatsTypeLog2Histogram: + return "log2-histogram" default: - return fmt.Sprintf("QuorumReadPattern(%d)", e) + return fmt.Sprintf("StatsType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e QuorumReadPattern) MarshalJSON() ([]byte, error) { +func (e StatsType) MarshalJSON() ([]byte, error) { switch e { - case QuorumReadPatternQuorum: - return json.Marshal("quorum") - case QuorumReadPatternFifo: - return json.Marshal("fifo") + case StatsTypeCumulative: + return json.Marshal("cumulative") + case StatsTypeInstant: + return json.Marshal("instant") + case StatsTypePeak: + return json.Marshal("peak") + case StatsTypeLinearHistogram: + return json.Marshal("linear-histogram") + case StatsTypeLog2Histogram: + return json.Marshal("log2-histogram") default: - return nil, fmt.Errorf("unknown enum value %q for QuorumReadPattern", e) + return nil, fmt.Errorf("unknown enum value %q for StatsType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *QuorumReadPattern) UnmarshalJSON(bs []byte) error { +func (e *StatsType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "quorum": - *e = QuorumReadPatternQuorum - case "fifo": - *e = QuorumReadPatternFifo + case "cumulative": + *e = StatsTypeCumulative + case "instant": + *e = StatsTypeInstant + case "peak": + *e = StatsTypePeak + case "linear-histogram": + *e = StatsTypeLinearHistogram + case "log2-histogram": + *e = StatsTypeLog2Histogram default: - return fmt.Errorf("unknown enum value %q for QuorumReadPattern", s) + return fmt.Errorf("unknown enum value %q for StatsType", s) } return nil } -// EVENT RESET - -// EVENT RESUME - -// EVENT RTC_CHANGE - -// ReplicationMode -> ReplicationMode (enum) +// StatsUnit -> StatsUnit (enum) -// ReplicationMode implements the "ReplicationMode" QMP API type. -type ReplicationMode int +// StatsUnit implements the "StatsUnit" QMP API type. +type StatsUnit int -// Known values of ReplicationMode. +// Known values of StatsUnit. const ( - ReplicationModePrimary ReplicationMode = iota - ReplicationModeSecondary + StatsUnitBytes StatsUnit = iota + StatsUnitSeconds + StatsUnitCycles + StatsUnitBoolean ) // String implements fmt.Stringer. -func (e ReplicationMode) String() string { +func (e StatsUnit) String() string { switch e { - case ReplicationModePrimary: - return "primary" - case ReplicationModeSecondary: - return "secondary" + case StatsUnitBytes: + return "bytes" + case StatsUnitSeconds: + return "seconds" + case StatsUnitCycles: + return "cycles" + case StatsUnitBoolean: + return "boolean" default: - return fmt.Sprintf("ReplicationMode(%d)", e) + return fmt.Sprintf("StatsUnit(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e ReplicationMode) MarshalJSON() ([]byte, error) { +func (e StatsUnit) MarshalJSON() ([]byte, error) { switch e { - case ReplicationModePrimary: - return json.Marshal("primary") - case ReplicationModeSecondary: - return json.Marshal("secondary") + case StatsUnitBytes: + return json.Marshal("bytes") + case StatsUnitSeconds: + return json.Marshal("seconds") + case StatsUnitCycles: + return json.Marshal("cycles") + case StatsUnitBoolean: + return json.Marshal("boolean") default: - return nil, fmt.Errorf("unknown enum value %q for ReplicationMode", e) + return nil, fmt.Errorf("unknown enum value %q for StatsUnit", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *ReplicationMode) UnmarshalJSON(bs []byte) error { +func (e *StatsUnit) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "primary": - *e = ReplicationModePrimary - case "secondary": - *e = ReplicationModeSecondary + case "bytes": + *e = StatsUnitBytes + case "seconds": + *e = StatsUnitSeconds + case "cycles": + *e = StatsUnitCycles + case "boolean": + *e = StatsUnitBoolean default: - return fmt.Errorf("unknown enum value %q for ReplicationMode", s) + return fmt.Errorf("unknown enum value %q for StatsUnit", s) } return nil } -// ReplicationStatus -> ReplicationStatus (struct) +// StatsValue -> StatsValue (alternate) -// ReplicationStatus implements the "ReplicationStatus" QMP API type. -type ReplicationStatus struct { - Error bool `json:"error"` - Desc *string `json:"desc,omitempty"` +// StatsValue implements the "StatsValue" QMP API type. +// +// Can be one of: +// - StatsValueVariantBoolean +// - StatsValueVariantList +// - StatsValueVariantScalar +type StatsValue interface { + isStatsValue() } -// RockerOfDpaFlow -> RockerOfDpaFlow (struct) +// StatsValueVariantBoolean is an implementation of StatsValue +type StatsValueVariantBoolean bool -// RockerOfDpaFlow implements the "RockerOfDpaFlow" QMP API type. -type RockerOfDpaFlow struct { - Cookie uint64 `json:"cookie"` - Hits uint64 `json:"hits"` - Key RockerOfDpaFlowKey `json:"key"` - Mask RockerOfDpaFlowMask `json:"mask"` - Action RockerOfDpaFlowAction `json:"action"` -} +func (StatsValueVariantBoolean) isStatsValue() {} -// RockerOfDpaFlowAction -> RockerOfDpaFlowAction (struct) +// StatsValueVariantList is an implementation of StatsValue +type StatsValueVariantList uint64 -// RockerOfDpaFlowAction implements the "RockerOfDpaFlowAction" QMP API type. -type RockerOfDpaFlowAction struct { - GotoTbl *uint32 `json:"goto-tbl,omitempty"` - GroupID *uint32 `json:"group-id,omitempty"` - TunnelLport *uint32 `json:"tunnel-lport,omitempty"` - VlanID *uint16 `json:"vlan-id,omitempty"` - NewVlanID *uint16 `json:"new-vlan-id,omitempty"` - OutPport *uint32 `json:"out-pport,omitempty"` +func (StatsValueVariantList) isStatsValue() {} + +// StatsValueVariantScalar is an implementation of StatsValue +type StatsValueVariantScalar uint64 + +func (StatsValueVariantScalar) isStatsValue() {} + +func decodeStatsValue(bs json.RawMessage) (StatsValue, error) { + + var boolean StatsValueVariantBoolean + if err := json.Unmarshal([]byte(bs), &boolean); err == nil { + return boolean, nil + } + var list StatsValueVariantList + if err := json.Unmarshal([]byte(bs), &list); err == nil { + return list, nil + } + var scalar StatsValueVariantScalar + if err := json.Unmarshal([]byte(bs), &scalar); err == nil { + return scalar, nil + } + return nil, fmt.Errorf("unable to decode %q as a StatsValue", string(bs)) } -// RockerOfDpaFlowKey -> RockerOfDpaFlowKey (struct) +// StatusInfo -> StatusInfo (struct) -// RockerOfDpaFlowKey implements the "RockerOfDpaFlowKey" QMP API type. -type RockerOfDpaFlowKey struct { - Priority uint32 `json:"priority"` - TblID uint32 `json:"tbl-id"` - InPport *uint32 `json:"in-pport,omitempty"` - TunnelID *uint32 `json:"tunnel-id,omitempty"` - VlanID *uint16 `json:"vlan-id,omitempty"` - EthType *uint16 `json:"eth-type,omitempty"` - EthSrc *string `json:"eth-src,omitempty"` - EthDst *string `json:"eth-dst,omitempty"` - IPProto *uint8 `json:"ip-proto,omitempty"` - IPTos *uint8 `json:"ip-tos,omitempty"` - IPDst *string `json:"ip-dst,omitempty"` +// StatusInfo implements the "StatusInfo" QMP API type. +type StatusInfo struct { + Running bool `json:"running"` + Singlestep bool `json:"singlestep"` + Status RunState `json:"status"` } -// RockerOfDpaFlowMask -> RockerOfDpaFlowMask (struct) +// StrOrNull -> StrOrNull (alternate) -// RockerOfDpaFlowMask implements the "RockerOfDpaFlowMask" QMP API type. -type RockerOfDpaFlowMask struct { - InPport *uint32 `json:"in-pport,omitempty"` - TunnelID *uint32 `json:"tunnel-id,omitempty"` - VlanID *uint16 `json:"vlan-id,omitempty"` - EthSrc *string `json:"eth-src,omitempty"` - EthDst *string `json:"eth-dst,omitempty"` - IPProto *uint8 `json:"ip-proto,omitempty"` - IPTos *uint8 `json:"ip-tos,omitempty"` +// StrOrNull implements the "StrOrNull" QMP API type. +// +// Can be one of: +// - StrOrNullVariantN +// - StrOrNullVariantS +type StrOrNull interface { + isStrOrNull() } -// RockerOfDpaGroup -> RockerOfDpaGroup (struct) +// StrOrNullVariantN is a JSON null type, so it must +// also implement the isNullable interface. +type StrOrNullVariantN struct{} -// RockerOfDpaGroup implements the "RockerOfDpaGroup" QMP API type. -type RockerOfDpaGroup struct { - ID uint32 `json:"id"` - Type uint8 `json:"type"` - VlanID *uint16 `json:"vlan-id,omitempty"` - Pport *uint32 `json:"pport,omitempty"` - Index *uint32 `json:"index,omitempty"` - OutPport *uint32 `json:"out-pport,omitempty"` - GroupID *uint32 `json:"group-id,omitempty"` - SetVlanID *uint16 `json:"set-vlan-id,omitempty"` - PopVlan *uint8 `json:"pop-vlan,omitempty"` - GroupIds []uint32 `json:"group-ids,omitempty"` - SetEthSrc *string `json:"set-eth-src,omitempty"` - SetEthDst *string `json:"set-eth-dst,omitempty"` - TTLCheck *uint8 `json:"ttl-check,omitempty"` +func (StrOrNullVariantN) isNull() bool { return true } +func (StrOrNullVariantN) isStrOrNull() {} + +// StrOrNullVariantS is an implementation of StrOrNull +type StrOrNullVariantS string + +func (StrOrNullVariantS) isStrOrNull() {} + +func decodeStrOrNull(bs json.RawMessage) (StrOrNull, error) { + + // Always try unmarshalling for nil first if it's an option + // because other types could unmarshal successfully in the case + // where a Null json type was provided. + var n *int + if err := json.Unmarshal([]byte(bs), &n); err == nil { + if n == nil { + return StrOrNullVariantN{}, nil + } + } + var s StrOrNullVariantS + if err := json.Unmarshal([]byte(bs), &s); err == nil { + return s, nil + } + return nil, fmt.Errorf("unable to decode %q as a StrOrNull", string(bs)) } -// RockerPort -> RockerPort (struct) +// String -> String (struct) -// RockerPort implements the "RockerPort" QMP API type. -type RockerPort struct { - Name string `json:"name"` - Enabled bool `json:"enabled"` - LinkUp bool `json:"link-up"` - Speed uint32 `json:"speed"` - Duplex RockerPortDuplex `json:"duplex"` - Autoneg RockerPortAutoneg `json:"autoneg"` +// String implements the "String" QMP API type. +type String struct { + Str string `json:"str"` } -// RockerPortAutoneg -> RockerPortAutoneg (enum) +// SysEmuTarget -> SysEmuTarget (enum) -// RockerPortAutoneg implements the "RockerPortAutoneg" QMP API type. -type RockerPortAutoneg int +// SysEmuTarget implements the "SysEmuTarget" QMP API type. +type SysEmuTarget int -// Known values of RockerPortAutoneg. +// Known values of SysEmuTarget. const ( - RockerPortAutonegOff RockerPortAutoneg = iota - RockerPortAutonegOn + SysEmuTargetAarch64 SysEmuTarget = iota + SysEmuTargetAlpha + SysEmuTargetArm + SysEmuTargetAvr + SysEmuTargetCris + SysEmuTargetHppa + SysEmuTargetI386 + SysEmuTargetLoongarch64 + SysEmuTargetM68K + SysEmuTargetMicroblaze + SysEmuTargetMicroblazeel + SysEmuTargetMIPS + SysEmuTargetMIPS64 + SysEmuTargetMIPS64El + SysEmuTargetMipsel + SysEmuTargetNios2 + SysEmuTargetOr1K + SysEmuTargetPPC + SysEmuTargetPPC64 + SysEmuTargetRiscv32 + SysEmuTargetRiscv64 + SysEmuTargetRx + SysEmuTargetS390X + SysEmuTargetSh4 + SysEmuTargetSh4Eb + SysEmuTargetSPARC + SysEmuTargetSPARC64 + SysEmuTargetTricore + SysEmuTargetX8664 + SysEmuTargetXtensa + SysEmuTargetXtensaeb ) // String implements fmt.Stringer. -func (e RockerPortAutoneg) String() string { +func (e SysEmuTarget) String() string { switch e { - case RockerPortAutonegOff: - return "off" - case RockerPortAutonegOn: - return "on" + case SysEmuTargetAarch64: + return "aarch64" + case SysEmuTargetAlpha: + return "alpha" + case SysEmuTargetArm: + return "arm" + case SysEmuTargetAvr: + return "avr" + case SysEmuTargetCris: + return "cris" + case SysEmuTargetHppa: + return "hppa" + case SysEmuTargetI386: + return "i386" + case SysEmuTargetLoongarch64: + return "loongarch64" + case SysEmuTargetM68K: + return "m68k" + case SysEmuTargetMicroblaze: + return "microblaze" + case SysEmuTargetMicroblazeel: + return "microblazeel" + case SysEmuTargetMIPS: + return "mips" + case SysEmuTargetMIPS64: + return "mips64" + case SysEmuTargetMIPS64El: + return "mips64el" + case SysEmuTargetMipsel: + return "mipsel" + case SysEmuTargetNios2: + return "nios2" + case SysEmuTargetOr1K: + return "or1k" + case SysEmuTargetPPC: + return "ppc" + case SysEmuTargetPPC64: + return "ppc64" + case SysEmuTargetRiscv32: + return "riscv32" + case SysEmuTargetRiscv64: + return "riscv64" + case SysEmuTargetRx: + return "rx" + case SysEmuTargetS390X: + return "s390x" + case SysEmuTargetSh4: + return "sh4" + case SysEmuTargetSh4Eb: + return "sh4eb" + case SysEmuTargetSPARC: + return "sparc" + case SysEmuTargetSPARC64: + return "sparc64" + case SysEmuTargetTricore: + return "tricore" + case SysEmuTargetX8664: + return "x86_64" + case SysEmuTargetXtensa: + return "xtensa" + case SysEmuTargetXtensaeb: + return "xtensaeb" default: - return fmt.Sprintf("RockerPortAutoneg(%d)", e) + return fmt.Sprintf("SysEmuTarget(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e RockerPortAutoneg) MarshalJSON() ([]byte, error) { +func (e SysEmuTarget) MarshalJSON() ([]byte, error) { switch e { - case RockerPortAutonegOff: - return json.Marshal("off") - case RockerPortAutonegOn: - return json.Marshal("on") + case SysEmuTargetAarch64: + return json.Marshal("aarch64") + case SysEmuTargetAlpha: + return json.Marshal("alpha") + case SysEmuTargetArm: + return json.Marshal("arm") + case SysEmuTargetAvr: + return json.Marshal("avr") + case SysEmuTargetCris: + return json.Marshal("cris") + case SysEmuTargetHppa: + return json.Marshal("hppa") + case SysEmuTargetI386: + return json.Marshal("i386") + case SysEmuTargetLoongarch64: + return json.Marshal("loongarch64") + case SysEmuTargetM68K: + return json.Marshal("m68k") + case SysEmuTargetMicroblaze: + return json.Marshal("microblaze") + case SysEmuTargetMicroblazeel: + return json.Marshal("microblazeel") + case SysEmuTargetMIPS: + return json.Marshal("mips") + case SysEmuTargetMIPS64: + return json.Marshal("mips64") + case SysEmuTargetMIPS64El: + return json.Marshal("mips64el") + case SysEmuTargetMipsel: + return json.Marshal("mipsel") + case SysEmuTargetNios2: + return json.Marshal("nios2") + case SysEmuTargetOr1K: + return json.Marshal("or1k") + case SysEmuTargetPPC: + return json.Marshal("ppc") + case SysEmuTargetPPC64: + return json.Marshal("ppc64") + case SysEmuTargetRiscv32: + return json.Marshal("riscv32") + case SysEmuTargetRiscv64: + return json.Marshal("riscv64") + case SysEmuTargetRx: + return json.Marshal("rx") + case SysEmuTargetS390X: + return json.Marshal("s390x") + case SysEmuTargetSh4: + return json.Marshal("sh4") + case SysEmuTargetSh4Eb: + return json.Marshal("sh4eb") + case SysEmuTargetSPARC: + return json.Marshal("sparc") + case SysEmuTargetSPARC64: + return json.Marshal("sparc64") + case SysEmuTargetTricore: + return json.Marshal("tricore") + case SysEmuTargetX8664: + return json.Marshal("x86_64") + case SysEmuTargetXtensa: + return json.Marshal("xtensa") + case SysEmuTargetXtensaeb: + return json.Marshal("xtensaeb") default: - return nil, fmt.Errorf("unknown enum value %q for RockerPortAutoneg", e) + return nil, fmt.Errorf("unknown enum value %q for SysEmuTarget", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *RockerPortAutoneg) UnmarshalJSON(bs []byte) error { +func (e *SysEmuTarget) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "off": - *e = RockerPortAutonegOff - case "on": - *e = RockerPortAutonegOn + case "aarch64": + *e = SysEmuTargetAarch64 + case "alpha": + *e = SysEmuTargetAlpha + case "arm": + *e = SysEmuTargetArm + case "avr": + *e = SysEmuTargetAvr + case "cris": + *e = SysEmuTargetCris + case "hppa": + *e = SysEmuTargetHppa + case "i386": + *e = SysEmuTargetI386 + case "loongarch64": + *e = SysEmuTargetLoongarch64 + case "m68k": + *e = SysEmuTargetM68K + case "microblaze": + *e = SysEmuTargetMicroblaze + case "microblazeel": + *e = SysEmuTargetMicroblazeel + case "mips": + *e = SysEmuTargetMIPS + case "mips64": + *e = SysEmuTargetMIPS64 + case "mips64el": + *e = SysEmuTargetMIPS64El + case "mipsel": + *e = SysEmuTargetMipsel + case "nios2": + *e = SysEmuTargetNios2 + case "or1k": + *e = SysEmuTargetOr1K + case "ppc": + *e = SysEmuTargetPPC + case "ppc64": + *e = SysEmuTargetPPC64 + case "riscv32": + *e = SysEmuTargetRiscv32 + case "riscv64": + *e = SysEmuTargetRiscv64 + case "rx": + *e = SysEmuTargetRx + case "s390x": + *e = SysEmuTargetS390X + case "sh4": + *e = SysEmuTargetSh4 + case "sh4eb": + *e = SysEmuTargetSh4Eb + case "sparc": + *e = SysEmuTargetSPARC + case "sparc64": + *e = SysEmuTargetSPARC64 + case "tricore": + *e = SysEmuTargetTricore + case "x86_64": + *e = SysEmuTargetX8664 + case "xtensa": + *e = SysEmuTargetXtensa + case "xtensaeb": + *e = SysEmuTargetXtensaeb default: - return fmt.Errorf("unknown enum value %q for RockerPortAutoneg", s) + return fmt.Errorf("unknown enum value %q for SysEmuTarget", s) } return nil } -// RockerPortDuplex -> RockerPortDuplex (enum) +// TPMEmulatorOptions -> TPMEmulatorOptions (struct) -// RockerPortDuplex implements the "RockerPortDuplex" QMP API type. -type RockerPortDuplex int +// TPMEmulatorOptions implements the "TPMEmulatorOptions" QMP API type. +type TPMEmulatorOptions struct { + Chardev string `json:"chardev"` +} -// Known values of RockerPortDuplex. +// TPMInfo -> TPMInfo (struct) + +// TPMInfo implements the "TPMInfo" QMP API type. +type TPMInfo struct { + ID string `json:"id"` + Model TPMModel `json:"model"` + Options TPMTypeOptions `json:"options"` +} + +// TPMPassthroughOptions -> TPMPassthroughOptions (struct) + +// TPMPassthroughOptions implements the "TPMPassthroughOptions" QMP API type. +type TPMPassthroughOptions struct { + Path *string `json:"path,omitempty"` + CancelPath *string `json:"cancel-path,omitempty"` +} + +// TargetInfo -> TargetInfo (struct) + +// TargetInfo implements the "TargetInfo" QMP API type. +type TargetInfo struct { + Arch SysEmuTarget `json:"arch"` +} + +// ThrottleLimits -> ThrottleLimits (struct) + +// ThrottleLimits implements the "ThrottleLimits" QMP API type. +type ThrottleLimits struct { + IopsTotal *int64 `json:"iops-total,omitempty"` + IopsTotalMax *int64 `json:"iops-total-max,omitempty"` + IopsTotalMaxLength *int64 `json:"iops-total-max-length,omitempty"` + IopsRead *int64 `json:"iops-read,omitempty"` + IopsReadMax *int64 `json:"iops-read-max,omitempty"` + IopsReadMaxLength *int64 `json:"iops-read-max-length,omitempty"` + IopsWrite *int64 `json:"iops-write,omitempty"` + IopsWriteMax *int64 `json:"iops-write-max,omitempty"` + IopsWriteMaxLength *int64 `json:"iops-write-max-length,omitempty"` + BpsTotal *int64 `json:"bps-total,omitempty"` + BpsTotalMax *int64 `json:"bps-total-max,omitempty"` + BpsTotalMaxLength *int64 `json:"bps-total-max-length,omitempty"` + BpsRead *int64 `json:"bps-read,omitempty"` + BpsReadMax *int64 `json:"bps-read-max,omitempty"` + BpsReadMaxLength *int64 `json:"bps-read-max-length,omitempty"` + BpsWrite *int64 `json:"bps-write,omitempty"` + BpsWriteMax *int64 `json:"bps-write-max,omitempty"` + BpsWriteMaxLength *int64 `json:"bps-write-max-length,omitempty"` + IopsSize *int64 `json:"iops-size,omitempty"` +} + +// TpmModel -> TPMModel (enum) + +// TPMModel implements the "TpmModel" QMP API type. +type TPMModel int + +// Known values of TPMModel. const ( - RockerPortDuplexHalf RockerPortDuplex = iota - RockerPortDuplexFull + TPMModelTPMTis TPMModel = iota + TPMModelTPMCrb + TPMModelTPMSpapr ) // String implements fmt.Stringer. -func (e RockerPortDuplex) String() string { +func (e TPMModel) String() string { switch e { - case RockerPortDuplexHalf: - return "half" - case RockerPortDuplexFull: - return "full" + case TPMModelTPMTis: + return "tpm-tis" + case TPMModelTPMCrb: + return "tpm-crb" + case TPMModelTPMSpapr: + return "tpm-spapr" default: - return fmt.Sprintf("RockerPortDuplex(%d)", e) + return fmt.Sprintf("TPMModel(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e RockerPortDuplex) MarshalJSON() ([]byte, error) { +func (e TPMModel) MarshalJSON() ([]byte, error) { switch e { - case RockerPortDuplexHalf: - return json.Marshal("half") - case RockerPortDuplexFull: - return json.Marshal("full") + case TPMModelTPMTis: + return json.Marshal("tpm-tis") + case TPMModelTPMCrb: + return json.Marshal("tpm-crb") + case TPMModelTPMSpapr: + return json.Marshal("tpm-spapr") default: - return nil, fmt.Errorf("unknown enum value %q for RockerPortDuplex", e) + return nil, fmt.Errorf("unknown enum value %q for TPMModel", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *RockerPortDuplex) UnmarshalJSON(bs []byte) error { +func (e *TPMModel) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "half": - *e = RockerPortDuplexHalf - case "full": - *e = RockerPortDuplexFull + case "tpm-tis": + *e = TPMModelTPMTis + case "tpm-crb": + *e = TPMModelTPMCrb + case "tpm-spapr": + *e = TPMModelTPMSpapr default: - return fmt.Errorf("unknown enum value %q for RockerPortDuplex", s) + return fmt.Errorf("unknown enum value %q for TPMModel", s) } return nil } -// RockerSwitch -> RockerSwitch (struct) - -// RockerSwitch implements the "RockerSwitch" QMP API type. -type RockerSwitch struct { - Name string `json:"name"` - ID uint64 `json:"id"` - Ports uint32 `json:"ports"` -} - -// RunState -> RunState (enum) +// TpmType -> TPMType (enum) -// RunState implements the "RunState" QMP API type. -type RunState int +// TPMType implements the "TpmType" QMP API type. +type TPMType int -// Known values of RunState. +// Known values of TPMType. const ( - RunStateDebug RunState = iota - RunStateInmigrate - RunStateInternalError - RunStateIOError - RunStatePaused - RunStatePostmigrate - RunStatePrelaunch - RunStateFinishMigrate - RunStateRestoreVM - RunStateRunning - RunStateSaveVM - RunStateShutdown - RunStateSuspended - RunStateWatchdog - RunStateGuestPanicked - RunStateColo + TPMTypePassthrough TPMType = iota + TPMTypeEmulator ) // String implements fmt.Stringer. -func (e RunState) String() string { +func (e TPMType) String() string { switch e { - case RunStateDebug: - return "debug" - case RunStateInmigrate: - return "inmigrate" - case RunStateInternalError: - return "internal-error" - case RunStateIOError: - return "io-error" - case RunStatePaused: - return "paused" - case RunStatePostmigrate: - return "postmigrate" - case RunStatePrelaunch: - return "prelaunch" - case RunStateFinishMigrate: - return "finish-migrate" - case RunStateRestoreVM: - return "restore-vm" - case RunStateRunning: - return "running" - case RunStateSaveVM: - return "save-vm" - case RunStateShutdown: - return "shutdown" - case RunStateSuspended: - return "suspended" - case RunStateWatchdog: - return "watchdog" - case RunStateGuestPanicked: - return "guest-panicked" - case RunStateColo: - return "colo" + case TPMTypePassthrough: + return "passthrough" + case TPMTypeEmulator: + return "emulator" default: - return fmt.Sprintf("RunState(%d)", e) + return fmt.Sprintf("TPMType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e RunState) MarshalJSON() ([]byte, error) { +func (e TPMType) MarshalJSON() ([]byte, error) { switch e { - case RunStateDebug: - return json.Marshal("debug") - case RunStateInmigrate: - return json.Marshal("inmigrate") - case RunStateInternalError: - return json.Marshal("internal-error") - case RunStateIOError: - return json.Marshal("io-error") - case RunStatePaused: - return json.Marshal("paused") - case RunStatePostmigrate: - return json.Marshal("postmigrate") - case RunStatePrelaunch: - return json.Marshal("prelaunch") - case RunStateFinishMigrate: - return json.Marshal("finish-migrate") - case RunStateRestoreVM: - return json.Marshal("restore-vm") - case RunStateRunning: - return json.Marshal("running") - case RunStateSaveVM: - return json.Marshal("save-vm") - case RunStateShutdown: - return json.Marshal("shutdown") - case RunStateSuspended: - return json.Marshal("suspended") - case RunStateWatchdog: - return json.Marshal("watchdog") - case RunStateGuestPanicked: - return json.Marshal("guest-panicked") - case RunStateColo: - return json.Marshal("colo") + case TPMTypePassthrough: + return json.Marshal("passthrough") + case TPMTypeEmulator: + return json.Marshal("emulator") default: - return nil, fmt.Errorf("unknown enum value %q for RunState", e) + return nil, fmt.Errorf("unknown enum value %q for TPMType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *RunState) UnmarshalJSON(bs []byte) error { +func (e *TPMType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "debug": - *e = RunStateDebug - case "inmigrate": - *e = RunStateInmigrate - case "internal-error": - *e = RunStateInternalError - case "io-error": - *e = RunStateIOError - case "paused": - *e = RunStatePaused - case "postmigrate": - *e = RunStatePostmigrate - case "prelaunch": - *e = RunStatePrelaunch - case "finish-migrate": - *e = RunStateFinishMigrate - case "restore-vm": - *e = RunStateRestoreVM - case "running": - *e = RunStateRunning - case "save-vm": - *e = RunStateSaveVM - case "shutdown": - *e = RunStateShutdown - case "suspended": - *e = RunStateSuspended - case "watchdog": - *e = RunStateWatchdog - case "guest-panicked": - *e = RunStateGuestPanicked - case "colo": - *e = RunStateColo + case "passthrough": + *e = TPMTypePassthrough + case "emulator": + *e = TPMTypeEmulator default: - return fmt.Errorf("unknown enum value %q for RunState", s) + return fmt.Errorf("unknown enum value %q for TPMType", s) } return nil } -// RxFilterInfo -> RxFilterInfo (struct) +// TpmTypeOptions -> TPMTypeOptions (flat union) -// RxFilterInfo implements the "RxFilterInfo" QMP API type. -type RxFilterInfo struct { - Name string `json:"name"` - Promiscuous bool `json:"promiscuous"` - Multicast RxState `json:"multicast"` - Unicast RxState `json:"unicast"` - Vlan RxState `json:"vlan"` - BroadcastAllowed bool `json:"broadcast-allowed"` - MulticastOverflow bool `json:"multicast-overflow"` - UnicastOverflow bool `json:"unicast-overflow"` - MainMac string `json:"main-mac"` - VlanTable []int64 `json:"vlan-table"` - UnicastTable []string `json:"unicast-table"` - MulticastTable []string `json:"multicast-table"` +// TPMTypeOptions implements the "TpmTypeOptions" QMP API type. +// +// Can be one of: +// - TPMTypeOptionsVariantEmulator +// - TPMTypeOptionsVariantPassthrough +type TPMTypeOptions interface { + isTPMTypeOptions() +} + +// TPMTypeOptionsVariantEmulator is an implementation of TPMTypeOptions. +type TPMTypeOptionsVariantEmulator struct { + Data TPMEmulatorOptions `json:"data"` +} + +func (TPMTypeOptionsVariantEmulator) isTPMTypeOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s TPMTypeOptionsVariantEmulator) MarshalJSON() ([]byte, error) { + v := struct { + Type TPMType `json:"type"` + TPMTypeOptionsVariantEmulator + }{ + TPMTypeEmulator, + s, + } + return json.Marshal(v) +} + +// TPMTypeOptionsVariantPassthrough is an implementation of TPMTypeOptions. +type TPMTypeOptionsVariantPassthrough struct { + Data TPMPassthroughOptions `json:"data"` +} + +func (TPMTypeOptionsVariantPassthrough) isTPMTypeOptions() {} + +// MarshalJSON implements json.Marshaler. +func (s TPMTypeOptionsVariantPassthrough) MarshalJSON() ([]byte, error) { + v := struct { + Type TPMType `json:"type"` + TPMTypeOptionsVariantPassthrough + }{ + TPMTypePassthrough, + s, + } + return json.Marshal(v) +} + +func decodeTPMTypeOptions(bs json.RawMessage) (TPMTypeOptions, error) { + v := struct { + Type TPMType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case TPMTypeEmulator: + var ret TPMTypeOptionsVariantEmulator + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TPMTypePassthrough: + var ret TPMTypeOptionsVariantPassthrough + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union TPMTypeOptions", v.Type) + } } -// RxState -> RxState (enum) +// TraceEventInfo -> TraceEventInfo (struct) -// RxState implements the "RxState" QMP API type. -type RxState int +// TraceEventInfo implements the "TraceEventInfo" QMP API type. +type TraceEventInfo struct { + Name string `json:"name"` + State TraceEventState `json:"state"` + Vcpu bool `json:"vcpu"` +} -// Known values of RxState. +// TraceEventState -> TraceEventState (enum) + +// TraceEventState implements the "TraceEventState" QMP API type. +type TraceEventState int + +// Known values of TraceEventState. const ( - RxStateNormal RxState = iota - RxStateNone - RxStateAll + TraceEventStateUnavailable TraceEventState = iota + TraceEventStateDisabled + TraceEventStateEnabled ) // String implements fmt.Stringer. -func (e RxState) String() string { +func (e TraceEventState) String() string { switch e { - case RxStateNormal: - return "normal" - case RxStateNone: - return "none" - case RxStateAll: - return "all" + case TraceEventStateUnavailable: + return "unavailable" + case TraceEventStateDisabled: + return "disabled" + case TraceEventStateEnabled: + return "enabled" default: - return fmt.Sprintf("RxState(%d)", e) + return fmt.Sprintf("TraceEventState(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e RxState) MarshalJSON() ([]byte, error) { +func (e TraceEventState) MarshalJSON() ([]byte, error) { switch e { - case RxStateNormal: - return json.Marshal("normal") - case RxStateNone: - return json.Marshal("none") - case RxStateAll: - return json.Marshal("all") + case TraceEventStateUnavailable: + return json.Marshal("unavailable") + case TraceEventStateDisabled: + return json.Marshal("disabled") + case TraceEventStateEnabled: + return json.Marshal("enabled") default: - return nil, fmt.Errorf("unknown enum value %q for RxState", e) + return nil, fmt.Errorf("unknown enum value %q for TraceEventState", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *RxState) UnmarshalJSON(bs []byte) error { +func (e *TraceEventState) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "normal": - *e = RxStateNormal - case "none": - *e = RxStateNone - case "all": - *e = RxStateAll + case "unavailable": + *e = TraceEventStateUnavailable + case "disabled": + *e = TraceEventStateDisabled + case "enabled": + *e = TraceEventStateEnabled default: - return fmt.Errorf("unknown enum value %q for RxState", s) + return fmt.Errorf("unknown enum value %q for TraceEventState", s) } return nil } -// EVENT SHUTDOWN +// TransactionAction -> TransactionAction (flat union) -// EVENT SPICE_CONNECTED +// TransactionAction implements the "TransactionAction" QMP API type. +// +// Can be one of: +// - TransactionActionVariantAbort +// - TransactionActionVariantBlockDirtyBitmapAdd +// - TransactionActionVariantBlockDirtyBitmapClear +// - TransactionActionVariantBlockDirtyBitmapDisable +// - TransactionActionVariantBlockDirtyBitmapEnable +// - TransactionActionVariantBlockDirtyBitmapMerge +// - TransactionActionVariantBlockDirtyBitmapRemove +// - TransactionActionVariantBlockdevBackup +// - TransactionActionVariantBlockdevSnapshot +// - TransactionActionVariantBlockdevSnapshotInternalSync +// - TransactionActionVariantBlockdevSnapshotSync +// - TransactionActionVariantDriveBackup +type TransactionAction interface { + isTransactionAction() +} -// EVENT SPICE_DISCONNECTED +// TransactionActionVariantAbort is an implementation of TransactionAction. +type TransactionActionVariantAbort struct { + Data Abort `json:"data"` +} -// EVENT SPICE_INITIALIZED +func (TransactionActionVariantAbort) isTransactionAction() {} -// EVENT SPICE_MIGRATE_COMPLETED +// MarshalJSON implements json.Marshaler. +func (s TransactionActionVariantAbort) MarshalJSON() ([]byte, error) { + v := struct { + Type TransactionActionKind `json:"type"` + TransactionActionVariantAbort + }{ + TransactionActionKindAbort, + s, + } + return json.Marshal(v) +} -// EVENT STOP +// TransactionActionVariantBlockDirtyBitmapAdd is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapAdd struct { + Data BlockDirtyBitmapAdd `json:"data"` +} -// EVENT SUSPEND +func (TransactionActionVariantBlockDirtyBitmapAdd) isTransactionAction() {} -// EVENT SUSPEND_DISK +// MarshalJSON implements json.Marshaler. +func (s TransactionActionVariantBlockDirtyBitmapAdd) MarshalJSON() ([]byte, error) { + v := struct { + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapAdd + }{ + TransactionActionKindBlockDirtyBitmapAdd, + s, + } + return json.Marshal(v) +} -// SchemaInfo -> SchemaInfo (flat union) +// TransactionActionVariantBlockDirtyBitmapClear is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapClear struct { + Data BlockDirtyBitmap `json:"data"` +} -// SchemaInfo implements the "SchemaInfo" QMP API type. -// -// Can be one of: -// - SchemaInfoVariantAlternate -// - SchemaInfoVariantArray -// - SchemaInfoVariantBuiltin -// - SchemaInfoVariantCommand -// - SchemaInfoVariantEnum -// - SchemaInfoVariantEvent -// - SchemaInfoVariantObject -type SchemaInfo interface { - isSchemaInfo() +func (TransactionActionVariantBlockDirtyBitmapClear) isTransactionAction() {} + +// MarshalJSON implements json.Marshaler. +func (s TransactionActionVariantBlockDirtyBitmapClear) MarshalJSON() ([]byte, error) { + v := struct { + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapClear + }{ + TransactionActionKindBlockDirtyBitmapClear, + s, + } + return json.Marshal(v) } -// SchemaInfoVariantAlternate is an implementation of SchemaInfo. -type SchemaInfoVariantAlternate struct { - Name string `json:"name"` - Members []SchemaInfoAlternateMember `json:"members"` +// TransactionActionVariantBlockDirtyBitmapDisable is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapDisable struct { + Data BlockDirtyBitmap `json:"data"` } -func (SchemaInfoVariantAlternate) isSchemaInfo() {} +func (TransactionActionVariantBlockDirtyBitmapDisable) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantAlternate) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockDirtyBitmapDisable) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantAlternate + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapDisable }{ - SchemaMetaTypeAlternate, + TransactionActionKindBlockDirtyBitmapDisable, s, } return json.Marshal(v) } -// SchemaInfoVariantArray is an implementation of SchemaInfo. -type SchemaInfoVariantArray struct { - Name string `json:"name"` - ElementType string `json:"element-type"` +// TransactionActionVariantBlockDirtyBitmapEnable is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapEnable struct { + Data BlockDirtyBitmap `json:"data"` } -func (SchemaInfoVariantArray) isSchemaInfo() {} +func (TransactionActionVariantBlockDirtyBitmapEnable) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantArray) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockDirtyBitmapEnable) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantArray + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapEnable }{ - SchemaMetaTypeArray, + TransactionActionKindBlockDirtyBitmapEnable, s, } return json.Marshal(v) } -// SchemaInfoVariantBuiltin is an implementation of SchemaInfo. -type SchemaInfoVariantBuiltin struct { - Name string `json:"name"` - JSONType JSONType `json:"json-type"` +// TransactionActionVariantBlockDirtyBitmapMerge is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapMerge struct { + Data BlockDirtyBitmapMerge `json:"data"` } -func (SchemaInfoVariantBuiltin) isSchemaInfo() {} +func (TransactionActionVariantBlockDirtyBitmapMerge) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantBuiltin) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockDirtyBitmapMerge) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantBuiltin + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapMerge }{ - SchemaMetaTypeBuiltin, + TransactionActionKindBlockDirtyBitmapMerge, s, } return json.Marshal(v) } -// SchemaInfoVariantCommand is an implementation of SchemaInfo. -type SchemaInfoVariantCommand struct { - Name string `json:"name"` - ArgType string `json:"arg-type"` - RetType string `json:"ret-type"` +// TransactionActionVariantBlockDirtyBitmapRemove is an implementation of TransactionAction. +type TransactionActionVariantBlockDirtyBitmapRemove struct { + Data BlockDirtyBitmap `json:"data"` } -func (SchemaInfoVariantCommand) isSchemaInfo() {} +func (TransactionActionVariantBlockDirtyBitmapRemove) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantCommand) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockDirtyBitmapRemove) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantCommand + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockDirtyBitmapRemove }{ - SchemaMetaTypeCommand, + TransactionActionKindBlockDirtyBitmapRemove, s, } return json.Marshal(v) } -// SchemaInfoVariantEnum is an implementation of SchemaInfo. -type SchemaInfoVariantEnum struct { - Name string `json:"name"` - Values []string `json:"values"` +// TransactionActionVariantBlockdevBackup is an implementation of TransactionAction. +type TransactionActionVariantBlockdevBackup struct { + Data BlockdevBackup `json:"data"` } -func (SchemaInfoVariantEnum) isSchemaInfo() {} +func (TransactionActionVariantBlockdevBackup) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantEnum) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockdevBackup) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantEnum + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockdevBackup }{ - SchemaMetaTypeEnum, + TransactionActionKindBlockdevBackup, s, } return json.Marshal(v) } -// SchemaInfoVariantEvent is an implementation of SchemaInfo. -type SchemaInfoVariantEvent struct { - Name string `json:"name"` - ArgType string `json:"arg-type"` +// TransactionActionVariantBlockdevSnapshot is an implementation of TransactionAction. +type TransactionActionVariantBlockdevSnapshot struct { + Data BlockdevSnapshot `json:"data"` } -func (SchemaInfoVariantEvent) isSchemaInfo() {} +func (TransactionActionVariantBlockdevSnapshot) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantEvent) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockdevSnapshot) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantEvent + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockdevSnapshot }{ - SchemaMetaTypeEvent, + TransactionActionKindBlockdevSnapshot, s, } return json.Marshal(v) } -// SchemaInfoVariantObject is an implementation of SchemaInfo. -type SchemaInfoVariantObject struct { - Name string `json:"name"` - Members []SchemaInfoObjectMember `json:"members"` - Tag *string `json:"tag,omitempty"` - Variants []SchemaInfoObjectVariant `json:"variants,omitempty"` +// TransactionActionVariantBlockdevSnapshotInternalSync is an implementation of TransactionAction. +type TransactionActionVariantBlockdevSnapshotInternalSync struct { + Data BlockdevSnapshotInternal `json:"data"` } -func (SchemaInfoVariantObject) isSchemaInfo() {} +func (TransactionActionVariantBlockdevSnapshotInternalSync) isTransactionAction() {} // MarshalJSON implements json.Marshaler. -func (s SchemaInfoVariantObject) MarshalJSON() ([]byte, error) { +func (s TransactionActionVariantBlockdevSnapshotInternalSync) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` - SchemaInfoVariantObject + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockdevSnapshotInternalSync }{ - SchemaMetaTypeObject, + TransactionActionKindBlockdevSnapshotInternalSync, s, } return json.Marshal(v) } -func decodeSchemaInfo(bs json.RawMessage) (SchemaInfo, error) { +// TransactionActionVariantBlockdevSnapshotSync is an implementation of TransactionAction. +type TransactionActionVariantBlockdevSnapshotSync struct { + Data BlockdevSnapshotSync `json:"data"` +} + +func (TransactionActionVariantBlockdevSnapshotSync) isTransactionAction() {} + +// MarshalJSON implements json.Marshaler. +func (s TransactionActionVariantBlockdevSnapshotSync) MarshalJSON() ([]byte, error) { v := struct { - MetaType SchemaMetaType `json:"meta-type"` + Type TransactionActionKind `json:"type"` + TransactionActionVariantBlockdevSnapshotSync + }{ + TransactionActionKindBlockdevSnapshotSync, + s, + } + return json.Marshal(v) +} + +// TransactionActionVariantDriveBackup is an implementation of TransactionAction. +type TransactionActionVariantDriveBackup struct { + Data DriveBackup `json:"data"` +} + +func (TransactionActionVariantDriveBackup) isTransactionAction() {} + +// MarshalJSON implements json.Marshaler. +func (s TransactionActionVariantDriveBackup) MarshalJSON() ([]byte, error) { + v := struct { + Type TransactionActionKind `json:"type"` + TransactionActionVariantDriveBackup + }{ + TransactionActionKindDriveBackup, + s, + } + return json.Marshal(v) +} + +func decodeTransactionAction(bs json.RawMessage) (TransactionAction, error) { + v := struct { + Type TransactionActionKind `json:"type"` }{} if err := json.Unmarshal([]byte(bs), &v); err != nil { return nil, err } - switch v.MetaType { - case SchemaMetaTypeAlternate: - var ret SchemaInfoVariantAlternate + switch v.Type { + case TransactionActionKindAbort: + var ret TransactionActionVariantAbort err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeArray: - var ret SchemaInfoVariantArray + case TransactionActionKindBlockDirtyBitmapAdd: + var ret TransactionActionVariantBlockDirtyBitmapAdd err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeBuiltin: - var ret SchemaInfoVariantBuiltin + case TransactionActionKindBlockDirtyBitmapClear: + var ret TransactionActionVariantBlockDirtyBitmapClear + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TransactionActionKindBlockDirtyBitmapDisable: + var ret TransactionActionVariantBlockDirtyBitmapDisable + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TransactionActionKindBlockDirtyBitmapEnable: + var ret TransactionActionVariantBlockDirtyBitmapEnable + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TransactionActionKindBlockDirtyBitmapMerge: + var ret TransactionActionVariantBlockDirtyBitmapMerge + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TransactionActionKindBlockDirtyBitmapRemove: + var ret TransactionActionVariantBlockDirtyBitmapRemove + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case TransactionActionKindBlockdevBackup: + var ret TransactionActionVariantBlockdevBackup err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeCommand: - var ret SchemaInfoVariantCommand + case TransactionActionKindBlockdevSnapshot: + var ret TransactionActionVariantBlockdevSnapshot err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeEnum: - var ret SchemaInfoVariantEnum + case TransactionActionKindBlockdevSnapshotInternalSync: + var ret TransactionActionVariantBlockdevSnapshotInternalSync err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeEvent: - var ret SchemaInfoVariantEvent + case TransactionActionKindBlockdevSnapshotSync: + var ret TransactionActionVariantBlockdevSnapshotSync err := json.Unmarshal([]byte(bs), &ret) return ret, err - case SchemaMetaTypeObject: - var ret SchemaInfoVariantObject + case TransactionActionKindDriveBackup: + var ret TransactionActionVariantDriveBackup err := json.Unmarshal([]byte(bs), &ret) return ret, err default: - return nil, fmt.Errorf("unknown flat union subtype %q for flat union SchemaInfo", v.MetaType) + return nil, fmt.Errorf("unknown flat union subtype %q for flat union TransactionAction", v.Type) } } -// SchemaInfoAlternateMember -> SchemaInfoAlternateMember (struct) - -// SchemaInfoAlternateMember implements the "SchemaInfoAlternateMember" QMP API type. -type SchemaInfoAlternateMember struct { - Type string `json:"type"` -} - -// SchemaInfoObjectMember -> SchemaInfoObjectMember (struct) - -// SchemaInfoObjectMember implements the "SchemaInfoObjectMember" QMP API type. -type SchemaInfoObjectMember struct { - Name string `json:"name"` - Type string `json:"type"` - Default *interface{} `json:"default,omitempty"` -} - -// SchemaInfoObjectVariant -> SchemaInfoObjectVariant (struct) - -// SchemaInfoObjectVariant implements the "SchemaInfoObjectVariant" QMP API type. -type SchemaInfoObjectVariant struct { - Case string `json:"case"` - Type string `json:"type"` -} - -// SchemaMetaType -> SchemaMetaType (enum) +// TransactionActionKind -> TransactionActionKind (enum) -// SchemaMetaType implements the "SchemaMetaType" QMP API type. -type SchemaMetaType int +// TransactionActionKind implements the "TransactionActionKind" QMP API type. +type TransactionActionKind int -// Known values of SchemaMetaType. +// Known values of TransactionActionKind. const ( - SchemaMetaTypeBuiltin SchemaMetaType = iota - SchemaMetaTypeEnum - SchemaMetaTypeArray - SchemaMetaTypeObject - SchemaMetaTypeAlternate - SchemaMetaTypeCommand - SchemaMetaTypeEvent + TransactionActionKindAbort TransactionActionKind = iota + TransactionActionKindBlockDirtyBitmapAdd + TransactionActionKindBlockDirtyBitmapRemove + TransactionActionKindBlockDirtyBitmapClear + TransactionActionKindBlockDirtyBitmapEnable + TransactionActionKindBlockDirtyBitmapDisable + TransactionActionKindBlockDirtyBitmapMerge + TransactionActionKindBlockdevBackup + TransactionActionKindBlockdevSnapshot + TransactionActionKindBlockdevSnapshotInternalSync + TransactionActionKindBlockdevSnapshotSync + TransactionActionKindDriveBackup ) // String implements fmt.Stringer. -func (e SchemaMetaType) String() string { +func (e TransactionActionKind) String() string { switch e { - case SchemaMetaTypeBuiltin: - return "builtin" - case SchemaMetaTypeEnum: - return "enum" - case SchemaMetaTypeArray: - return "array" - case SchemaMetaTypeObject: - return "object" - case SchemaMetaTypeAlternate: - return "alternate" - case SchemaMetaTypeCommand: - return "command" - case SchemaMetaTypeEvent: - return "event" + case TransactionActionKindAbort: + return "abort" + case TransactionActionKindBlockDirtyBitmapAdd: + return "block-dirty-bitmap-add" + case TransactionActionKindBlockDirtyBitmapRemove: + return "block-dirty-bitmap-remove" + case TransactionActionKindBlockDirtyBitmapClear: + return "block-dirty-bitmap-clear" + case TransactionActionKindBlockDirtyBitmapEnable: + return "block-dirty-bitmap-enable" + case TransactionActionKindBlockDirtyBitmapDisable: + return "block-dirty-bitmap-disable" + case TransactionActionKindBlockDirtyBitmapMerge: + return "block-dirty-bitmap-merge" + case TransactionActionKindBlockdevBackup: + return "blockdev-backup" + case TransactionActionKindBlockdevSnapshot: + return "blockdev-snapshot" + case TransactionActionKindBlockdevSnapshotInternalSync: + return "blockdev-snapshot-internal-sync" + case TransactionActionKindBlockdevSnapshotSync: + return "blockdev-snapshot-sync" + case TransactionActionKindDriveBackup: + return "drive-backup" default: - return fmt.Sprintf("SchemaMetaType(%d)", e) + return fmt.Sprintf("TransactionActionKind(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e SchemaMetaType) MarshalJSON() ([]byte, error) { +func (e TransactionActionKind) MarshalJSON() ([]byte, error) { switch e { - case SchemaMetaTypeBuiltin: - return json.Marshal("builtin") - case SchemaMetaTypeEnum: - return json.Marshal("enum") - case SchemaMetaTypeArray: - return json.Marshal("array") - case SchemaMetaTypeObject: - return json.Marshal("object") - case SchemaMetaTypeAlternate: - return json.Marshal("alternate") - case SchemaMetaTypeCommand: - return json.Marshal("command") - case SchemaMetaTypeEvent: - return json.Marshal("event") + case TransactionActionKindAbort: + return json.Marshal("abort") + case TransactionActionKindBlockDirtyBitmapAdd: + return json.Marshal("block-dirty-bitmap-add") + case TransactionActionKindBlockDirtyBitmapRemove: + return json.Marshal("block-dirty-bitmap-remove") + case TransactionActionKindBlockDirtyBitmapClear: + return json.Marshal("block-dirty-bitmap-clear") + case TransactionActionKindBlockDirtyBitmapEnable: + return json.Marshal("block-dirty-bitmap-enable") + case TransactionActionKindBlockDirtyBitmapDisable: + return json.Marshal("block-dirty-bitmap-disable") + case TransactionActionKindBlockDirtyBitmapMerge: + return json.Marshal("block-dirty-bitmap-merge") + case TransactionActionKindBlockdevBackup: + return json.Marshal("blockdev-backup") + case TransactionActionKindBlockdevSnapshot: + return json.Marshal("blockdev-snapshot") + case TransactionActionKindBlockdevSnapshotInternalSync: + return json.Marshal("blockdev-snapshot-internal-sync") + case TransactionActionKindBlockdevSnapshotSync: + return json.Marshal("blockdev-snapshot-sync") + case TransactionActionKindDriveBackup: + return json.Marshal("drive-backup") default: - return nil, fmt.Errorf("unknown enum value %q for SchemaMetaType", e) + return nil, fmt.Errorf("unknown enum value %q for TransactionActionKind", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *SchemaMetaType) UnmarshalJSON(bs []byte) error { +func (e *TransactionActionKind) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "builtin": - *e = SchemaMetaTypeBuiltin - case "enum": - *e = SchemaMetaTypeEnum - case "array": - *e = SchemaMetaTypeArray - case "object": - *e = SchemaMetaTypeObject - case "alternate": - *e = SchemaMetaTypeAlternate - case "command": - *e = SchemaMetaTypeCommand - case "event": - *e = SchemaMetaTypeEvent + case "abort": + *e = TransactionActionKindAbort + case "block-dirty-bitmap-add": + *e = TransactionActionKindBlockDirtyBitmapAdd + case "block-dirty-bitmap-remove": + *e = TransactionActionKindBlockDirtyBitmapRemove + case "block-dirty-bitmap-clear": + *e = TransactionActionKindBlockDirtyBitmapClear + case "block-dirty-bitmap-enable": + *e = TransactionActionKindBlockDirtyBitmapEnable + case "block-dirty-bitmap-disable": + *e = TransactionActionKindBlockDirtyBitmapDisable + case "block-dirty-bitmap-merge": + *e = TransactionActionKindBlockDirtyBitmapMerge + case "blockdev-backup": + *e = TransactionActionKindBlockdevBackup + case "blockdev-snapshot": + *e = TransactionActionKindBlockdevSnapshot + case "blockdev-snapshot-internal-sync": + *e = TransactionActionKindBlockdevSnapshotInternalSync + case "blockdev-snapshot-sync": + *e = TransactionActionKindBlockdevSnapshotSync + case "drive-backup": + *e = TransactionActionKindDriveBackup default: - return fmt.Errorf("unknown enum value %q for SchemaMetaType", s) + return fmt.Errorf("unknown enum value %q for TransactionActionKind", s) } return nil } -// SnapshotInfo -> SnapshotInfo (struct) +// TransactionProperties -> TransactionProperties (struct) -// SnapshotInfo implements the "SnapshotInfo" QMP API type. -type SnapshotInfo struct { - ID string `json:"id"` - Name string `json:"name"` - VMStateSize int64 `json:"vm-state-size"` - DateSec int64 `json:"date-sec"` - DateNsec int64 `json:"date-nsec"` - VMClockSec int64 `json:"vm-clock-sec"` - VMClockNsec int64 `json:"vm-clock-nsec"` +// TransactionProperties implements the "TransactionProperties" QMP API type. +type TransactionProperties struct { + CompletionMode *ActionCompletionMode `json:"completion-mode,omitempty"` } -// SocketAddress -> SocketAddress (flat union) +// EVENT UNPLUG_PRIMARY -// SocketAddress implements the "SocketAddress" QMP API type. -// -// Can be one of: -// - SocketAddressVariantFD -// - SocketAddressVariantInet -// - SocketAddressVariantUnix -// - SocketAddressVariantVsock -type SocketAddress interface { - isSocketAddress() +// UnixSocketAddress -> UnixSocketAddress (struct) + +// UnixSocketAddress implements the "UnixSocketAddress" QMP API type. +type UnixSocketAddress struct { + Path string `json:"path"` + Abstract *bool `json:"abstract,omitempty"` + Tight *bool `json:"tight,omitempty"` } -// SocketAddressVariantFD is an implementation of SocketAddress. -type SocketAddressVariantFD struct { - Str string `json:"str"` +// UuidInfo -> UUIDInfo (struct) + +// UUIDInfo implements the "UuidInfo" QMP API type. +type UUIDInfo struct { + UUID string `json:"UUID"` } -func (SocketAddressVariantFD) isSocketAddress() {} +// EVENT VFU_CLIENT_HANGUP -// MarshalJSON implements json.Marshaler. -func (s SocketAddressVariantFD) MarshalJSON() ([]byte, error) { - v := struct { - Type SocketAddressType `json:"type"` - SocketAddressVariantFD - }{ - SocketAddressTypeFD, - s, - } - return json.Marshal(v) +// EVENT VNC_CONNECTED + +// EVENT VNC_DISCONNECTED + +// EVENT VNC_INITIALIZED + +// EVENT VSERPORT_CHANGE + +// VersionInfo -> VersionInfo (struct) + +// VersionInfo implements the "VersionInfo" QMP API type. +type VersionInfo struct { + Qemu VersionTriple `json:"qemu"` + Package string `json:"package"` } -// SocketAddressVariantInet is an implementation of SocketAddress. -type SocketAddressVariantInet struct { - Numeric *bool `json:"numeric,omitempty"` - To *uint16 `json:"to,omitempty"` - Ipv4 *bool `json:"ipv4,omitempty"` - Ipv6 *bool `json:"ipv6,omitempty"` +// VersionTriple -> VersionTriple (struct) + +// VersionTriple implements the "VersionTriple" QMP API type. +type VersionTriple struct { + Major int64 `json:"major"` + Minor int64 `json:"minor"` + Micro int64 `json:"micro"` } -func (SocketAddressVariantInet) isSocketAddress() {} +// VfioStats -> VfioStats (struct) -// MarshalJSON implements json.Marshaler. -func (s SocketAddressVariantInet) MarshalJSON() ([]byte, error) { - v := struct { - Type SocketAddressType `json:"type"` - SocketAddressVariantInet - }{ - SocketAddressTypeInet, - s, - } - return json.Marshal(v) +// VfioStats implements the "VfioStats" QMP API type. +type VfioStats struct { + Transferred int64 `json:"transferred"` } -// SocketAddressVariantUnix is an implementation of SocketAddress. -type SocketAddressVariantUnix struct { - Path string `json:"path"` +// VirtioMEMDeviceInfo -> VirtioMemDeviceInfo (struct) + +// VirtioMemDeviceInfo implements the "VirtioMEMDeviceInfo" QMP API type. +type VirtioMemDeviceInfo struct { + ID *string `json:"id,omitempty"` + Memaddr uint64 `json:"memaddr"` + RequestedSize uint64 `json:"requested-size"` + Size uint64 `json:"size"` + MaxSize uint64 `json:"max-size"` + BlockSize uint64 `json:"block-size"` + Node int64 `json:"node"` + Memdev string `json:"memdev"` } -func (SocketAddressVariantUnix) isSocketAddress() {} +// VirtioPMEMDeviceInfo -> VirtioPmemDeviceInfo (struct) -// MarshalJSON implements json.Marshaler. -func (s SocketAddressVariantUnix) MarshalJSON() ([]byte, error) { - v := struct { - Type SocketAddressType `json:"type"` - SocketAddressVariantUnix - }{ - SocketAddressTypeUnix, - s, - } - return json.Marshal(v) +// VirtioPmemDeviceInfo implements the "VirtioPMEMDeviceInfo" QMP API type. +type VirtioPmemDeviceInfo struct { + ID *string `json:"id,omitempty"` + Memaddr uint64 `json:"memaddr"` + Size uint64 `json:"size"` + Memdev string `json:"memdev"` +} + +// VncBasicInfo -> VNCBasicInfo (struct) + +// VNCBasicInfo implements the "VncBasicInfo" QMP API type. +type VNCBasicInfo struct { + Host string `json:"host"` + Service string `json:"service"` + Family NetworkAddressFamily `json:"family"` + Websocket bool `json:"websocket"` +} + +// VncClientInfo -> VNCClientInfo (struct) + +// VNCClientInfo implements the "VncClientInfo" QMP API type. +type VNCClientInfo struct { + Host string `json:"host"` + Service string `json:"service"` + Family NetworkAddressFamily `json:"family"` + Websocket bool `json:"websocket"` + X509Dname *string `json:"x509_dname,omitempty"` + SaslUsername *string `json:"sasl_username,omitempty"` +} + +// VncInfo -> VNCInfo (struct) + +// VNCInfo implements the "VncInfo" QMP API type. +type VNCInfo struct { + Enabled bool `json:"enabled"` + Host *string `json:"host,omitempty"` + Family *NetworkAddressFamily `json:"family,omitempty"` + Service *string `json:"service,omitempty"` + Auth *string `json:"auth,omitempty"` + Clients []VNCClientInfo `json:"clients,omitempty"` +} + +// VncInfo2 -> VNCInfo2 (struct) + +// VNCInfo2 implements the "VncInfo2" QMP API type. +type VNCInfo2 struct { + ID string `json:"id"` + Server []VNCServerInfo2 `json:"server"` + Clients []VNCClientInfo `json:"clients"` + Auth VNCPrimaryAuth `json:"auth"` + Vencrypt *VNCVencryptSubAuth `json:"vencrypt,omitempty"` + Display *string `json:"display,omitempty"` } -// SocketAddressVariantVsock is an implementation of SocketAddress. -type SocketAddressVariantVsock struct { - Cid string `json:"cid"` - Port string `json:"port"` +// VncPrimaryAuth -> VNCPrimaryAuth (enum) + +// VNCPrimaryAuth implements the "VncPrimaryAuth" QMP API type. +type VNCPrimaryAuth int + +// Known values of VNCPrimaryAuth. +const ( + VNCPrimaryAuthNone VNCPrimaryAuth = iota + VNCPrimaryAuthVNC + VNCPrimaryAuthRa2 + VNCPrimaryAuthRa2Ne + VNCPrimaryAuthTight + VNCPrimaryAuthUltra + VNCPrimaryAuthTLS + VNCPrimaryAuthVencrypt + VNCPrimaryAuthSasl +) + +// String implements fmt.Stringer. +func (e VNCPrimaryAuth) String() string { + switch e { + case VNCPrimaryAuthNone: + return "none" + case VNCPrimaryAuthVNC: + return "vnc" + case VNCPrimaryAuthRa2: + return "ra2" + case VNCPrimaryAuthRa2Ne: + return "ra2ne" + case VNCPrimaryAuthTight: + return "tight" + case VNCPrimaryAuthUltra: + return "ultra" + case VNCPrimaryAuthTLS: + return "tls" + case VNCPrimaryAuthVencrypt: + return "vencrypt" + case VNCPrimaryAuthSasl: + return "sasl" + default: + return fmt.Sprintf("VNCPrimaryAuth(%d)", e) + } } -func (SocketAddressVariantVsock) isSocketAddress() {} - // MarshalJSON implements json.Marshaler. -func (s SocketAddressVariantVsock) MarshalJSON() ([]byte, error) { - v := struct { - Type SocketAddressType `json:"type"` - SocketAddressVariantVsock - }{ - SocketAddressTypeVsock, - s, +func (e VNCPrimaryAuth) MarshalJSON() ([]byte, error) { + switch e { + case VNCPrimaryAuthNone: + return json.Marshal("none") + case VNCPrimaryAuthVNC: + return json.Marshal("vnc") + case VNCPrimaryAuthRa2: + return json.Marshal("ra2") + case VNCPrimaryAuthRa2Ne: + return json.Marshal("ra2ne") + case VNCPrimaryAuthTight: + return json.Marshal("tight") + case VNCPrimaryAuthUltra: + return json.Marshal("ultra") + case VNCPrimaryAuthTLS: + return json.Marshal("tls") + case VNCPrimaryAuthVencrypt: + return json.Marshal("vencrypt") + case VNCPrimaryAuthSasl: + return json.Marshal("sasl") + default: + return nil, fmt.Errorf("unknown enum value %q for VNCPrimaryAuth", e) } - return json.Marshal(v) } -func decodeSocketAddress(bs json.RawMessage) (SocketAddress, error) { - v := struct { - Type SocketAddressType `json:"type"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err +// UnmarshalJSON implements json.Unmarshaler. +func (e *VNCPrimaryAuth) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - switch v.Type { - case SocketAddressTypeFD: - var ret SocketAddressVariantFD - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case SocketAddressTypeInet: - var ret SocketAddressVariantInet - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case SocketAddressTypeUnix: - var ret SocketAddressVariantUnix - err := json.Unmarshal([]byte(bs), &ret) - return ret, err - case SocketAddressTypeVsock: - var ret SocketAddressVariantVsock - err := json.Unmarshal([]byte(bs), &ret) - return ret, err + switch s { + case "none": + *e = VNCPrimaryAuthNone + case "vnc": + *e = VNCPrimaryAuthVNC + case "ra2": + *e = VNCPrimaryAuthRa2 + case "ra2ne": + *e = VNCPrimaryAuthRa2Ne + case "tight": + *e = VNCPrimaryAuthTight + case "ultra": + *e = VNCPrimaryAuthUltra + case "tls": + *e = VNCPrimaryAuthTLS + case "vencrypt": + *e = VNCPrimaryAuthVencrypt + case "sasl": + *e = VNCPrimaryAuthSasl default: - return nil, fmt.Errorf("unknown flat union subtype %q for flat union SocketAddress", v.Type) + return fmt.Errorf("unknown enum value %q for VNCPrimaryAuth", s) } + return nil } -// SocketAddressLegacy -> SocketAddressLegacy (simple union) +// VncServerInfo -> VNCServerInfo (struct) -// SocketAddressLegacy implements the "SocketAddressLegacy" QMP API type. -// -// Can be one of: -// - SocketAddressLegacyVariantFD -// - SocketAddressLegacyVariantInet -// - SocketAddressLegacyVariantUnix -// - SocketAddressLegacyVariantVsock -type SocketAddressLegacy interface { - isSocketAddressLegacy() +// VNCServerInfo implements the "VncServerInfo" QMP API type. +type VNCServerInfo struct { + Host string `json:"host"` + Service string `json:"service"` + Family NetworkAddressFamily `json:"family"` + Websocket bool `json:"websocket"` + Auth *string `json:"auth,omitempty"` } -// SocketAddressLegacyVariantFD is an implementation of SocketAddressLegacy. -type SocketAddressLegacyVariantFD String - -func (SocketAddressLegacyVariantFD) isSocketAddressLegacy() {} +// VncServerInfo2 -> VNCServerInfo2 (struct) -// MarshalJSON implements json.Marshaler. -func (s SocketAddressLegacyVariantFD) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "fd", - "data": String(s), - } - return json.Marshal(v) +// VNCServerInfo2 implements the "VncServerInfo2" QMP API type. +type VNCServerInfo2 struct { + Host string `json:"host"` + Service string `json:"service"` + Family NetworkAddressFamily `json:"family"` + Websocket bool `json:"websocket"` + Auth VNCPrimaryAuth `json:"auth"` + Vencrypt *VNCVencryptSubAuth `json:"vencrypt,omitempty"` } -// SocketAddressLegacyVariantInet is an implementation of SocketAddressLegacy. -type SocketAddressLegacyVariantInet InetSocketAddress - -func (SocketAddressLegacyVariantInet) isSocketAddressLegacy() {} - -// MarshalJSON implements json.Marshaler. -func (s SocketAddressLegacyVariantInet) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "inet", - "data": InetSocketAddress(s), - } - return json.Marshal(v) -} +// VncVencryptSubAuth -> VNCVencryptSubAuth (enum) -// SocketAddressLegacyVariantUnix is an implementation of SocketAddressLegacy. -type SocketAddressLegacyVariantUnix UnixSocketAddress +// VNCVencryptSubAuth implements the "VncVencryptSubAuth" QMP API type. +type VNCVencryptSubAuth int -func (SocketAddressLegacyVariantUnix) isSocketAddressLegacy() {} +// Known values of VNCVencryptSubAuth. +const ( + VNCVencryptSubAuthPlain VNCVencryptSubAuth = iota + VNCVencryptSubAuthTLSNone + VNCVencryptSubAuthX509None + VNCVencryptSubAuthTLSVNC + VNCVencryptSubAuthX509VNC + VNCVencryptSubAuthTLSPlain + VNCVencryptSubAuthX509Plain + VNCVencryptSubAuthTLSSasl + VNCVencryptSubAuthX509Sasl +) -// MarshalJSON implements json.Marshaler. -func (s SocketAddressLegacyVariantUnix) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "unix", - "data": UnixSocketAddress(s), +// String implements fmt.Stringer. +func (e VNCVencryptSubAuth) String() string { + switch e { + case VNCVencryptSubAuthPlain: + return "plain" + case VNCVencryptSubAuthTLSNone: + return "tls-none" + case VNCVencryptSubAuthX509None: + return "x509-none" + case VNCVencryptSubAuthTLSVNC: + return "tls-vnc" + case VNCVencryptSubAuthX509VNC: + return "x509-vnc" + case VNCVencryptSubAuthTLSPlain: + return "tls-plain" + case VNCVencryptSubAuthX509Plain: + return "x509-plain" + case VNCVencryptSubAuthTLSSasl: + return "tls-sasl" + case VNCVencryptSubAuthX509Sasl: + return "x509-sasl" + default: + return fmt.Sprintf("VNCVencryptSubAuth(%d)", e) } - return json.Marshal(v) } -// SocketAddressLegacyVariantVsock is an implementation of SocketAddressLegacy. -type SocketAddressLegacyVariantVsock VsockSocketAddress - -func (SocketAddressLegacyVariantVsock) isSocketAddressLegacy() {} - // MarshalJSON implements json.Marshaler. -func (s SocketAddressLegacyVariantVsock) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "vsock", - "data": VsockSocketAddress(s), +func (e VNCVencryptSubAuth) MarshalJSON() ([]byte, error) { + switch e { + case VNCVencryptSubAuthPlain: + return json.Marshal("plain") + case VNCVencryptSubAuthTLSNone: + return json.Marshal("tls-none") + case VNCVencryptSubAuthX509None: + return json.Marshal("x509-none") + case VNCVencryptSubAuthTLSVNC: + return json.Marshal("tls-vnc") + case VNCVencryptSubAuthX509VNC: + return json.Marshal("x509-vnc") + case VNCVencryptSubAuthTLSPlain: + return json.Marshal("tls-plain") + case VNCVencryptSubAuthX509Plain: + return json.Marshal("x509-plain") + case VNCVencryptSubAuthTLSSasl: + return json.Marshal("tls-sasl") + case VNCVencryptSubAuthX509Sasl: + return json.Marshal("x509-sasl") + default: + return nil, fmt.Errorf("unknown enum value %q for VNCVencryptSubAuth", e) } - return json.Marshal(v) } -func decodeSocketAddressLegacy(bs json.RawMessage) (SocketAddressLegacy, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err +// UnmarshalJSON implements json.Unmarshaler. +func (e *VNCVencryptSubAuth) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - switch v.T { - case "fd": - var ret SocketAddressLegacyVariantFD - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "inet": - var ret SocketAddressLegacyVariantInet - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "unix": - var ret SocketAddressLegacyVariantUnix - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "vsock": - var ret SocketAddressLegacyVariantVsock - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil + switch s { + case "plain": + *e = VNCVencryptSubAuthPlain + case "tls-none": + *e = VNCVencryptSubAuthTLSNone + case "x509-none": + *e = VNCVencryptSubAuthX509None + case "tls-vnc": + *e = VNCVencryptSubAuthTLSVNC + case "x509-vnc": + *e = VNCVencryptSubAuthX509VNC + case "tls-plain": + *e = VNCVencryptSubAuthTLSPlain + case "x509-plain": + *e = VNCVencryptSubAuthX509Plain + case "tls-sasl": + *e = VNCVencryptSubAuthTLSSasl + case "x509-sasl": + *e = VNCVencryptSubAuthX509Sasl default: - return nil, fmt.Errorf("unknown subtype %q for union SocketAddressLegacy", v.T) + return fmt.Errorf("unknown enum value %q for VNCVencryptSubAuth", s) } + return nil } -// SocketAddressType -> SocketAddressType (enum) +// VsockSocketAddress -> VsockSocketAddress (struct) -// SocketAddressType implements the "SocketAddressType" QMP API type. -type SocketAddressType int +// VsockSocketAddress implements the "VsockSocketAddress" QMP API type. +type VsockSocketAddress struct { + Cid string `json:"cid"` + Port string `json:"port"` +} -// Known values of SocketAddressType. +// EVENT WAKEUP + +// EVENT WATCHDOG + +// WatchdogAction -> WatchdogAction (enum) + +// WatchdogAction implements the "WatchdogAction" QMP API type. +type WatchdogAction int + +// Known values of WatchdogAction. const ( - SocketAddressTypeInet SocketAddressType = iota - SocketAddressTypeUnix - SocketAddressTypeVsock - SocketAddressTypeFD + WatchdogActionReset WatchdogAction = iota + WatchdogActionShutdown + WatchdogActionPoweroff + WatchdogActionPause + WatchdogActionDebug + WatchdogActionNone + WatchdogActionInjectNmi ) // String implements fmt.Stringer. -func (e SocketAddressType) String() string { +func (e WatchdogAction) String() string { switch e { - case SocketAddressTypeInet: - return "inet" - case SocketAddressTypeUnix: - return "unix" - case SocketAddressTypeVsock: - return "vsock" - case SocketAddressTypeFD: - return "fd" + case WatchdogActionReset: + return "reset" + case WatchdogActionShutdown: + return "shutdown" + case WatchdogActionPoweroff: + return "poweroff" + case WatchdogActionPause: + return "pause" + case WatchdogActionDebug: + return "debug" + case WatchdogActionNone: + return "none" + case WatchdogActionInjectNmi: + return "inject-nmi" default: - return fmt.Sprintf("SocketAddressType(%d)", e) + return fmt.Sprintf("WatchdogAction(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e SocketAddressType) MarshalJSON() ([]byte, error) { +func (e WatchdogAction) MarshalJSON() ([]byte, error) { switch e { - case SocketAddressTypeInet: - return json.Marshal("inet") - case SocketAddressTypeUnix: - return json.Marshal("unix") - case SocketAddressTypeVsock: - return json.Marshal("vsock") - case SocketAddressTypeFD: - return json.Marshal("fd") + case WatchdogActionReset: + return json.Marshal("reset") + case WatchdogActionShutdown: + return json.Marshal("shutdown") + case WatchdogActionPoweroff: + return json.Marshal("poweroff") + case WatchdogActionPause: + return json.Marshal("pause") + case WatchdogActionDebug: + return json.Marshal("debug") + case WatchdogActionNone: + return json.Marshal("none") + case WatchdogActionInjectNmi: + return json.Marshal("inject-nmi") default: - return nil, fmt.Errorf("unknown enum value %q for SocketAddressType", e) + return nil, fmt.Errorf("unknown enum value %q for WatchdogAction", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *SocketAddressType) UnmarshalJSON(bs []byte) error { +func (e *WatchdogAction) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "inet": - *e = SocketAddressTypeInet - case "unix": - *e = SocketAddressTypeUnix - case "vsock": - *e = SocketAddressTypeVsock - case "fd": - *e = SocketAddressTypeFD + case "reset": + *e = WatchdogActionReset + case "shutdown": + *e = WatchdogActionShutdown + case "poweroff": + *e = WatchdogActionPoweroff + case "pause": + *e = WatchdogActionPause + case "debug": + *e = WatchdogActionDebug + case "none": + *e = WatchdogActionNone + case "inject-nmi": + *e = WatchdogActionInjectNmi default: - return fmt.Errorf("unknown enum value %q for SocketAddressType", s) + return fmt.Errorf("unknown enum value %q for WatchdogAction", s) } return nil } -// SpiceBasicInfo -> SpiceBasicInfo (struct) +// XBZRLECacheStats -> XbzrleCacheStats (struct) -// SpiceBasicInfo implements the "SpiceBasicInfo" QMP API type. -type SpiceBasicInfo struct { - Host string `json:"host"` - Port string `json:"port"` - Family NetworkAddressFamily `json:"family"` +// XbzrleCacheStats implements the "XBZRLECacheStats" QMP API type. +type XbzrleCacheStats struct { + CacheSize uint64 `json:"cache-size"` + Bytes int64 `json:"bytes"` + Pages int64 `json:"pages"` + CacheMiss int64 `json:"cache-miss"` + CacheMissRate float64 `json:"cache-miss-rate"` + EncodingRate float64 `json:"encoding-rate"` + Overflow int64 `json:"overflow"` } -// SpiceChannel -> SpiceChannel (struct) +// XDbgBlockGraph -> XDbgBlockGraph (struct) -// SpiceChannel implements the "SpiceChannel" QMP API type. -type SpiceChannel struct { - Host string `json:"host"` - Port string `json:"port"` - Family NetworkAddressFamily `json:"family"` - ConnectionID int64 `json:"connection-id"` - ChannelType int64 `json:"channel-type"` - ChannelID int64 `json:"channel-id"` - TLS bool `json:"tls"` +// XDbgBlockGraph implements the "XDbgBlockGraph" QMP API type. +type XDbgBlockGraph struct { + Nodes []XDbgBlockGraphNode `json:"nodes"` + Edges []XDbgBlockGraphEdge `json:"edges"` } -// SpiceInfo -> SpiceInfo (struct) +// XDbgBlockGraphEdge -> XDbgBlockGraphEdge (struct) -// SpiceInfo implements the "SpiceInfo" QMP API type. -type SpiceInfo struct { - Enabled bool `json:"enabled"` - Migrated bool `json:"migrated"` - Host *string `json:"host,omitempty"` - Port *int64 `json:"port,omitempty"` - TLSPort *int64 `json:"tls-port,omitempty"` - Auth *string `json:"auth,omitempty"` - CompiledVersion *string `json:"compiled-version,omitempty"` - MouseMode SpiceQueryMouseMode `json:"mouse-mode"` - Channels []SpiceChannel `json:"channels,omitempty"` +// XDbgBlockGraphEdge implements the "XDbgBlockGraphEdge" QMP API type. +type XDbgBlockGraphEdge struct { + Parent uint64 `json:"parent"` + Child uint64 `json:"child"` + Name string `json:"name"` + Perm []BlockPermission `json:"perm"` + SharedPerm []BlockPermission `json:"shared-perm"` } -// SpiceQueryMouseMode -> SpiceQueryMouseMode (enum) +// XDbgBlockGraphNode -> XDbgBlockGraphNode (struct) -// SpiceQueryMouseMode implements the "SpiceQueryMouseMode" QMP API type. -type SpiceQueryMouseMode int +// XDbgBlockGraphNode implements the "XDbgBlockGraphNode" QMP API type. +type XDbgBlockGraphNode struct { + ID uint64 `json:"id"` + Type XDbgBlockGraphNodeType `json:"type"` + Name string `json:"name"` +} -// Known values of SpiceQueryMouseMode. +// XDbgBlockGraphNodeType -> XDbgBlockGraphNodeType (enum) + +// XDbgBlockGraphNodeType implements the "XDbgBlockGraphNodeType" QMP API type. +type XDbgBlockGraphNodeType int + +// Known values of XDbgBlockGraphNodeType. const ( - SpiceQueryMouseModeClient SpiceQueryMouseMode = iota - SpiceQueryMouseModeServer - SpiceQueryMouseModeUnknown + XDbgBlockGraphNodeTypeBlockBackend XDbgBlockGraphNodeType = iota + XDbgBlockGraphNodeTypeBlockJob + XDbgBlockGraphNodeTypeBlockDriver ) // String implements fmt.Stringer. -func (e SpiceQueryMouseMode) String() string { +func (e XDbgBlockGraphNodeType) String() string { switch e { - case SpiceQueryMouseModeClient: - return "client" - case SpiceQueryMouseModeServer: - return "server" - case SpiceQueryMouseModeUnknown: - return "unknown" + case XDbgBlockGraphNodeTypeBlockBackend: + return "block-backend" + case XDbgBlockGraphNodeTypeBlockJob: + return "block-job" + case XDbgBlockGraphNodeTypeBlockDriver: + return "block-driver" default: - return fmt.Sprintf("SpiceQueryMouseMode(%d)", e) + return fmt.Sprintf("XDbgBlockGraphNodeType(%d)", e) } } // MarshalJSON implements json.Marshaler. -func (e SpiceQueryMouseMode) MarshalJSON() ([]byte, error) { +func (e XDbgBlockGraphNodeType) MarshalJSON() ([]byte, error) { switch e { - case SpiceQueryMouseModeClient: - return json.Marshal("client") - case SpiceQueryMouseModeServer: - return json.Marshal("server") - case SpiceQueryMouseModeUnknown: - return json.Marshal("unknown") + case XDbgBlockGraphNodeTypeBlockBackend: + return json.Marshal("block-backend") + case XDbgBlockGraphNodeTypeBlockJob: + return json.Marshal("block-job") + case XDbgBlockGraphNodeTypeBlockDriver: + return json.Marshal("block-driver") default: - return nil, fmt.Errorf("unknown enum value %q for SpiceQueryMouseMode", e) + return nil, fmt.Errorf("unknown enum value %q for XDbgBlockGraphNodeType", e) } } // UnmarshalJSON implements json.Unmarshaler. -func (e *SpiceQueryMouseMode) UnmarshalJSON(bs []byte) error { +func (e *XDbgBlockGraphNodeType) UnmarshalJSON(bs []byte) error { var s string if err := json.Unmarshal(bs, &s); err != nil { return err } switch s { - case "client": - *e = SpiceQueryMouseModeClient - case "server": - *e = SpiceQueryMouseModeServer - case "unknown": - *e = SpiceQueryMouseModeUnknown + case "block-backend": + *e = XDbgBlockGraphNodeTypeBlockBackend + case "block-job": + *e = XDbgBlockGraphNodeTypeBlockJob + case "block-driver": + *e = XDbgBlockGraphNodeTypeBlockDriver default: - return fmt.Errorf("unknown enum value %q for SpiceQueryMouseMode", s) + return fmt.Errorf("unknown enum value %q for XDbgBlockGraphNodeType", s) } return nil } -// SpiceServerInfo -> SpiceServerInfo (struct) +// YankInstance -> YankInstance (flat union) -// SpiceServerInfo implements the "SpiceServerInfo" QMP API type. -type SpiceServerInfo struct { - Host string `json:"host"` - Port string `json:"port"` - Family NetworkAddressFamily `json:"family"` - Auth *string `json:"auth,omitempty"` +// YankInstance implements the "YankInstance" QMP API type. +// +// Can be one of: +// - YankInstanceVariantBlockNode +// - YankInstanceVariantChardev +type YankInstance interface { + isYankInstance() } -// StatusInfo -> StatusInfo (struct) +// YankInstanceVariantBlockNode is an implementation of YankInstance. +type YankInstanceVariantBlockNode struct { + NodeName string `json:"node-name"` +} -// StatusInfo implements the "StatusInfo" QMP API type. -type StatusInfo struct { - Running bool `json:"running"` - Singlestep bool `json:"singlestep"` - Status RunState `json:"status"` +func (YankInstanceVariantBlockNode) isYankInstance() {} + +// MarshalJSON implements json.Marshaler. +func (s YankInstanceVariantBlockNode) MarshalJSON() ([]byte, error) { + v := struct { + Type YankInstanceType `json:"type"` + YankInstanceVariantBlockNode + }{ + YankInstanceTypeBlockNode, + s, + } + return json.Marshal(v) } -// StrOrNull -> StrOrNull (alternate) +// YankInstanceVariantChardev is an implementation of YankInstance. +type YankInstanceVariantChardev struct { + ID string `json:"id"` +} -// StrOrNull implements the "StrOrNull" QMP API type. -// -// Can be one of: -// - StrOrNullVariantN -// - StrOrNullVariantS -type StrOrNull interface { - isStrOrNull() +func (YankInstanceVariantChardev) isYankInstance() {} + +// MarshalJSON implements json.Marshaler. +func (s YankInstanceVariantChardev) MarshalJSON() ([]byte, error) { + v := struct { + Type YankInstanceType `json:"type"` + YankInstanceVariantChardev + }{ + YankInstanceTypeChardev, + s, + } + return json.Marshal(v) } -// StrOrNullVariantN is a JSON null type, so it must -// also implement the isNullable interface. -type StrOrNullVariantN struct{} +func decodeYankInstance(bs json.RawMessage) (YankInstance, error) { + v := struct { + Type YankInstanceType `json:"type"` + }{} + if err := json.Unmarshal([]byte(bs), &v); err != nil { + return nil, err + } + switch v.Type { + case YankInstanceTypeBlockNode: + var ret YankInstanceVariantBlockNode + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + case YankInstanceTypeChardev: + var ret YankInstanceVariantChardev + err := json.Unmarshal([]byte(bs), &ret) + return ret, err + default: + return nil, fmt.Errorf("unknown flat union subtype %q for flat union YankInstance", v.Type) + } +} -func (StrOrNullVariantN) isNull() bool { return true } -func (StrOrNullVariantN) isStrOrNull() {} +// YankInstanceType -> YankInstanceType (enum) -// StrOrNullVariantS is an implementation of StrOrNull -type StrOrNullVariantS string +// YankInstanceType implements the "YankInstanceType" QMP API type. +type YankInstanceType int + +// Known values of YankInstanceType. +const ( + YankInstanceTypeBlockNode YankInstanceType = iota + YankInstanceTypeChardev + YankInstanceTypeMigration +) -func (StrOrNullVariantS) isStrOrNull() {} +// String implements fmt.Stringer. +func (e YankInstanceType) String() string { + switch e { + case YankInstanceTypeBlockNode: + return "block-node" + case YankInstanceTypeChardev: + return "chardev" + case YankInstanceTypeMigration: + return "migration" + default: + return fmt.Sprintf("YankInstanceType(%d)", e) + } +} -func decodeStrOrNull(bs json.RawMessage) (StrOrNull, error) { +// MarshalJSON implements json.Marshaler. +func (e YankInstanceType) MarshalJSON() ([]byte, error) { + switch e { + case YankInstanceTypeBlockNode: + return json.Marshal("block-node") + case YankInstanceTypeChardev: + return json.Marshal("chardev") + case YankInstanceTypeMigration: + return json.Marshal("migration") + default: + return nil, fmt.Errorf("unknown enum value %q for YankInstanceType", e) + } +} - // Always try unmarshalling for nil first if it's an option - // because other types could unmarshal successfully in the case - // where a Null json type was provided. - var n *int - if err := json.Unmarshal([]byte(bs), &n); err == nil { - if n == nil { - return StrOrNullVariantN{}, nil - } +// UnmarshalJSON implements json.Unmarshaler. +func (e *YankInstanceType) UnmarshalJSON(bs []byte) error { + var s string + if err := json.Unmarshal(bs, &s); err != nil { + return err } - var s StrOrNullVariantS - if err := json.Unmarshal([]byte(bs), &s); err == nil { - return s, nil + switch s { + case "block-node": + *e = YankInstanceTypeBlockNode + case "chardev": + *e = YankInstanceTypeChardev + case "migration": + *e = YankInstanceTypeMigration + default: + return fmt.Errorf("unknown enum value %q for YankInstanceType", s) } - return nil, fmt.Errorf("unable to decode %q as a StrOrNull", string(bs)) + return nil } -// String -> String (struct) +// add-fd -> AddFD (command) -// String implements the "String" QMP API type. -type String struct { - Str string `json:"str"` +// AddFD implements the "add-fd" QMP API call. +func (m *Monitor) AddFD(fdsetID *int64, opaque *string) (ret AddfdInfo, err error) { + cmd := struct { + FdsetID *int64 `json:"fdset-id,omitempty"` + Opaque *string `json:"opaque,omitempty"` + }{ + fdsetID, + opaque, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "add-fd", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } + return } -// TPMEmulatorOptions -> TPMEmulatorOptions (struct) +// add_client -> AddClient (command) -// TPMEmulatorOptions implements the "TPMEmulatorOptions" QMP API type. -type TPMEmulatorOptions struct { - Chardev string `json:"chardev"` +// AddClient implements the "add_client" QMP API call. +func (m *Monitor) AddClient(protocol string, fdname string, skipauth *bool, tls *bool) (err error) { + cmd := struct { + Protocol string `json:"protocol"` + Fdname string `json:"fdname"` + Skipauth *bool `json:"skipauth,omitempty"` + TLS *bool `json:"tls,omitempty"` + }{ + protocol, + fdname, + skipauth, + tls, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "add_client", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TPMInfo -> TPMInfo (struct) +// announce-self -> AnnounceSelf (command) -// TPMInfo implements the "TPMInfo" QMP API type. -type TPMInfo struct { - ID string `json:"id"` - Model TPMModel `json:"model"` - Options TPMTypeOptions `json:"options"` +// AnnounceSelf implements the "announce-self" QMP API call. +func (m *Monitor) AnnounceSelf(cmd *AnnounceParameters) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "announce-self", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TPMPassthroughOptions -> TPMPassthroughOptions (struct) +// balloon -> Balloon (command) -// TPMPassthroughOptions implements the "TPMPassthroughOptions" QMP API type. -type TPMPassthroughOptions struct { - Path *string `json:"path,omitempty"` - CancelPath *string `json:"cancel-path,omitempty"` +// Balloon implements the "balloon" QMP API call. +func (m *Monitor) Balloon(value int64) (err error) { + cmd := struct { + Value int64 `json:"value"` + }{ + value, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "balloon", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TargetInfo -> TargetInfo (struct) +// block-commit -> BlockCommit (command) -// TargetInfo implements the "TargetInfo" QMP API type. -type TargetInfo struct { - Arch string `json:"arch"` +// BlockCommit implements the "block-commit" QMP API call. +func (m *Monitor) BlockCommit(jobID *string, device string, baseNode *string, base *string, topNode *string, top *string, backingFile *string, speed *int64, onError *BlockdevOnError, filterNodeName *string, autoFinalize *bool, autoDismiss *bool) (err error) { + cmd := struct { + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + BaseNode *string `json:"base-node,omitempty"` + Base *string `json:"base,omitempty"` + TopNode *string `json:"top-node,omitempty"` + Top *string `json:"top,omitempty"` + BackingFile *string `json:"backing-file,omitempty"` + Speed *int64 `json:"speed,omitempty"` + OnError *BlockdevOnError `json:"on-error,omitempty"` + FilterNodeName *string `json:"filter-node-name,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` + }{ + jobID, + device, + baseNode, + base, + topNode, + top, + backingFile, + speed, + onError, + filterNodeName, + autoFinalize, + autoDismiss, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-commit", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TpmModel -> TPMModel (enum) +// block-dirty-bitmap-add -> BlockDirtyBitmapAdd (command) -// TPMModel implements the "TpmModel" QMP API type. -type TPMModel int +// BlockDirtyBitmapAdd implements the "block-dirty-bitmap-add" QMP API call. +func (m *Monitor) BlockDirtyBitmapAdd(node string, name string, granularity *uint32, persistent *bool, disabled *bool) (err error) { + cmd := struct { + Node string `json:"node"` + Name string `json:"name"` + Granularity *uint32 `json:"granularity,omitempty"` + Persistent *bool `json:"persistent,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + }{ + node, + name, + granularity, + persistent, + disabled, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-add", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} -// Known values of TPMModel. -const ( - TPMModelTPMTis TPMModel = iota -) +// block-dirty-bitmap-clear -> BlockDirtyBitmapClear (command) -// String implements fmt.Stringer. -func (e TPMModel) String() string { - switch e { - case TPMModelTPMTis: - return "tpm-tis" - default: - return fmt.Sprintf("TPMModel(%d)", e) +// BlockDirtyBitmapClear implements the "block-dirty-bitmap-clear" QMP API call. +func (m *Monitor) BlockDirtyBitmapClear(node string, name string) (err error) { + cmd := struct { + Node string `json:"node"` + Name string `json:"name"` + }{ + node, + name, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-clear", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// MarshalJSON implements json.Marshaler. -func (e TPMModel) MarshalJSON() ([]byte, error) { - switch e { - case TPMModelTPMTis: - return json.Marshal("tpm-tis") - default: - return nil, fmt.Errorf("unknown enum value %q for TPMModel", e) +// block-dirty-bitmap-disable -> BlockDirtyBitmapDisable (command) + +// BlockDirtyBitmapDisable implements the "block-dirty-bitmap-disable" QMP API call. +func (m *Monitor) BlockDirtyBitmapDisable(node string, name string) (err error) { + cmd := struct { + Node string `json:"node"` + Name string `json:"name"` + }{ + node, + name, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-disable", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *TPMModel) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// block-dirty-bitmap-enable -> BlockDirtyBitmapEnable (command) + +// BlockDirtyBitmapEnable implements the "block-dirty-bitmap-enable" QMP API call. +func (m *Monitor) BlockDirtyBitmapEnable(node string, name string) (err error) { + cmd := struct { + Node string `json:"node"` + Name string `json:"name"` + }{ + node, + name, } - switch s { - case "tpm-tis": - *e = TPMModelTPMTis - default: - return fmt.Errorf("unknown enum value %q for TPMModel", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-enable", + "arguments": cmd, + }) + if err != nil { + return } - return nil + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TpmType -> TPMType (enum) - -// TPMType implements the "TpmType" QMP API type. -type TPMType int - -// Known values of TPMType. -const ( - TPMTypePassthrough TPMType = iota - TPMTypeEmulator -) +// block-dirty-bitmap-merge -> BlockDirtyBitmapMerge (command) -// String implements fmt.Stringer. -func (e TPMType) String() string { - switch e { - case TPMTypePassthrough: - return "passthrough" - case TPMTypeEmulator: - return "emulator" - default: - return fmt.Sprintf("TPMType(%d)", e) +// BlockDirtyBitmapMerge implements the "block-dirty-bitmap-merge" QMP API call. +func (m *Monitor) BlockDirtyBitmapMerge(node string, target string, bitmaps []BlockDirtyBitmapOrStr) (err error) { + cmd := struct { + Node string `json:"node"` + Target string `json:"target"` + Bitmaps []BlockDirtyBitmapOrStr `json:"bitmaps"` + }{ + node, + target, + bitmaps, } -} - -// MarshalJSON implements json.Marshaler. -func (e TPMType) MarshalJSON() ([]byte, error) { - switch e { - case TPMTypePassthrough: - return json.Marshal("passthrough") - case TPMTypeEmulator: - return json.Marshal("emulator") - default: - return nil, fmt.Errorf("unknown enum value %q for TPMType", e) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-merge", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *TPMType) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// block-dirty-bitmap-remove -> BlockDirtyBitmapRemove (command) + +// BlockDirtyBitmapRemove implements the "block-dirty-bitmap-remove" QMP API call. +func (m *Monitor) BlockDirtyBitmapRemove(node string, name string) (err error) { + cmd := struct { + Node string `json:"node"` + Name string `json:"name"` + }{ + node, + name, } - switch s { - case "passthrough": - *e = TPMTypePassthrough - case "emulator": - *e = TPMTypeEmulator - default: - return fmt.Errorf("unknown enum value %q for TPMType", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-dirty-bitmap-remove", + "arguments": cmd, + }) + if err != nil { + return } - return nil + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TpmTypeOptions -> TPMTypeOptions (simple union) +// block-export-add -> BlockExportAdd (command) -// TPMTypeOptions implements the "TpmTypeOptions" QMP API type. -// -// Can be one of: -// - TPMTypeOptionsVariantEmulator -// - TPMTypeOptionsVariantPassthrough -type TPMTypeOptions interface { - isTPMTypeOptions() +// BlockExportAdd implements the "block-export-add" QMP API call. +func (m *Monitor) BlockExportAdd(cmd *BlockExportOptions) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-export-add", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TPMTypeOptionsVariantEmulator is an implementation of TPMTypeOptions. -type TPMTypeOptionsVariantEmulator TPMEmulatorOptions - -func (TPMTypeOptionsVariantEmulator) isTPMTypeOptions() {} +// block-export-del -> BlockExportDel (command) -// MarshalJSON implements json.Marshaler. -func (s TPMTypeOptionsVariantEmulator) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "emulator", - "data": TPMEmulatorOptions(s), +// BlockExportDel implements the "block-export-del" QMP API call. +func (m *Monitor) BlockExportDel(id string, mode *BlockExportRemoveMode) (err error) { + cmd := struct { + ID string `json:"id"` + Mode *BlockExportRemoveMode `json:"mode,omitempty"` + }{ + id, + mode, } - return json.Marshal(v) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-export-del", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TPMTypeOptionsVariantPassthrough is an implementation of TPMTypeOptions. -type TPMTypeOptionsVariantPassthrough TPMPassthroughOptions - -func (TPMTypeOptionsVariantPassthrough) isTPMTypeOptions() {} +// block-job-cancel -> BlockJobCancel (command) -// MarshalJSON implements json.Marshaler. -func (s TPMTypeOptionsVariantPassthrough) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "passthrough", - "data": TPMPassthroughOptions(s), +// BlockJobCancel implements the "block-job-cancel" QMP API call. +func (m *Monitor) BlockJobCancel(device string, force *bool) (err error) { + cmd := struct { + Device string `json:"device"` + Force *bool `json:"force,omitempty"` + }{ + device, + force, } - return json.Marshal(v) -} - -func decodeTPMTypeOptions(bs json.RawMessage) (TPMTypeOptions, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-cancel", + "arguments": cmd, + }) + if err != nil { + return } - switch v.T { - case "emulator": - var ret TPMTypeOptionsVariantEmulator - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "passthrough": - var ret TPMTypeOptionsVariantPassthrough - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - default: - return nil, fmt.Errorf("unknown subtype %q for union TPMTypeOptions", v.T) + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// TraceEventInfo -> TraceEventInfo (struct) +// block-job-complete -> BlockJobComplete (command) -// TraceEventInfo implements the "TraceEventInfo" QMP API type. -type TraceEventInfo struct { - Name string `json:"name"` - State TraceEventState `json:"state"` - Vcpu bool `json:"vcpu"` +// BlockJobComplete implements the "block-job-complete" QMP API call. +func (m *Monitor) BlockJobComplete(device string) (err error) { + cmd := struct { + Device string `json:"device"` + }{ + device, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-complete", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TraceEventState -> TraceEventState (enum) +// block-job-dismiss -> BlockJobDismiss (command) -// TraceEventState implements the "TraceEventState" QMP API type. -type TraceEventState int +// BlockJobDismiss implements the "block-job-dismiss" QMP API call. +func (m *Monitor) BlockJobDismiss(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-dismiss", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} -// Known values of TraceEventState. -const ( - TraceEventStateUnavailable TraceEventState = iota - TraceEventStateDisabled - TraceEventStateEnabled -) +// block-job-finalize -> BlockJobFinalize (command) -// String implements fmt.Stringer. -func (e TraceEventState) String() string { - switch e { - case TraceEventStateUnavailable: - return "unavailable" - case TraceEventStateDisabled: - return "disabled" - case TraceEventStateEnabled: - return "enabled" - default: - return fmt.Sprintf("TraceEventState(%d)", e) +// BlockJobFinalize implements the "block-job-finalize" QMP API call. +func (m *Monitor) BlockJobFinalize(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-finalize", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// MarshalJSON implements json.Marshaler. -func (e TraceEventState) MarshalJSON() ([]byte, error) { - switch e { - case TraceEventStateUnavailable: - return json.Marshal("unavailable") - case TraceEventStateDisabled: - return json.Marshal("disabled") - case TraceEventStateEnabled: - return json.Marshal("enabled") - default: - return nil, fmt.Errorf("unknown enum value %q for TraceEventState", e) +// block-job-pause -> BlockJobPause (command) + +// BlockJobPause implements the "block-job-pause" QMP API call. +func (m *Monitor) BlockJobPause(device string) (err error) { + cmd := struct { + Device string `json:"device"` + }{ + device, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-pause", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *TraceEventState) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// block-job-resume -> BlockJobResume (command) + +// BlockJobResume implements the "block-job-resume" QMP API call. +func (m *Monitor) BlockJobResume(device string) (err error) { + cmd := struct { + Device string `json:"device"` + }{ + device, } - switch s { - case "unavailable": - *e = TraceEventStateUnavailable - case "disabled": - *e = TraceEventStateDisabled - case "enabled": - *e = TraceEventStateEnabled - default: - return fmt.Errorf("unknown enum value %q for TraceEventState", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-resume", + "arguments": cmd, + }) + if err != nil { + return } - return nil + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionAction -> TransactionAction (simple union) +// block-job-set-speed -> BlockJobSetSpeed (command) -// TransactionAction implements the "TransactionAction" QMP API type. -// -// Can be one of: -// - TransactionActionVariantAbort -// - TransactionActionVariantBlockDirtyBitmapAdd -// - TransactionActionVariantBlockDirtyBitmapClear -// - TransactionActionVariantBlockdevBackup -// - TransactionActionVariantBlockdevSnapshot -// - TransactionActionVariantBlockdevSnapshotInternalSync -// - TransactionActionVariantBlockdevSnapshotSync -// - TransactionActionVariantDriveBackup -type TransactionAction interface { - isTransactionAction() +// BlockJobSetSpeed implements the "block-job-set-speed" QMP API call. +func (m *Monitor) BlockJobSetSpeed(device string, speed int64) (err error) { + cmd := struct { + Device string `json:"device"` + Speed int64 `json:"speed"` + }{ + device, + speed, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-job-set-speed", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantAbort is an implementation of TransactionAction. -type TransactionActionVariantAbort Abort - -func (TransactionActionVariantAbort) isTransactionAction() {} +// block-latency-histogram-set -> BlockLatencyHistogramSet (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantAbort) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "abort", - "data": Abort(s), +// BlockLatencyHistogramSet implements the "block-latency-histogram-set" QMP API call. +func (m *Monitor) BlockLatencyHistogramSet(id string, boundaries []uint64, boundariesRead []uint64, boundariesWrite []uint64, boundariesFlush []uint64) (err error) { + cmd := struct { + ID string `json:"id"` + Boundaries []uint64 `json:"boundaries,omitempty"` + BoundariesRead []uint64 `json:"boundaries-read,omitempty"` + BoundariesWrite []uint64 `json:"boundaries-write,omitempty"` + BoundariesFlush []uint64 `json:"boundaries-flush,omitempty"` + }{ + id, + boundaries, + boundariesRead, + boundariesWrite, + boundariesFlush, } - return json.Marshal(v) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-latency-histogram-set", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantBlockDirtyBitmapAdd is an implementation of TransactionAction. -type TransactionActionVariantBlockDirtyBitmapAdd BlockDirtyBitmapAdd - -func (TransactionActionVariantBlockDirtyBitmapAdd) isTransactionAction() {} +// block-set-write-threshold -> BlockSetWriteThreshold (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockDirtyBitmapAdd) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "block-dirty-bitmap-add", - "data": BlockDirtyBitmapAdd(s), +// BlockSetWriteThreshold implements the "block-set-write-threshold" QMP API call. +func (m *Monitor) BlockSetWriteThreshold(nodeName string, writeThreshold uint64) (err error) { + cmd := struct { + NodeName string `json:"node-name"` + WriteThreshold uint64 `json:"write-threshold"` + }{ + nodeName, + writeThreshold, } - return json.Marshal(v) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-set-write-threshold", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantBlockDirtyBitmapClear is an implementation of TransactionAction. -type TransactionActionVariantBlockDirtyBitmapClear BlockDirtyBitmap - -func (TransactionActionVariantBlockDirtyBitmapClear) isTransactionAction() {} +// block-stream -> BlockStream (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockDirtyBitmapClear) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "block-dirty-bitmap-clear", - "data": BlockDirtyBitmap(s), +// BlockStream implements the "block-stream" QMP API call. +func (m *Monitor) BlockStream(jobID *string, device string, base *string, baseNode *string, backingFile *string, bottom *string, speed *int64, onError *BlockdevOnError, filterNodeName *string, autoFinalize *bool, autoDismiss *bool) (err error) { + cmd := struct { + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + Base *string `json:"base,omitempty"` + BaseNode *string `json:"base-node,omitempty"` + BackingFile *string `json:"backing-file,omitempty"` + Bottom *string `json:"bottom,omitempty"` + Speed *int64 `json:"speed,omitempty"` + OnError *BlockdevOnError `json:"on-error,omitempty"` + FilterNodeName *string `json:"filter-node-name,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` + }{ + jobID, + device, + base, + baseNode, + backingFile, + bottom, + speed, + onError, + filterNodeName, + autoFinalize, + autoDismiss, } - return json.Marshal(v) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block-stream", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantBlockdevBackup is an implementation of TransactionAction. -type TransactionActionVariantBlockdevBackup BlockdevBackup - -func (TransactionActionVariantBlockdevBackup) isTransactionAction() {} +// block_resize -> BlockResize (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockdevBackup) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "blockdev-backup", - "data": BlockdevBackup(s), +// BlockResize implements the "block_resize" QMP API call. +func (m *Monitor) BlockResize(device *string, nodeName *string, size int64) (err error) { + cmd := struct { + Device *string `json:"device,omitempty"` + NodeName *string `json:"node-name,omitempty"` + Size int64 `json:"size"` + }{ + device, + nodeName, + size, } - return json.Marshal(v) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block_resize", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantBlockdevSnapshot is an implementation of TransactionAction. -type TransactionActionVariantBlockdevSnapshot BlockdevSnapshot - -func (TransactionActionVariantBlockdevSnapshot) isTransactionAction() {} +// block_set_io_throttle -> BlockSetIOThrottle (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockdevSnapshot) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "blockdev-snapshot", - "data": BlockdevSnapshot(s), +// BlockSetIOThrottle implements the "block_set_io_throttle" QMP API call. +func (m *Monitor) BlockSetIOThrottle(cmd *BlockIOThrottle) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "block_set_io_throttle", + "arguments": cmd, + }) + if err != nil { + return } - return json.Marshal(v) + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantBlockdevSnapshotInternalSync is an implementation of TransactionAction. -type TransactionActionVariantBlockdevSnapshotInternalSync BlockdevSnapshotInternal - -func (TransactionActionVariantBlockdevSnapshotInternalSync) isTransactionAction() {} +// blockdev-add -> BlockdevAdd (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockdevSnapshotInternalSync) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "blockdev-snapshot-internal-sync", - "data": BlockdevSnapshotInternal(s), +// BlockdevAdd implements the "blockdev-add" QMP API call. +func (m *Monitor) BlockdevAdd(cmd *BlockdevOptions) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-add", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } - return json.Marshal(v) + return } -// TransactionActionVariantBlockdevSnapshotSync is an implementation of TransactionAction. -type TransactionActionVariantBlockdevSnapshotSync BlockdevSnapshotSync - -func (TransactionActionVariantBlockdevSnapshotSync) isTransactionAction() {} +// blockdev-backup -> BlockdevBackup (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantBlockdevSnapshotSync) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "blockdev-snapshot-sync", - "data": BlockdevSnapshotSync(s), +// BlockdevBackup implements the "blockdev-backup" QMP API call. +func (m *Monitor) BlockdevBackup(cmd *BlockdevBackup) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-backup", + "arguments": cmd, + }) + if err != nil { + return } - return json.Marshal(v) + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// TransactionActionVariantDriveBackup is an implementation of TransactionAction. -type TransactionActionVariantDriveBackup DriveBackup - -func (TransactionActionVariantDriveBackup) isTransactionAction() {} +// blockdev-change-medium -> BlockdevChangeMedium (command) -// MarshalJSON implements json.Marshaler. -func (s TransactionActionVariantDriveBackup) MarshalJSON() ([]byte, error) { - v := map[string]interface{}{ - "type": "drive-backup", - "data": DriveBackup(s), +// BlockdevChangeMedium implements the "blockdev-change-medium" QMP API call. +func (m *Monitor) BlockdevChangeMedium(device *string, id *string, filename string, format *string, force *bool, readOnlyMode *BlockdevChangeReadOnlyMode) (err error) { + cmd := struct { + Device *string `json:"device,omitempty"` + ID *string `json:"id,omitempty"` + Filename string `json:"filename"` + Format *string `json:"format,omitempty"` + Force *bool `json:"force,omitempty"` + ReadOnlyMode *BlockdevChangeReadOnlyMode `json:"read-only-mode,omitempty"` + }{ + device, + id, + filename, + format, + force, + readOnlyMode, } - return json.Marshal(v) -} - -func decodeTransactionAction(bs json.RawMessage) (TransactionAction, error) { - v := struct { - T string `json:"type"` - V json.RawMessage `json:"data"` - }{} - if err := json.Unmarshal([]byte(bs), &v); err != nil { - return nil, err + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-change-medium", + "arguments": cmd, + }) + if err != nil { + return } - switch v.T { - case "abort": - var ret TransactionActionVariantAbort - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "block-dirty-bitmap-add": - var ret TransactionActionVariantBlockDirtyBitmapAdd - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "block-dirty-bitmap-clear": - var ret TransactionActionVariantBlockDirtyBitmapClear - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "blockdev-backup": - var ret TransactionActionVariantBlockdevBackup - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "blockdev-snapshot": - var ret TransactionActionVariantBlockdevSnapshot - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "blockdev-snapshot-internal-sync": - var ret TransactionActionVariantBlockdevSnapshotInternalSync - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "blockdev-snapshot-sync": - var ret TransactionActionVariantBlockdevSnapshotSync - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - case "drive-backup": - var ret TransactionActionVariantDriveBackup - if err := json.Unmarshal([]byte(v.V), &ret); err != nil { - return nil, err - } - return ret, nil - default: - return nil, fmt.Errorf("unknown subtype %q for union TransactionAction", v.T) + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// TransactionProperties -> TransactionProperties (struct) +// blockdev-close-tray -> BlockdevCloseTray (command) -// TransactionProperties implements the "TransactionProperties" QMP API type. -type TransactionProperties struct { - CompletionMode *ActionCompletionMode `json:"completion-mode,omitempty"` +// BlockdevCloseTray implements the "blockdev-close-tray" QMP API call. +func (m *Monitor) BlockdevCloseTray(device *string, id *string) (err error) { + cmd := struct { + Device *string `json:"device,omitempty"` + ID *string `json:"id,omitempty"` + }{ + device, + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-close-tray", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// UnixSocketAddress -> UnixSocketAddress (struct) +// blockdev-create -> BlockdevCreate (command) -// UnixSocketAddress implements the "UnixSocketAddress" QMP API type. -type UnixSocketAddress struct { - Path string `json:"path"` +// BlockdevCreate implements the "blockdev-create" QMP API call. +func (m *Monitor) BlockdevCreate(jobID string, options BlockdevCreateOptions) (err error) { + cmd := struct { + JobID string `json:"job-id"` + Options BlockdevCreateOptions `json:"options"` + }{ + jobID, + options, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-create", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// UuidInfo -> UUIDInfo (struct) +// blockdev-del -> BlockdevDel (command) -// UUIDInfo implements the "UuidInfo" QMP API type. -type UUIDInfo struct { - UUID string `json:"UUID"` +// BlockdevDel implements the "blockdev-del" QMP API call. +func (m *Monitor) BlockdevDel(nodeName string) (err error) { + cmd := struct { + NodeName string `json:"node-name"` + }{ + nodeName, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-del", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// EVENT VNC_CONNECTED - -// EVENT VNC_DISCONNECTED - -// EVENT VNC_INITIALIZED - -// EVENT VSERPORT_CHANGE - -// VersionInfo -> VersionInfo (struct) +// blockdev-insert-medium -> BlockdevInsertMedium (command) -// VersionInfo implements the "VersionInfo" QMP API type. -type VersionInfo struct { - Qemu VersionTriple `json:"qemu"` - Package string `json:"package"` +// BlockdevInsertMedium implements the "blockdev-insert-medium" QMP API call. +func (m *Monitor) BlockdevInsertMedium(id string, nodeName string) (err error) { + cmd := struct { + ID string `json:"id"` + NodeName string `json:"node-name"` + }{ + id, + nodeName, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-insert-medium", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VersionTriple -> VersionTriple (struct) +// blockdev-mirror -> BlockdevMirror (command) -// VersionTriple implements the "VersionTriple" QMP API type. -type VersionTriple struct { - Major int64 `json:"major"` - Minor int64 `json:"minor"` - Micro int64 `json:"micro"` +// BlockdevMirror implements the "blockdev-mirror" QMP API call. +func (m *Monitor) BlockdevMirror(jobID *string, device string, target string, replaces *string, sync MirrorSyncMode, speed *int64, granularity *uint32, bufSize *int64, onSourceError *BlockdevOnError, onTargetError *BlockdevOnError, filterNodeName *string, copyMode *MirrorCopyMode, autoFinalize *bool, autoDismiss *bool) (err error) { + cmd := struct { + JobID *string `json:"job-id,omitempty"` + Device string `json:"device"` + Target string `json:"target"` + Replaces *string `json:"replaces,omitempty"` + Sync MirrorSyncMode `json:"sync"` + Speed *int64 `json:"speed,omitempty"` + Granularity *uint32 `json:"granularity,omitempty"` + BufSize *int64 `json:"buf-size,omitempty"` + OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` + OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` + FilterNodeName *string `json:"filter-node-name,omitempty"` + CopyMode *MirrorCopyMode `json:"copy-mode,omitempty"` + AutoFinalize *bool `json:"auto-finalize,omitempty"` + AutoDismiss *bool `json:"auto-dismiss,omitempty"` + }{ + jobID, + device, + target, + replaces, + sync, + speed, + granularity, + bufSize, + onSourceError, + onTargetError, + filterNodeName, + copyMode, + autoFinalize, + autoDismiss, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-mirror", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncBasicInfo -> VNCBasicInfo (struct) +// blockdev-open-tray -> BlockdevOpenTray (command) -// VNCBasicInfo implements the "VncBasicInfo" QMP API type. -type VNCBasicInfo struct { - Host string `json:"host"` - Service string `json:"service"` - Family NetworkAddressFamily `json:"family"` - Websocket bool `json:"websocket"` +// BlockdevOpenTray implements the "blockdev-open-tray" QMP API call. +func (m *Monitor) BlockdevOpenTray(device *string, id *string, force *bool) (err error) { + cmd := struct { + Device *string `json:"device,omitempty"` + ID *string `json:"id,omitempty"` + Force *bool `json:"force,omitempty"` + }{ + device, + id, + force, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-open-tray", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncClientInfo -> VNCClientInfo (struct) +// blockdev-remove-medium -> BlockdevRemoveMedium (command) -// VNCClientInfo implements the "VncClientInfo" QMP API type. -type VNCClientInfo struct { - Host string `json:"host"` - Service string `json:"service"` - Family NetworkAddressFamily `json:"family"` - Websocket bool `json:"websocket"` - X509Dname *string `json:"x509_dname,omitempty"` - SaslUsername *string `json:"sasl_username,omitempty"` +// BlockdevRemoveMedium implements the "blockdev-remove-medium" QMP API call. +func (m *Monitor) BlockdevRemoveMedium(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-remove-medium", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncInfo -> VNCInfo (struct) +// blockdev-reopen -> BlockdevReopen (command) -// VNCInfo implements the "VncInfo" QMP API type. -type VNCInfo struct { - Enabled bool `json:"enabled"` - Host *string `json:"host,omitempty"` - Family *NetworkAddressFamily `json:"family,omitempty"` - Service *string `json:"service,omitempty"` - Auth *string `json:"auth,omitempty"` - Clients []VNCClientInfo `json:"clients,omitempty"` +// BlockdevReopen implements the "blockdev-reopen" QMP API call. +func (m *Monitor) BlockdevReopen(options []BlockdevOptions) (err error) { + cmd := struct { + Options []BlockdevOptions `json:"options"` + }{ + options, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-reopen", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncInfo2 -> VNCInfo2 (struct) +// blockdev-snapshot -> BlockdevSnapshot (command) -// VNCInfo2 implements the "VncInfo2" QMP API type. -type VNCInfo2 struct { - ID string `json:"id"` - Server []VNCServerInfo2 `json:"server"` - Clients []VNCClientInfo `json:"clients"` - Auth VNCPrimaryAuth `json:"auth"` - Vencrypt *VNCVencryptSubAuth `json:"vencrypt,omitempty"` - Display *string `json:"display,omitempty"` +// BlockdevSnapshot implements the "blockdev-snapshot" QMP API call. +func (m *Monitor) BlockdevSnapshot(node string, overlay string) (err error) { + cmd := struct { + Node string `json:"node"` + Overlay string `json:"overlay"` + }{ + node, + overlay, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-snapshot", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncPrimaryAuth -> VNCPrimaryAuth (enum) - -// VNCPrimaryAuth implements the "VncPrimaryAuth" QMP API type. -type VNCPrimaryAuth int - -// Known values of VNCPrimaryAuth. -const ( - VNCPrimaryAuthNone VNCPrimaryAuth = iota - VNCPrimaryAuthVNC - VNCPrimaryAuthRa2 - VNCPrimaryAuthRa2Ne - VNCPrimaryAuthTight - VNCPrimaryAuthUltra - VNCPrimaryAuthTLS - VNCPrimaryAuthVencrypt - VNCPrimaryAuthSasl -) +// blockdev-snapshot-delete-internal-sync -> BlockdevSnapshotDeleteInternalSync (command) -// String implements fmt.Stringer. -func (e VNCPrimaryAuth) String() string { - switch e { - case VNCPrimaryAuthNone: - return "none" - case VNCPrimaryAuthVNC: - return "vnc" - case VNCPrimaryAuthRa2: - return "ra2" - case VNCPrimaryAuthRa2Ne: - return "ra2ne" - case VNCPrimaryAuthTight: - return "tight" - case VNCPrimaryAuthUltra: - return "ultra" - case VNCPrimaryAuthTLS: - return "tls" - case VNCPrimaryAuthVencrypt: - return "vencrypt" - case VNCPrimaryAuthSasl: - return "sasl" - default: - return fmt.Sprintf("VNCPrimaryAuth(%d)", e) +// BlockdevSnapshotDeleteInternalSync implements the "blockdev-snapshot-delete-internal-sync" QMP API call. +func (m *Monitor) BlockdevSnapshotDeleteInternalSync(device string, id *string, name *string) (ret SnapshotInfo, err error) { + cmd := struct { + Device string `json:"device"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + }{ + device, + id, + name, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-snapshot-delete-internal-sync", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } + return } -// MarshalJSON implements json.Marshaler. -func (e VNCPrimaryAuth) MarshalJSON() ([]byte, error) { - switch e { - case VNCPrimaryAuthNone: - return json.Marshal("none") - case VNCPrimaryAuthVNC: - return json.Marshal("vnc") - case VNCPrimaryAuthRa2: - return json.Marshal("ra2") - case VNCPrimaryAuthRa2Ne: - return json.Marshal("ra2ne") - case VNCPrimaryAuthTight: - return json.Marshal("tight") - case VNCPrimaryAuthUltra: - return json.Marshal("ultra") - case VNCPrimaryAuthTLS: - return json.Marshal("tls") - case VNCPrimaryAuthVencrypt: - return json.Marshal("vencrypt") - case VNCPrimaryAuthSasl: - return json.Marshal("sasl") - default: - return nil, fmt.Errorf("unknown enum value %q for VNCPrimaryAuth", e) +// blockdev-snapshot-internal-sync -> BlockdevSnapshotInternalSync (command) + +// BlockdevSnapshotInternalSync implements the "blockdev-snapshot-internal-sync" QMP API call. +func (m *Monitor) BlockdevSnapshotInternalSync(device string, name string) (err error) { + cmd := struct { + Device string `json:"device"` + Name string `json:"name"` + }{ + device, + name, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-snapshot-internal-sync", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *VNCPrimaryAuth) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// blockdev-snapshot-sync -> BlockdevSnapshotSync (command) + +// BlockdevSnapshotSync implements the "blockdev-snapshot-sync" QMP API call. +func (m *Monitor) BlockdevSnapshotSync(device *string, nodeName *string, snapshotFile string, snapshotNodeName *string, format *string, mode *NewImageMode) (err error) { + cmd := struct { + Device *string `json:"device,omitempty"` + NodeName *string `json:"node-name,omitempty"` + SnapshotFile string `json:"snapshot-file"` + SnapshotNodeName *string `json:"snapshot-node-name,omitempty"` + Format *string `json:"format,omitempty"` + Mode *NewImageMode `json:"mode,omitempty"` + }{ + device, + nodeName, + snapshotFile, + snapshotNodeName, + format, + mode, } - switch s { - case "none": - *e = VNCPrimaryAuthNone - case "vnc": - *e = VNCPrimaryAuthVNC - case "ra2": - *e = VNCPrimaryAuthRa2 - case "ra2ne": - *e = VNCPrimaryAuthRa2Ne - case "tight": - *e = VNCPrimaryAuthTight - case "ultra": - *e = VNCPrimaryAuthUltra - case "tls": - *e = VNCPrimaryAuthTLS - case "vencrypt": - *e = VNCPrimaryAuthVencrypt - case "sasl": - *e = VNCPrimaryAuthSasl - default: - return fmt.Errorf("unknown enum value %q for VNCPrimaryAuth", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "blockdev-snapshot-sync", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} + +// calc-dirty-rate -> CalcDirtyRate (command) + +// CalcDirtyRate implements the "calc-dirty-rate" QMP API call. +func (m *Monitor) CalcDirtyRate(calcTime int64, samplePages *int64, mode *DirtyRateMeasureMode) (err error) { + cmd := struct { + CalcTime int64 `json:"calc-time"` + SamplePages *int64 `json:"sample-pages,omitempty"` + Mode *DirtyRateMeasureMode `json:"mode,omitempty"` + }{ + calcTime, + samplePages, + mode, } - return nil + bs, err := json.Marshal(map[string]interface{}{ + "execute": "calc-dirty-rate", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncServerInfo -> VNCServerInfo (struct) +// cancel-vcpu-dirty-limit -> CancelVcpuDirtyLimit (command) -// VNCServerInfo implements the "VncServerInfo" QMP API type. -type VNCServerInfo struct { - Host string `json:"host"` - Service string `json:"service"` - Family NetworkAddressFamily `json:"family"` - Websocket bool `json:"websocket"` - Auth *string `json:"auth,omitempty"` +// CancelVcpuDirtyLimit implements the "cancel-vcpu-dirty-limit" QMP API call. +func (m *Monitor) CancelVcpuDirtyLimit(cpuIndex *int64) (err error) { + cmd := struct { + CPUIndex *int64 `json:"cpu-index,omitempty"` + }{ + cpuIndex, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "cancel-vcpu-dirty-limit", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncServerInfo2 -> VNCServerInfo2 (struct) +// change-backing-file -> ChangeBackingFile (command) -// VNCServerInfo2 implements the "VncServerInfo2" QMP API type. -type VNCServerInfo2 struct { - Host string `json:"host"` - Service string `json:"service"` - Family NetworkAddressFamily `json:"family"` - Websocket bool `json:"websocket"` - Auth VNCPrimaryAuth `json:"auth"` - Vencrypt *VNCVencryptSubAuth `json:"vencrypt,omitempty"` +// ChangeBackingFile implements the "change-backing-file" QMP API call. +func (m *Monitor) ChangeBackingFile(device string, imageNodeName string, backingFile string) (err error) { + cmd := struct { + Device string `json:"device"` + ImageNodeName string `json:"image-node-name"` + BackingFile string `json:"backing-file"` + }{ + device, + imageNodeName, + backingFile, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "change-backing-file", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VncVencryptSubAuth -> VNCVencryptSubAuth (enum) +// change-vnc-password -> ChangeVNCPassword (command) -// VNCVencryptSubAuth implements the "VncVencryptSubAuth" QMP API type. -type VNCVencryptSubAuth int +// ChangeVNCPassword implements the "change-vnc-password" QMP API call. +func (m *Monitor) ChangeVNCPassword(password string) (err error) { + cmd := struct { + Password string `json:"password"` + }{ + password, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "change-vnc-password", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} -// Known values of VNCVencryptSubAuth. -const ( - VNCVencryptSubAuthPlain VNCVencryptSubAuth = iota - VNCVencryptSubAuthTLSNone - VNCVencryptSubAuthX509None - VNCVencryptSubAuthTLSVNC - VNCVencryptSubAuthX509VNC - VNCVencryptSubAuthTLSPlain - VNCVencryptSubAuthX509Plain - VNCVencryptSubAuthTLSSasl - VNCVencryptSubAuthX509Sasl -) +// chardev-add -> ChardevAdd (command) -// String implements fmt.Stringer. -func (e VNCVencryptSubAuth) String() string { - switch e { - case VNCVencryptSubAuthPlain: - return "plain" - case VNCVencryptSubAuthTLSNone: - return "tls-none" - case VNCVencryptSubAuthX509None: - return "x509-none" - case VNCVencryptSubAuthTLSVNC: - return "tls-vnc" - case VNCVencryptSubAuthX509VNC: - return "x509-vnc" - case VNCVencryptSubAuthTLSPlain: - return "tls-plain" - case VNCVencryptSubAuthX509Plain: - return "x509-plain" - case VNCVencryptSubAuthTLSSasl: - return "tls-sasl" - case VNCVencryptSubAuthX509Sasl: - return "x509-sasl" - default: - return fmt.Sprintf("VNCVencryptSubAuth(%d)", e) +// ChardevAdd implements the "chardev-add" QMP API call. +func (m *Monitor) ChardevAdd(id string, backend ChardevBackend) (ret ChardevReturn, err error) { + cmd := struct { + ID string `json:"id"` + Backend ChardevBackend `json:"backend"` + }{ + id, + backend, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "chardev-add", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return } + return } -// MarshalJSON implements json.Marshaler. -func (e VNCVencryptSubAuth) MarshalJSON() ([]byte, error) { - switch e { - case VNCVencryptSubAuthPlain: - return json.Marshal("plain") - case VNCVencryptSubAuthTLSNone: - return json.Marshal("tls-none") - case VNCVencryptSubAuthX509None: - return json.Marshal("x509-none") - case VNCVencryptSubAuthTLSVNC: - return json.Marshal("tls-vnc") - case VNCVencryptSubAuthX509VNC: - return json.Marshal("x509-vnc") - case VNCVencryptSubAuthTLSPlain: - return json.Marshal("tls-plain") - case VNCVencryptSubAuthX509Plain: - return json.Marshal("x509-plain") - case VNCVencryptSubAuthTLSSasl: - return json.Marshal("tls-sasl") - case VNCVencryptSubAuthX509Sasl: - return json.Marshal("x509-sasl") - default: - return nil, fmt.Errorf("unknown enum value %q for VNCVencryptSubAuth", e) +// chardev-change -> ChardevChange (command) + +// ChardevChange implements the "chardev-change" QMP API call. +func (m *Monitor) ChardevChange(id string, backend ChardevBackend) (ret ChardevReturn, err error) { + cmd := struct { + ID string `json:"id"` + Backend ChardevBackend `json:"backend"` + }{ + id, + backend, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "chardev-change", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *VNCVencryptSubAuth) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// chardev-remove -> ChardevRemove (command) + +// ChardevRemove implements the "chardev-remove" QMP API call. +func (m *Monitor) ChardevRemove(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, } - switch s { - case "plain": - *e = VNCVencryptSubAuthPlain - case "tls-none": - *e = VNCVencryptSubAuthTLSNone - case "x509-none": - *e = VNCVencryptSubAuthX509None - case "tls-vnc": - *e = VNCVencryptSubAuthTLSVNC - case "x509-vnc": - *e = VNCVencryptSubAuthX509VNC - case "tls-plain": - *e = VNCVencryptSubAuthTLSPlain - case "x509-plain": - *e = VNCVencryptSubAuthX509Plain - case "tls-sasl": - *e = VNCVencryptSubAuthTLSSasl - case "x509-sasl": - *e = VNCVencryptSubAuthX509Sasl - default: - return fmt.Errorf("unknown enum value %q for VNCVencryptSubAuth", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "chardev-remove", + "arguments": cmd, + }) + if err != nil { + return } - return nil + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// VsockSocketAddress -> VsockSocketAddress (struct) +// chardev-send-break -> ChardevSendBreak (command) -// VsockSocketAddress implements the "VsockSocketAddress" QMP API type. -type VsockSocketAddress struct { - Cid string `json:"cid"` - Port string `json:"port"` +// ChardevSendBreak implements the "chardev-send-break" QMP API call. +func (m *Monitor) ChardevSendBreak(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "chardev-send-break", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// EVENT WAKEUP - -// EVENT WATCHDOG - -// WatchdogAction -> WatchdogAction (enum) - -// WatchdogAction implements the "WatchdogAction" QMP API type. -type WatchdogAction int - -// Known values of WatchdogAction. -const ( - WatchdogActionReset WatchdogAction = iota - WatchdogActionShutdown - WatchdogActionPoweroff - WatchdogActionPause - WatchdogActionDebug - WatchdogActionNone - WatchdogActionInjectNmi -) +// client_migrate_info -> ClientMigrateInfo (command) -// String implements fmt.Stringer. -func (e WatchdogAction) String() string { - switch e { - case WatchdogActionReset: - return "reset" - case WatchdogActionShutdown: - return "shutdown" - case WatchdogActionPoweroff: - return "poweroff" - case WatchdogActionPause: - return "pause" - case WatchdogActionDebug: - return "debug" - case WatchdogActionNone: - return "none" - case WatchdogActionInjectNmi: - return "inject-nmi" - default: - return fmt.Sprintf("WatchdogAction(%d)", e) +// ClientMigrateInfo implements the "client_migrate_info" QMP API call. +func (m *Monitor) ClientMigrateInfo(protocol string, hostname string, port *int64, tlsPort *int64, certSubject *string) (err error) { + cmd := struct { + Protocol string `json:"protocol"` + Hostname string `json:"hostname"` + Port *int64 `json:"port,omitempty"` + TLSPort *int64 `json:"tls-port,omitempty"` + CertSubject *string `json:"cert-subject,omitempty"` + }{ + protocol, + hostname, + port, + tlsPort, + certSubject, } -} - -// MarshalJSON implements json.Marshaler. -func (e WatchdogAction) MarshalJSON() ([]byte, error) { - switch e { - case WatchdogActionReset: - return json.Marshal("reset") - case WatchdogActionShutdown: - return json.Marshal("shutdown") - case WatchdogActionPoweroff: - return json.Marshal("poweroff") - case WatchdogActionPause: - return json.Marshal("pause") - case WatchdogActionDebug: - return json.Marshal("debug") - case WatchdogActionNone: - return json.Marshal("none") - case WatchdogActionInjectNmi: - return json.Marshal("inject-nmi") - default: - return nil, fmt.Errorf("unknown enum value %q for WatchdogAction", e) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "client_migrate_info", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return } -// UnmarshalJSON implements json.Unmarshaler. -func (e *WatchdogAction) UnmarshalJSON(bs []byte) error { - var s string - if err := json.Unmarshal(bs, &s); err != nil { - return err +// closefd -> Closefd (command) + +// Closefd implements the "closefd" QMP API call. +func (m *Monitor) Closefd(fdname string) (err error) { + cmd := struct { + Fdname string `json:"fdname"` + }{ + fdname, } - switch s { - case "reset": - *e = WatchdogActionReset - case "shutdown": - *e = WatchdogActionShutdown - case "poweroff": - *e = WatchdogActionPoweroff - case "pause": - *e = WatchdogActionPause - case "debug": - *e = WatchdogActionDebug - case "none": - *e = WatchdogActionNone - case "inject-nmi": - *e = WatchdogActionInjectNmi - default: - return fmt.Errorf("unknown enum value %q for WatchdogAction", s) + bs, err := json.Marshal(map[string]interface{}{ + "execute": "closefd", + "arguments": cmd, + }) + if err != nil { + return } - return nil + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// XBZRLECacheStats -> XbzrleCacheStats (struct) +// cont -> Cont (command) -// XbzrleCacheStats implements the "XBZRLECacheStats" QMP API type. -type XbzrleCacheStats struct { - CacheSize int64 `json:"cache-size"` - Bytes int64 `json:"bytes"` - Pages int64 `json:"pages"` - CacheMiss int64 `json:"cache-miss"` - CacheMissRate float64 `json:"cache-miss-rate"` - Overflow int64 `json:"overflow"` +// Cont implements the "cont" QMP API call. +func (m *Monitor) Cont() (err error) { + cmd := struct { + }{} + bs, err := json.Marshal(map[string]interface{}{ + "execute": "cont", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return } -// add-fd -> AddFD (command) +// device-list-properties -> DeviceListProperties (command) -// AddFD implements the "add-fd" QMP API call. -func (m *Monitor) AddFD(fdsetID *int64, opaque *string) (ret AddfdInfo, err error) { +// DeviceListProperties implements the "device-list-properties" QMP API call. +func (m *Monitor) DeviceListProperties(typename string) (ret []ObjectPropertyInfo, err error) { cmd := struct { - FdsetID *int64 `json:"fdset-id,omitempty"` - Opaque *string `json:"opaque,omitempty"` + Typename string `json:"typename"` }{ - fdsetID, - opaque, + typename, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "add-fd", + "execute": "device-list-properties", "arguments": cmd, }) if err != nil { @@ -10500,23 +21651,62 @@ func (m *Monitor) AddFD(fdsetID *int64, opaque *string) (ret AddfdInfo, err erro return } -// add_client -> AddClient (command) +// device_add -> DeviceAdd (command) -// AddClient implements the "add_client" QMP API call. -func (m *Monitor) AddClient(protocol string, fdname string, skipauth *bool, tls *bool) (err error) { +// DeviceAdd implements the "device_add" QMP API call. +func (m *Monitor) DeviceAdd(driver string, bus *string, id *string) (err error) { cmd := struct { - Protocol string `json:"protocol"` - Fdname string `json:"fdname"` - Skipauth *bool `json:"skipauth,omitempty"` - TLS *bool `json:"tls,omitempty"` + Driver string `json:"driver"` + Bus *string `json:"bus,omitempty"` + ID *string `json:"id,omitempty"` }{ - protocol, - fdname, - skipauth, - tls, + driver, + bus, + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "device_add", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} + +// device_del -> DeviceDel (command) + +// DeviceDel implements the "device_del" QMP API call. +func (m *Monitor) DeviceDel(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "device_del", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return } + return +} + +// display-reload -> DisplayReload (command) + +// DisplayReload implements the "display-reload" QMP API call. +func (m *Monitor) DisplayReload(cmd *DisplayReloadOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "add_client", + "execute": "display-reload", "arguments": cmd, }) if err != nil { @@ -10529,17 +21719,12 @@ func (m *Monitor) AddClient(protocol string, fdname string, skipauth *bool, tls return } -// balloon -> Balloon (command) +// display-update -> DisplayUpdate (command) -// Balloon implements the "balloon" QMP API call. -func (m *Monitor) Balloon(value int64) (err error) { - cmd := struct { - Value int64 `json:"value"` - }{ - value, - } +// DisplayUpdate implements the "display-update" QMP API call. +func (m *Monitor) DisplayUpdate(cmd *DisplayUpdateOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "balloon", + "execute": "display-update", "arguments": cmd, }) if err != nil { @@ -10552,29 +21737,12 @@ func (m *Monitor) Balloon(value int64) (err error) { return } -// block-commit -> BlockCommit (command) +// drive-backup -> DriveBackup (command) -// BlockCommit implements the "block-commit" QMP API call. -func (m *Monitor) BlockCommit(jobID *string, device string, base *string, top *string, backingFile *string, speed *int64, filterNodeName *string) (err error) { - cmd := struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Base *string `json:"base,omitempty"` - Top *string `json:"top,omitempty"` - BackingFile *string `json:"backing-file,omitempty"` - Speed *int64 `json:"speed,omitempty"` - FilterNodeName *string `json:"filter-node-name,omitempty"` - }{ - jobID, - device, - base, - top, - backingFile, - speed, - filterNodeName, - } +// DriveBackup implements the "drive-backup" QMP API call. +func (m *Monitor) DriveBackup(cmd *DriveBackup) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-commit", + "execute": "drive-backup", "arguments": cmd, }) if err != nil { @@ -10587,25 +21755,12 @@ func (m *Monitor) BlockCommit(jobID *string, device string, base *string, top *s return } -// block-dirty-bitmap-add -> BlockDirtyBitmapAdd (command) +// drive-mirror -> DriveMirror (command) -// BlockDirtyBitmapAdd implements the "block-dirty-bitmap-add" QMP API call. -func (m *Monitor) BlockDirtyBitmapAdd(node string, name string, granularity *uint32, persistent *bool, autoload *bool) (err error) { - cmd := struct { - Node string `json:"node"` - Name string `json:"name"` - Granularity *uint32 `json:"granularity,omitempty"` - Persistent *bool `json:"persistent,omitempty"` - Autoload *bool `json:"autoload,omitempty"` - }{ - node, - name, - granularity, - persistent, - autoload, - } +// DriveMirror implements the "drive-mirror" QMP API call. +func (m *Monitor) DriveMirror(cmd *DriveMirror) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-dirty-bitmap-add", + "execute": "drive-mirror", "arguments": cmd, }) if err != nil { @@ -10618,19 +21773,27 @@ func (m *Monitor) BlockDirtyBitmapAdd(node string, name string, granularity *uin return } -// block-dirty-bitmap-clear -> BlockDirtyBitmapClear (command) +// dump-guest-memory -> DumpGuestMemory (command) -// BlockDirtyBitmapClear implements the "block-dirty-bitmap-clear" QMP API call. -func (m *Monitor) BlockDirtyBitmapClear(node string, name string) (err error) { +// DumpGuestMemory implements the "dump-guest-memory" QMP API call. +func (m *Monitor) DumpGuestMemory(paging bool, protocol string, detach *bool, begin *int64, length *int64, format *DumpGuestMemoryFormat) (err error) { cmd := struct { - Node string `json:"node"` - Name string `json:"name"` + Paging bool `json:"paging"` + Protocol string `json:"protocol"` + Detach *bool `json:"detach,omitempty"` + Begin *int64 `json:"begin,omitempty"` + Length *int64 `json:"length,omitempty"` + Format *DumpGuestMemoryFormat `json:"format,omitempty"` }{ - node, - name, + paging, + protocol, + detach, + begin, + length, + format, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-dirty-bitmap-clear", + "execute": "dump-guest-memory", "arguments": cmd, }) if err != nil { @@ -10643,19 +21806,17 @@ func (m *Monitor) BlockDirtyBitmapClear(node string, name string) (err error) { return } -// block-dirty-bitmap-remove -> BlockDirtyBitmapRemove (command) +// dump-skeys -> DumpSkeys (command) -// BlockDirtyBitmapRemove implements the "block-dirty-bitmap-remove" QMP API call. -func (m *Monitor) BlockDirtyBitmapRemove(node string, name string) (err error) { +// DumpSkeys implements the "dump-skeys" QMP API call. +func (m *Monitor) DumpSkeys(filename string) (err error) { cmd := struct { - Node string `json:"node"` - Name string `json:"name"` + Filename string `json:"filename"` }{ - node, - name, + filename, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-dirty-bitmap-remove", + "execute": "dump-skeys", "arguments": cmd, }) if err != nil { @@ -10668,19 +21829,21 @@ func (m *Monitor) BlockDirtyBitmapRemove(node string, name string) (err error) { return } -// block-job-cancel -> BlockJobCancel (command) +// eject -> Eject (command) -// BlockJobCancel implements the "block-job-cancel" QMP API call. -func (m *Monitor) BlockJobCancel(device string, force *bool) (err error) { +// Eject implements the "eject" QMP API call. +func (m *Monitor) Eject(device *string, id *string, force *bool) (err error) { cmd := struct { - Device string `json:"device"` - Force *bool `json:"force,omitempty"` + Device *string `json:"device,omitempty"` + ID *string `json:"id,omitempty"` + Force *bool `json:"force,omitempty"` }{ device, + id, force, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-job-cancel", + "execute": "eject", "arguments": cmd, }) if err != nil { @@ -10693,17 +21856,35 @@ func (m *Monitor) BlockJobCancel(device string, force *bool) (err error) { return } -// block-job-complete -> BlockJobComplete (command) +// expire_password -> ExpirePassword (command) -// BlockJobComplete implements the "block-job-complete" QMP API call. -func (m *Monitor) BlockJobComplete(device string) (err error) { +// ExpirePassword implements the "expire_password" QMP API call. +func (m *Monitor) ExpirePassword(cmd *ExpirePasswordOptions) (err error) { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "expire_password", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +} + +// getfd -> Getfd (command) + +// Getfd implements the "getfd" QMP API call. +func (m *Monitor) Getfd(fdname string) (err error) { cmd := struct { - Device string `json:"device"` + Fdname string `json:"fdname"` }{ - device, + fdname, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-job-complete", + "execute": "getfd", "arguments": cmd, }) if err != nil { @@ -10716,17 +21897,19 @@ func (m *Monitor) BlockJobComplete(device string) (err error) { return } -// block-job-pause -> BlockJobPause (command) +// human-monitor-command -> HumanMonitorCommand (command) -// BlockJobPause implements the "block-job-pause" QMP API call. -func (m *Monitor) BlockJobPause(device string) (err error) { +// HumanMonitorCommand implements the "human-monitor-command" QMP API call. +func (m *Monitor) HumanMonitorCommand(commandLine string, cpuIndex *int64) (ret string, err error) { cmd := struct { - Device string `json:"device"` + CommandLine string `json:"command-line"` + CPUIndex *int64 `json:"cpu-index,omitempty"` }{ - device, + commandLine, + cpuIndex, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-job-pause", + "execute": "human-monitor-command", "arguments": cmd, }) if err != nil { @@ -10736,20 +21919,26 @@ func (m *Monitor) BlockJobPause(device string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// block-job-resume -> BlockJobResume (command) +// inject-nmi -> InjectNmi (command) -// BlockJobResume implements the "block-job-resume" QMP API call. -func (m *Monitor) BlockJobResume(device string) (err error) { +// InjectNmi implements the "inject-nmi" QMP API call. +func (m *Monitor) InjectNmi() (err error) { cmd := struct { - Device string `json:"device"` - }{ - device, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-job-resume", + "execute": "inject-nmi", "arguments": cmd, }) if err != nil { @@ -10762,19 +21951,21 @@ func (m *Monitor) BlockJobResume(device string) (err error) { return } -// block-job-set-speed -> BlockJobSetSpeed (command) +// input-send-event -> InputSendEvent (command) -// BlockJobSetSpeed implements the "block-job-set-speed" QMP API call. -func (m *Monitor) BlockJobSetSpeed(device string, speed int64) (err error) { +// InputSendEvent implements the "input-send-event" QMP API call. +func (m *Monitor) InputSendEvent(device *string, head *int64, events []InputEvent) (err error) { cmd := struct { - Device string `json:"device"` - Speed int64 `json:"speed"` + Device *string `json:"device,omitempty"` + Head *int64 `json:"head,omitempty"` + Events []InputEvent `json:"events"` }{ device, - speed, + head, + events, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-job-set-speed", + "execute": "input-send-event", "arguments": cmd, }) if err != nil { @@ -10787,19 +21978,17 @@ func (m *Monitor) BlockJobSetSpeed(device string, speed int64) (err error) { return } -// block-set-write-threshold -> BlockSetWriteThreshold (command) +// job-cancel -> JobCancel (command) -// BlockSetWriteThreshold implements the "block-set-write-threshold" QMP API call. -func (m *Monitor) BlockSetWriteThreshold(nodeName string, writeThreshold uint64) (err error) { +// JobCancel implements the "job-cancel" QMP API call. +func (m *Monitor) JobCancel(id string) (err error) { cmd := struct { - NodeName string `json:"node-name"` - WriteThreshold uint64 `json:"write-threshold"` + ID string `json:"id"` }{ - nodeName, - writeThreshold, + id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-set-write-threshold", + "execute": "job-cancel", "arguments": cmd, }) if err != nil { @@ -10812,29 +22001,17 @@ func (m *Monitor) BlockSetWriteThreshold(nodeName string, writeThreshold uint64) return } -// block-stream -> BlockStream (command) +// job-complete -> JobComplete (command) -// BlockStream implements the "block-stream" QMP API call. -func (m *Monitor) BlockStream(jobID *string, device string, base *string, baseNode *string, backingFile *string, speed *int64, onError *BlockdevOnError) (err error) { +// JobComplete implements the "job-complete" QMP API call. +func (m *Monitor) JobComplete(id string) (err error) { cmd := struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Base *string `json:"base,omitempty"` - BaseNode *string `json:"base-node,omitempty"` - BackingFile *string `json:"backing-file,omitempty"` - Speed *int64 `json:"speed,omitempty"` - OnError *BlockdevOnError `json:"on-error,omitempty"` + ID string `json:"id"` }{ - jobID, - device, - base, - baseNode, - backingFile, - speed, - onError, + id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block-stream", + "execute": "job-complete", "arguments": cmd, }) if err != nil { @@ -10847,21 +22024,17 @@ func (m *Monitor) BlockStream(jobID *string, device string, base *string, baseNo return } -// block_passwd -> BlockPasswd (command) +// job-dismiss -> JobDismiss (command) -// BlockPasswd implements the "block_passwd" QMP API call. -func (m *Monitor) BlockPasswd(device *string, nodeName *string, password string) (err error) { +// JobDismiss implements the "job-dismiss" QMP API call. +func (m *Monitor) JobDismiss(id string) (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - NodeName *string `json:"node-name,omitempty"` - Password string `json:"password"` + ID string `json:"id"` }{ - device, - nodeName, - password, + id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block_passwd", + "execute": "job-dismiss", "arguments": cmd, }) if err != nil { @@ -10874,21 +22047,17 @@ func (m *Monitor) BlockPasswd(device *string, nodeName *string, password string) return } -// block_resize -> BlockResize (command) +// job-finalize -> JobFinalize (command) -// BlockResize implements the "block_resize" QMP API call. -func (m *Monitor) BlockResize(device *string, nodeName *string, size int64) (err error) { +// JobFinalize implements the "job-finalize" QMP API call. +func (m *Monitor) JobFinalize(id string) (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - NodeName *string `json:"node-name,omitempty"` - Size int64 `json:"size"` + ID string `json:"id"` }{ - device, - nodeName, - size, + id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block_resize", + "execute": "job-finalize", "arguments": cmd, }) if err != nil { @@ -10901,12 +22070,17 @@ func (m *Monitor) BlockResize(device *string, nodeName *string, size int64) (err return } -// block_set_io_throttle -> BlockSetIOThrottle (command) +// job-pause -> JobPause (command) -// BlockSetIOThrottle implements the "block_set_io_throttle" QMP API call. -func (m *Monitor) BlockSetIOThrottle(cmd *BlockIOThrottle) (err error) { +// JobPause implements the "job-pause" QMP API call. +func (m *Monitor) JobPause(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "block_set_io_throttle", + "execute": "job-pause", "arguments": cmd, }) if err != nil { @@ -10919,12 +22093,17 @@ func (m *Monitor) BlockSetIOThrottle(cmd *BlockIOThrottle) (err error) { return } -// blockdev-add -> BlockdevAdd (command) +// job-resume -> JobResume (command) -// BlockdevAdd implements the "blockdev-add" QMP API call. -func (m *Monitor) BlockdevAdd(cmd *BlockdevOptions) (err error) { +// JobResume implements the "job-resume" QMP API call. +func (m *Monitor) JobResume(id string) (err error) { + cmd := struct { + ID string `json:"id"` + }{ + id, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-add", + "execute": "job-resume", "arguments": cmd, }) if err != nil { @@ -10934,15 +22113,26 @@ func (m *Monitor) BlockdevAdd(cmd *BlockdevOptions) (err error) { if err != nil { return } - return -} - -// blockdev-backup -> BlockdevBackup (command) - -// BlockdevBackup implements the "blockdev-backup" QMP API call. -func (m *Monitor) BlockdevBackup(cmd *BlockdevBackup) (err error) { + return +} + +// memsave -> Memsave (command) + +// Memsave implements the "memsave" QMP API call. +func (m *Monitor) Memsave(val int64, size int64, filename string, cpuIndex *int64) (err error) { + cmd := struct { + Val int64 `json:"val"` + Size int64 `json:"size"` + Filename string `json:"filename"` + CPUIndex *int64 `json:"cpu-index,omitempty"` + }{ + val, + size, + filename, + cpuIndex, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-backup", + "execute": "memsave", "arguments": cmd, }) if err != nil { @@ -10955,25 +22145,25 @@ func (m *Monitor) BlockdevBackup(cmd *BlockdevBackup) (err error) { return } -// blockdev-change-medium -> BlockdevChangeMedium (command) +// migrate -> Migrate (command) -// BlockdevChangeMedium implements the "blockdev-change-medium" QMP API call. -func (m *Monitor) BlockdevChangeMedium(device *string, id *string, filename string, format *string, readOnlyMode *BlockdevChangeReadOnlyMode) (err error) { +// Migrate implements the "migrate" QMP API call. +func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool, resume *bool) (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` - Filename string `json:"filename"` - Format *string `json:"format,omitempty"` - ReadOnlyMode *BlockdevChangeReadOnlyMode `json:"read-only-mode,omitempty"` + URI string `json:"uri"` + Blk *bool `json:"blk,omitempty"` + Inc *bool `json:"inc,omitempty"` + Detach *bool `json:"detach,omitempty"` + Resume *bool `json:"resume,omitempty"` }{ - device, - id, - filename, - format, - readOnlyMode, + uri, + blk, + inc, + detach, + resume, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-change-medium", + "execute": "migrate", "arguments": cmd, }) if err != nil { @@ -10986,19 +22176,17 @@ func (m *Monitor) BlockdevChangeMedium(device *string, id *string, filename stri return } -// blockdev-close-tray -> BlockdevCloseTray (command) +// migrate-continue -> MigrateContinue (command) -// BlockdevCloseTray implements the "blockdev-close-tray" QMP API call. -func (m *Monitor) BlockdevCloseTray(device *string, id *string) (err error) { +// MigrateContinue implements the "migrate-continue" QMP API call. +func (m *Monitor) MigrateContinue(state MigrationStatus) (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` + State MigrationStatus `json:"state"` }{ - device, - id, + state, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-close-tray", + "execute": "migrate-continue", "arguments": cmd, }) if err != nil { @@ -11011,17 +22199,17 @@ func (m *Monitor) BlockdevCloseTray(device *string, id *string) (err error) { return } -// blockdev-del -> BlockdevDel (command) +// migrate-incoming -> MigrateIncoming (command) -// BlockdevDel implements the "blockdev-del" QMP API call. -func (m *Monitor) BlockdevDel(nodeName string) (err error) { +// MigrateIncoming implements the "migrate-incoming" QMP API call. +func (m *Monitor) MigrateIncoming(uri string) (err error) { cmd := struct { - NodeName string `json:"node-name"` + URI string `json:"uri"` }{ - nodeName, + uri, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-del", + "execute": "migrate-incoming", "arguments": cmd, }) if err != nil { @@ -11034,37 +22222,14 @@ func (m *Monitor) BlockdevDel(nodeName string) (err error) { return } -// blockdev-mirror -> BlockdevMirror (command) +// migrate-pause -> MigratePause (command) -// BlockdevMirror implements the "blockdev-mirror" QMP API call. -func (m *Monitor) BlockdevMirror(jobID *string, device string, target string, replaces *string, sync MirrorSyncMode, speed *int64, granularity *uint32, bufSize *int64, onSourceError *BlockdevOnError, onTargetError *BlockdevOnError, filterNodeName *string) (err error) { +// MigratePause implements the "migrate-pause" QMP API call. +func (m *Monitor) MigratePause() (err error) { cmd := struct { - JobID *string `json:"job-id,omitempty"` - Device string `json:"device"` - Target string `json:"target"` - Replaces *string `json:"replaces,omitempty"` - Sync MirrorSyncMode `json:"sync"` - Speed *int64 `json:"speed,omitempty"` - Granularity *uint32 `json:"granularity,omitempty"` - BufSize *int64 `json:"buf-size,omitempty"` - OnSourceError *BlockdevOnError `json:"on-source-error,omitempty"` - OnTargetError *BlockdevOnError `json:"on-target-error,omitempty"` - FilterNodeName *string `json:"filter-node-name,omitempty"` - }{ - jobID, - device, - target, - replaces, - sync, - speed, - granularity, - bufSize, - onSourceError, - onTargetError, - filterNodeName, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-mirror", + "execute": "migrate-pause", "arguments": cmd, }) if err != nil { @@ -11077,21 +22242,17 @@ func (m *Monitor) BlockdevMirror(jobID *string, device string, target string, re return } -// blockdev-open-tray -> BlockdevOpenTray (command) +// migrate-recover -> MigrateRecover (command) -// BlockdevOpenTray implements the "blockdev-open-tray" QMP API call. -func (m *Monitor) BlockdevOpenTray(device *string, id *string, force *bool) (err error) { +// MigrateRecover implements the "migrate-recover" QMP API call. +func (m *Monitor) MigrateRecover(uri string) (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` - Force *bool `json:"force,omitempty"` + URI string `json:"uri"` }{ - device, - id, - force, + uri, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-open-tray", + "execute": "migrate-recover", "arguments": cmd, }) if err != nil { @@ -11104,19 +22265,17 @@ func (m *Monitor) BlockdevOpenTray(device *string, id *string, force *bool) (err return } -// blockdev-snapshot -> BlockdevSnapshot (command) +// migrate-set-capabilities -> MigrateSetCapabilities (command) -// BlockdevSnapshot implements the "blockdev-snapshot" QMP API call. -func (m *Monitor) BlockdevSnapshot(node string, overlay string) (err error) { +// MigrateSetCapabilities implements the "migrate-set-capabilities" QMP API call. +func (m *Monitor) MigrateSetCapabilities(capabilities []MigrationCapabilityStatus) (err error) { cmd := struct { - Node string `json:"node"` - Overlay string `json:"overlay"` + Capabilities []MigrationCapabilityStatus `json:"capabilities"` }{ - node, - overlay, + capabilities, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-snapshot", + "execute": "migrate-set-capabilities", "arguments": cmd, }) if err != nil { @@ -11129,21 +22288,12 @@ func (m *Monitor) BlockdevSnapshot(node string, overlay string) (err error) { return } -// blockdev-snapshot-delete-internal-sync -> BlockdevSnapshotDeleteInternalSync (command) +// migrate-set-parameters -> MigrateSetParameters (command) -// BlockdevSnapshotDeleteInternalSync implements the "blockdev-snapshot-delete-internal-sync" QMP API call. -func (m *Monitor) BlockdevSnapshotDeleteInternalSync(device string, id *string, name *string) (ret SnapshotInfo, err error) { - cmd := struct { - Device string `json:"device"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - }{ - device, - id, - name, - } +// MigrateSetParameters implements the "migrate-set-parameters" QMP API call. +func (m *Monitor) MigrateSetParameters(cmd *MigrateSetParameters) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-snapshot-delete-internal-sync", + "execute": "migrate-set-parameters", "arguments": cmd, }) if err != nil { @@ -11153,31 +22303,17 @@ func (m *Monitor) BlockdevSnapshotDeleteInternalSync(device string, id *string, if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// blockdev-snapshot-internal-sync -> BlockdevSnapshotInternalSync (command) +// migrate-start-postcopy -> MigrateStartPostcopy (command) -// BlockdevSnapshotInternalSync implements the "blockdev-snapshot-internal-sync" QMP API call. -func (m *Monitor) BlockdevSnapshotInternalSync(device string, name string) (err error) { +// MigrateStartPostcopy implements the "migrate-start-postcopy" QMP API call. +func (m *Monitor) MigrateStartPostcopy() (err error) { cmd := struct { - Device string `json:"device"` - Name string `json:"name"` - }{ - device, - name, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-snapshot-internal-sync", + "execute": "migrate-start-postcopy", "arguments": cmd, }) if err != nil { @@ -11190,27 +22326,14 @@ func (m *Monitor) BlockdevSnapshotInternalSync(device string, name string) (err return } -// blockdev-snapshot-sync -> BlockdevSnapshotSync (command) +// migrate_cancel -> MigrateCancel (command) -// BlockdevSnapshotSync implements the "blockdev-snapshot-sync" QMP API call. -func (m *Monitor) BlockdevSnapshotSync(device *string, nodeName *string, snapshotFile string, snapshotNodeName *string, format *string, mode *NewImageMode) (err error) { +// MigrateCancel implements the "migrate_cancel" QMP API call. +func (m *Monitor) MigrateCancel() (err error) { cmd := struct { - Device *string `json:"device,omitempty"` - NodeName *string `json:"node-name,omitempty"` - SnapshotFile string `json:"snapshot-file"` - SnapshotNodeName *string `json:"snapshot-node-name,omitempty"` - Format *string `json:"format,omitempty"` - Mode *NewImageMode `json:"mode,omitempty"` - }{ - device, - nodeName, - snapshotFile, - snapshotNodeName, - format, - mode, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "blockdev-snapshot-sync", + "execute": "migrate_cancel", "arguments": cmd, }) if err != nil { @@ -11223,21 +22346,12 @@ func (m *Monitor) BlockdevSnapshotSync(device *string, nodeName *string, snapsho return } -// change -> Change (command) +// nbd-server-add -> NBDServerAdd (command) -// Change implements the "change" QMP API call. -func (m *Monitor) Change(device string, target string, arg *string) (err error) { - cmd := struct { - Device string `json:"device"` - Target string `json:"target"` - Arg *string `json:"arg,omitempty"` - }{ - device, - target, - arg, - } +// NBDServerAdd implements the "nbd-server-add" QMP API call. +func (m *Monitor) NBDServerAdd(cmd *NBDServerAddOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "change", + "execute": "nbd-server-add", "arguments": cmd, }) if err != nil { @@ -11250,21 +22364,19 @@ func (m *Monitor) Change(device string, target string, arg *string) (err error) return } -// change-backing-file -> ChangeBackingFile (command) +// nbd-server-remove -> NBDServerRemove (command) -// ChangeBackingFile implements the "change-backing-file" QMP API call. -func (m *Monitor) ChangeBackingFile(device string, imageNodeName string, backingFile string) (err error) { +// NBDServerRemove implements the "nbd-server-remove" QMP API call. +func (m *Monitor) NBDServerRemove(name string, mode *BlockExportRemoveMode) (err error) { cmd := struct { - Device string `json:"device"` - ImageNodeName string `json:"image-node-name"` - BackingFile string `json:"backing-file"` + Name string `json:"name"` + Mode *BlockExportRemoveMode `json:"mode,omitempty"` }{ - device, - imageNodeName, - backingFile, + name, + mode, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "change-backing-file", + "execute": "nbd-server-remove", "arguments": cmd, }) if err != nil { @@ -11277,17 +22389,23 @@ func (m *Monitor) ChangeBackingFile(device string, imageNodeName string, backing return } -// change-vnc-password -> ChangeVNCPassword (command) +// nbd-server-start -> NBDServerStart (command) -// ChangeVNCPassword implements the "change-vnc-password" QMP API call. -func (m *Monitor) ChangeVNCPassword(password string) (err error) { +// NBDServerStart implements the "nbd-server-start" QMP API call. +func (m *Monitor) NBDServerStart(addr SocketAddressLegacy, tlsCreds *string, tlsAuthz *string, maxConnections *uint32) (err error) { cmd := struct { - Password string `json:"password"` + Addr SocketAddressLegacy `json:"addr"` + TLSCreds *string `json:"tls-creds,omitempty"` + TLSAuthz *string `json:"tls-authz,omitempty"` + MaxConnections *uint32 `json:"max-connections,omitempty"` }{ - password, + addr, + tlsCreds, + tlsAuthz, + maxConnections, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "change-vnc-password", + "execute": "nbd-server-start", "arguments": cmd, }) if err != nil { @@ -11300,19 +22418,14 @@ func (m *Monitor) ChangeVNCPassword(password string) (err error) { return } -// chardev-add -> ChardevAdd (command) +// nbd-server-stop -> NBDServerStop (command) -// ChardevAdd implements the "chardev-add" QMP API call. -func (m *Monitor) ChardevAdd(id string, backend ChardevBackend) (ret ChardevReturn, err error) { +// NBDServerStop implements the "nbd-server-stop" QMP API call. +func (m *Monitor) NBDServerStop() (err error) { cmd := struct { - ID string `json:"id"` - Backend ChardevBackend `json:"backend"` - }{ - id, - backend, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "chardev-add", + "execute": "nbd-server-stop", "arguments": cmd, }) if err != nil { @@ -11322,31 +22435,15 @@ func (m *Monitor) ChardevAdd(id string, backend ChardevBackend) (ret ChardevRetu if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// chardev-change -> ChardevChange (command) +// netdev_add -> NetdevAdd (command) -// ChardevChange implements the "chardev-change" QMP API call. -func (m *Monitor) ChardevChange(id string, backend ChardevBackend) (ret ChardevReturn, err error) { - cmd := struct { - ID string `json:"id"` - Backend ChardevBackend `json:"backend"` - }{ - id, - backend, - } +// NetdevAdd implements the "netdev_add" QMP API call. +func (m *Monitor) NetdevAdd(cmd *Netdev) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "chardev-change", + "execute": "netdev_add", "arguments": cmd, }) if err != nil { @@ -11356,29 +22453,20 @@ func (m *Monitor) ChardevChange(id string, backend ChardevBackend) (ret ChardevR if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// chardev-remove -> ChardevRemove (command) +// netdev_del -> NetdevDel (command) -// ChardevRemove implements the "chardev-remove" QMP API call. -func (m *Monitor) ChardevRemove(id string) (err error) { +// NetdevDel implements the "netdev_del" QMP API call. +func (m *Monitor) NetdevDel(id string) (err error) { cmd := struct { ID string `json:"id"` }{ id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "chardev-remove", + "execute": "netdev_del", "arguments": cmd, }) if err != nil { @@ -11391,17 +22479,12 @@ func (m *Monitor) ChardevRemove(id string) (err error) { return } -// chardev-send-break -> ChardevSendBreak (command) +// object-add -> ObjectAdd (command) -// ChardevSendBreak implements the "chardev-send-break" QMP API call. -func (m *Monitor) ChardevSendBreak(id string) (err error) { - cmd := struct { - ID string `json:"id"` - }{ - id, - } +// ObjectAdd implements the "object-add" QMP API call. +func (m *Monitor) ObjectAdd(cmd *ObjectOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "chardev-send-break", + "execute": "object-add", "arguments": cmd, }) if err != nil { @@ -11414,25 +22497,17 @@ func (m *Monitor) ChardevSendBreak(id string) (err error) { return } -// client_migrate_info -> ClientMigrateInfo (command) +// object-del -> ObjectDel (command) -// ClientMigrateInfo implements the "client_migrate_info" QMP API call. -func (m *Monitor) ClientMigrateInfo(protocol string, hostname string, port *int64, tlsPort *int64, certSubject *string) (err error) { +// ObjectDel implements the "object-del" QMP API call. +func (m *Monitor) ObjectDel(id string) (err error) { cmd := struct { - Protocol string `json:"protocol"` - Hostname string `json:"hostname"` - Port *int64 `json:"port,omitempty"` - TLSPort *int64 `json:"tls-port,omitempty"` - CertSubject *string `json:"cert-subject,omitempty"` + ID string `json:"id"` }{ - protocol, - hostname, - port, - tlsPort, - certSubject, + id, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "client_migrate_info", + "execute": "object-del", "arguments": cmd, }) if err != nil { @@ -11445,17 +22520,21 @@ func (m *Monitor) ClientMigrateInfo(protocol string, hostname string, port *int6 return } -// closefd -> Closefd (command) +// pmemsave -> Pmemsave (command) -// Closefd implements the "closefd" QMP API call. -func (m *Monitor) Closefd(fdname string) (err error) { +// Pmemsave implements the "pmemsave" QMP API call. +func (m *Monitor) Pmemsave(val int64, size int64, filename string) (err error) { cmd := struct { - Fdname string `json:"fdname"` + Val int64 `json:"val"` + Size int64 `json:"size"` + Filename string `json:"filename"` }{ - fdname, + val, + size, + filename, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "closefd", + "execute": "pmemsave", "arguments": cmd, }) if err != nil { @@ -11468,14 +22547,17 @@ func (m *Monitor) Closefd(fdname string) (err error) { return } -// cont -> Cont (command) +// qmp_capabilities -> QMPCapabilities (command) -// Cont implements the "cont" QMP API call. -func (m *Monitor) Cont() (err error) { +// QMPCapabilities implements the "qmp_capabilities" QMP API call. +func (m *Monitor) QMPCapabilities(enable []QMPCapability) (err error) { cmd := struct { - }{} + Enable []QMPCapability `json:"enable,omitempty"` + }{ + enable, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "cont", + "execute": "qmp_capabilities", "arguments": cmd, }) if err != nil { @@ -11488,17 +22570,19 @@ func (m *Monitor) Cont() (err error) { return } -// cpu -> CPU (command) +// qom-get -> QomGet (command) -// CPU implements the "cpu" QMP API call. -func (m *Monitor) CPU(index int64) (err error) { +// QomGet implements the "qom-get" QMP API call. +func (m *Monitor) QomGet(path string, property string) (ret interface{}, err error) { cmd := struct { - Index int64 `json:"index"` + Path string `json:"path"` + Property string `json:"property"` }{ - index, + path, + property, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "cpu", + "execute": "qom-get", "arguments": cmd, }) if err != nil { @@ -11508,20 +22592,29 @@ func (m *Monitor) CPU(index int64) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// cpu-add -> CPUAdd (command) +// qom-list -> QomList (command) -// CPUAdd implements the "cpu-add" QMP API call. -func (m *Monitor) CPUAdd(id int64) (err error) { +// QomList implements the "qom-list" QMP API call. +func (m *Monitor) QomList(path string) (ret []ObjectPropertyInfo, err error) { cmd := struct { - ID int64 `json:"id"` + Path string `json:"path"` }{ - id, + path, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "cpu-add", + "execute": "qom-list", "arguments": cmd, }) if err != nil { @@ -11531,20 +22624,29 @@ func (m *Monitor) CPUAdd(id int64) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// device-list-properties -> DeviceListProperties (command) +// qom-list-properties -> QomListProperties (command) -// DeviceListProperties implements the "device-list-properties" QMP API call. -func (m *Monitor) DeviceListProperties(typename string) (ret []DevicePropertyInfo, err error) { +// QomListProperties implements the "qom-list-properties" QMP API call. +func (m *Monitor) QomListProperties(typename string) (ret []ObjectPropertyInfo, err error) { cmd := struct { Typename string `json:"typename"` }{ typename, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "device-list-properties", + "execute": "qom-list-properties", "arguments": cmd, }) if err != nil { @@ -11566,21 +22668,19 @@ func (m *Monitor) DeviceListProperties(typename string) (ret []DevicePropertyInf return } -// device_add -> DeviceAdd (command) +// qom-list-types -> QomListTypes (command) -// DeviceAdd implements the "device_add" QMP API call. -func (m *Monitor) DeviceAdd(driver string, bus *string, id *string) (err error) { +// QomListTypes implements the "qom-list-types" QMP API call. +func (m *Monitor) QomListTypes(implements *string, abstract *bool) (ret []ObjectTypeInfo, err error) { cmd := struct { - Driver string `json:"driver"` - Bus *string `json:"bus,omitempty"` - ID *string `json:"id,omitempty"` + Implements *string `json:"implements,omitempty"` + Abstract *bool `json:"abstract,omitempty"` }{ - driver, - bus, - id, + implements, + abstract, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "device_add", + "execute": "qom-list-types", "arguments": cmd, }) if err != nil { @@ -11590,20 +22690,33 @@ func (m *Monitor) DeviceAdd(driver string, bus *string, id *string) (err error) if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// device_del -> DeviceDel (command) +// qom-set -> QomSet (command) -// DeviceDel implements the "device_del" QMP API call. -func (m *Monitor) DeviceDel(id string) (err error) { +// QomSet implements the "qom-set" QMP API call. +func (m *Monitor) QomSet(path string, property string, value interface{}) (err error) { cmd := struct { - ID string `json:"id"` + Path string `json:"path"` + Property string `json:"property"` + Value interface{} `json:"value"` }{ - id, + path, + property, + value, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "device_del", + "execute": "qom-set", "arguments": cmd, }) if err != nil { @@ -11616,12 +22729,14 @@ func (m *Monitor) DeviceDel(id string) (err error) { return } -// drive-backup -> DriveBackup (command) +// query-acpi-ospm-status -> QueryACPIOspmStatus (command) -// DriveBackup implements the "drive-backup" QMP API call. -func (m *Monitor) DriveBackup(cmd *DriveBackup) (err error) { +// QueryACPIOspmStatus implements the "query-acpi-ospm-status" QMP API call. +func (m *Monitor) QueryACPIOspmStatus() (ret []ACPIOSTInfo, err error) { + cmd := struct { + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "drive-backup", + "execute": "query-acpi-ospm-status", "arguments": cmd, }) if err != nil { @@ -11631,15 +22746,26 @@ func (m *Monitor) DriveBackup(cmd *DriveBackup) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// drive-mirror -> DriveMirror (command) +// query-balloon -> QueryBalloon (command) -// DriveMirror implements the "drive-mirror" QMP API call. -func (m *Monitor) DriveMirror(cmd *DriveMirror) (err error) { +// QueryBalloon implements the "query-balloon" QMP API call. +func (m *Monitor) QueryBalloon() (ret BalloonInfo, err error) { + cmd := struct { + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "drive-mirror", + "execute": "query-balloon", "arguments": cmd, }) if err != nil { @@ -11649,30 +22775,26 @@ func (m *Monitor) DriveMirror(cmd *DriveMirror) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// dump-guest-memory -> DumpGuestMemory (command) +// query-block -> QueryBlock (command) -// DumpGuestMemory implements the "dump-guest-memory" QMP API call. -func (m *Monitor) DumpGuestMemory(paging bool, protocol string, detach *bool, begin *int64, length *int64, format *DumpGuestMemoryFormat) (err error) { +// QueryBlock implements the "query-block" QMP API call. +func (m *Monitor) QueryBlock() (ret []BlockInfo, err error) { cmd := struct { - Paging bool `json:"paging"` - Protocol string `json:"protocol"` - Detach *bool `json:"detach,omitempty"` - Begin *int64 `json:"begin,omitempty"` - Length *int64 `json:"length,omitempty"` - Format *DumpGuestMemoryFormat `json:"format,omitempty"` - }{ - paging, - protocol, - detach, - begin, - length, - format, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "dump-guest-memory", + "execute": "query-block", "arguments": cmd, }) if err != nil { @@ -11682,20 +22804,26 @@ func (m *Monitor) DumpGuestMemory(paging bool, protocol string, detach *bool, be if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// dump-skeys -> DumpSkeys (command) +// query-block-exports -> QueryBlockExports (command) -// DumpSkeys implements the "dump-skeys" QMP API call. -func (m *Monitor) DumpSkeys(filename string) (err error) { +// QueryBlockExports implements the "query-block-exports" QMP API call. +func (m *Monitor) QueryBlockExports() (ret []BlockExportInfo, err error) { cmd := struct { - Filename string `json:"filename"` - }{ - filename, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "dump-skeys", + "execute": "query-block-exports", "arguments": cmd, }) if err != nil { @@ -11705,49 +22833,58 @@ func (m *Monitor) DumpSkeys(filename string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// eject -> Eject (command) +// query-block-jobs -> QueryBlockJobs (command) -// Eject implements the "eject" QMP API call. -func (m *Monitor) Eject(device *string, id *string, force *bool) (err error) { +// QueryBlockJobs implements the "query-block-jobs" QMP API call. +func (m *Monitor) QueryBlockJobs() (ret []BlockJobInfo, err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` - Force *bool `json:"force,omitempty"` - }{ - device, - id, - force, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "eject", + "execute": "query-block-jobs", "arguments": cmd, }) if err != nil { return } - bs, err = m.mon.Run(bs) - if err != nil { + bs, err = m.mon.Run(bs) + if err != nil { + return + } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { return } return } -// expire_password -> ExpirePassword (command) +// query-blockstats -> QueryBlockstats (command) -// ExpirePassword implements the "expire_password" QMP API call. -func (m *Monitor) ExpirePassword(protocol string, time string) (err error) { +// QueryBlockstats implements the "query-blockstats" QMP API call. +func (m *Monitor) QueryBlockstats(queryNodes *bool) (ret []BlockStats, err error) { cmd := struct { - Protocol string `json:"protocol"` - Time string `json:"time"` + QueryNodes *bool `json:"query-nodes,omitempty"` }{ - protocol, - time, + queryNodes, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "expire_password", + "execute": "query-blockstats", "arguments": cmd, }) if err != nil { @@ -11757,20 +22894,26 @@ func (m *Monitor) ExpirePassword(protocol string, time string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// getfd -> Getfd (command) +// query-chardev -> QueryChardev (command) -// Getfd implements the "getfd" QMP API call. -func (m *Monitor) Getfd(fdname string) (err error) { +// QueryChardev implements the "query-chardev" QMP API call. +func (m *Monitor) QueryChardev() (ret []ChardevInfo, err error) { cmd := struct { - Fdname string `json:"fdname"` - }{ - fdname, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "getfd", + "execute": "query-chardev", "arguments": cmd, }) if err != nil { @@ -11780,22 +22923,26 @@ func (m *Monitor) Getfd(fdname string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// human-monitor-command -> HumanMonitorCommand (command) +// query-chardev-backends -> QueryChardevBackends (command) -// HumanMonitorCommand implements the "human-monitor-command" QMP API call. -func (m *Monitor) HumanMonitorCommand(commandLine string, cpuIndex *int64) (ret string, err error) { +// QueryChardevBackends implements the "query-chardev-backends" QMP API call. +func (m *Monitor) QueryChardevBackends() (ret []ChardevBackendInfo, err error) { cmd := struct { - CommandLine string `json:"command-line"` - CPUIndex *int64 `json:"cpu-index,omitempty"` - }{ - commandLine, - cpuIndex, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "human-monitor-command", + "execute": "query-chardev-backends", "arguments": cmd, }) if err != nil { @@ -11817,14 +22964,14 @@ func (m *Monitor) HumanMonitorCommand(commandLine string, cpuIndex *int64) (ret return } -// inject-nmi -> InjectNmi (command) +// query-colo-status -> QueryColoStatus (command) -// InjectNmi implements the "inject-nmi" QMP API call. -func (m *Monitor) InjectNmi() (err error) { +// QueryColoStatus implements the "query-colo-status" QMP API call. +func (m *Monitor) QueryColoStatus() (ret ColoStatus, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "inject-nmi", + "execute": "query-colo-status", "arguments": cmd, }) if err != nil { @@ -11834,24 +22981,29 @@ func (m *Monitor) InjectNmi() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// input-send-event -> InputSendEvent (command) +// query-command-line-options -> QueryCommandLineOptions (command) -// InputSendEvent implements the "input-send-event" QMP API call. -func (m *Monitor) InputSendEvent(device *string, head *int64, events []InputEvent) (err error) { +// QueryCommandLineOptions implements the "query-command-line-options" QMP API call. +func (m *Monitor) QueryCommandLineOptions(option *string) (ret []CommandLineOptionInfo, err error) { cmd := struct { - Device *string `json:"device,omitempty"` - Head *int64 `json:"head,omitempty"` - Events []InputEvent `json:"events"` + Option *string `json:"option,omitempty"` }{ - device, - head, - events, + option, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "input-send-event", + "execute": "query-command-line-options", "arguments": cmd, }) if err != nil { @@ -11861,26 +23013,26 @@ func (m *Monitor) InputSendEvent(device *string, head *int64, events []InputEven if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// memsave -> Memsave (command) +// query-commands -> QueryCommands (command) -// Memsave implements the "memsave" QMP API call. -func (m *Monitor) Memsave(val int64, size int64, filename string, cpuIndex *int64) (err error) { +// QueryCommands implements the "query-commands" QMP API call. +func (m *Monitor) QueryCommands() (ret []CommandInfo, err error) { cmd := struct { - Val int64 `json:"val"` - Size int64 `json:"size"` - Filename string `json:"filename"` - CPUIndex *int64 `json:"cpu-index,omitempty"` - }{ - val, - size, - filename, - cpuIndex, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "memsave", + "execute": "query-commands", "arguments": cmd, }) if err != nil { @@ -11890,26 +23042,26 @@ func (m *Monitor) Memsave(val int64, size int64, filename string, cpuIndex *int6 if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate -> Migrate (command) +// query-cpu-definitions -> QueryCPUDefinitions (command) -// Migrate implements the "migrate" QMP API call. -func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err error) { +// QueryCPUDefinitions implements the "query-cpu-definitions" QMP API call. +func (m *Monitor) QueryCPUDefinitions() (ret []CPUDefinitionInfo, err error) { cmd := struct { - URI string `json:"uri"` - Blk *bool `json:"blk,omitempty"` - Inc *bool `json:"inc,omitempty"` - Detach *bool `json:"detach,omitempty"` - }{ - uri, - blk, - inc, - detach, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate", + "execute": "query-cpu-definitions", "arguments": cmd, }) if err != nil { @@ -11919,20 +23071,31 @@ func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err e if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-continue -> MigrateContinue (command) +// query-cpu-model-baseline -> QueryCPUModelBaseline (command) -// MigrateContinue implements the "migrate-continue" QMP API call. -func (m *Monitor) MigrateContinue(state MigrationStatus) (err error) { +// QueryCPUModelBaseline implements the "query-cpu-model-baseline" QMP API call. +func (m *Monitor) QueryCPUModelBaseline(modela CPUModelInfo, modelb CPUModelInfo) (ret CPUModelBaselineInfo, err error) { cmd := struct { - State MigrationStatus `json:"state"` + Modela CPUModelInfo `json:"modela"` + Modelb CPUModelInfo `json:"modelb"` }{ - state, + modela, + modelb, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-continue", + "execute": "query-cpu-model-baseline", "arguments": cmd, }) if err != nil { @@ -11942,20 +23105,31 @@ func (m *Monitor) MigrateContinue(state MigrationStatus) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-incoming -> MigrateIncoming (command) +// query-cpu-model-comparison -> QueryCPUModelComparison (command) -// MigrateIncoming implements the "migrate-incoming" QMP API call. -func (m *Monitor) MigrateIncoming(uri string) (err error) { +// QueryCPUModelComparison implements the "query-cpu-model-comparison" QMP API call. +func (m *Monitor) QueryCPUModelComparison(modela CPUModelInfo, modelb CPUModelInfo) (ret CPUModelCompareInfo, err error) { cmd := struct { - URI string `json:"uri"` + Modela CPUModelInfo `json:"modela"` + Modelb CPUModelInfo `json:"modelb"` }{ - uri, + modela, + modelb, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-incoming", + "execute": "query-cpu-model-comparison", "arguments": cmd, }) if err != nil { @@ -11965,20 +23139,31 @@ func (m *Monitor) MigrateIncoming(uri string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-set-cache-size -> MigrateSetCacheSize (command) +// query-cpu-model-expansion -> QueryCPUModelExpansion (command) -// MigrateSetCacheSize implements the "migrate-set-cache-size" QMP API call. -func (m *Monitor) MigrateSetCacheSize(value int64) (err error) { +// QueryCPUModelExpansion implements the "query-cpu-model-expansion" QMP API call. +func (m *Monitor) QueryCPUModelExpansion(typ CPUModelExpansionType, model CPUModelInfo) (ret CPUModelExpansionInfo, err error) { cmd := struct { - Value int64 `json:"value"` + Type CPUModelExpansionType `json:"type"` + Model CPUModelInfo `json:"model"` }{ - value, + typ, + model, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-set-cache-size", + "execute": "query-cpu-model-expansion", "arguments": cmd, }) if err != nil { @@ -11988,20 +23173,26 @@ func (m *Monitor) MigrateSetCacheSize(value int64) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-set-capabilities -> MigrateSetCapabilities (command) +// query-cpus-fast -> QueryCpusFast (command) -// MigrateSetCapabilities implements the "migrate-set-capabilities" QMP API call. -func (m *Monitor) MigrateSetCapabilities(capabilities []MigrationCapabilityStatus) (err error) { +// QueryCpusFast implements the "query-cpus-fast" QMP API call. +func (m *Monitor) QueryCpusFast() (ret []CPUInfoFast, err error) { cmd := struct { - Capabilities []MigrationCapabilityStatus `json:"capabilities"` - }{ - capabilities, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-set-capabilities", + "execute": "query-cpus-fast", "arguments": cmd, }) if err != nil { @@ -12011,15 +23202,26 @@ func (m *Monitor) MigrateSetCapabilities(capabilities []MigrationCapabilityStatu if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-set-parameters -> MigrateSetParameters (command) +// query-current-machine -> QueryCurrentMachine (command) -// MigrateSetParameters implements the "migrate-set-parameters" QMP API call. -func (m *Monitor) MigrateSetParameters(cmd *MigrateSetParameters) (err error) { +// QueryCurrentMachine implements the "query-current-machine" QMP API call. +func (m *Monitor) QueryCurrentMachine() (ret CurrentMachineParams, err error) { + cmd := struct { + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-set-parameters", + "execute": "query-current-machine", "arguments": cmd, }) if err != nil { @@ -12029,17 +23231,26 @@ func (m *Monitor) MigrateSetParameters(cmd *MigrateSetParameters) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate-start-postcopy -> MigrateStartPostcopy (command) +// query-dirty-rate -> QueryDirtyRate (command) -// MigrateStartPostcopy implements the "migrate-start-postcopy" QMP API call. -func (m *Monitor) MigrateStartPostcopy() (err error) { +// QueryDirtyRate implements the "query-dirty-rate" QMP API call. +func (m *Monitor) QueryDirtyRate() (ret DirtyRateInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate-start-postcopy", + "execute": "query-dirty-rate", "arguments": cmd, }) if err != nil { @@ -12049,17 +23260,26 @@ func (m *Monitor) MigrateStartPostcopy() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate_cancel -> MigrateCancel (command) +// query-display-options -> QueryDisplayOptions (command) -// MigrateCancel implements the "migrate_cancel" QMP API call. -func (m *Monitor) MigrateCancel() (err error) { +// QueryDisplayOptions implements the "query-display-options" QMP API call. +func (m *Monitor) QueryDisplayOptions() (ret DisplayOptions, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate_cancel", + "execute": "query-display-options", "arguments": cmd, }) if err != nil { @@ -12069,20 +23289,26 @@ func (m *Monitor) MigrateCancel() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate_set_downtime -> MigrateSetDowntime (command) +// query-dump -> QueryDump (command) -// MigrateSetDowntime implements the "migrate_set_downtime" QMP API call. -func (m *Monitor) MigrateSetDowntime(value float64) (err error) { +// QueryDump implements the "query-dump" QMP API call. +func (m *Monitor) QueryDump() (ret DumpQueryResult, err error) { cmd := struct { - Value float64 `json:"value"` - }{ - value, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate_set_downtime", + "execute": "query-dump", "arguments": cmd, }) if err != nil { @@ -12092,20 +23318,26 @@ func (m *Monitor) MigrateSetDowntime(value float64) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// migrate_set_speed -> MigrateSetSpeed (command) +// query-dump-guest-memory-capability -> QueryDumpGuestMemoryCapability (command) -// MigrateSetSpeed implements the "migrate_set_speed" QMP API call. -func (m *Monitor) MigrateSetSpeed(value int64) (err error) { +// QueryDumpGuestMemoryCapability implements the "query-dump-guest-memory-capability" QMP API call. +func (m *Monitor) QueryDumpGuestMemoryCapability() (ret DumpGuestMemoryCapability, err error) { cmd := struct { - Value int64 `json:"value"` - }{ - value, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "migrate_set_speed", + "execute": "query-dump-guest-memory-capability", "arguments": cmd, }) if err != nil { @@ -12115,22 +23347,26 @@ func (m *Monitor) MigrateSetSpeed(value int64) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// nbd-server-add -> NBDServerAdd (command) +// query-fdsets -> QueryFdsets (command) -// NBDServerAdd implements the "nbd-server-add" QMP API call. -func (m *Monitor) NBDServerAdd(device string, writable *bool) (err error) { +// QueryFdsets implements the "query-fdsets" QMP API call. +func (m *Monitor) QueryFdsets() (ret []FdsetInfo, err error) { cmd := struct { - Device string `json:"device"` - Writable *bool `json:"writable,omitempty"` - }{ - device, - writable, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "nbd-server-add", + "execute": "query-fdsets", "arguments": cmd, }) if err != nil { @@ -12140,22 +23376,26 @@ func (m *Monitor) NBDServerAdd(device string, writable *bool) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// nbd-server-start -> NBDServerStart (command) +// query-gic-capabilities -> QueryGicCapabilities (command) -// NBDServerStart implements the "nbd-server-start" QMP API call. -func (m *Monitor) NBDServerStart(addr SocketAddressLegacy, tlsCreds *string) (err error) { +// QueryGicCapabilities implements the "query-gic-capabilities" QMP API call. +func (m *Monitor) QueryGicCapabilities() (ret []GicCapability, err error) { cmd := struct { - Addr SocketAddressLegacy `json:"addr"` - TLSCreds *string `json:"tls-creds,omitempty"` - }{ - addr, - tlsCreds, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "nbd-server-start", + "execute": "query-gic-capabilities", "arguments": cmd, }) if err != nil { @@ -12165,17 +23405,26 @@ func (m *Monitor) NBDServerStart(addr SocketAddressLegacy, tlsCreds *string) (er if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// nbd-server-stop -> NBDServerStop (command) +// query-hotpluggable-cpus -> QueryHotpluggableCpus (command) -// NBDServerStop implements the "nbd-server-stop" QMP API call. -func (m *Monitor) NBDServerStop() (err error) { +// QueryHotpluggableCpus implements the "query-hotpluggable-cpus" QMP API call. +func (m *Monitor) QueryHotpluggableCpus() (ret []HotpluggableCPU, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "nbd-server-stop", + "execute": "query-hotpluggable-cpus", "arguments": cmd, }) if err != nil { @@ -12185,22 +23434,26 @@ func (m *Monitor) NBDServerStop() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// netdev_add -> NetdevAdd (command) +// query-iothreads -> QueryIothreads (command) -// NetdevAdd implements the "netdev_add" QMP API call. -func (m *Monitor) NetdevAdd(typ string, id string) (err error) { +// QueryIothreads implements the "query-iothreads" QMP API call. +func (m *Monitor) QueryIothreads() (ret []IOThreadInfo, err error) { cmd := struct { - Type string `json:"type"` - ID string `json:"id"` - }{ - typ, - id, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "netdev_add", + "execute": "query-iothreads", "arguments": cmd, }) if err != nil { @@ -12210,20 +23463,26 @@ func (m *Monitor) NetdevAdd(typ string, id string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// netdev_del -> NetdevDel (command) +// query-jobs -> QueryJobs (command) -// NetdevDel implements the "netdev_del" QMP API call. -func (m *Monitor) NetdevDel(id string) (err error) { +// QueryJobs implements the "query-jobs" QMP API call. +func (m *Monitor) QueryJobs() (ret []JobInfo, err error) { cmd := struct { - ID string `json:"id"` - }{ - id, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "netdev_del", + "execute": "query-jobs", "arguments": cmd, }) if err != nil { @@ -12233,24 +23492,26 @@ func (m *Monitor) NetdevDel(id string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// object-add -> ObjectAdd (command) +// query-kvm -> QueryKVM (command) -// ObjectAdd implements the "object-add" QMP API call. -func (m *Monitor) ObjectAdd(qomType string, id string, props *interface{}) (err error) { +// QueryKVM implements the "query-kvm" QMP API call. +func (m *Monitor) QueryKVM() (ret KVMInfo, err error) { cmd := struct { - QomType string `json:"qom-type"` - ID string `json:"id"` - Props *interface{} `json:"props,omitempty"` - }{ - qomType, - id, - props, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "object-add", + "execute": "query-kvm", "arguments": cmd, }) if err != nil { @@ -12260,20 +23521,26 @@ func (m *Monitor) ObjectAdd(qomType string, id string, props *interface{}) (err if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// object-del -> ObjectDel (command) +// query-machines -> QueryMachines (command) -// ObjectDel implements the "object-del" QMP API call. -func (m *Monitor) ObjectDel(id string) (err error) { +// QueryMachines implements the "query-machines" QMP API call. +func (m *Monitor) QueryMachines() (ret []MachineInfo, err error) { cmd := struct { - ID string `json:"id"` - }{ - id, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "object-del", + "execute": "query-machines", "arguments": cmd, }) if err != nil { @@ -12283,24 +23550,26 @@ func (m *Monitor) ObjectDel(id string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// pmemsave -> Pmemsave (command) +// query-memdev -> QueryMemdev (command) -// Pmemsave implements the "pmemsave" QMP API call. -func (m *Monitor) Pmemsave(val int64, size int64, filename string) (err error) { +// QueryMemdev implements the "query-memdev" QMP API call. +func (m *Monitor) QueryMemdev() (ret []Memdev, err error) { cmd := struct { - Val int64 `json:"val"` - Size int64 `json:"size"` - Filename string `json:"filename"` - }{ - val, - size, - filename, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "pmemsave", + "execute": "query-memdev", "arguments": cmd, }) if err != nil { @@ -12310,17 +23579,26 @@ func (m *Monitor) Pmemsave(val int64, size int64, filename string) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// qmp_capabilities -> QMPCapabilities (command) +// query-memory-devices -> QueryMemoryDevices (command) -// QMPCapabilities implements the "qmp_capabilities" QMP API call. -func (m *Monitor) QMPCapabilities() (err error) { +// QueryMemoryDevices implements the "query-memory-devices" QMP API call. +func (m *Monitor) QueryMemoryDevices() (ret []MemoryDeviceInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "qmp_capabilities", + "execute": "query-memory-devices", "arguments": cmd, }) if err != nil { @@ -12330,22 +23608,26 @@ func (m *Monitor) QMPCapabilities() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// qom-get -> QomGet (command) +// query-memory-size-summary -> QueryMemorySizeSummary (command) -// QomGet implements the "qom-get" QMP API call. -func (m *Monitor) QomGet(path string, property string) (ret interface{}, err error) { +// QueryMemorySizeSummary implements the "query-memory-size-summary" QMP API call. +func (m *Monitor) QueryMemorySizeSummary() (ret MemoryInfo, err error) { cmd := struct { - Path string `json:"path"` - Property string `json:"property"` - }{ - path, - property, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "qom-get", + "execute": "query-memory-size-summary", "arguments": cmd, }) if err != nil { @@ -12367,17 +23649,14 @@ func (m *Monitor) QomGet(path string, property string) (ret interface{}, err err return } -// qom-list -> QomList (command) +// query-mice -> QueryMice (command) -// QomList implements the "qom-list" QMP API call. -func (m *Monitor) QomList(path string) (ret []ObjectPropertyInfo, err error) { +// QueryMice implements the "query-mice" QMP API call. +func (m *Monitor) QueryMice() (ret []MouseInfo, err error) { cmd := struct { - Path string `json:"path"` - }{ - path, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "qom-list", + "execute": "query-mice", "arguments": cmd, }) if err != nil { @@ -12399,19 +23678,14 @@ func (m *Monitor) QomList(path string) (ret []ObjectPropertyInfo, err error) { return } -// qom-list-types -> QomListTypes (command) +// query-migrate -> QueryMigrate (command) -// QomListTypes implements the "qom-list-types" QMP API call. -func (m *Monitor) QomListTypes(implements *string, abstract *bool) (ret []ObjectTypeInfo, err error) { +// QueryMigrate implements the "query-migrate" QMP API call. +func (m *Monitor) QueryMigrate() (ret MigrationInfo, err error) { cmd := struct { - Implements *string `json:"implements,omitempty"` - Abstract *bool `json:"abstract,omitempty"` - }{ - implements, - abstract, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "qom-list-types", + "execute": "query-migrate", "arguments": cmd, }) if err != nil { @@ -12433,21 +23707,14 @@ func (m *Monitor) QomListTypes(implements *string, abstract *bool) (ret []Object return } -// qom-set -> QomSet (command) +// query-migrate-capabilities -> QueryMigrateCapabilities (command) -// QomSet implements the "qom-set" QMP API call. -func (m *Monitor) QomSet(path string, property string, value interface{}) (err error) { +// QueryMigrateCapabilities implements the "query-migrate-capabilities" QMP API call. +func (m *Monitor) QueryMigrateCapabilities() (ret []MigrationCapabilityStatus, err error) { cmd := struct { - Path string `json:"path"` - Property string `json:"property"` - Value interface{} `json:"value"` - }{ - path, - property, - value, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "qom-set", + "execute": "query-migrate-capabilities", "arguments": cmd, }) if err != nil { @@ -12457,17 +23724,26 @@ func (m *Monitor) QomSet(path string, property string, value interface{}) (err e if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// query-acpi-ospm-status -> QueryACPIOspmStatus (command) +// query-migrate-parameters -> QueryMigrateParameters (command) -// QueryACPIOspmStatus implements the "query-acpi-ospm-status" QMP API call. -func (m *Monitor) QueryACPIOspmStatus() (ret []ACPIOSTInfo, err error) { +// QueryMigrateParameters implements the "query-migrate-parameters" QMP API call. +func (m *Monitor) QueryMigrateParameters() (ret MigrationParameters, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-acpi-ospm-status", + "execute": "query-migrate-parameters", "arguments": cmd, }) if err != nil { @@ -12489,14 +23765,14 @@ func (m *Monitor) QueryACPIOspmStatus() (ret []ACPIOSTInfo, err error) { return } -// query-balloon -> QueryBalloon (command) +// query-name -> QueryName (command) -// QueryBalloon implements the "query-balloon" QMP API call. -func (m *Monitor) QueryBalloon() (ret BalloonInfo, err error) { +// QueryName implements the "query-name" QMP API call. +func (m *Monitor) QueryName() (ret NameInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-balloon", + "execute": "query-name", "arguments": cmd, }) if err != nil { @@ -12518,14 +23794,17 @@ func (m *Monitor) QueryBalloon() (ret BalloonInfo, err error) { return } -// query-block -> QueryBlock (command) +// query-named-block-nodes -> QueryNamedBlockNodes (command) -// QueryBlock implements the "query-block" QMP API call. -func (m *Monitor) QueryBlock() (ret []BlockInfo, err error) { +// QueryNamedBlockNodes implements the "query-named-block-nodes" QMP API call. +func (m *Monitor) QueryNamedBlockNodes(flat *bool) (ret []BlockDeviceInfo, err error) { cmd := struct { - }{} + Flat *bool `json:"flat,omitempty"` + }{ + flat, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-block", + "execute": "query-named-block-nodes", "arguments": cmd, }) if err != nil { @@ -12547,14 +23826,14 @@ func (m *Monitor) QueryBlock() (ret []BlockInfo, err error) { return } -// query-block-jobs -> QueryBlockJobs (command) +// query-pci -> QueryPCI (command) -// QueryBlockJobs implements the "query-block-jobs" QMP API call. -func (m *Monitor) QueryBlockJobs() (ret []BlockJobInfo, err error) { +// QueryPCI implements the "query-pci" QMP API call. +func (m *Monitor) QueryPCI() (ret []PCIInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-block-jobs", + "execute": "query-pci", "arguments": cmd, }) if err != nil { @@ -12576,17 +23855,14 @@ func (m *Monitor) QueryBlockJobs() (ret []BlockJobInfo, err error) { return } -// query-blockstats -> QueryBlockstats (command) +// query-pr-managers -> QueryPrManagers (command) -// QueryBlockstats implements the "query-blockstats" QMP API call. -func (m *Monitor) QueryBlockstats(queryNodes *bool) (ret []BlockStats, err error) { +// QueryPrManagers implements the "query-pr-managers" QMP API call. +func (m *Monitor) QueryPrManagers() (ret []PrManagerInfo, err error) { cmd := struct { - QueryNodes *bool `json:"query-nodes,omitempty"` - }{ - queryNodes, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-blockstats", + "execute": "query-pr-managers", "arguments": cmd, }) if err != nil { @@ -12608,14 +23884,14 @@ func (m *Monitor) QueryBlockstats(queryNodes *bool) (ret []BlockStats, err error return } -// query-chardev -> QueryChardev (command) +// query-qmp-schema -> QueryQMPSchema (command) -// QueryChardev implements the "query-chardev" QMP API call. -func (m *Monitor) QueryChardev() (ret []ChardevInfo, err error) { +// QueryQMPSchema implements the "query-qmp-schema" QMP API call. +func (m *Monitor) QueryQMPSchema() (ret []SchemaInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-chardev", + "execute": "query-qmp-schema", "arguments": cmd, }) if err != nil { @@ -12637,14 +23913,14 @@ func (m *Monitor) QueryChardev() (ret []ChardevInfo, err error) { return } -// query-chardev-backends -> QueryChardevBackends (command) +// query-replay -> QueryReplay (command) -// QueryChardevBackends implements the "query-chardev-backends" QMP API call. -func (m *Monitor) QueryChardevBackends() (ret []ChardevBackendInfo, err error) { +// QueryReplay implements the "query-replay" QMP API call. +func (m *Monitor) QueryReplay() (ret ReplayInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-chardev-backends", + "execute": "query-replay", "arguments": cmd, }) if err != nil { @@ -12666,17 +23942,17 @@ func (m *Monitor) QueryChardevBackends() (ret []ChardevBackendInfo, err error) { return } -// query-command-line-options -> QueryCommandLineOptions (command) +// query-rocker -> QueryRocker (command) -// QueryCommandLineOptions implements the "query-command-line-options" QMP API call. -func (m *Monitor) QueryCommandLineOptions(option *string) (ret []CommandLineOptionInfo, err error) { +// QueryRocker implements the "query-rocker" QMP API call. +func (m *Monitor) QueryRocker(name string) (ret RockerSwitch, err error) { cmd := struct { - Option *string `json:"option,omitempty"` + Name string `json:"name"` }{ - option, + name, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-command-line-options", + "execute": "query-rocker", "arguments": cmd, }) if err != nil { @@ -12698,14 +23974,19 @@ func (m *Monitor) QueryCommandLineOptions(option *string) (ret []CommandLineOpti return } -// query-commands -> QueryCommands (command) +// query-rocker-of-dpa-flows -> QueryRockerOfDpaFlows (command) -// QueryCommands implements the "query-commands" QMP API call. -func (m *Monitor) QueryCommands() (ret []CommandInfo, err error) { +// QueryRockerOfDpaFlows implements the "query-rocker-of-dpa-flows" QMP API call. +func (m *Monitor) QueryRockerOfDpaFlows(name string, tblID *uint32) (ret []RockerOfDpaFlow, err error) { cmd := struct { - }{} + Name string `json:"name"` + TblID *uint32 `json:"tbl-id,omitempty"` + }{ + name, + tblID, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-commands", + "execute": "query-rocker-of-dpa-flows", "arguments": cmd, }) if err != nil { @@ -12727,14 +24008,19 @@ func (m *Monitor) QueryCommands() (ret []CommandInfo, err error) { return } -// query-cpu-definitions -> QueryCPUDefinitions (command) +// query-rocker-of-dpa-groups -> QueryRockerOfDpaGroups (command) -// QueryCPUDefinitions implements the "query-cpu-definitions" QMP API call. -func (m *Monitor) QueryCPUDefinitions() (ret []CPUDefinitionInfo, err error) { +// QueryRockerOfDpaGroups implements the "query-rocker-of-dpa-groups" QMP API call. +func (m *Monitor) QueryRockerOfDpaGroups(name string, typ *uint8) (ret []RockerOfDpaGroup, err error) { cmd := struct { - }{} + Name string `json:"name"` + Type *uint8 `json:"type,omitempty"` + }{ + name, + typ, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-cpu-definitions", + "execute": "query-rocker-of-dpa-groups", "arguments": cmd, }) if err != nil { @@ -12756,19 +24042,17 @@ func (m *Monitor) QueryCPUDefinitions() (ret []CPUDefinitionInfo, err error) { return } -// query-cpu-model-baseline -> QueryCPUModelBaseline (command) +// query-rocker-ports -> QueryRockerPorts (command) -// QueryCPUModelBaseline implements the "query-cpu-model-baseline" QMP API call. -func (m *Monitor) QueryCPUModelBaseline(modela CPUModelInfo, modelb CPUModelInfo) (ret CPUModelBaselineInfo, err error) { +// QueryRockerPorts implements the "query-rocker-ports" QMP API call. +func (m *Monitor) QueryRockerPorts(name string) (ret []RockerPort, err error) { cmd := struct { - Modela CPUModelInfo `json:"modela"` - Modelb CPUModelInfo `json:"modelb"` + Name string `json:"name"` }{ - modela, - modelb, + name, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-cpu-model-baseline", + "execute": "query-rocker-ports", "arguments": cmd, }) if err != nil { @@ -12790,19 +24074,17 @@ func (m *Monitor) QueryCPUModelBaseline(modela CPUModelInfo, modelb CPUModelInfo return } -// query-cpu-model-comparison -> QueryCPUModelComparison (command) +// query-rx-filter -> QueryRxFilter (command) -// QueryCPUModelComparison implements the "query-cpu-model-comparison" QMP API call. -func (m *Monitor) QueryCPUModelComparison(modela CPUModelInfo, modelb CPUModelInfo) (ret CPUModelCompareInfo, err error) { +// QueryRxFilter implements the "query-rx-filter" QMP API call. +func (m *Monitor) QueryRxFilter(name *string) (ret []RxFilterInfo, err error) { cmd := struct { - Modela CPUModelInfo `json:"modela"` - Modelb CPUModelInfo `json:"modelb"` + Name *string `json:"name,omitempty"` }{ - modela, - modelb, + name, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-cpu-model-comparison", + "execute": "query-rx-filter", "arguments": cmd, }) if err != nil { @@ -12824,19 +24106,14 @@ func (m *Monitor) QueryCPUModelComparison(modela CPUModelInfo, modelb CPUModelIn return } -// query-cpu-model-expansion -> QueryCPUModelExpansion (command) +// query-sev -> QuerySev (command) -// QueryCPUModelExpansion implements the "query-cpu-model-expansion" QMP API call. -func (m *Monitor) QueryCPUModelExpansion(typ CPUModelExpansionType, model CPUModelInfo) (ret CPUModelExpansionInfo, err error) { +// QuerySev implements the "query-sev" QMP API call. +func (m *Monitor) QuerySev() (ret SevInfo, err error) { cmd := struct { - Type CPUModelExpansionType `json:"type"` - Model CPUModelInfo `json:"model"` - }{ - typ, - model, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-cpu-model-expansion", + "execute": "query-sev", "arguments": cmd, }) if err != nil { @@ -12858,14 +24135,17 @@ func (m *Monitor) QueryCPUModelExpansion(typ CPUModelExpansionType, model CPUMod return } -// query-cpus -> QueryCpus (command) +// query-sev-attestation-report -> QuerySevAttestationReport (command) -// QueryCpus implements the "query-cpus" QMP API call. -func (m *Monitor) QueryCpus() (ret []CPUInfo, err error) { +// QuerySevAttestationReport implements the "query-sev-attestation-report" QMP API call. +func (m *Monitor) QuerySevAttestationReport(mnonce string) (ret SevAttestationReport, err error) { cmd := struct { - }{} + Mnonce string `json:"mnonce"` + }{ + mnonce, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-cpus", + "execute": "query-sev-attestation-report", "arguments": cmd, }) if err != nil { @@ -12887,14 +24167,14 @@ func (m *Monitor) QueryCpus() (ret []CPUInfo, err error) { return } -// query-dump -> QueryDump (command) +// query-sev-capabilities -> QuerySevCapabilities (command) -// QueryDump implements the "query-dump" QMP API call. -func (m *Monitor) QueryDump() (ret DumpQueryResult, err error) { +// QuerySevCapabilities implements the "query-sev-capabilities" QMP API call. +func (m *Monitor) QuerySevCapabilities() (ret SevCapability, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-dump", + "execute": "query-sev-capabilities", "arguments": cmd, }) if err != nil { @@ -12916,14 +24196,14 @@ func (m *Monitor) QueryDump() (ret DumpQueryResult, err error) { return } -// query-dump-guest-memory-capability -> QueryDumpGuestMemoryCapability (command) +// query-sev-launch-measure -> QuerySevLaunchMeasure (command) -// QueryDumpGuestMemoryCapability implements the "query-dump-guest-memory-capability" QMP API call. -func (m *Monitor) QueryDumpGuestMemoryCapability() (ret DumpGuestMemoryCapability, err error) { +// QuerySevLaunchMeasure implements the "query-sev-launch-measure" QMP API call. +func (m *Monitor) QuerySevLaunchMeasure() (ret SevLaunchMeasureInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-dump-guest-memory-capability", + "execute": "query-sev-launch-measure", "arguments": cmd, }) if err != nil { @@ -12945,14 +24225,14 @@ func (m *Monitor) QueryDumpGuestMemoryCapability() (ret DumpGuestMemoryCapabilit return } -// query-events -> QueryEvents (command) +// query-sgx -> QuerySgx (command) -// QueryEvents implements the "query-events" QMP API call. -func (m *Monitor) QueryEvents() (ret []EventInfo, err error) { +// QuerySgx implements the "query-sgx" QMP API call. +func (m *Monitor) QuerySgx() (ret SgxInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-events", + "execute": "query-sgx", "arguments": cmd, }) if err != nil { @@ -12974,14 +24254,14 @@ func (m *Monitor) QueryEvents() (ret []EventInfo, err error) { return } -// query-fdsets -> QueryFdsets (command) +// query-sgx-capabilities -> QuerySgxCapabilities (command) -// QueryFdsets implements the "query-fdsets" QMP API call. -func (m *Monitor) QueryFdsets() (ret []FdsetInfo, err error) { +// QuerySgxCapabilities implements the "query-sgx-capabilities" QMP API call. +func (m *Monitor) QuerySgxCapabilities() (ret SgxInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-fdsets", + "execute": "query-sgx-capabilities", "arguments": cmd, }) if err != nil { @@ -13003,14 +24283,14 @@ func (m *Monitor) QueryFdsets() (ret []FdsetInfo, err error) { return } -// query-gic-capabilities -> QueryGicCapabilities (command) +// query-spice -> QuerySpice (command) -// QueryGicCapabilities implements the "query-gic-capabilities" QMP API call. -func (m *Monitor) QueryGicCapabilities() (ret []GicCapability, err error) { +// QuerySpice implements the "query-spice" QMP API call. +func (m *Monitor) QuerySpice() (ret SpiceInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-gic-capabilities", + "execute": "query-spice", "arguments": cmd, }) if err != nil { @@ -13032,14 +24312,12 @@ func (m *Monitor) QueryGicCapabilities() (ret []GicCapability, err error) { return } -// query-hotpluggable-cpus -> QueryHotpluggableCpus (command) +// query-stats -> QueryStats (command) -// QueryHotpluggableCpus implements the "query-hotpluggable-cpus" QMP API call. -func (m *Monitor) QueryHotpluggableCpus() (ret []HotpluggableCPU, err error) { - cmd := struct { - }{} +// QueryStats implements the "query-stats" QMP API call. +func (m *Monitor) QueryStats(cmd *StatsFilter) (ret []StatsResult, err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-hotpluggable-cpus", + "execute": "query-stats", "arguments": cmd, }) if err != nil { @@ -13061,14 +24339,17 @@ func (m *Monitor) QueryHotpluggableCpus() (ret []HotpluggableCPU, err error) { return } -// query-iothreads -> QueryIothreads (command) +// query-stats-schemas -> QueryStatsSchemas (command) -// QueryIothreads implements the "query-iothreads" QMP API call. -func (m *Monitor) QueryIothreads() (ret []IOThreadInfo, err error) { +// QueryStatsSchemas implements the "query-stats-schemas" QMP API call. +func (m *Monitor) QueryStatsSchemas(provider *StatsProvider) (ret []StatsSchema, err error) { cmd := struct { - }{} + Provider *StatsProvider `json:"provider,omitempty"` + }{ + provider, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-iothreads", + "execute": "query-stats-schemas", "arguments": cmd, }) if err != nil { @@ -13090,14 +24371,14 @@ func (m *Monitor) QueryIothreads() (ret []IOThreadInfo, err error) { return } -// query-kvm -> QueryKVM (command) +// query-status -> QueryStatus (command) -// QueryKVM implements the "query-kvm" QMP API call. -func (m *Monitor) QueryKVM() (ret KVMInfo, err error) { +// QueryStatus implements the "query-status" QMP API call. +func (m *Monitor) QueryStatus() (ret StatusInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-kvm", + "execute": "query-status", "arguments": cmd, }) if err != nil { @@ -13119,14 +24400,14 @@ func (m *Monitor) QueryKVM() (ret KVMInfo, err error) { return } -// query-machines -> QueryMachines (command) +// query-target -> QueryTarget (command) -// QueryMachines implements the "query-machines" QMP API call. -func (m *Monitor) QueryMachines() (ret []MachineInfo, err error) { +// QueryTarget implements the "query-target" QMP API call. +func (m *Monitor) QueryTarget() (ret TargetInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-machines", + "execute": "query-target", "arguments": cmd, }) if err != nil { @@ -13148,14 +24429,14 @@ func (m *Monitor) QueryMachines() (ret []MachineInfo, err error) { return } -// query-memdev -> QueryMemdev (command) +// query-tpm -> QueryTPM (command) -// QueryMemdev implements the "query-memdev" QMP API call. -func (m *Monitor) QueryMemdev() (ret []Memdev, err error) { +// QueryTPM implements the "query-tpm" QMP API call. +func (m *Monitor) QueryTPM() (ret []TPMInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-memdev", + "execute": "query-tpm", "arguments": cmd, }) if err != nil { @@ -13177,14 +24458,14 @@ func (m *Monitor) QueryMemdev() (ret []Memdev, err error) { return } -// query-memory-devices -> QueryMemoryDevices (command) - -// QueryMemoryDevices implements the "query-memory-devices" QMP API call. -func (m *Monitor) QueryMemoryDevices() (ret []MemoryDeviceInfo, err error) { +// query-tpm-models -> QueryTPMModels (command) + +// QueryTPMModels implements the "query-tpm-models" QMP API call. +func (m *Monitor) QueryTPMModels() (ret []TPMModel, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-memory-devices", + "execute": "query-tpm-models", "arguments": cmd, }) if err != nil { @@ -13206,14 +24487,14 @@ func (m *Monitor) QueryMemoryDevices() (ret []MemoryDeviceInfo, err error) { return } -// query-memory-size-summary -> QueryMemorySizeSummary (command) +// query-tpm-types -> QueryTPMTypes (command) -// QueryMemorySizeSummary implements the "query-memory-size-summary" QMP API call. -func (m *Monitor) QueryMemorySizeSummary() (ret MemoryInfo, err error) { +// QueryTPMTypes implements the "query-tpm-types" QMP API call. +func (m *Monitor) QueryTPMTypes() (ret []TPMType, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-memory-size-summary", + "execute": "query-tpm-types", "arguments": cmd, }) if err != nil { @@ -13235,14 +24516,14 @@ func (m *Monitor) QueryMemorySizeSummary() (ret MemoryInfo, err error) { return } -// query-mice -> QueryMice (command) +// query-uuid -> QueryUUID (command) -// QueryMice implements the "query-mice" QMP API call. -func (m *Monitor) QueryMice() (ret []MouseInfo, err error) { +// QueryUUID implements the "query-uuid" QMP API call. +func (m *Monitor) QueryUUID() (ret UUIDInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-mice", + "execute": "query-uuid", "arguments": cmd, }) if err != nil { @@ -13264,14 +24545,14 @@ func (m *Monitor) QueryMice() (ret []MouseInfo, err error) { return } -// query-migrate -> QueryMigrate (command) +// query-vcpu-dirty-limit -> QueryVcpuDirtyLimit (command) -// QueryMigrate implements the "query-migrate" QMP API call. -func (m *Monitor) QueryMigrate() (ret MigrationInfo, err error) { +// QueryVcpuDirtyLimit implements the "query-vcpu-dirty-limit" QMP API call. +func (m *Monitor) QueryVcpuDirtyLimit() (ret []DirtyLimitInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-migrate", + "execute": "query-vcpu-dirty-limit", "arguments": cmd, }) if err != nil { @@ -13293,14 +24574,14 @@ func (m *Monitor) QueryMigrate() (ret MigrationInfo, err error) { return } -// query-migrate-cache-size -> QueryMigrateCacheSize (command) +// query-version -> QueryVersion (command) -// QueryMigrateCacheSize implements the "query-migrate-cache-size" QMP API call. -func (m *Monitor) QueryMigrateCacheSize() (ret int64, err error) { +// QueryVersion implements the "query-version" QMP API call. +func (m *Monitor) QueryVersion() (ret VersionInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-migrate-cache-size", + "execute": "query-version", "arguments": cmd, }) if err != nil { @@ -13322,14 +24603,14 @@ func (m *Monitor) QueryMigrateCacheSize() (ret int64, err error) { return } -// query-migrate-capabilities -> QueryMigrateCapabilities (command) +// query-vm-generation-id -> QueryVMGenerationID (command) -// QueryMigrateCapabilities implements the "query-migrate-capabilities" QMP API call. -func (m *Monitor) QueryMigrateCapabilities() (ret []MigrationCapabilityStatus, err error) { +// QueryVMGenerationID implements the "query-vm-generation-id" QMP API call. +func (m *Monitor) QueryVMGenerationID() (ret GUIDInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-migrate-capabilities", + "execute": "query-vm-generation-id", "arguments": cmd, }) if err != nil { @@ -13351,14 +24632,14 @@ func (m *Monitor) QueryMigrateCapabilities() (ret []MigrationCapabilityStatus, e return } -// query-migrate-parameters -> QueryMigrateParameters (command) +// query-vnc -> QueryVNC (command) -// QueryMigrateParameters implements the "query-migrate-parameters" QMP API call. -func (m *Monitor) QueryMigrateParameters() (ret MigrationParameters, err error) { +// QueryVNC implements the "query-vnc" QMP API call. +func (m *Monitor) QueryVNC() (ret VNCInfo, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-migrate-parameters", + "execute": "query-vnc", "arguments": cmd, }) if err != nil { @@ -13380,14 +24661,14 @@ func (m *Monitor) QueryMigrateParameters() (ret MigrationParameters, err error) return } -// query-name -> QueryName (command) +// query-vnc-servers -> QueryVNCServers (command) -// QueryName implements the "query-name" QMP API call. -func (m *Monitor) QueryName() (ret NameInfo, err error) { +// QueryVNCServers implements the "query-vnc-servers" QMP API call. +func (m *Monitor) QueryVNCServers() (ret []VNCInfo2, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-name", + "execute": "query-vnc-servers", "arguments": cmd, }) if err != nil { @@ -13409,14 +24690,14 @@ func (m *Monitor) QueryName() (ret NameInfo, err error) { return } -// query-named-block-nodes -> QueryNamedBlockNodes (command) +// query-xen-replication-status -> QueryXenReplicationStatus (command) -// QueryNamedBlockNodes implements the "query-named-block-nodes" QMP API call. -func (m *Monitor) QueryNamedBlockNodes() (ret []BlockDeviceInfo, err error) { +// QueryXenReplicationStatus implements the "query-xen-replication-status" QMP API call. +func (m *Monitor) QueryXenReplicationStatus() (ret ReplicationStatus, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-named-block-nodes", + "execute": "query-xen-replication-status", "arguments": cmd, }) if err != nil { @@ -13438,14 +24719,14 @@ func (m *Monitor) QueryNamedBlockNodes() (ret []BlockDeviceInfo, err error) { return } -// query-pci -> QueryPCI (command) +// query-yank -> QueryYank (command) -// QueryPCI implements the "query-pci" QMP API call. -func (m *Monitor) QueryPCI() (ret []PCIInfo, err error) { +// QueryYank implements the "query-yank" QMP API call. +func (m *Monitor) QueryYank() (ret []YankInstance, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-pci", + "execute": "query-yank", "arguments": cmd, }) if err != nil { @@ -13467,14 +24748,14 @@ func (m *Monitor) QueryPCI() (ret []PCIInfo, err error) { return } -// query-qmp-schema -> QueryQMPSchema (command) +// quit -> Quit (command) -// QueryQMPSchema implements the "query-qmp-schema" QMP API call. -func (m *Monitor) QueryQMPSchema() (ret []SchemaInfo, err error) { +// Quit implements the "quit" QMP API call. +func (m *Monitor) Quit() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-qmp-schema", + "execute": "quit", "arguments": cmd, }) if err != nil { @@ -13484,29 +24765,22 @@ func (m *Monitor) QueryQMPSchema() (ret []SchemaInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-rocker -> QueryRocker (command) +// remove-fd -> RemoveFD (command) -// QueryRocker implements the "query-rocker" QMP API call. -func (m *Monitor) QueryRocker(name string) (ret RockerSwitch, err error) { +// RemoveFD implements the "remove-fd" QMP API call. +func (m *Monitor) RemoveFD(fdsetID int64, fd *int64) (err error) { cmd := struct { - Name string `json:"name"` + FdsetID int64 `json:"fdset-id"` + FD *int64 `json:"fd,omitempty"` }{ - name, + fdsetID, + fd, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-rocker", + "execute": "remove-fd", "arguments": cmd, }) if err != nil { @@ -13516,31 +24790,20 @@ func (m *Monitor) QueryRocker(name string) (ret RockerSwitch, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-rocker-of-dpa-flows -> QueryRockerOfDpaFlows (command) +// replay-break -> ReplayBreak (command) -// QueryRockerOfDpaFlows implements the "query-rocker-of-dpa-flows" QMP API call. -func (m *Monitor) QueryRockerOfDpaFlows(name string, tblID *uint32) (ret []RockerOfDpaFlow, err error) { +// ReplayBreak implements the "replay-break" QMP API call. +func (m *Monitor) ReplayBreak(icount int64) (err error) { cmd := struct { - Name string `json:"name"` - TblID *uint32 `json:"tbl-id,omitempty"` + Icount int64 `json:"icount"` }{ - name, - tblID, + icount, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-rocker-of-dpa-flows", + "execute": "replay-break", "arguments": cmd, }) if err != nil { @@ -13550,31 +24813,40 @@ func (m *Monitor) QueryRockerOfDpaFlows(name string, tblID *uint32) (ret []Rocke if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` + return +} + +// replay-delete-break -> ReplayDeleteBreak (command) + +// ReplayDeleteBreak implements the "replay-delete-break" QMP API call. +func (m *Monitor) ReplayDeleteBreak() (err error) { + cmd := struct { }{} - if err = json.Unmarshal(bs, &res); err != nil { + bs, err := json.Marshal(map[string]interface{}{ + "execute": "replay-delete-break", + "arguments": cmd, + }) + if err != nil { return } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + bs, err = m.mon.Run(bs) + if err != nil { return } return } -// query-rocker-of-dpa-groups -> QueryRockerOfDpaGroups (command) +// replay-seek -> ReplaySeek (command) -// QueryRockerOfDpaGroups implements the "query-rocker-of-dpa-groups" QMP API call. -func (m *Monitor) QueryRockerOfDpaGroups(name string, typ *uint8) (ret []RockerOfDpaGroup, err error) { +// ReplaySeek implements the "replay-seek" QMP API call. +func (m *Monitor) ReplaySeek(icount int64) (err error) { cmd := struct { - Name string `json:"name"` - Type *uint8 `json:"type,omitempty"` + Icount int64 `json:"icount"` }{ - name, - typ, + icount, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-rocker-of-dpa-groups", + "execute": "replay-seek", "arguments": cmd, }) if err != nil { @@ -13584,29 +24856,24 @@ func (m *Monitor) QueryRockerOfDpaGroups(name string, typ *uint8) (ret []RockerO if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-rocker-ports -> QueryRockerPorts (command) +// ringbuf-read -> RingbufRead (command) -// QueryRockerPorts implements the "query-rocker-ports" QMP API call. -func (m *Monitor) QueryRockerPorts(name string) (ret []RockerPort, err error) { +// RingbufRead implements the "ringbuf-read" QMP API call. +func (m *Monitor) RingbufRead(device string, size int64, format *DataFormat) (ret string, err error) { cmd := struct { - Name string `json:"name"` + Device string `json:"device"` + Size int64 `json:"size"` + Format *DataFormat `json:"format,omitempty"` }{ - name, + device, + size, + format, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-rocker-ports", + "execute": "ringbuf-read", "arguments": cmd, }) if err != nil { @@ -13628,17 +24895,21 @@ func (m *Monitor) QueryRockerPorts(name string) (ret []RockerPort, err error) { return } -// query-rx-filter -> QueryRxFilter (command) +// ringbuf-write -> RingbufWrite (command) -// QueryRxFilter implements the "query-rx-filter" QMP API call. -func (m *Monitor) QueryRxFilter(name *string) (ret []RxFilterInfo, err error) { +// RingbufWrite implements the "ringbuf-write" QMP API call. +func (m *Monitor) RingbufWrite(device string, data string, format *DataFormat) (err error) { cmd := struct { - Name *string `json:"name,omitempty"` + Device string `json:"device"` + Data string `json:"data"` + Format *DataFormat `json:"format,omitempty"` }{ - name, + device, + data, + format, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-rx-filter", + "execute": "ringbuf-write", "arguments": cmd, }) if err != nil { @@ -13648,26 +24919,17 @@ func (m *Monitor) QueryRxFilter(name *string) (ret []RxFilterInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-spice -> QuerySpice (command) +// rtc-reset-reinjection -> RtcResetReinjection (command) -// QuerySpice implements the "query-spice" QMP API call. -func (m *Monitor) QuerySpice() (ret SpiceInfo, err error) { +// RtcResetReinjection implements the "rtc-reset-reinjection" QMP API call. +func (m *Monitor) RtcResetReinjection() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-spice", + "execute": "rtc-reset-reinjection", "arguments": cmd, }) if err != nil { @@ -13677,26 +24939,51 @@ func (m *Monitor) QuerySpice() (ret SpiceInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { + return +} + +// screendump -> Screendump (command) + +// Screendump implements the "screendump" QMP API call. +func (m *Monitor) Screendump(filename string, device *string, head *int64, format *ImageFormat) (err error) { + cmd := struct { + Filename string `json:"filename"` + Device *string `json:"device,omitempty"` + Head *int64 `json:"head,omitempty"` + Format *ImageFormat `json:"format,omitempty"` + }{ + filename, + device, + head, + format, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "screendump", + "arguments": cmd, + }) + if err != nil { return } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + bs, err = m.mon.Run(bs) + if err != nil { return } return } -// query-status -> QueryStatus (command) +// send-key -> SendKey (command) -// QueryStatus implements the "query-status" QMP API call. -func (m *Monitor) QueryStatus() (ret StatusInfo, err error) { +// SendKey implements the "send-key" QMP API call. +func (m *Monitor) SendKey(keys []KeyValue, holdTime *int64) (err error) { cmd := struct { - }{} + Keys []KeyValue `json:"keys"` + HoldTime *int64 `json:"hold-time,omitempty"` + }{ + keys, + holdTime, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-status", + "execute": "send-key", "arguments": cmd, }) if err != nil { @@ -13706,26 +24993,44 @@ func (m *Monitor) QueryStatus() (ret StatusInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { + return +} + +// set-action -> SetAction (command) + +// SetAction implements the "set-action" QMP API call. +func (m *Monitor) SetAction(reboot *RebootAction, shutdown *ShutdownAction, panic *PanicAction, watchdog *WatchdogAction) (err error) { + cmd := struct { + Reboot *RebootAction `json:"reboot,omitempty"` + Shutdown *ShutdownAction `json:"shutdown,omitempty"` + Panic *PanicAction `json:"panic,omitempty"` + Watchdog *WatchdogAction `json:"watchdog,omitempty"` + }{ + reboot, + shutdown, + panic, + watchdog, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "set-action", + "arguments": cmd, + }) + if err != nil { return } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + bs, err = m.mon.Run(bs) + if err != nil { return } return } -// query-target -> QueryTarget (command) +// set-numa-node -> SetNumaNode (command) -// QueryTarget implements the "query-target" QMP API call. -func (m *Monitor) QueryTarget() (ret TargetInfo, err error) { - cmd := struct { - }{} +// SetNumaNode implements the "set-numa-node" QMP API call. +func (m *Monitor) SetNumaNode(cmd *NumaOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-target", + "execute": "set-numa-node", "arguments": cmd, }) if err != nil { @@ -13735,26 +25040,22 @@ func (m *Monitor) QueryTarget() (ret TargetInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-tpm -> QueryTPM (command) +// set-vcpu-dirty-limit -> SetVcpuDirtyLimit (command) -// QueryTPM implements the "query-tpm" QMP API call. -func (m *Monitor) QueryTPM() (ret []TPMInfo, err error) { +// SetVcpuDirtyLimit implements the "set-vcpu-dirty-limit" QMP API call. +func (m *Monitor) SetVcpuDirtyLimit(cpuIndex *int64, dirtyRate uint64) (err error) { cmd := struct { - }{} + CPUIndex *int64 `json:"cpu-index,omitempty"` + DirtyRate uint64 `json:"dirty-rate"` + }{ + cpuIndex, + dirtyRate, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-tpm", + "execute": "set-vcpu-dirty-limit", "arguments": cmd, }) if err != nil { @@ -13764,26 +25065,22 @@ func (m *Monitor) QueryTPM() (ret []TPMInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-tpm-models -> QueryTPMModels (command) +// set_link -> SetLink (command) -// QueryTPMModels implements the "query-tpm-models" QMP API call. -func (m *Monitor) QueryTPMModels() (ret []TPMModel, err error) { +// SetLink implements the "set_link" QMP API call. +func (m *Monitor) SetLink(name string, up bool) (err error) { cmd := struct { - }{} + Name string `json:"name"` + Up bool `json:"up"` + }{ + name, + up, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-tpm-models", + "execute": "set_link", "arguments": cmd, }) if err != nil { @@ -13793,26 +25090,15 @@ func (m *Monitor) QueryTPMModels() (ret []TPMModel, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-tpm-types -> QueryTPMTypes (command) +// set_password -> SetPassword (command) -// QueryTPMTypes implements the "query-tpm-types" QMP API call. -func (m *Monitor) QueryTPMTypes() (ret []TPMType, err error) { - cmd := struct { - }{} +// SetPassword implements the "set_password" QMP API call. +func (m *Monitor) SetPassword(cmd *SetPasswordOptions) (err error) { bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-tpm-types", + "execute": "set_password", "arguments": cmd, }) if err != nil { @@ -13822,26 +25108,24 @@ func (m *Monitor) QueryTPMTypes() (ret []TPMType, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-uuid -> QueryUUID (command) +// sev-inject-launch-secret -> SevInjectLaunchSecret (command) -// QueryUUID implements the "query-uuid" QMP API call. -func (m *Monitor) QueryUUID() (ret UUIDInfo, err error) { +// SevInjectLaunchSecret implements the "sev-inject-launch-secret" QMP API call. +func (m *Monitor) SevInjectLaunchSecret(packetHeader string, secret string, gpa *uint64) (err error) { cmd := struct { - }{} + PacketHeader string `json:"packet-header"` + Secret string `json:"secret"` + Gpa *uint64 `json:"gpa,omitempty"` + }{ + packetHeader, + secret, + gpa, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-uuid", + "execute": "sev-inject-launch-secret", "arguments": cmd, }) if err != nil { @@ -13851,26 +25135,24 @@ func (m *Monitor) QueryUUID() (ret UUIDInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-version -> QueryVersion (command) +// snapshot-delete -> SnapshotDelete (command) -// QueryVersion implements the "query-version" QMP API call. -func (m *Monitor) QueryVersion() (ret VersionInfo, err error) { +// SnapshotDelete implements the "snapshot-delete" QMP API call. +func (m *Monitor) SnapshotDelete(jobID string, tag string, devices []string) (err error) { cmd := struct { - }{} + JobID string `json:"job-id"` + Tag string `json:"tag"` + Devices []string `json:"devices"` + }{ + jobID, + tag, + devices, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-version", + "execute": "snapshot-delete", "arguments": cmd, }) if err != nil { @@ -13880,26 +25162,26 @@ func (m *Monitor) QueryVersion() (ret VersionInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-vm-generation-id -> QueryVMGenerationID (command) +// snapshot-load -> SnapshotLoad (command) -// QueryVMGenerationID implements the "query-vm-generation-id" QMP API call. -func (m *Monitor) QueryVMGenerationID() (ret GUIDInfo, err error) { +// SnapshotLoad implements the "snapshot-load" QMP API call. +func (m *Monitor) SnapshotLoad(jobID string, tag string, vmstate string, devices []string) (err error) { cmd := struct { - }{} + JobID string `json:"job-id"` + Tag string `json:"tag"` + Vmstate string `json:"vmstate"` + Devices []string `json:"devices"` + }{ + jobID, + tag, + vmstate, + devices, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-vm-generation-id", + "execute": "snapshot-load", "arguments": cmd, }) if err != nil { @@ -13909,26 +25191,26 @@ func (m *Monitor) QueryVMGenerationID() (ret GUIDInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-vnc -> QueryVNC (command) +// snapshot-save -> SnapshotSave (command) -// QueryVNC implements the "query-vnc" QMP API call. -func (m *Monitor) QueryVNC() (ret VNCInfo, err error) { +// SnapshotSave implements the "snapshot-save" QMP API call. +func (m *Monitor) SnapshotSave(jobID string, tag string, vmstate string, devices []string) (err error) { cmd := struct { - }{} + JobID string `json:"job-id"` + Tag string `json:"tag"` + Vmstate string `json:"vmstate"` + Devices []string `json:"devices"` + }{ + jobID, + tag, + vmstate, + devices, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-vnc", + "execute": "snapshot-save", "arguments": cmd, }) if err != nil { @@ -13938,26 +25220,17 @@ func (m *Monitor) QueryVNC() (ret VNCInfo, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-vnc-servers -> QueryVNCServers (command) +// stop -> Stop (command) -// QueryVNCServers implements the "query-vnc-servers" QMP API call. -func (m *Monitor) QueryVNCServers() (ret []VNCInfo2, err error) { +// Stop implements the "stop" QMP API call. +func (m *Monitor) Stop() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-vnc-servers", + "execute": "stop", "arguments": cmd, }) if err != nil { @@ -13967,26 +25240,17 @@ func (m *Monitor) QueryVNCServers() (ret []VNCInfo2, err error) { if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// query-xen-replication-status -> QueryXenReplicationStatus (command) +// system_powerdown -> SystemPowerdown (command) -// QueryXenReplicationStatus implements the "query-xen-replication-status" QMP API call. -func (m *Monitor) QueryXenReplicationStatus() (ret ReplicationStatus, err error) { +// SystemPowerdown implements the "system_powerdown" QMP API call. +func (m *Monitor) SystemPowerdown() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "query-xen-replication-status", + "execute": "system_powerdown", "arguments": cmd, }) if err != nil { @@ -13996,26 +25260,17 @@ func (m *Monitor) QueryXenReplicationStatus() (ret ReplicationStatus, err error) if err != nil { return } - res := struct { - Res json.RawMessage `json:"return"` - }{} - if err = json.Unmarshal(bs, &res); err != nil { - return - } - if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { - return - } return } -// quit -> Quit (command) +// system_reset -> SystemReset (command) -// Quit implements the "quit" QMP API call. -func (m *Monitor) Quit() (err error) { +// SystemReset implements the "system_reset" QMP API call. +func (m *Monitor) SystemReset() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "quit", + "execute": "system_reset", "arguments": cmd, }) if err != nil { @@ -14028,19 +25283,14 @@ func (m *Monitor) Quit() (err error) { return } -// remove-fd -> RemoveFD (command) +// system_wakeup -> SystemWakeup (command) -// RemoveFD implements the "remove-fd" QMP API call. -func (m *Monitor) RemoveFD(fdsetID int64, fd *int64) (err error) { +// SystemWakeup implements the "system_wakeup" QMP API call. +func (m *Monitor) SystemWakeup() (err error) { cmd := struct { - FdsetID int64 `json:"fdset-id"` - FD *int64 `json:"fd,omitempty"` - }{ - fdsetID, - fd, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "remove-fd", + "execute": "system_wakeup", "arguments": cmd, }) if err != nil { @@ -14053,21 +25303,19 @@ func (m *Monitor) RemoveFD(fdsetID int64, fd *int64) (err error) { return } -// ringbuf-read -> RingbufRead (command) +// trace-event-get-state -> TraceEventGetState (command) -// RingbufRead implements the "ringbuf-read" QMP API call. -func (m *Monitor) RingbufRead(device string, size int64, format *DataFormat) (ret string, err error) { +// TraceEventGetState implements the "trace-event-get-state" QMP API call. +func (m *Monitor) TraceEventGetState(name string, vcpu *int64) (ret []TraceEventInfo, err error) { cmd := struct { - Device string `json:"device"` - Size int64 `json:"size"` - Format *DataFormat `json:"format,omitempty"` + Name string `json:"name"` + Vcpu *int64 `json:"vcpu,omitempty"` }{ - device, - size, - format, + name, + vcpu, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "ringbuf-read", + "execute": "trace-event-get-state", "arguments": cmd, }) if err != nil { @@ -14089,21 +25337,23 @@ func (m *Monitor) RingbufRead(device string, size int64, format *DataFormat) (re return } -// ringbuf-write -> RingbufWrite (command) +// trace-event-set-state -> TraceEventSetState (command) -// RingbufWrite implements the "ringbuf-write" QMP API call. -func (m *Monitor) RingbufWrite(device string, data string, format *DataFormat) (err error) { +// TraceEventSetState implements the "trace-event-set-state" QMP API call. +func (m *Monitor) TraceEventSetState(name string, enable bool, ignoreUnavailable *bool, vcpu *int64) (err error) { cmd := struct { - Device string `json:"device"` - Data string `json:"data"` - Format *DataFormat `json:"format,omitempty"` + Name string `json:"name"` + Enable bool `json:"enable"` + IgnoreUnavailable *bool `json:"ignore-unavailable,omitempty"` + Vcpu *int64 `json:"vcpu,omitempty"` }{ - device, - data, - format, + name, + enable, + ignoreUnavailable, + vcpu, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "ringbuf-write", + "execute": "trace-event-set-state", "arguments": cmd, }) if err != nil { @@ -14116,14 +25366,19 @@ func (m *Monitor) RingbufWrite(device string, data string, format *DataFormat) ( return } -// rtc-reset-reinjection -> RtcResetReinjection (command) +// transaction -> Transaction (command) -// RtcResetReinjection implements the "rtc-reset-reinjection" QMP API call. -func (m *Monitor) RtcResetReinjection() (err error) { +// Transaction implements the "transaction" QMP API call. +func (m *Monitor) Transaction(actions []TransactionAction, properties *TransactionProperties) (err error) { cmd := struct { - }{} + Actions []TransactionAction `json:"actions"` + Properties *TransactionProperties `json:"properties,omitempty"` + }{ + actions, + properties, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "rtc-reset-reinjection", + "execute": "transaction", "arguments": cmd, }) if err != nil { @@ -14136,17 +25391,17 @@ func (m *Monitor) RtcResetReinjection() (err error) { return } -// screendump -> Screendump (command) +// watchdog-set-action -> WatchdogSetAction (command) -// Screendump implements the "screendump" QMP API call. -func (m *Monitor) Screendump(filename string) (err error) { +// WatchdogSetAction implements the "watchdog-set-action" QMP API call. +func (m *Monitor) WatchdogSetAction(action WatchdogAction) (err error) { cmd := struct { - Filename string `json:"filename"` + Action WatchdogAction `json:"action"` }{ - filename, + action, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "screendump", + "execute": "watchdog-set-action", "arguments": cmd, }) if err != nil { @@ -14159,19 +25414,23 @@ func (m *Monitor) Screendump(filename string) (err error) { return } -// send-key -> SendKey (command) +// x-blockdev-amend -> XBlockdevAmend (command) -// SendKey implements the "send-key" QMP API call. -func (m *Monitor) SendKey(keys []KeyValue, holdTime *int64) (err error) { +// XBlockdevAmend implements the "x-blockdev-amend" QMP API call. +func (m *Monitor) XBlockdevAmend(jobID string, nodeName string, options BlockdevAmendOptions, force *bool) (err error) { cmd := struct { - Keys []KeyValue `json:"keys"` - HoldTime *int64 `json:"hold-time,omitempty"` + JobID string `json:"job-id"` + NodeName string `json:"node-name"` + Options BlockdevAmendOptions `json:"options"` + Force *bool `json:"force,omitempty"` }{ - keys, - holdTime, + jobID, + nodeName, + options, + force, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "send-key", + "execute": "x-blockdev-amend", "arguments": cmd, }) if err != nil { @@ -14184,19 +25443,21 @@ func (m *Monitor) SendKey(keys []KeyValue, holdTime *int64) (err error) { return } -// set_link -> SetLink (command) +// x-blockdev-change -> XBlockdevChange (command) -// SetLink implements the "set_link" QMP API call. -func (m *Monitor) SetLink(name string, up bool) (err error) { +// XBlockdevChange implements the "x-blockdev-change" QMP API call. +func (m *Monitor) XBlockdevChange(parent string, child *string, node *string) (err error) { cmd := struct { - Name string `json:"name"` - Up bool `json:"up"` + Parent string `json:"parent"` + Child *string `json:"child,omitempty"` + Node *string `json:"node,omitempty"` }{ - name, - up, + parent, + child, + node, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "set_link", + "execute": "x-blockdev-change", "arguments": cmd, }) if err != nil { @@ -14209,21 +25470,21 @@ func (m *Monitor) SetLink(name string, up bool) (err error) { return } -// set_password -> SetPassword (command) +// x-blockdev-set-iothread -> XBlockdevSetIothread (command) -// SetPassword implements the "set_password" QMP API call. -func (m *Monitor) SetPassword(protocol string, password string, connected *string) (err error) { +// XBlockdevSetIothread implements the "x-blockdev-set-iothread" QMP API call. +func (m *Monitor) XBlockdevSetIothread(nodeName string, iothread StrOrNull, force *bool) (err error) { cmd := struct { - Protocol string `json:"protocol"` - Password string `json:"password"` - Connected *string `json:"connected,omitempty"` + NodeName string `json:"node-name"` + Iothread StrOrNull `json:"iothread"` + Force *bool `json:"force,omitempty"` }{ - protocol, - password, - connected, + nodeName, + iothread, + force, } bs, err := json.Marshal(map[string]interface{}{ - "execute": "set_password", + "execute": "x-blockdev-set-iothread", "arguments": cmd, }) if err != nil { @@ -14236,14 +25497,14 @@ func (m *Monitor) SetPassword(protocol string, password string, connected *strin return } -// stop -> Stop (command) +// x-colo-lost-heartbeat -> XColoLostHeartbeat (command) -// Stop implements the "stop" QMP API call. -func (m *Monitor) Stop() (err error) { +// XColoLostHeartbeat implements the "x-colo-lost-heartbeat" QMP API call. +func (m *Monitor) XColoLostHeartbeat() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "stop", + "execute": "x-colo-lost-heartbeat", "arguments": cmd, }) if err != nil { @@ -14256,14 +25517,19 @@ func (m *Monitor) Stop() (err error) { return } -// system_powerdown -> SystemPowerdown (command) +// x-debug-block-dirty-bitmap-sha256 -> XDebugBlockDirtyBitmapSha256 (command) -// SystemPowerdown implements the "system_powerdown" QMP API call. -func (m *Monitor) SystemPowerdown() (err error) { +// XDebugBlockDirtyBitmapSha256 implements the "x-debug-block-dirty-bitmap-sha256" QMP API call. +func (m *Monitor) XDebugBlockDirtyBitmapSha256(node string, name string) (ret BlockDirtyBitmapSha256, err error) { cmd := struct { - }{} + Node string `json:"node"` + Name string `json:"name"` + }{ + node, + name, + } bs, err := json.Marshal(map[string]interface{}{ - "execute": "system_powerdown", + "execute": "x-debug-block-dirty-bitmap-sha256", "arguments": cmd, }) if err != nil { @@ -14273,17 +25539,26 @@ func (m *Monitor) SystemPowerdown() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// system_reset -> SystemReset (command) +// x-debug-query-block-graph -> XDebugQueryBlockGraph (command) -// SystemReset implements the "system_reset" QMP API call. -func (m *Monitor) SystemReset() (err error) { +// XDebugQueryBlockGraph implements the "x-debug-query-block-graph" QMP API call. +func (m *Monitor) XDebugQueryBlockGraph() (ret XDbgBlockGraph, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "system_reset", + "execute": "x-debug-query-block-graph", "arguments": cmd, }) if err != nil { @@ -14293,17 +25568,26 @@ func (m *Monitor) SystemReset() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// system_wakeup -> SystemWakeup (command) +// x-exit-preconfig -> XExitPreconfig (command) -// SystemWakeup implements the "system_wakeup" QMP API call. -func (m *Monitor) SystemWakeup() (err error) { +// XExitPreconfig implements the "x-exit-preconfig" QMP API call. +func (m *Monitor) XExitPreconfig() (err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "system_wakeup", + "execute": "x-exit-preconfig", "arguments": cmd, }) if err != nil { @@ -14316,19 +25600,14 @@ func (m *Monitor) SystemWakeup() (err error) { return } -// trace-event-get-state -> TraceEventGetState (command) +// x-query-irq -> XQueryIrq (command) -// TraceEventGetState implements the "trace-event-get-state" QMP API call. -func (m *Monitor) TraceEventGetState(name string, vcpu *int64) (ret []TraceEventInfo, err error) { +// XQueryIrq implements the "x-query-irq" QMP API call. +func (m *Monitor) XQueryIrq() (ret HumanReadableText, err error) { cmd := struct { - Name string `json:"name"` - Vcpu *int64 `json:"vcpu,omitempty"` - }{ - name, - vcpu, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "trace-event-get-state", + "execute": "x-query-irq", "arguments": cmd, }) if err != nil { @@ -14350,23 +25629,14 @@ func (m *Monitor) TraceEventGetState(name string, vcpu *int64) (ret []TraceEvent return } -// trace-event-set-state -> TraceEventSetState (command) +// x-query-jit -> XQueryJit (command) -// TraceEventSetState implements the "trace-event-set-state" QMP API call. -func (m *Monitor) TraceEventSetState(name string, enable bool, ignoreUnavailable *bool, vcpu *int64) (err error) { +// XQueryJit implements the "x-query-jit" QMP API call. +func (m *Monitor) XQueryJit() (ret HumanReadableText, err error) { cmd := struct { - Name string `json:"name"` - Enable bool `json:"enable"` - IgnoreUnavailable *bool `json:"ignore-unavailable,omitempty"` - Vcpu *int64 `json:"vcpu,omitempty"` - }{ - name, - enable, - ignoreUnavailable, - vcpu, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "trace-event-set-state", + "execute": "x-query-jit", "arguments": cmd, }) if err != nil { @@ -14376,22 +25646,26 @@ func (m *Monitor) TraceEventSetState(name string, enable bool, ignoreUnavailable if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// transaction -> Transaction (command) +// x-query-numa -> XQueryNuma (command) -// Transaction implements the "transaction" QMP API call. -func (m *Monitor) Transaction(actions []TransactionAction, properties *TransactionProperties) (err error) { +// XQueryNuma implements the "x-query-numa" QMP API call. +func (m *Monitor) XQueryNuma() (ret HumanReadableText, err error) { cmd := struct { - Actions []TransactionAction `json:"actions"` - Properties *TransactionProperties `json:"properties,omitempty"` - }{ - actions, - properties, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "transaction", + "execute": "x-query-numa", "arguments": cmd, }) if err != nil { @@ -14401,20 +25675,26 @@ func (m *Monitor) Transaction(actions []TransactionAction, properties *Transacti if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// watchdog-set-action -> WatchdogSetAction (command) +// x-query-opcount -> XQueryOpcount (command) -// WatchdogSetAction implements the "watchdog-set-action" QMP API call. -func (m *Monitor) WatchdogSetAction(action WatchdogAction) (err error) { +// XQueryOpcount implements the "x-query-opcount" QMP API call. +func (m *Monitor) XQueryOpcount() (ret HumanReadableText, err error) { cmd := struct { - Action WatchdogAction `json:"action"` - }{ - action, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "watchdog-set-action", + "execute": "x-query-opcount", "arguments": cmd, }) if err != nil { @@ -14424,24 +25704,26 @@ func (m *Monitor) WatchdogSetAction(action WatchdogAction) (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// x-blockdev-change -> XBlockdevChange (command) +// x-query-profile -> XQueryProfile (command) -// XBlockdevChange implements the "x-blockdev-change" QMP API call. -func (m *Monitor) XBlockdevChange(parent string, child *string, node *string) (err error) { +// XQueryProfile implements the "x-query-profile" QMP API call. +func (m *Monitor) XQueryProfile() (ret HumanReadableText, err error) { cmd := struct { - Parent string `json:"parent"` - Child *string `json:"child,omitempty"` - Node *string `json:"node,omitempty"` - }{ - parent, - child, - node, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "x-blockdev-change", + "execute": "x-query-profile", "arguments": cmd, }) if err != nil { @@ -14451,24 +25733,26 @@ func (m *Monitor) XBlockdevChange(parent string, child *string, node *string) (e if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// x-blockdev-insert-medium -> XBlockdevInsertMedium (command) +// x-query-ramblock -> XQueryRamblock (command) -// XBlockdevInsertMedium implements the "x-blockdev-insert-medium" QMP API call. -func (m *Monitor) XBlockdevInsertMedium(device *string, id *string, nodeName string) (err error) { +// XQueryRamblock implements the "x-query-ramblock" QMP API call. +func (m *Monitor) XQueryRamblock() (ret HumanReadableText, err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` - NodeName string `json:"node-name"` - }{ - device, - id, - nodeName, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "x-blockdev-insert-medium", + "execute": "x-query-ramblock", "arguments": cmd, }) if err != nil { @@ -14478,22 +25762,26 @@ func (m *Monitor) XBlockdevInsertMedium(device *string, id *string, nodeName str if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// x-blockdev-remove-medium -> XBlockdevRemoveMedium (command) +// x-query-rdma -> XQueryRdma (command) -// XBlockdevRemoveMedium implements the "x-blockdev-remove-medium" QMP API call. -func (m *Monitor) XBlockdevRemoveMedium(device *string, id *string) (err error) { +// XQueryRdma implements the "x-query-rdma" QMP API call. +func (m *Monitor) XQueryRdma() (ret HumanReadableText, err error) { cmd := struct { - Device *string `json:"device,omitempty"` - ID *string `json:"id,omitempty"` - }{ - device, - id, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "x-blockdev-remove-medium", + "execute": "x-query-rdma", "arguments": cmd, }) if err != nil { @@ -14503,17 +25791,26 @@ func (m *Monitor) XBlockdevRemoveMedium(device *string, id *string) (err error) if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// x-colo-lost-heartbeat -> XColoLostHeartbeat (command) +// x-query-roms -> XQueryRoms (command) -// XColoLostHeartbeat implements the "x-colo-lost-heartbeat" QMP API call. -func (m *Monitor) XColoLostHeartbeat() (err error) { +// XQueryRoms implements the "x-query-roms" QMP API call. +func (m *Monitor) XQueryRoms() (ret HumanReadableText, err error) { cmd := struct { }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "x-colo-lost-heartbeat", + "execute": "x-query-roms", "arguments": cmd, }) if err != nil { @@ -14523,22 +25820,26 @@ func (m *Monitor) XColoLostHeartbeat() (err error) { if err != nil { return } + res := struct { + Res json.RawMessage `json:"return"` + }{} + if err = json.Unmarshal(bs, &res); err != nil { + return + } + if err = json.Unmarshal([]byte(res.Res), &ret); err != nil { + return + } return } -// x-debug-block-dirty-bitmap-sha256 -> XDebugBlockDirtyBitmapSha256 (command) +// x-query-usb -> XQueryUsb (command) -// XDebugBlockDirtyBitmapSha256 implements the "x-debug-block-dirty-bitmap-sha256" QMP API call. -func (m *Monitor) XDebugBlockDirtyBitmapSha256(node string, name string) (ret BlockDirtyBitmapSha256, err error) { +// XQueryUsb implements the "x-query-usb" QMP API call. +func (m *Monitor) XQueryUsb() (ret HumanReadableText, err error) { cmd := struct { - Node string `json:"node"` - Name string `json:"name"` - }{ - node, - name, - } + }{} bs, err := json.Marshal(map[string]interface{}{ - "execute": "x-debug-block-dirty-bitmap-sha256", + "execute": "x-query-usb", "arguments": cmd, }) if err != nil { @@ -14677,3 +25978,26 @@ func (m *Monitor) XenSetReplication(enable bool, primary bool, failover *bool) ( } return } + +// yank -> Yank (command) + +// Yank implements the "yank" QMP API call. +func (m *Monitor) Yank(instances []YankInstance) (err error) { + cmd := struct { + Instances []YankInstance `json:"instances"` + }{ + instances, + } + bs, err := json.Marshal(map[string]interface{}{ + "execute": "yank", + "arguments": cmd, + }) + if err != nil { + return + } + bs, err = m.mon.Run(bs) + if err != nil { + return + } + return +}