mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-06 16:04:26 +01:00
runtime: move all code to src/runtime
To prepare for merging into kata-containers repository. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
31
src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile
Normal file
31
src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
all: | update-yaml generate-client-code
|
||||
MK_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
YQ_INSTALLER := "$(MK_DIR)/../../../.ci/install-yq.sh"
|
||||
VERSIONS_FILE := "$(MK_DIR)/../../../versions.yaml"
|
||||
YQ := $(shell command -v yq 2> /dev/null)
|
||||
|
||||
generate-client-code: clean-generated-code
|
||||
docker run --rm \
|
||||
--user $$(id -u):$$(id -g) \
|
||||
-v $${PWD}:/local openapitools/openapi-generator-cli generate \
|
||||
-i /local/cloud-hypervisor.yaml \
|
||||
-g go \
|
||||
-o /local/client
|
||||
|
||||
|
||||
|
||||
update-yaml:
|
||||
ifndef YQ
|
||||
$(MK_DIR)/../../../.ci/install-yq.sh
|
||||
endif
|
||||
clh_version=$(shell yq r $(VERSIONS_FILE) assets.hypervisor.cloud_hypervisor.version); \
|
||||
curl -OL https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/$$clh_version/vmm/src/api/openapi/cloud-hypervisor.yaml
|
||||
|
||||
clean-generated-code:
|
||||
rm "./client" -rf
|
||||
13
src/runtime/virtcontainers/pkg/cloud-hypervisor/README.md
Normal file
13
src/runtime/virtcontainers/pkg/cloud-hypervisor/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Cloud Hypervisor OpenAPI generated code
|
||||
|
||||
This directory provide tools to generate code client based
|
||||
on `cloud-hypervisor` `OpenAPI` schema.
|
||||
|
||||
## Update client to match latest Cloud Hypervisor server API
|
||||
|
||||
Requirements:
|
||||
- docker: `openapi-generator` is executed in a docker container
|
||||
|
||||
```
|
||||
make all
|
||||
```
|
||||
24
src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.gitignore
vendored
Normal file
24
src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -0,0 +1 @@
|
||||
4.3.1-SNAPSHOT
|
||||
@@ -0,0 +1,8 @@
|
||||
language: go
|
||||
|
||||
install:
|
||||
- go get -d -v .
|
||||
|
||||
script:
|
||||
- go build -v ./
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# Go API client for openapi
|
||||
|
||||
Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
|
||||
## Overview
|
||||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
|
||||
|
||||
- API version: 0.3.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
Install the following dependencies:
|
||||
|
||||
```shell
|
||||
go get github.com/stretchr/testify/assert
|
||||
go get golang.org/x/oauth2
|
||||
go get golang.org/x/net/context
|
||||
go get github.com/antihax/optional
|
||||
```
|
||||
|
||||
Put the package under your project folder and add the following in import:
|
||||
|
||||
```golang
|
||||
import "./openapi"
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost/api/v1*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**BootVM**](docs/DefaultApi.md#bootvm) | **Put** /vm.boot | Boot the previously created VM instance.
|
||||
*DefaultApi* | [**CreateVM**](docs/DefaultApi.md#createvm) | **Put** /vm.create | Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
|
||||
*DefaultApi* | [**DeleteVM**](docs/DefaultApi.md#deletevm) | **Put** /vm.delete | Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
*DefaultApi* | [**PauseVM**](docs/DefaultApi.md#pausevm) | **Put** /vm.pause | Pause a previously booted VM instance.
|
||||
*DefaultApi* | [**RebootVM**](docs/DefaultApi.md#rebootvm) | **Put** /vm.reboot | Reboot the VM instance.
|
||||
*DefaultApi* | [**ResumeVM**](docs/DefaultApi.md#resumevm) | **Put** /vm.resume | Resume a previously paused VM instance.
|
||||
*DefaultApi* | [**ShutdownVM**](docs/DefaultApi.md#shutdownvm) | **Put** /vm.shutdown | Shut the VM instance down.
|
||||
*DefaultApi* | [**ShutdownVMM**](docs/DefaultApi.md#shutdownvmm) | **Put** /vmm.shutdown | Shuts the cloud-hypervisor VMM.
|
||||
*DefaultApi* | [**VmAddDevicePut**](docs/DefaultApi.md#vmadddeviceput) | **Put** /vm.add-device | Add a new device to the VM
|
||||
*DefaultApi* | [**VmAddDiskPut**](docs/DefaultApi.md#vmadddiskput) | **Put** /vm.add-disk | Add a new disk to the VM
|
||||
*DefaultApi* | [**VmAddNetPut**](docs/DefaultApi.md#vmaddnetput) | **Put** /vm.add-net | Add a new network device to the VM
|
||||
*DefaultApi* | [**VmAddPmemPut**](docs/DefaultApi.md#vmaddpmemput) | **Put** /vm.add-pmem | Add a new pmem device to the VM
|
||||
*DefaultApi* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
*DefaultApi* | [**VmRemoveDevicePut**](docs/DefaultApi.md#vmremovedeviceput) | **Put** /vm.remove-device | Remove a device from the VM
|
||||
*DefaultApi* | [**VmResizePut**](docs/DefaultApi.md#vmresizeput) | **Put** /vm.resize | Resize the VM
|
||||
*DefaultApi* | [**VmRestorePut**](docs/DefaultApi.md#vmrestoreput) | **Put** /vm.restore | Restore a VM from a snapshot.
|
||||
*DefaultApi* | [**VmSnapshotPut**](docs/DefaultApi.md#vmsnapshotput) | **Put** /vm.snapshot | Returns a VM snapshot.
|
||||
*DefaultApi* | [**VmmPingGet**](docs/DefaultApi.md#vmmpingget) | **Get** /vmm.ping | Ping the VMM to check for API server availability
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [CmdLineConfig](docs/CmdLineConfig.md)
|
||||
- [ConsoleConfig](docs/ConsoleConfig.md)
|
||||
- [CpusConfig](docs/CpusConfig.md)
|
||||
- [DeviceConfig](docs/DeviceConfig.md)
|
||||
- [DiskConfig](docs/DiskConfig.md)
|
||||
- [FsConfig](docs/FsConfig.md)
|
||||
- [InitramfsConfig](docs/InitramfsConfig.md)
|
||||
- [KernelConfig](docs/KernelConfig.md)
|
||||
- [MemoryConfig](docs/MemoryConfig.md)
|
||||
- [NetConfig](docs/NetConfig.md)
|
||||
- [PmemConfig](docs/PmemConfig.md)
|
||||
- [RestoreConfig](docs/RestoreConfig.md)
|
||||
- [RngConfig](docs/RngConfig.md)
|
||||
- [VmAddDevice](docs/VmAddDevice.md)
|
||||
- [VmConfig](docs/VmConfig.md)
|
||||
- [VmInfo](docs/VmInfo.md)
|
||||
- [VmRemoveDevice](docs/VmRemoveDevice.md)
|
||||
- [VmResize](docs/VmResize.md)
|
||||
- [VmSnapshotConfig](docs/VmSnapshotConfig.md)
|
||||
- [VmmPingResponse](docs/VmmPingResponse.md)
|
||||
- [VsockConfig](docs/VsockConfig.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
Endpoints do not require authorization.
|
||||
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,857 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
description: Local HTTP based API for managing and inspecting a cloud-hypervisor
|
||||
virtual machine.
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
title: Cloud Hypervisor API
|
||||
version: 0.3.0
|
||||
servers:
|
||||
- url: http://localhost/api/v1
|
||||
paths:
|
||||
/vmm.ping:
|
||||
get:
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmmPingResponse'
|
||||
description: The VMM information
|
||||
summary: Ping the VMM to check for API server availability
|
||||
/vmm.shutdown:
|
||||
put:
|
||||
operationId: shutdownVMM
|
||||
responses:
|
||||
"204":
|
||||
description: The VMM successfully shutdown.
|
||||
summary: Shuts the cloud-hypervisor VMM.
|
||||
/vm.info:
|
||||
get:
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmInfo'
|
||||
description: The VM information
|
||||
summary: Returns general information about the cloud-hypervisor Virtual Machine
|
||||
(VM) instance.
|
||||
/vm.create:
|
||||
put:
|
||||
operationId: createVM
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmConfig'
|
||||
description: The VM configuration
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance was successfully created.
|
||||
summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance
|
||||
is not booted, only created.
|
||||
/vm.delete:
|
||||
put:
|
||||
operationId: deleteVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance was successfully deleted.
|
||||
summary: Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
/vm.boot:
|
||||
put:
|
||||
operationId: bootVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance successfully booted.
|
||||
"404":
|
||||
description: The VM instance could not boot because it is not created yet
|
||||
summary: Boot the previously created VM instance.
|
||||
/vm.pause:
|
||||
put:
|
||||
operationId: pauseVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance successfully paused.
|
||||
"404":
|
||||
description: The VM instance could not pause because it is not created yet
|
||||
"405":
|
||||
description: The VM instance could not pause because it is not booted.
|
||||
summary: Pause a previously booted VM instance.
|
||||
/vm.resume:
|
||||
put:
|
||||
operationId: resumeVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance successfully paused.
|
||||
"404":
|
||||
description: The VM instance could not resume because it is not booted yet
|
||||
"405":
|
||||
description: The VM instance could not resume because it is not paused.
|
||||
summary: Resume a previously paused VM instance.
|
||||
/vm.shutdown:
|
||||
put:
|
||||
operationId: shutdownVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance successfully shut down.
|
||||
"404":
|
||||
description: The VM instance could not shut down because is not created.
|
||||
"405":
|
||||
description: The VM instance could not shut down because it is not started.
|
||||
summary: Shut the VM instance down.
|
||||
/vm.reboot:
|
||||
put:
|
||||
operationId: rebootVM
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance successfully rebooted.
|
||||
"404":
|
||||
description: The VM instance could not reboot because it is not created.
|
||||
"405":
|
||||
description: The VM instance could not reboot because it is not booted.
|
||||
summary: Reboot the VM instance.
|
||||
/vm.resize:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmResize'
|
||||
description: The target size for the VM
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance was successfully resized.
|
||||
"404":
|
||||
description: The VM instance could not be resized because it is not created.
|
||||
summary: Resize the VM
|
||||
/vm.add-device:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmAddDevice'
|
||||
description: The path of the new device
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The new device was successfully added to the VM instance.
|
||||
"404":
|
||||
description: The new device could not be added to the VM instance.
|
||||
summary: Add a new device to the VM
|
||||
/vm.remove-device:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmRemoveDevice'
|
||||
description: The identifier of the device
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The device was successfully removed from the VM instance.
|
||||
"404":
|
||||
description: The device could not be removed from the VM instance.
|
||||
summary: Remove a device from the VM
|
||||
/vm.add-disk:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DiskConfig'
|
||||
description: The details of the new disk
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The new disk was successfully added to the VM instance.
|
||||
"500":
|
||||
description: The new disk could not be added to the VM instance.
|
||||
summary: Add a new disk to the VM
|
||||
/vm.add-pmem:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PmemConfig'
|
||||
description: The details of the new pmem device
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The new device was successfully added to the VM instance.
|
||||
"500":
|
||||
description: The new device could not be added to the VM instance.
|
||||
summary: Add a new pmem device to the VM
|
||||
/vm.add-net:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NetConfig'
|
||||
description: The details of the new network device
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The new device was successfully added to the VM instance.
|
||||
"500":
|
||||
description: The new device could not be added to the VM instance.
|
||||
summary: Add a new network device to the VM
|
||||
/vm.snapshot:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmSnapshotConfig'
|
||||
description: The snapshot configuration
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance was successfully snapshotted.
|
||||
"404":
|
||||
description: The VM instance could not be snapshotted because it is not
|
||||
created.
|
||||
"405":
|
||||
description: The VM instance could not be snapshotted because it is not
|
||||
booted.
|
||||
summary: Returns a VM snapshot.
|
||||
/vm.restore:
|
||||
put:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RestoreConfig'
|
||||
description: The restore configuration
|
||||
required: true
|
||||
responses:
|
||||
"204":
|
||||
description: The VM instance was successfully restored.
|
||||
"404":
|
||||
description: The VM instance could not be restored because it is already
|
||||
created.
|
||||
summary: Restore a VM from a snapshot.
|
||||
components:
|
||||
schemas:
|
||||
VmmPingResponse:
|
||||
description: Virtual Machine Monitor information
|
||||
example:
|
||||
version: version
|
||||
properties:
|
||||
version:
|
||||
type: string
|
||||
required:
|
||||
- version
|
||||
type: object
|
||||
VmInfo:
|
||||
description: Virtual Machine information
|
||||
example:
|
||||
state: Created
|
||||
config:
|
||||
console:
|
||||
mode: "false"
|
||||
file: file
|
||||
iommu: false
|
||||
memory:
|
||||
mergeable: false
|
||||
file: file
|
||||
size: 1
|
||||
hotplug_size: 5
|
||||
hotplug_method: acpi
|
||||
disks:
|
||||
- path: path
|
||||
num_queues: 5
|
||||
readonly: false
|
||||
iommu: false
|
||||
queue_size: 2
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
direct: false
|
||||
wce: true
|
||||
poll_queue: true
|
||||
- path: path
|
||||
num_queues: 5
|
||||
readonly: false
|
||||
iommu: false
|
||||
queue_size: 2
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
direct: false
|
||||
wce: true
|
||||
poll_queue: true
|
||||
cpus:
|
||||
boot_vcpus: 1
|
||||
max_vcpus: 1
|
||||
devices:
|
||||
- path: path
|
||||
iommu: false
|
||||
id: id
|
||||
- path: path
|
||||
iommu: false
|
||||
id: id
|
||||
kernel:
|
||||
path: path
|
||||
rng:
|
||||
iommu: false
|
||||
src: /dev/urandom
|
||||
fs:
|
||||
- sock: sock
|
||||
num_queues: 3
|
||||
queue_size: 2
|
||||
cache_size: 4
|
||||
dax: true
|
||||
tag: tag
|
||||
- sock: sock
|
||||
num_queues: 3
|
||||
queue_size: 2
|
||||
cache_size: 4
|
||||
dax: true
|
||||
tag: tag
|
||||
vsock:
|
||||
- sock: sock
|
||||
iommu: false
|
||||
cid: 3
|
||||
- sock: sock
|
||||
iommu: false
|
||||
cid: 3
|
||||
pmem:
|
||||
- mergeable: false
|
||||
file: file
|
||||
size: 7
|
||||
iommu: false
|
||||
discard_writes: false
|
||||
- mergeable: false
|
||||
file: file
|
||||
size: 7
|
||||
iommu: false
|
||||
discard_writes: false
|
||||
cmdline:
|
||||
args: args
|
||||
iommu: false
|
||||
serial:
|
||||
mode: "false"
|
||||
file: file
|
||||
iommu: false
|
||||
initramfs:
|
||||
path: path
|
||||
net:
|
||||
- tap: tap
|
||||
num_queues: 7
|
||||
iommu: false
|
||||
queue_size: 9
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
ip: 192.168.249.1
|
||||
mac: mac
|
||||
mask: 255.255.255.0
|
||||
- tap: tap
|
||||
num_queues: 7
|
||||
iommu: false
|
||||
queue_size: 9
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
ip: 192.168.249.1
|
||||
mac: mac
|
||||
mask: 255.255.255.0
|
||||
properties:
|
||||
config:
|
||||
$ref: '#/components/schemas/VmConfig'
|
||||
state:
|
||||
enum:
|
||||
- Created
|
||||
- Running
|
||||
- Shutdown
|
||||
- Paused
|
||||
type: string
|
||||
required:
|
||||
- config
|
||||
- state
|
||||
type: object
|
||||
VmConfig:
|
||||
description: Virtual machine configuration
|
||||
example:
|
||||
console:
|
||||
mode: "false"
|
||||
file: file
|
||||
iommu: false
|
||||
memory:
|
||||
mergeable: false
|
||||
file: file
|
||||
size: 1
|
||||
hotplug_size: 5
|
||||
hotplug_method: acpi
|
||||
disks:
|
||||
- path: path
|
||||
num_queues: 5
|
||||
readonly: false
|
||||
iommu: false
|
||||
queue_size: 2
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
direct: false
|
||||
wce: true
|
||||
poll_queue: true
|
||||
- path: path
|
||||
num_queues: 5
|
||||
readonly: false
|
||||
iommu: false
|
||||
queue_size: 2
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
direct: false
|
||||
wce: true
|
||||
poll_queue: true
|
||||
cpus:
|
||||
boot_vcpus: 1
|
||||
max_vcpus: 1
|
||||
devices:
|
||||
- path: path
|
||||
iommu: false
|
||||
id: id
|
||||
- path: path
|
||||
iommu: false
|
||||
id: id
|
||||
kernel:
|
||||
path: path
|
||||
rng:
|
||||
iommu: false
|
||||
src: /dev/urandom
|
||||
fs:
|
||||
- sock: sock
|
||||
num_queues: 3
|
||||
queue_size: 2
|
||||
cache_size: 4
|
||||
dax: true
|
||||
tag: tag
|
||||
- sock: sock
|
||||
num_queues: 3
|
||||
queue_size: 2
|
||||
cache_size: 4
|
||||
dax: true
|
||||
tag: tag
|
||||
vsock:
|
||||
- sock: sock
|
||||
iommu: false
|
||||
cid: 3
|
||||
- sock: sock
|
||||
iommu: false
|
||||
cid: 3
|
||||
pmem:
|
||||
- mergeable: false
|
||||
file: file
|
||||
size: 7
|
||||
iommu: false
|
||||
discard_writes: false
|
||||
- mergeable: false
|
||||
file: file
|
||||
size: 7
|
||||
iommu: false
|
||||
discard_writes: false
|
||||
cmdline:
|
||||
args: args
|
||||
iommu: false
|
||||
serial:
|
||||
mode: "false"
|
||||
file: file
|
||||
iommu: false
|
||||
initramfs:
|
||||
path: path
|
||||
net:
|
||||
- tap: tap
|
||||
num_queues: 7
|
||||
iommu: false
|
||||
queue_size: 9
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
ip: 192.168.249.1
|
||||
mac: mac
|
||||
mask: 255.255.255.0
|
||||
- tap: tap
|
||||
num_queues: 7
|
||||
iommu: false
|
||||
queue_size: 9
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
ip: 192.168.249.1
|
||||
mac: mac
|
||||
mask: 255.255.255.0
|
||||
properties:
|
||||
cpus:
|
||||
$ref: '#/components/schemas/CpusConfig'
|
||||
memory:
|
||||
$ref: '#/components/schemas/MemoryConfig'
|
||||
kernel:
|
||||
$ref: '#/components/schemas/KernelConfig'
|
||||
initramfs:
|
||||
$ref: '#/components/schemas/InitramfsConfig'
|
||||
cmdline:
|
||||
$ref: '#/components/schemas/CmdLineConfig'
|
||||
disks:
|
||||
items:
|
||||
$ref: '#/components/schemas/DiskConfig'
|
||||
type: array
|
||||
net:
|
||||
items:
|
||||
$ref: '#/components/schemas/NetConfig'
|
||||
type: array
|
||||
rng:
|
||||
$ref: '#/components/schemas/RngConfig'
|
||||
fs:
|
||||
items:
|
||||
$ref: '#/components/schemas/FsConfig'
|
||||
type: array
|
||||
pmem:
|
||||
items:
|
||||
$ref: '#/components/schemas/PmemConfig'
|
||||
type: array
|
||||
serial:
|
||||
$ref: '#/components/schemas/ConsoleConfig'
|
||||
console:
|
||||
$ref: '#/components/schemas/ConsoleConfig'
|
||||
devices:
|
||||
items:
|
||||
$ref: '#/components/schemas/DeviceConfig'
|
||||
type: array
|
||||
vsock:
|
||||
items:
|
||||
$ref: '#/components/schemas/VsockConfig'
|
||||
type: array
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- cmdline
|
||||
- kernel
|
||||
type: object
|
||||
CpusConfig:
|
||||
example:
|
||||
boot_vcpus: 1
|
||||
max_vcpus: 1
|
||||
properties:
|
||||
boot_vcpus:
|
||||
default: 1
|
||||
minimum: 1
|
||||
type: integer
|
||||
max_vcpus:
|
||||
default: 1
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- boot_vcpus
|
||||
- max_vcpus
|
||||
type: object
|
||||
MemoryConfig:
|
||||
example:
|
||||
mergeable: false
|
||||
file: file
|
||||
size: 1
|
||||
hotplug_size: 5
|
||||
hotplug_method: acpi
|
||||
properties:
|
||||
size:
|
||||
format: int64
|
||||
type: integer
|
||||
hotplug_size:
|
||||
format: int64
|
||||
type: integer
|
||||
file:
|
||||
type: string
|
||||
mergeable:
|
||||
default: false
|
||||
type: boolean
|
||||
hotplug_method:
|
||||
default: acpi
|
||||
type: string
|
||||
required:
|
||||
- size
|
||||
type: object
|
||||
KernelConfig:
|
||||
example:
|
||||
path: path
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
InitramfsConfig:
|
||||
example:
|
||||
path: path
|
||||
nullable: true
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
CmdLineConfig:
|
||||
example:
|
||||
args: args
|
||||
properties:
|
||||
args:
|
||||
type: string
|
||||
required:
|
||||
- args
|
||||
type: object
|
||||
DiskConfig:
|
||||
example:
|
||||
path: path
|
||||
num_queues: 5
|
||||
readonly: false
|
||||
iommu: false
|
||||
queue_size: 2
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
direct: false
|
||||
wce: true
|
||||
poll_queue: true
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
readonly:
|
||||
default: false
|
||||
type: boolean
|
||||
direct:
|
||||
default: false
|
||||
type: boolean
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
num_queues:
|
||||
default: 1
|
||||
type: integer
|
||||
queue_size:
|
||||
default: 128
|
||||
type: integer
|
||||
vhost_user:
|
||||
default: false
|
||||
type: boolean
|
||||
vhost_socket:
|
||||
type: string
|
||||
wce:
|
||||
default: true
|
||||
type: boolean
|
||||
poll_queue:
|
||||
default: true
|
||||
type: boolean
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
NetConfig:
|
||||
example:
|
||||
tap: tap
|
||||
num_queues: 7
|
||||
iommu: false
|
||||
queue_size: 9
|
||||
vhost_socket: vhost_socket
|
||||
vhost_user: false
|
||||
ip: 192.168.249.1
|
||||
mac: mac
|
||||
mask: 255.255.255.0
|
||||
properties:
|
||||
tap:
|
||||
default: ""
|
||||
type: string
|
||||
ip:
|
||||
default: 192.168.249.1
|
||||
type: string
|
||||
mask:
|
||||
default: 255.255.255.0
|
||||
type: string
|
||||
mac:
|
||||
type: string
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
num_queues:
|
||||
default: 2
|
||||
type: integer
|
||||
queue_size:
|
||||
default: 256
|
||||
type: integer
|
||||
vhost_user:
|
||||
default: false
|
||||
type: boolean
|
||||
vhost_socket:
|
||||
type: string
|
||||
type: object
|
||||
RngConfig:
|
||||
example:
|
||||
iommu: false
|
||||
src: /dev/urandom
|
||||
properties:
|
||||
src:
|
||||
default: /dev/urandom
|
||||
type: string
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- src
|
||||
type: object
|
||||
FsConfig:
|
||||
example:
|
||||
sock: sock
|
||||
num_queues: 3
|
||||
queue_size: 2
|
||||
cache_size: 4
|
||||
dax: true
|
||||
tag: tag
|
||||
properties:
|
||||
tag:
|
||||
type: string
|
||||
sock:
|
||||
type: string
|
||||
num_queues:
|
||||
default: 1
|
||||
type: integer
|
||||
queue_size:
|
||||
default: 1024
|
||||
type: integer
|
||||
dax:
|
||||
default: true
|
||||
type: boolean
|
||||
cache_size:
|
||||
format: int64
|
||||
type: integer
|
||||
required:
|
||||
- sock
|
||||
- tag
|
||||
type: object
|
||||
PmemConfig:
|
||||
example:
|
||||
mergeable: false
|
||||
file: file
|
||||
size: 7
|
||||
iommu: false
|
||||
discard_writes: false
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
size:
|
||||
format: int64
|
||||
type: integer
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
mergeable:
|
||||
default: false
|
||||
type: boolean
|
||||
discard_writes:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- file
|
||||
- size
|
||||
type: object
|
||||
ConsoleConfig:
|
||||
example:
|
||||
mode: "false"
|
||||
file: file
|
||||
iommu: false
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
mode:
|
||||
enum:
|
||||
- "false"
|
||||
- Tty
|
||||
- File
|
||||
- null
|
||||
type: string
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- mode
|
||||
type: object
|
||||
DeviceConfig:
|
||||
example:
|
||||
path: path
|
||||
iommu: false
|
||||
id: id
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
id:
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
VsockConfig:
|
||||
example:
|
||||
sock: sock
|
||||
iommu: false
|
||||
cid: 3
|
||||
properties:
|
||||
cid:
|
||||
description: Guest Vsock CID
|
||||
format: int64
|
||||
minimum: 3
|
||||
type: integer
|
||||
sock:
|
||||
description: Path to UNIX domain socket, used to proxy vsock connections.
|
||||
type: string
|
||||
iommu:
|
||||
default: false
|
||||
type: boolean
|
||||
required:
|
||||
- cid
|
||||
- sock
|
||||
type: object
|
||||
VmResize:
|
||||
example:
|
||||
desired_vcpus: 1
|
||||
desired_ram: 6
|
||||
properties:
|
||||
desired_vcpus:
|
||||
minimum: 1
|
||||
type: integer
|
||||
desired_ram:
|
||||
description: desired memory ram in bytes
|
||||
format: int64
|
||||
type: integer
|
||||
type: object
|
||||
VmAddDevice:
|
||||
example:
|
||||
path: path
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
type: object
|
||||
VmRemoveDevice:
|
||||
example:
|
||||
id: id
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
type: object
|
||||
VmSnapshotConfig:
|
||||
example:
|
||||
destination_url: destination_url
|
||||
properties:
|
||||
destination_url:
|
||||
type: string
|
||||
type: object
|
||||
RestoreConfig:
|
||||
example:
|
||||
prefault: true
|
||||
source_url: source_url
|
||||
properties:
|
||||
source_url:
|
||||
type: string
|
||||
prefault:
|
||||
type: boolean
|
||||
required:
|
||||
- source_url
|
||||
type: object
|
||||
File diff suppressed because it is too large
Load Diff
532
src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go
Normal file
532
src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go
Normal file
@@ -0,0 +1,532 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
|
||||
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
|
||||
)
|
||||
|
||||
// APIClient manages communication with the Cloud Hypervisor API API v0.3.0
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
|
||||
DefaultApi *DefaultApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *APIClient
|
||||
}
|
||||
|
||||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = http.DefaultClient
|
||||
}
|
||||
|
||||
c := &APIClient{}
|
||||
c.cfg = cfg
|
||||
c.common.client = c
|
||||
|
||||
// API Services
|
||||
c.DefaultApi = (*DefaultApiService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
return ""
|
||||
}
|
||||
if contains(contentTypes, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
// selectHeaderAccept join all accept types and return
|
||||
func selectHeaderAccept(accepts []string) string {
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
// contains is a case insenstive match, finding needle in a haystack
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Verify optional parameters are of the correct type.
|
||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||
// Make sure there is an object.
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the type is as expected.
|
||||
if reflect.TypeOf(obj).String() != expected {
|
||||
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
||||
func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
var delimiter string
|
||||
|
||||
switch collectionFormat {
|
||||
case "pipes":
|
||||
delimiter = "|"
|
||||
case "ssv":
|
||||
delimiter = " "
|
||||
case "tsv":
|
||||
delimiter = "\t"
|
||||
case "csv":
|
||||
delimiter = ","
|
||||
}
|
||||
|
||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||
} else if t, ok := obj.(time.Time); ok {
|
||||
return t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
|
||||
// helper for converting interface{} parameters to json strings
|
||||
func parameterToJson(obj interface{}) (string, error) {
|
||||
jsonBuf, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
|
||||
resp, err := c.cfg.HTTPClient.Do(request)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
if c.cfg.Debug {
|
||||
dump, err := httputil.DumpResponse(resp, true)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// ChangeBasePath changes base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// Allow modification of underlying config for alternate implementations and testing
|
||||
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
|
||||
func (c *APIClient) GetConfig() *Configuration {
|
||||
return c.cfg
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams url.Values,
|
||||
formFileName string,
|
||||
fileName string,
|
||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if postBody != nil {
|
||||
contentType := headerParams["Content-Type"]
|
||||
if contentType == "" {
|
||||
contentType = detectContentType(postBody)
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// add form parameters and file if available.
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
w := multipart.NewWriter(body)
|
||||
|
||||
for k, v := range formParams {
|
||||
for _, iv := range v {
|
||||
if strings.HasPrefix(k, "@") { // file
|
||||
err = addFile(w, k[1:], iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else { // form value
|
||||
w.WriteField(k, iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(fileBytes) > 0 && fileName != "" {
|
||||
w.Boundary()
|
||||
//_, fileNm := filepath.Split(fileName)
|
||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = part.Write(fileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Boundary in the Content-Type
|
||||
headerParams["Content-Type"] = w.FormDataContentType()
|
||||
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
w.Close()
|
||||
}
|
||||
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
body.WriteString(formParams.Encode())
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
}
|
||||
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Override request host, if applicable
|
||||
if c.cfg.Host != "" {
|
||||
url.Host = c.cfg.Host
|
||||
}
|
||||
|
||||
// Override request scheme, if applicable
|
||||
if c.cfg.Scheme != "" {
|
||||
url.Scheme = c.cfg.Scheme
|
||||
}
|
||||
|
||||
// Adding Query Param
|
||||
query := url.Query()
|
||||
for k, v := range queryParams {
|
||||
for _, iv := range v {
|
||||
query.Add(k, iv)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the parameters.
|
||||
url.RawQuery = query.Encode()
|
||||
|
||||
// Generate a new request
|
||||
if body != nil {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||
} else {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add header parameters, if any
|
||||
if len(headerParams) > 0 {
|
||||
headers := http.Header{}
|
||||
for h, v := range headerParams {
|
||||
headers.Set(h, v)
|
||||
}
|
||||
localVarRequest.Header = headers
|
||||
}
|
||||
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
|
||||
// Walk through any authentication.
|
||||
|
||||
// OAuth2 authentication
|
||||
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
||||
// We were able to grab an oauth2 token from the context
|
||||
var latestToken *oauth2.Token
|
||||
if latestToken, err = tok.Token(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
latestToken.SetAuthHeader(localVarRequest)
|
||||
}
|
||||
|
||||
// Basic HTTP Authentication
|
||||
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||
}
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for header, value := range c.cfg.DefaultHeader {
|
||||
localVarRequest.Header.Add(header, value)
|
||||
}
|
||||
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
if s, ok := v.(*string); ok {
|
||||
*s = string(b)
|
||||
return nil
|
||||
}
|
||||
if xmlCheck.MatchString(contentType) {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if err = json.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(part, file)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
bodyBuf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
if reader, ok := body.(io.Reader); ok {
|
||||
_, err = bodyBuf.ReadFrom(reader)
|
||||
} else if b, ok := body.([]byte); ok {
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
err = xml.NewEncoder(bodyBuf).Encode(body)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bodyBuf.Len() == 0 {
|
||||
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
||||
return nil, err
|
||||
}
|
||||
return bodyBuf, nil
|
||||
}
|
||||
|
||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||
func detectContentType(body interface{}) string {
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
kind := reflect.TypeOf(body).Kind()
|
||||
|
||||
switch kind {
|
||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
case reflect.String:
|
||||
contentType = "text/plain; charset=utf-8"
|
||||
default:
|
||||
if b, ok := body.([]byte); ok {
|
||||
contentType = http.DetectContentType(b)
|
||||
} else if kind == reflect.Slice {
|
||||
contentType = "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
||||
|
||||
return contentType
|
||||
}
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
func parseCacheControl(headers http.Header) cacheControl {
|
||||
cc := cacheControl{}
|
||||
ccHeader := headers.Get("Cache-Control")
|
||||
for _, part := range strings.Split(ccHeader, ",") {
|
||||
part = strings.Trim(part, " ")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
if strings.ContainsRune(part, '=') {
|
||||
keyval := strings.Split(part, "=")
|
||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||
} else {
|
||||
cc[part] = ""
|
||||
}
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
if err != nil {
|
||||
return time.Now()
|
||||
}
|
||||
respCacheControl := parseCacheControl(r.Header)
|
||||
|
||||
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||
if err != nil {
|
||||
expires = now
|
||||
} else {
|
||||
expires = now.Add(lifetime)
|
||||
}
|
||||
} else {
|
||||
expiresHeader := r.Header.Get("Expires")
|
||||
if expiresHeader != "" {
|
||||
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
}
|
||||
}
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
||||
type GenericOpenAPIError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericOpenAPIError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericOpenAPIError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericOpenAPIError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// contextKeys are used to identify the type of value in the context.
|
||||
// Since these are string, it is possible to get a short description of the
|
||||
// context key for logging and debugging using key.String().
|
||||
|
||||
type contextKey string
|
||||
|
||||
func (c contextKey) String() string {
|
||||
return "auth " + string(c)
|
||||
}
|
||||
|
||||
var (
|
||||
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
|
||||
ContextOAuth2 = contextKey("token")
|
||||
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
|
||||
// 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
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
|
||||
// ServerVariable stores the information about a server variable
|
||||
type ServerVariable struct {
|
||||
Description string
|
||||
DefaultValue string
|
||||
EnumValues []string
|
||||
}
|
||||
|
||||
// ServerConfiguration stores the information about a server
|
||||
type ServerConfiguration struct {
|
||||
Url string
|
||||
Description string
|
||||
Variables map[string]ServerVariable
|
||||
}
|
||||
|
||||
// Configuration stores the configuration of the API client
|
||||
type Configuration struct {
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
Servers []ServerConfiguration
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewConfiguration returns a new Configuration object
|
||||
func NewConfiguration() *Configuration {
|
||||
cfg := &Configuration{
|
||||
BasePath: "http://localhost/api/v1",
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Servers: []ServerConfiguration{
|
||||
{
|
||||
Url: "http://localhost/api/v1",
|
||||
Description: "No description provided",
|
||||
},
|
||||
},
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// AddDefaultHeader adds a new HTTP header to the default header in the request
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
c.DefaultHeader[key] = value
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
server := c.Servers[index]
|
||||
url := server.Url
|
||||
|
||||
// go through variables and replace placeholders
|
||||
for name, variable := range server.Variables {
|
||||
if value, ok := variables[name]; ok {
|
||||
found := bool(len(variable.EnumValues) == 0)
|
||||
for _, enumValue := range variable.EnumValues {
|
||||
if value == enumValue {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
|
||||
}
|
||||
url = strings.Replace(url, "{"+name+"}", value, -1)
|
||||
} else {
|
||||
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
|
||||
}
|
||||
}
|
||||
return url, nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# CmdLineConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Args** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# ConsoleConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**File** | **string** | | [optional]
|
||||
**Mode** | **string** | |
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# CpusConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**BootVcpus** | **int32** | | [default to 1]
|
||||
**MaxVcpus** | **int32** | | [default to 1]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,566 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://localhost/api/v1*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**BootVM**](DefaultApi.md#BootVM) | **Put** /vm.boot | Boot the previously created VM instance.
|
||||
[**CreateVM**](DefaultApi.md#CreateVM) | **Put** /vm.create | Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
|
||||
[**DeleteVM**](DefaultApi.md#DeleteVM) | **Put** /vm.delete | Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
[**PauseVM**](DefaultApi.md#PauseVM) | **Put** /vm.pause | Pause a previously booted VM instance.
|
||||
[**RebootVM**](DefaultApi.md#RebootVM) | **Put** /vm.reboot | Reboot the VM instance.
|
||||
[**ResumeVM**](DefaultApi.md#ResumeVM) | **Put** /vm.resume | Resume a previously paused VM instance.
|
||||
[**ShutdownVM**](DefaultApi.md#ShutdownVM) | **Put** /vm.shutdown | Shut the VM instance down.
|
||||
[**ShutdownVMM**](DefaultApi.md#ShutdownVMM) | **Put** /vmm.shutdown | Shuts the cloud-hypervisor VMM.
|
||||
[**VmAddDevicePut**](DefaultApi.md#VmAddDevicePut) | **Put** /vm.add-device | Add a new device to the VM
|
||||
[**VmAddDiskPut**](DefaultApi.md#VmAddDiskPut) | **Put** /vm.add-disk | Add a new disk to the VM
|
||||
[**VmAddNetPut**](DefaultApi.md#VmAddNetPut) | **Put** /vm.add-net | Add a new network device to the VM
|
||||
[**VmAddPmemPut**](DefaultApi.md#VmAddPmemPut) | **Put** /vm.add-pmem | Add a new pmem device to the VM
|
||||
[**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
[**VmRemoveDevicePut**](DefaultApi.md#VmRemoveDevicePut) | **Put** /vm.remove-device | Remove a device from the VM
|
||||
[**VmResizePut**](DefaultApi.md#VmResizePut) | **Put** /vm.resize | Resize the VM
|
||||
[**VmRestorePut**](DefaultApi.md#VmRestorePut) | **Put** /vm.restore | Restore a VM from a snapshot.
|
||||
[**VmSnapshotPut**](DefaultApi.md#VmSnapshotPut) | **Put** /vm.snapshot | Returns a VM snapshot.
|
||||
[**VmmPingGet**](DefaultApi.md#VmmPingGet) | **Get** /vmm.ping | Ping the VMM to check for API server availability
|
||||
|
||||
|
||||
|
||||
## BootVM
|
||||
|
||||
> BootVM(ctx, )
|
||||
|
||||
Boot the previously created VM instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## CreateVM
|
||||
|
||||
> CreateVM(ctx, vmConfig)
|
||||
|
||||
Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**vmConfig** | [**VmConfig**](VmConfig.md)| The VM configuration |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## DeleteVM
|
||||
|
||||
> DeleteVM(ctx, )
|
||||
|
||||
Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## PauseVM
|
||||
|
||||
> PauseVM(ctx, )
|
||||
|
||||
Pause a previously booted VM instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## RebootVM
|
||||
|
||||
> RebootVM(ctx, )
|
||||
|
||||
Reboot the VM instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## ResumeVM
|
||||
|
||||
> ResumeVM(ctx, )
|
||||
|
||||
Resume a previously paused VM instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## ShutdownVM
|
||||
|
||||
> ShutdownVM(ctx, )
|
||||
|
||||
Shut the VM instance down.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## ShutdownVMM
|
||||
|
||||
> ShutdownVMM(ctx, )
|
||||
|
||||
Shuts the cloud-hypervisor VMM.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmAddDevicePut
|
||||
|
||||
> VmAddDevicePut(ctx, vmAddDevice)
|
||||
|
||||
Add a new device to the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**vmAddDevice** | [**VmAddDevice**](VmAddDevice.md)| The path of the new device |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmAddDiskPut
|
||||
|
||||
> VmAddDiskPut(ctx, diskConfig)
|
||||
|
||||
Add a new disk to the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**diskConfig** | [**DiskConfig**](DiskConfig.md)| The details of the new disk |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmAddNetPut
|
||||
|
||||
> VmAddNetPut(ctx, netConfig)
|
||||
|
||||
Add a new network device to the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**netConfig** | [**NetConfig**](NetConfig.md)| The details of the new network device |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmAddPmemPut
|
||||
|
||||
> VmAddPmemPut(ctx, pmemConfig)
|
||||
|
||||
Add a new pmem device to the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pmemConfig** | [**PmemConfig**](PmemConfig.md)| The details of the new pmem device |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmInfoGet
|
||||
|
||||
> VmInfo VmInfoGet(ctx, )
|
||||
|
||||
Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**VmInfo**](VmInfo.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmRemoveDevicePut
|
||||
|
||||
> VmRemoveDevicePut(ctx, vmRemoveDevice)
|
||||
|
||||
Remove a device from the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**vmRemoveDevice** | [**VmRemoveDevice**](VmRemoveDevice.md)| The identifier of the device |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmResizePut
|
||||
|
||||
> VmResizePut(ctx, vmResize)
|
||||
|
||||
Resize the VM
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**vmResize** | [**VmResize**](VmResize.md)| The target size for the VM |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmRestorePut
|
||||
|
||||
> VmRestorePut(ctx, restoreConfig)
|
||||
|
||||
Restore a VM from a snapshot.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**restoreConfig** | [**RestoreConfig**](RestoreConfig.md)| The restore configuration |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmSnapshotPut
|
||||
|
||||
> VmSnapshotPut(ctx, vmSnapshotConfig)
|
||||
|
||||
Returns a VM snapshot.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**vmSnapshotConfig** | [**VmSnapshotConfig**](VmSnapshotConfig.md)| The snapshot configuration |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
|
||||
## VmmPingGet
|
||||
|
||||
> VmmPingResponse VmmPingGet(ctx, )
|
||||
|
||||
Ping the VMM to check for API server availability
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**VmmPingResponse**](VmmPingResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
|
||||
[[Back to Model list]](../README.md#documentation-for-models)
|
||||
[[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# DeviceConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Path** | **string** | |
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
**Id** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# DiskConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Path** | **string** | |
|
||||
**Readonly** | **bool** | | [optional] [default to false]
|
||||
**Direct** | **bool** | | [optional] [default to false]
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
**NumQueues** | **int32** | | [optional] [default to 1]
|
||||
**QueueSize** | **int32** | | [optional] [default to 128]
|
||||
**VhostUser** | **bool** | | [optional] [default to false]
|
||||
**VhostSocket** | **string** | | [optional]
|
||||
**Wce** | **bool** | | [optional] [default to true]
|
||||
**PollQueue** | **bool** | | [optional] [default to true]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# FsConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Tag** | **string** | |
|
||||
**Sock** | **string** | |
|
||||
**NumQueues** | **int32** | | [optional] [default to 1]
|
||||
**QueueSize** | **int32** | | [optional] [default to 1024]
|
||||
**Dax** | **bool** | | [optional] [default to true]
|
||||
**CacheSize** | **int64** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# InitramfsConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Path** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# KernelConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Path** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# MemoryConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Size** | **int64** | |
|
||||
**HotplugSize** | **int64** | | [optional]
|
||||
**File** | **string** | | [optional]
|
||||
**Mergeable** | **bool** | | [optional] [default to false]
|
||||
**HotplugMethod** | **string** | | [optional] [default to acpi]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# NetConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Tap** | **string** | | [optional] [default to ]
|
||||
**Ip** | **string** | | [optional] [default to 192.168.249.1]
|
||||
**Mask** | **string** | | [optional] [default to 255.255.255.0]
|
||||
**Mac** | **string** | | [optional]
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
**NumQueues** | **int32** | | [optional] [default to 2]
|
||||
**QueueSize** | **int32** | | [optional] [default to 256]
|
||||
**VhostUser** | **bool** | | [optional] [default to false]
|
||||
**VhostSocket** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# PmemConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**File** | **string** | |
|
||||
**Size** | **int64** | |
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
**Mergeable** | **bool** | | [optional] [default to false]
|
||||
**DiscardWrites** | **bool** | | [optional] [default to false]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# RestoreConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**SourceUrl** | **string** | |
|
||||
**Prefault** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# RngConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Src** | **string** | | [default to /dev/urandom]
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# VmAddDevice
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Path** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# VmConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Cpus** | [**CpusConfig**](CpusConfig.md) | | [optional]
|
||||
**Memory** | [**MemoryConfig**](MemoryConfig.md) | | [optional]
|
||||
**Kernel** | [**KernelConfig**](KernelConfig.md) | |
|
||||
**Initramfs** | Pointer to [**InitramfsConfig**](InitramfsConfig.md) | | [optional]
|
||||
**Cmdline** | [**CmdLineConfig**](CmdLineConfig.md) | |
|
||||
**Disks** | [**[]DiskConfig**](DiskConfig.md) | | [optional]
|
||||
**Net** | [**[]NetConfig**](NetConfig.md) | | [optional]
|
||||
**Rng** | [**RngConfig**](RngConfig.md) | | [optional]
|
||||
**Fs** | [**[]FsConfig**](FsConfig.md) | | [optional]
|
||||
**Pmem** | [**[]PmemConfig**](PmemConfig.md) | | [optional]
|
||||
**Serial** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional]
|
||||
**Console** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional]
|
||||
**Devices** | [**[]DeviceConfig**](DeviceConfig.md) | | [optional]
|
||||
**Vsock** | [**[]VsockConfig**](VsockConfig.md) | | [optional]
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# VmInfo
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Config** | [**VmConfig**](VmConfig.md) | |
|
||||
**State** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# VmRemoveDevice
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# VmResize
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**DesiredVcpus** | **int32** | | [optional]
|
||||
**DesiredRam** | **int64** | desired memory ram in bytes | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# VmSnapshotConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**DestinationUrl** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# VmmPingResponse
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Version** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# VsockConfig
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Cid** | **int64** | Guest Vsock CID |
|
||||
**Sock** | **string** | Path to UNIX domain socket, used to proxy vsock connections. |
|
||||
**Iommu** | **bool** | | [optional] [default to false]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
module github.com/GIT_USER_ID/GIT_REPO_ID
|
||||
|
||||
require (
|
||||
github.com/antihax/optional v1.0.0
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk=
|
||||
github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// CmdLineConfig struct for CmdLineConfig
|
||||
type CmdLineConfig struct {
|
||||
Args string `json:"args"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// ConsoleConfig struct for ConsoleConfig
|
||||
type ConsoleConfig struct {
|
||||
File string `json:"file,omitempty"`
|
||||
Mode string `json:"mode"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// CpusConfig struct for CpusConfig
|
||||
type CpusConfig struct {
|
||||
BootVcpus int32 `json:"boot_vcpus"`
|
||||
MaxVcpus int32 `json:"max_vcpus"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// DeviceConfig struct for DeviceConfig
|
||||
type DeviceConfig struct {
|
||||
Path string `json:"path"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
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"`
|
||||
Wce bool `json:"wce,omitempty"`
|
||||
PollQueue bool `json:"poll_queue,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// FsConfig struct for FsConfig
|
||||
type FsConfig struct {
|
||||
Tag string `json:"tag"`
|
||||
Sock string `json:"sock"`
|
||||
NumQueues int32 `json:"num_queues,omitempty"`
|
||||
QueueSize int32 `json:"queue_size,omitempty"`
|
||||
Dax bool `json:"dax,omitempty"`
|
||||
CacheSize int64 `json:"cache_size,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// InitramfsConfig struct for InitramfsConfig
|
||||
type InitramfsConfig struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// KernelConfig struct for KernelConfig
|
||||
type KernelConfig struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// MemoryConfig struct for MemoryConfig
|
||||
type MemoryConfig struct {
|
||||
Size int64 `json:"size"`
|
||||
HotplugSize int64 `json:"hotplug_size,omitempty"`
|
||||
File string `json:"file,omitempty"`
|
||||
Mergeable bool `json:"mergeable,omitempty"`
|
||||
HotplugMethod string `json:"hotplug_method,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
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"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// PmemConfig struct for PmemConfig
|
||||
type PmemConfig struct {
|
||||
File string `json:"file"`
|
||||
Size int64 `json:"size"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
Mergeable bool `json:"mergeable,omitempty"`
|
||||
DiscardWrites bool `json:"discard_writes,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// RestoreConfig struct for RestoreConfig
|
||||
type RestoreConfig struct {
|
||||
SourceUrl string `json:"source_url"`
|
||||
Prefault bool `json:"prefault,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// RngConfig struct for RngConfig
|
||||
type RngConfig struct {
|
||||
Src string `json:"src"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmAddDevice struct for VmAddDevice
|
||||
type VmAddDevice struct {
|
||||
Path string `json:"path,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmConfig Virtual machine configuration
|
||||
type VmConfig struct {
|
||||
Cpus CpusConfig `json:"cpus,omitempty"`
|
||||
Memory MemoryConfig `json:"memory,omitempty"`
|
||||
Kernel KernelConfig `json:"kernel"`
|
||||
Initramfs *InitramfsConfig `json:"initramfs,omitempty"`
|
||||
Cmdline CmdLineConfig `json:"cmdline"`
|
||||
Disks []DiskConfig `json:"disks,omitempty"`
|
||||
Net []NetConfig `json:"net,omitempty"`
|
||||
Rng RngConfig `json:"rng,omitempty"`
|
||||
Fs []FsConfig `json:"fs,omitempty"`
|
||||
Pmem []PmemConfig `json:"pmem,omitempty"`
|
||||
Serial ConsoleConfig `json:"serial,omitempty"`
|
||||
Console ConsoleConfig `json:"console,omitempty"`
|
||||
Devices []DeviceConfig `json:"devices,omitempty"`
|
||||
Vsock []VsockConfig `json:"vsock,omitempty"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmInfo Virtual Machine information
|
||||
type VmInfo struct {
|
||||
Config VmConfig `json:"config"`
|
||||
State string `json:"state"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmRemoveDevice struct for VmRemoveDevice
|
||||
type VmRemoveDevice struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmResize struct for VmResize
|
||||
type VmResize struct {
|
||||
DesiredVcpus int32 `json:"desired_vcpus,omitempty"`
|
||||
// desired memory ram in bytes
|
||||
DesiredRam int64 `json:"desired_ram,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmSnapshotConfig struct for VmSnapshotConfig
|
||||
type VmSnapshotConfig struct {
|
||||
DestinationUrl string `json:"destination_url,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VmmPingResponse Virtual Machine Monitor information
|
||||
type VmmPingResponse struct {
|
||||
Version string `json:"version"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
// VsockConfig struct for VsockConfig
|
||||
type VsockConfig struct {
|
||||
// Guest Vsock CID
|
||||
Cid int64 `json:"cid"`
|
||||
// Path to UNIX domain socket, used to proxy vsock connections.
|
||||
Sock string `json:"sock"`
|
||||
Iommu bool `json:"iommu,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Cloud Hypervisor API
|
||||
*
|
||||
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
*
|
||||
* API version: 0.3.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// APIResponse stores the API response returned by the server.
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the OpenAPI operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
Payload []byte `json:"-"`
|
||||
}
|
||||
|
||||
// NewAPIResponse returns a new APIResonse object.
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
// NewAPIResponseWithError returns a new APIResponse object with the provided error message.
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Cloud Hypervisor API
|
||||
description: Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
version: 0.3.0
|
||||
|
||||
servers:
|
||||
- url: http://localhost/api/v1
|
||||
|
||||
paths:
|
||||
|
||||
/vmm.ping:
|
||||
get:
|
||||
summary: Ping the VMM to check for API server availability
|
||||
responses:
|
||||
200:
|
||||
description: The VMM information
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmmPingResponse'
|
||||
|
||||
/vmm.shutdown:
|
||||
put:
|
||||
summary: Shuts the cloud-hypervisor VMM.
|
||||
operationId: shutdownVMM
|
||||
responses:
|
||||
204:
|
||||
description: The VMM successfully shutdown.
|
||||
|
||||
/vm.info:
|
||||
get:
|
||||
summary: Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
responses:
|
||||
200:
|
||||
description: The VM information
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmInfo'
|
||||
|
||||
/vm.create:
|
||||
put:
|
||||
summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
|
||||
operationId: createVM
|
||||
requestBody:
|
||||
description: The VM configuration
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance was successfully created.
|
||||
|
||||
/vm.delete:
|
||||
put:
|
||||
summary: Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||
operationId: deleteVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance was successfully deleted.
|
||||
|
||||
/vm.boot:
|
||||
put:
|
||||
summary: Boot the previously created VM instance.
|
||||
operationId: bootVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance successfully booted.
|
||||
404:
|
||||
description: The VM instance could not boot because it is not created yet
|
||||
|
||||
/vm.pause:
|
||||
put:
|
||||
summary: Pause a previously booted VM instance.
|
||||
operationId: pauseVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance successfully paused.
|
||||
404:
|
||||
description: The VM instance could not pause because it is not created yet
|
||||
405:
|
||||
description: The VM instance could not pause because it is not booted.
|
||||
|
||||
/vm.resume:
|
||||
put:
|
||||
summary: Resume a previously paused VM instance.
|
||||
operationId: resumeVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance successfully paused.
|
||||
404:
|
||||
description: The VM instance could not resume because it is not booted yet
|
||||
405:
|
||||
description: The VM instance could not resume because it is not paused.
|
||||
|
||||
/vm.shutdown:
|
||||
put:
|
||||
summary: Shut the VM instance down.
|
||||
operationId: shutdownVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance successfully shut down.
|
||||
404:
|
||||
description: The VM instance could not shut down because is not created.
|
||||
405:
|
||||
description: The VM instance could not shut down because it is not started.
|
||||
|
||||
/vm.reboot:
|
||||
put:
|
||||
summary: Reboot the VM instance.
|
||||
operationId: rebootVM
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance successfully rebooted.
|
||||
404:
|
||||
description: The VM instance could not reboot because it is not created.
|
||||
405:
|
||||
description: The VM instance could not reboot because it is not booted.
|
||||
|
||||
/vm.resize:
|
||||
put:
|
||||
summary: Resize the VM
|
||||
requestBody:
|
||||
description: The target size for the VM
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmResize'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance was successfully resized.
|
||||
404:
|
||||
description: The VM instance could not be resized because it is not created.
|
||||
|
||||
/vm.add-device:
|
||||
put:
|
||||
summary: Add a new device to the VM
|
||||
requestBody:
|
||||
description: The path of the new device
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmAddDevice'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The new device was successfully added to the VM instance.
|
||||
404:
|
||||
description: The new device could not be added to the VM instance.
|
||||
|
||||
/vm.remove-device:
|
||||
put:
|
||||
summary: Remove a device from the VM
|
||||
requestBody:
|
||||
description: The identifier of the device
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmRemoveDevice'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The device was successfully removed from the VM instance.
|
||||
404:
|
||||
description: The device could not be removed from the VM instance.
|
||||
|
||||
/vm.add-disk:
|
||||
put:
|
||||
summary: Add a new disk to the VM
|
||||
requestBody:
|
||||
description: The details of the new disk
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DiskConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The new disk was successfully added to the VM instance.
|
||||
500:
|
||||
description: The new disk could not be added to the VM instance.
|
||||
|
||||
/vm.add-pmem:
|
||||
put:
|
||||
summary: Add a new pmem device to the VM
|
||||
requestBody:
|
||||
description: The details of the new pmem device
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PmemConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The new device was successfully added to the VM instance.
|
||||
500:
|
||||
description: The new device could not be added to the VM instance.
|
||||
|
||||
/vm.add-net:
|
||||
put:
|
||||
summary: Add a new network device to the VM
|
||||
requestBody:
|
||||
description: The details of the new network device
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NetConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The new device was successfully added to the VM instance.
|
||||
500:
|
||||
description: The new device could not be added to the VM instance.
|
||||
|
||||
/vm.snapshot:
|
||||
put:
|
||||
summary: Returns a VM snapshot.
|
||||
requestBody:
|
||||
description: The snapshot configuration
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VmSnapshotConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance was successfully snapshotted.
|
||||
404:
|
||||
description: The VM instance could not be snapshotted because it is not created.
|
||||
405:
|
||||
description: The VM instance could not be snapshotted because it is not booted.
|
||||
|
||||
/vm.restore:
|
||||
put:
|
||||
summary: Restore a VM from a snapshot.
|
||||
requestBody:
|
||||
description: The restore configuration
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RestoreConfig'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: The VM instance was successfully restored.
|
||||
404:
|
||||
description: The VM instance could not be restored because it is already created.
|
||||
|
||||
components:
|
||||
schemas:
|
||||
|
||||
VmmPingResponse:
|
||||
required:
|
||||
- version
|
||||
type: object
|
||||
properties:
|
||||
version:
|
||||
type: string
|
||||
description: Virtual Machine Monitor information
|
||||
|
||||
VmInfo:
|
||||
required:
|
||||
- config
|
||||
- state
|
||||
type: object
|
||||
properties:
|
||||
config:
|
||||
$ref: '#/components/schemas/VmConfig'
|
||||
state:
|
||||
type: string
|
||||
enum: [Created, Running, Shutdown, Paused]
|
||||
description: Virtual Machine information
|
||||
|
||||
VmConfig:
|
||||
required:
|
||||
- kernel
|
||||
- cmdline
|
||||
type: object
|
||||
properties:
|
||||
cpus:
|
||||
$ref: '#/components/schemas/CpusConfig'
|
||||
memory:
|
||||
$ref: '#/components/schemas/MemoryConfig'
|
||||
kernel:
|
||||
$ref: '#/components/schemas/KernelConfig'
|
||||
initramfs:
|
||||
$ref: '#/components/schemas/InitramfsConfig'
|
||||
cmdline:
|
||||
$ref: '#/components/schemas/CmdLineConfig'
|
||||
disks:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DiskConfig'
|
||||
net:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/NetConfig'
|
||||
rng:
|
||||
$ref: '#/components/schemas/RngConfig'
|
||||
fs:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/FsConfig'
|
||||
pmem:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/PmemConfig'
|
||||
serial:
|
||||
$ref: '#/components/schemas/ConsoleConfig'
|
||||
console:
|
||||
$ref: '#/components/schemas/ConsoleConfig'
|
||||
devices:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DeviceConfig'
|
||||
vsock:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/VsockConfig'
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
description: Virtual machine configuration
|
||||
|
||||
CpusConfig:
|
||||
required:
|
||||
- boot_vcpus
|
||||
- max_vcpus
|
||||
type: object
|
||||
properties:
|
||||
boot_vcpus:
|
||||
minimum: 1
|
||||
default: 1
|
||||
type: integer
|
||||
max_vcpus:
|
||||
minimum: 1
|
||||
default: 1
|
||||
type: integer
|
||||
|
||||
MemoryConfig:
|
||||
required:
|
||||
- size
|
||||
type: object
|
||||
properties:
|
||||
size:
|
||||
type: integer
|
||||
format: int64
|
||||
default: 512 MB
|
||||
hotplug_size:
|
||||
type: integer
|
||||
format: int64
|
||||
file:
|
||||
type: string
|
||||
mergeable:
|
||||
type: boolean
|
||||
default: false
|
||||
hotplug_method:
|
||||
type: string
|
||||
default: "acpi"
|
||||
|
||||
KernelConfig:
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
|
||||
InitramfsConfig:
|
||||
nullable: true
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
|
||||
CmdLineConfig:
|
||||
required:
|
||||
- args
|
||||
type: object
|
||||
properties:
|
||||
args:
|
||||
type: string
|
||||
|
||||
DiskConfig:
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
readonly:
|
||||
type: boolean
|
||||
default: false
|
||||
direct:
|
||||
type: boolean
|
||||
default: false
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
num_queues:
|
||||
type: integer
|
||||
default: 1
|
||||
queue_size:
|
||||
type: integer
|
||||
default: 128
|
||||
vhost_user:
|
||||
type: boolean
|
||||
default: false
|
||||
vhost_socket:
|
||||
type: string
|
||||
wce:
|
||||
type: boolean
|
||||
default: true
|
||||
poll_queue:
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
NetConfig:
|
||||
type: object
|
||||
properties:
|
||||
tap:
|
||||
type: string
|
||||
default: ""
|
||||
ip:
|
||||
type: string
|
||||
default: "192.168.249.1"
|
||||
mask:
|
||||
type: string
|
||||
default: "255.255.255.0"
|
||||
mac:
|
||||
type: string
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
num_queues:
|
||||
type: integer
|
||||
default: 2
|
||||
queue_size:
|
||||
type: integer
|
||||
default: 256
|
||||
vhost_user:
|
||||
type: boolean
|
||||
default: false
|
||||
vhost_socket:
|
||||
type: string
|
||||
|
||||
RngConfig:
|
||||
required:
|
||||
- src
|
||||
type: object
|
||||
properties:
|
||||
src:
|
||||
type: string
|
||||
default: "/dev/urandom"
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
FsConfig:
|
||||
required:
|
||||
- tag
|
||||
- sock
|
||||
type: object
|
||||
properties:
|
||||
tag:
|
||||
type: string
|
||||
sock:
|
||||
type: string
|
||||
num_queues:
|
||||
type: integer
|
||||
default: 1
|
||||
queue_size:
|
||||
type: integer
|
||||
default: 1024
|
||||
dax:
|
||||
type: boolean
|
||||
default: true
|
||||
cache_size:
|
||||
type: integer
|
||||
format: int64
|
||||
default: 8589934592
|
||||
|
||||
PmemConfig:
|
||||
required:
|
||||
- file
|
||||
- size
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
size:
|
||||
type: integer
|
||||
format: int64
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
mergeable:
|
||||
type: boolean
|
||||
default: false
|
||||
discard_writes:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
ConsoleConfig:
|
||||
required:
|
||||
- mode
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
mode:
|
||||
type: string
|
||||
enum: [Off, Tty, File, Null]
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
DeviceConfig:
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
id:
|
||||
type: string
|
||||
|
||||
VsockConfig:
|
||||
required:
|
||||
- cid
|
||||
- sock
|
||||
type: object
|
||||
properties:
|
||||
cid:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 3
|
||||
description: Guest Vsock CID
|
||||
sock:
|
||||
type: string
|
||||
description: Path to UNIX domain socket, used to proxy vsock connections.
|
||||
iommu:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
VmResize:
|
||||
type: object
|
||||
properties:
|
||||
desired_vcpus:
|
||||
minimum: 1
|
||||
type: integer
|
||||
desired_ram:
|
||||
description: desired memory ram in bytes
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
VmAddDevice:
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
|
||||
VmRemoveDevice:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
|
||||
VmSnapshotConfig:
|
||||
type: object
|
||||
properties:
|
||||
destination_url:
|
||||
type: string
|
||||
|
||||
RestoreConfig:
|
||||
required:
|
||||
- source_url
|
||||
type: object
|
||||
properties:
|
||||
source_url:
|
||||
type: string
|
||||
prefault:
|
||||
type: boolean
|
||||
Reference in New Issue
Block a user