Skip to content

Commit

Permalink
runtime: Fix the format of the client code of cloud-hypervisor APIs
Browse files Browse the repository at this point in the history
Regenerate the client code with the added `go-fmt` step. No functional
changes.

Fixes: #1606

Signed-off-by: Bo Chen <chen.bo@intel.com>
  • Loading branch information
likebreath committed Mar 31, 2021
1 parent 52cacf8 commit 0c38d9e
Show file tree
Hide file tree
Showing 34 changed files with 146 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ func parameterToJson(obj interface{}) (string, error) {
return string(jsonBuf), err
}


// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
if c.cfg.Debug {
dump, err := httputil.DumpRequestOut(request, true)
dump, err := httputil.DumpRequestOut(request, true)
if err != nil {
return nil, err
return nil, err
}
log.Printf("\n%s\n", string(dump))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var (

// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey")

)

// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
Expand All @@ -52,7 +51,6 @@ type APIKey struct {
Prefix string
}


// ServerVariable stores the information about a server variable
type ServerVariable struct {
Description string
Expand All @@ -62,9 +60,9 @@ type ServerVariable struct {

// ServerConfiguration stores the information about a server
type ServerConfiguration struct {
Url string
Url string
Description string
Variables map[string]ServerVariable
Variables map[string]ServerVariable
}

// Configuration stores the configuration of the API client
Expand All @@ -86,9 +84,9 @@ func NewConfiguration() *Configuration {
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Servers: []ServerConfiguration{
Servers: []ServerConfiguration{
{
Url: "http://localhost/api/v1",
Url: "http://localhost/api/v1",
Description: "No description provided",
},
},
Expand All @@ -104,7 +102,7 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
// ServerUrl returns URL based on server settings
func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) {
if index < 0 || len(c.Servers) <= index {
return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1)
return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers)-1)
}
server := c.Servers[index]
url := server.Url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

package openapi

// BalloonConfig struct for BalloonConfig
type BalloonConfig struct {
Size int64 `json:"size"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

package openapi

// CmdLineConfig struct for CmdLineConfig
type CmdLineConfig struct {
Args string `json:"args"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/

package openapi

// ConsoleConfig struct for ConsoleConfig
type ConsoleConfig struct {
File string `json:"file,omitempty"`
Mode string `json:"mode"`
Iommu bool `json:"iommu,omitempty"`
File string `json:"file,omitempty"`
Mode string `json:"mode"`
Iommu bool `json:"iommu,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/

package openapi

// CpuTopology struct for CpuTopology
type CpuTopology struct {
ThreadsPerCore int32 `json:"threads_per_core,omitempty"`
CoresPerDie int32 `json:"cores_per_die,omitempty"`
CoresPerDie int32 `json:"cores_per_die,omitempty"`
DiesPerPackage int32 `json:"dies_per_package,omitempty"`
Packages int32 `json:"packages,omitempty"`
Packages int32 `json:"packages,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/

package openapi

// CpusConfig struct for CpusConfig
type CpusConfig struct {
BootVcpus int32 `json:"boot_vcpus"`
MaxVcpus int32 `json:"max_vcpus"`
Topology CpuTopology `json:"topology,omitempty"`
MaxPhysBits int32 `json:"max_phys_bits,omitempty"`
BootVcpus int32 `json:"boot_vcpus"`
MaxVcpus int32 `json:"max_vcpus"`
Topology CpuTopology `json:"topology,omitempty"`
MaxPhysBits int32 `json:"max_phys_bits,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/

package openapi

// DeviceConfig struct for DeviceConfig
type DeviceConfig struct {
Path string `json:"path"`
Iommu bool `json:"iommu,omitempty"`
Id string `json:"id,omitempty"`
Path string `json:"path"`
Iommu bool `json:"iommu,omitempty"`
Id string `json:"id,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/

package openapi

// DeviceNode struct for DeviceNode
type DeviceNode struct {
Id string `json:"id,omitempty"`
Id string `json:"id,omitempty"`
Resources []map[string]interface{} `json:"resources,omitempty"`
Children []string `json:"children,omitempty"`
PciBdf int32 `json:"pci_bdf,omitempty"`
Children []string `json:"children,omitempty"`
PciBdf int32 `json:"pci_bdf,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
*/

package openapi

// DiskConfig struct for DiskConfig
type DiskConfig struct {
Path string `json:"path"`
Readonly bool `json:"readonly,omitempty"`
Direct bool `json:"direct,omitempty"`
Iommu bool `json:"iommu,omitempty"`
NumQueues int32 `json:"num_queues,omitempty"`
QueueSize int32 `json:"queue_size,omitempty"`
VhostUser bool `json:"vhost_user,omitempty"`
VhostSocket string `json:"vhost_socket,omitempty"`
PollQueue bool `json:"poll_queue,omitempty"`
Path string `json:"path"`
Readonly bool `json:"readonly,omitempty"`
Direct bool `json:"direct,omitempty"`
Iommu bool `json:"iommu,omitempty"`
NumQueues int32 `json:"num_queues,omitempty"`
QueueSize int32 `json:"queue_size,omitempty"`
VhostUser bool `json:"vhost_user,omitempty"`
VhostSocket string `json:"vhost_socket,omitempty"`
PollQueue bool `json:"poll_queue,omitempty"`
RateLimiterConfig RateLimiterConfig `json:"rate_limiter_config,omitempty"`
Id string `json:"id,omitempty"`
Id string `json:"id,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
*/

package openapi

// FsConfig struct for FsConfig
type FsConfig struct {
Tag string `json:"tag"`
Socket string `json:"socket"`
NumQueues int32 `json:"num_queues"`
QueueSize int32 `json:"queue_size"`
Dax bool `json:"dax"`
CacheSize int64 `json:"cache_size"`
Id string `json:"id,omitempty"`
Tag string `json:"tag"`
Socket string `json:"socket"`
NumQueues int32 `json:"num_queues"`
QueueSize int32 `json:"queue_size"`
Dax bool `json:"dax"`
CacheSize int64 `json:"cache_size"`
Id string `json:"id,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

package openapi

// InitramfsConfig struct for InitramfsConfig
type InitramfsConfig struct {
Path string `json:"path"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

package openapi

// KernelConfig struct for KernelConfig
type KernelConfig struct {
Path string `json:"path"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
*/

package openapi

// MemoryConfig struct for MemoryConfig
type MemoryConfig struct {
Size int64 `json:"size"`
HotplugSize int64 `json:"hotplug_size,omitempty"`
HotpluggedSize int64 `json:"hotplugged_size,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
HotplugMethod string `json:"hotplug_method,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
HugepageSize int64 `json:"hugepage_size,omitempty"`
Zones []MemoryZoneConfig `json:"zones,omitempty"`
Size int64 `json:"size"`
HotplugSize int64 `json:"hotplug_size,omitempty"`
HotpluggedSize int64 `json:"hotplugged_size,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
HotplugMethod string `json:"hotplug_method,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
HugepageSize int64 `json:"hugepage_size,omitempty"`
Zones []MemoryZoneConfig `json:"zones,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
*/

package openapi

// MemoryZoneConfig struct for MemoryZoneConfig
type MemoryZoneConfig struct {
Id string `json:"id"`
Size int64 `json:"size"`
File string `json:"file,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
HugepageSize int64 `json:"hugepage_size,omitempty"`
HostNumaNode int32 `json:"host_numa_node,omitempty"`
HotplugSize int64 `json:"hotplug_size,omitempty"`
HotpluggedSize int64 `json:"hotplugged_size,omitempty"`
Id string `json:"id"`
Size int64 `json:"size"`
File string `json:"file,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
HugepageSize int64 `json:"hugepage_size,omitempty"`
HostNumaNode int32 `json:"host_numa_node,omitempty"`
HotplugSize int64 `json:"hotplug_size,omitempty"`
HotpluggedSize int64 `json:"hotplugged_size,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
*/

package openapi

// NetConfig struct for NetConfig
type NetConfig struct {
Tap string `json:"tap,omitempty"`
Ip string `json:"ip,omitempty"`
Mask string `json:"mask,omitempty"`
Mac string `json:"mac,omitempty"`
Iommu bool `json:"iommu,omitempty"`
NumQueues int32 `json:"num_queues,omitempty"`
QueueSize int32 `json:"queue_size,omitempty"`
VhostUser bool `json:"vhost_user,omitempty"`
VhostSocket string `json:"vhost_socket,omitempty"`
Id string `json:"id,omitempty"`
Fd []int32 `json:"fd,omitempty"`
Tap string `json:"tap,omitempty"`
Ip string `json:"ip,omitempty"`
Mask string `json:"mask,omitempty"`
Mac string `json:"mac,omitempty"`
Iommu bool `json:"iommu,omitempty"`
NumQueues int32 `json:"num_queues,omitempty"`
QueueSize int32 `json:"queue_size,omitempty"`
VhostUser bool `json:"vhost_user,omitempty"`
VhostSocket string `json:"vhost_socket,omitempty"`
Id string `json:"id,omitempty"`
Fd []int32 `json:"fd,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/

package openapi

// NumaConfig struct for NumaConfig
type NumaConfig struct {
GuestNumaId int32 `json:"guest_numa_id"`
Cpus []int32 `json:"cpus,omitempty"`
Distances []NumaDistance `json:"distances,omitempty"`
MemoryZones []string `json:"memory_zones,omitempty"`
GuestNumaId int32 `json:"guest_numa_id"`
Cpus []int32 `json:"cpus,omitempty"`
Distances []NumaDistance `json:"distances,omitempty"`
MemoryZones []string `json:"memory_zones,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

package openapi

// NumaDistance struct for NumaDistance
type NumaDistance struct {
Destination int32 `json:"destination"`
Distance int32 `json:"distance"`
Distance int32 `json:"distance"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

package openapi

// PciDeviceInfo Information about a PCI device
type PciDeviceInfo struct {
Id string `json:"id"`
Id string `json:"id"`
Bdf string `json:"bdf"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
*/

package openapi

// PmemConfig struct for PmemConfig
type PmemConfig struct {
File string `json:"file"`
Size int64 `json:"size,omitempty"`
Iommu bool `json:"iommu,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
DiscardWrites bool `json:"discard_writes,omitempty"`
Id string `json:"id,omitempty"`
File string `json:"file"`
Size int64 `json:"size,omitempty"`
Iommu bool `json:"iommu,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
DiscardWrites bool `json:"discard_writes,omitempty"`
Id string `json:"id,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

package openapi

// RateLimiterConfig Defines an IO rate limiter with independent bytes/s and ops/s limits. Limits are defined by configuring each of the _bandwidth_ and _ops_ token buckets.
type RateLimiterConfig struct {
Bandwidth TokenBucket `json:"bandwidth,omitempty"`
Ops TokenBucket `json:"ops,omitempty"`
Ops TokenBucket `json:"ops,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

package openapi

// RestoreConfig struct for RestoreConfig
type RestoreConfig struct {
SourceUrl string `json:"source_url"`
Prefault bool `json:"prefault,omitempty"`
Prefault bool `json:"prefault,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

package openapi

// RngConfig struct for RngConfig
type RngConfig struct {
Src string `json:"src"`
Iommu bool `json:"iommu,omitempty"`
Src string `json:"src"`
Iommu bool `json:"iommu,omitempty"`
}
Loading

0 comments on commit 0c38d9e

Please sign in to comment.