mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
clh: generate client code
Generated using OpenAPITools/openapi-generator. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
dcac021637
commit
183622652a
24
virtcontainers/pkg/cloud-hypervisor/client/.gitignore
vendored
Normal file
24
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.2.2-SNAPSHOT
|
8
virtcontainers/pkg/cloud-hypervisor/client/.travis.yml
Normal file
8
virtcontainers/pkg/cloud-hypervisor/client/.travis.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
language: go
|
||||||
|
|
||||||
|
install:
|
||||||
|
- go get -d -v .
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go build -v ./
|
||||||
|
|
77
virtcontainers/pkg/cloud-hypervisor/client/README.md
Normal file
77
virtcontainers/pkg/cloud-hypervisor/client/README.md
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# 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* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||||
|
*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)
|
||||||
|
- [CpuConfig](docs/CpuConfig.md)
|
||||||
|
- [DeviceConfig](docs/DeviceConfig.md)
|
||||||
|
- [DiskConfig](docs/DiskConfig.md)
|
||||||
|
- [FsConfig](docs/FsConfig.md)
|
||||||
|
- [KernelConfig](docs/KernelConfig.md)
|
||||||
|
- [MemoryConfig](docs/MemoryConfig.md)
|
||||||
|
- [NetConfig](docs/NetConfig.md)
|
||||||
|
- [PmemConfig](docs/PmemConfig.md)
|
||||||
|
- [RngConfig](docs/RngConfig.md)
|
||||||
|
- [VhostUserBlkConfig](docs/VhostUserBlkConfig.md)
|
||||||
|
- [VhostUserConfig](docs/VhostUserConfig.md)
|
||||||
|
- [VhostUserNetConfig](docs/VhostUserNetConfig.md)
|
||||||
|
- [VmConfig](docs/VmConfig.md)
|
||||||
|
- [VmInfo](docs/VmInfo.md)
|
||||||
|
- [VmmPingResponse](docs/VmmPingResponse.md)
|
||||||
|
- [VsockConfig](docs/VsockConfig.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Authorization
|
||||||
|
|
||||||
|
Endpoints do not require authorization.
|
||||||
|
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
634
virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml
Normal file
634
virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml
Normal file
@ -0,0 +1,634 @@
|
|||||||
|
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.
|
||||||
|
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: 6
|
||||||
|
disks:
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
cpus:
|
||||||
|
cpu_count: 1
|
||||||
|
devices:
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
kernel:
|
||||||
|
path: path
|
||||||
|
vhost_user_blk:
|
||||||
|
- wce: true
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
- wce: true
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
rng:
|
||||||
|
iommu: false
|
||||||
|
src: /dev/urandom
|
||||||
|
fs:
|
||||||
|
- sock: sock
|
||||||
|
num_queues: 1
|
||||||
|
queue_size: 5
|
||||||
|
cache_size: 5
|
||||||
|
tag: tag
|
||||||
|
- sock: sock
|
||||||
|
num_queues: 1
|
||||||
|
queue_size: 5
|
||||||
|
cache_size: 5
|
||||||
|
tag: tag
|
||||||
|
vhost_user_net:
|
||||||
|
- vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
mac: mac
|
||||||
|
- vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
mac: mac
|
||||||
|
vsock:
|
||||||
|
- sock: sock
|
||||||
|
iommu: false
|
||||||
|
cid: 3
|
||||||
|
- sock: sock
|
||||||
|
iommu: false
|
||||||
|
cid: 3
|
||||||
|
pmem:
|
||||||
|
- mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 2
|
||||||
|
iommu: false
|
||||||
|
- mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 2
|
||||||
|
iommu: false
|
||||||
|
cmdline:
|
||||||
|
args: args
|
||||||
|
iommu: false
|
||||||
|
serial:
|
||||||
|
mode: "false"
|
||||||
|
file: file
|
||||||
|
iommu: false
|
||||||
|
net:
|
||||||
|
- tap: tap
|
||||||
|
iommu: false
|
||||||
|
ip: ip
|
||||||
|
mac: mac
|
||||||
|
mask: mask
|
||||||
|
- tap: tap
|
||||||
|
iommu: false
|
||||||
|
ip: ip
|
||||||
|
mac: mac
|
||||||
|
mask: mask
|
||||||
|
properties:
|
||||||
|
config:
|
||||||
|
$ref: '#/components/schemas/VmConfig'
|
||||||
|
state:
|
||||||
|
enum:
|
||||||
|
- Created
|
||||||
|
- Booted
|
||||||
|
- Shutdown
|
||||||
|
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: 6
|
||||||
|
disks:
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
cpus:
|
||||||
|
cpu_count: 1
|
||||||
|
devices:
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
- path: path
|
||||||
|
iommu: false
|
||||||
|
kernel:
|
||||||
|
path: path
|
||||||
|
vhost_user_blk:
|
||||||
|
- wce: true
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
- wce: true
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
rng:
|
||||||
|
iommu: false
|
||||||
|
src: /dev/urandom
|
||||||
|
fs:
|
||||||
|
- sock: sock
|
||||||
|
num_queues: 1
|
||||||
|
queue_size: 5
|
||||||
|
cache_size: 5
|
||||||
|
tag: tag
|
||||||
|
- sock: sock
|
||||||
|
num_queues: 1
|
||||||
|
queue_size: 5
|
||||||
|
cache_size: 5
|
||||||
|
tag: tag
|
||||||
|
vhost_user_net:
|
||||||
|
- vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
mac: mac
|
||||||
|
- vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
mac: mac
|
||||||
|
vsock:
|
||||||
|
- sock: sock
|
||||||
|
iommu: false
|
||||||
|
cid: 3
|
||||||
|
- sock: sock
|
||||||
|
iommu: false
|
||||||
|
cid: 3
|
||||||
|
pmem:
|
||||||
|
- mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 2
|
||||||
|
iommu: false
|
||||||
|
- mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 2
|
||||||
|
iommu: false
|
||||||
|
cmdline:
|
||||||
|
args: args
|
||||||
|
iommu: false
|
||||||
|
serial:
|
||||||
|
mode: "false"
|
||||||
|
file: file
|
||||||
|
iommu: false
|
||||||
|
net:
|
||||||
|
- tap: tap
|
||||||
|
iommu: false
|
||||||
|
ip: ip
|
||||||
|
mac: mac
|
||||||
|
mask: mask
|
||||||
|
- tap: tap
|
||||||
|
iommu: false
|
||||||
|
ip: ip
|
||||||
|
mac: mac
|
||||||
|
mask: mask
|
||||||
|
properties:
|
||||||
|
cpus:
|
||||||
|
$ref: '#/components/schemas/CpuConfig'
|
||||||
|
memory:
|
||||||
|
$ref: '#/components/schemas/MemoryConfig'
|
||||||
|
kernel:
|
||||||
|
$ref: '#/components/schemas/KernelConfig'
|
||||||
|
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
|
||||||
|
vhost_user_net:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VhostUserNetConfig'
|
||||||
|
type: array
|
||||||
|
vhost_user_blk:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VhostUserBlkConfig'
|
||||||
|
type: array
|
||||||
|
vsock:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/VsockConfig'
|
||||||
|
type: array
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- cmdline
|
||||||
|
- kernel
|
||||||
|
type: object
|
||||||
|
CpuConfig:
|
||||||
|
example:
|
||||||
|
cpu_count: 1
|
||||||
|
properties:
|
||||||
|
cpu_count:
|
||||||
|
default: 1
|
||||||
|
minimum: 1
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- cpu_count
|
||||||
|
type: object
|
||||||
|
MemoryConfig:
|
||||||
|
example:
|
||||||
|
mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 6
|
||||||
|
properties:
|
||||||
|
size:
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
mergeable:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- size
|
||||||
|
type: object
|
||||||
|
KernelConfig:
|
||||||
|
example:
|
||||||
|
path: path
|
||||||
|
properties:
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- path
|
||||||
|
type: object
|
||||||
|
CmdLineConfig:
|
||||||
|
example:
|
||||||
|
args: args
|
||||||
|
properties:
|
||||||
|
args:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- args
|
||||||
|
type: object
|
||||||
|
DiskConfig:
|
||||||
|
example:
|
||||||
|
path: path
|
||||||
|
iommu: false
|
||||||
|
properties:
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- path
|
||||||
|
type: object
|
||||||
|
NetConfig:
|
||||||
|
example:
|
||||||
|
tap: tap
|
||||||
|
iommu: false
|
||||||
|
ip: ip
|
||||||
|
mac: mac
|
||||||
|
mask: mask
|
||||||
|
properties:
|
||||||
|
tap:
|
||||||
|
type: string
|
||||||
|
ip:
|
||||||
|
type: string
|
||||||
|
mask:
|
||||||
|
type: string
|
||||||
|
mac:
|
||||||
|
type: string
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- ip
|
||||||
|
- mac
|
||||||
|
- mask
|
||||||
|
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: 1
|
||||||
|
queue_size: 5
|
||||||
|
cache_size: 5
|
||||||
|
tag: tag
|
||||||
|
properties:
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
sock:
|
||||||
|
type: string
|
||||||
|
num_queues:
|
||||||
|
type: integer
|
||||||
|
queue_size:
|
||||||
|
type: integer
|
||||||
|
cache_size:
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- num_queues
|
||||||
|
- queue_size
|
||||||
|
- sock
|
||||||
|
- tag
|
||||||
|
type: object
|
||||||
|
PmemConfig:
|
||||||
|
example:
|
||||||
|
mergeable: false
|
||||||
|
file: file
|
||||||
|
size: 2
|
||||||
|
iommu: false
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
size:
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
mergeable:
|
||||||
|
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
|
||||||
|
- None
|
||||||
|
type: string
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- mode
|
||||||
|
type: object
|
||||||
|
DeviceConfig:
|
||||||
|
example:
|
||||||
|
path: path
|
||||||
|
iommu: false
|
||||||
|
properties:
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
iommu:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- path
|
||||||
|
type: object
|
||||||
|
VhostUserConfig:
|
||||||
|
example:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
properties:
|
||||||
|
sock:
|
||||||
|
type: string
|
||||||
|
num_queues:
|
||||||
|
type: integer
|
||||||
|
queue:size:
|
||||||
|
type: integer
|
||||||
|
required:
|
||||||
|
- num_queues
|
||||||
|
- queue_size
|
||||||
|
- sock
|
||||||
|
type: object
|
||||||
|
VhostUserNetConfig:
|
||||||
|
example:
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
mac: mac
|
||||||
|
properties:
|
||||||
|
mac:
|
||||||
|
type: string
|
||||||
|
vu_cfg:
|
||||||
|
$ref: '#/components/schemas/VhostUserConfig'
|
||||||
|
required:
|
||||||
|
- mac
|
||||||
|
- vu_cfg
|
||||||
|
type: object
|
||||||
|
VhostUserBlkConfig:
|
||||||
|
example:
|
||||||
|
wce: true
|
||||||
|
vu_cfg:
|
||||||
|
sock: sock
|
||||||
|
num_queues: 7
|
||||||
|
queue:size: 9
|
||||||
|
properties:
|
||||||
|
wce:
|
||||||
|
type: boolean
|
||||||
|
vu_cfg:
|
||||||
|
$ref: '#/components/schemas/VhostUserConfig'
|
||||||
|
required:
|
||||||
|
- vu_cfg
|
||||||
|
- wce
|
||||||
|
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
|
708
virtcontainers/pkg/cloud-hypervisor/client/api_default.go
Normal file
708
virtcontainers/pkg/cloud-hypervisor/client/api_default.go
Normal file
@ -0,0 +1,708 @@
|
|||||||
|
/*
|
||||||
|
* 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 (
|
||||||
|
_context "context"
|
||||||
|
_ioutil "io/ioutil"
|
||||||
|
_nethttp "net/http"
|
||||||
|
_neturl "net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ _context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultApiService DefaultApi service
|
||||||
|
type DefaultApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
BootVM Boot the previously created VM instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) BootVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.boot"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CreateVM Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param vmConfig The VM configuration
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) CreateVM(ctx _context.Context, vmConfig VmConfig) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.create"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &vmConfig
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeleteVM Delete the cloud-hypervisor Virtual Machine (VM) instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) DeleteVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.delete"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PauseVM Pause a previously booted VM instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) PauseVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.pause"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
RebootVM Reboot the VM instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) RebootVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.reboot"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ResumeVM Resume a previously paused VM instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) ResumeVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.resume"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShutdownVM Shut the VM instance down.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) ShutdownVM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.shutdown"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShutdownVMM Shuts the cloud-hypervisor VMM.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) (*_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vmm.shutdown"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
VmInfoGet Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
@return VmInfo
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) VmInfoGet(ctx _context.Context) (VmInfo, *_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue VmInfo
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vm.info"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||||||
|
var v VmInfo
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
VmmPingGet Ping the VMM to check for API server availability
|
||||||
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
@return VmmPingResponse
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) VmmPingGet(ctx _context.Context) (VmmPingResponse, *_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue VmmPingResponse
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/vmm.ping"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHTTPContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
if localVarHTTPContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||||
|
if localVarHTTPHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHTTPResponse.StatusCode == 200 {
|
||||||
|
var v VmmPingResponse
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||||||
|
}
|
508
virtcontainers/pkg/cloud-hypervisor/client/client.go
Normal file
508
virtcontainers/pkg/cloud-hypervisor/client/client.go
Normal file
@ -0,0 +1,508 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
"mime/multipart"
|
||||||
|
"net/http"
|
||||||
|
"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) {
|
||||||
|
return c.cfg.HTTPClient.Do(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
75
virtcontainers/pkg/cloud-hypervisor/client/configuration.go
Normal file
75
virtcontainers/pkg/cloud-hypervisor/client/configuration.go
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
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",
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
@ -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)
|
||||||
|
|
||||||
|
|
11
virtcontainers/pkg/cloud-hypervisor/client/docs/CpuConfig.md
Normal file
11
virtcontainers/pkg/cloud-hypervisor/client/docs/CpuConfig.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# CpuConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**CpuCount** | **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)
|
||||||
|
|
||||||
|
|
302
virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md
Normal file
302
virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
# \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.
|
||||||
|
[**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
|
||||||
|
[**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)
|
||||||
|
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
|
||||||
|
## 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,12 @@
|
|||||||
|
# DeviceConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Path** | **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 @@
|
|||||||
|
# DiskConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Path** | **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)
|
||||||
|
|
||||||
|
|
15
virtcontainers/pkg/cloud-hypervisor/client/docs/FsConfig.md
Normal file
15
virtcontainers/pkg/cloud-hypervisor/client/docs/FsConfig.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# FsConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Tag** | **string** | |
|
||||||
|
**Sock** | **string** | |
|
||||||
|
**NumQueues** | **int32** | |
|
||||||
|
**QueueSize** | **int32** | |
|
||||||
|
**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 @@
|
|||||||
|
# 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,13 @@
|
|||||||
|
# MemoryConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Size** | **int64** | |
|
||||||
|
**File** | **string** | | [optional]
|
||||||
|
**Mergeable** | **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)
|
||||||
|
|
||||||
|
|
15
virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md
Normal file
15
virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# NetConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Tap** | **string** | | [optional]
|
||||||
|
**Ip** | **string** | |
|
||||||
|
**Mask** | **string** | |
|
||||||
|
**Mac** | **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,14 @@
|
|||||||
|
# PmemConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**File** | **string** | |
|
||||||
|
**Size** | **int64** | |
|
||||||
|
**Iommu** | **bool** | | [optional] [default to false]
|
||||||
|
**Mergeable** | **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)
|
||||||
|
|
||||||
|
|
12
virtcontainers/pkg/cloud-hypervisor/client/docs/RngConfig.md
Normal file
12
virtcontainers/pkg/cloud-hypervisor/client/docs/RngConfig.md
Normal file
@ -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,12 @@
|
|||||||
|
# VhostUserBlkConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Wce** | **bool** | |
|
||||||
|
**VuCfg** | [**VhostUserConfig**](VhostUserConfig.md) | |
|
||||||
|
|
||||||
|
[[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 @@
|
|||||||
|
# VhostUserConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Sock** | **string** | |
|
||||||
|
**NumQueues** | **int32** | |
|
||||||
|
**Queuesize** | **int32** | | [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 @@
|
|||||||
|
# VhostUserNetConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Mac** | **string** | |
|
||||||
|
**VuCfg** | [**VhostUserConfig**](VhostUserConfig.md) | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
26
virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md
Normal file
26
virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# VmConfig
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Cpus** | [**CpuConfig**](CpuConfig.md) | | [optional]
|
||||||
|
**Memory** | [**MemoryConfig**](MemoryConfig.md) | | [optional]
|
||||||
|
**Kernel** | [**KernelConfig**](KernelConfig.md) | |
|
||||||
|
**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]
|
||||||
|
**VhostUserNet** | [**[]VhostUserNetConfig**](VhostUserNetConfig.md) | | [optional]
|
||||||
|
**VhostUserBlk** | [**[]VhostUserBlkConfig**](VhostUserBlkConfig.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)
|
||||||
|
|
||||||
|
|
12
virtcontainers/pkg/cloud-hypervisor/client/docs/VmInfo.md
Normal file
12
virtcontainers/pkg/cloud-hypervisor/client/docs/VmInfo.md
Normal file
@ -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 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
|
58
virtcontainers/pkg/cloud-hypervisor/client/git_push.sh
Normal file
58
virtcontainers/pkg/cloud-hypervisor/client/git_push.sh
Normal file
@ -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'
|
||||||
|
|
6
virtcontainers/pkg/cloud-hypervisor/client/go.mod
Normal file
6
virtcontainers/pkg/cloud-hypervisor/client/go.mod
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
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
|
||||||
|
)
|
15
virtcontainers/pkg/cloud-hypervisor/client/go.sum
Normal file
15
virtcontainers/pkg/cloud-hypervisor/client/go.sum
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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/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,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
|
||||||
|
// CpuConfig struct for CpuConfig
|
||||||
|
type CpuConfig struct {
|
||||||
|
CpuCount int32 `json:"cpu_count"`
|
||||||
|
}
|
@ -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
|
||||||
|
// DeviceConfig struct for DeviceConfig
|
||||||
|
type DeviceConfig struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
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
|
||||||
|
// DiskConfig struct for DiskConfig
|
||||||
|
type DiskConfig struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Iommu bool `json:"iommu,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
|
||||||
|
// FsConfig struct for FsConfig
|
||||||
|
type FsConfig struct {
|
||||||
|
Tag string `json:"tag"`
|
||||||
|
Sock string `json:"sock"`
|
||||||
|
NumQueues int32 `json:"num_queues"`
|
||||||
|
QueueSize int32 `json:"queue_size"`
|
||||||
|
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
|
||||||
|
// KernelConfig struct for KernelConfig
|
||||||
|
type KernelConfig struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
}
|
@ -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
|
||||||
|
// MemoryConfig struct for MemoryConfig
|
||||||
|
type MemoryConfig struct {
|
||||||
|
Size int64 `json:"size"`
|
||||||
|
File string `json:"file,omitempty"`
|
||||||
|
Mergeable bool `json:"mergeable,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
|
||||||
|
// NetConfig struct for NetConfig
|
||||||
|
type NetConfig struct {
|
||||||
|
Tap string `json:"tap,omitempty"`
|
||||||
|
Ip string `json:"ip"`
|
||||||
|
Mask string `json:"mask"`
|
||||||
|
Mac string `json:"mac"`
|
||||||
|
Iommu bool `json:"iommu,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* 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"`
|
||||||
|
}
|
@ -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,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
|
||||||
|
// VhostUserBlkConfig struct for VhostUserBlkConfig
|
||||||
|
type VhostUserBlkConfig struct {
|
||||||
|
Wce bool `json:"wce"`
|
||||||
|
VuCfg VhostUserConfig `json:"vu_cfg"`
|
||||||
|
}
|
@ -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
|
||||||
|
// VhostUserConfig struct for VhostUserConfig
|
||||||
|
type VhostUserConfig struct {
|
||||||
|
Sock string `json:"sock"`
|
||||||
|
NumQueues int32 `json:"num_queues"`
|
||||||
|
Queuesize int32 `json:"queue:size,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
|
||||||
|
// VhostUserNetConfig struct for VhostUserNetConfig
|
||||||
|
type VhostUserNetConfig struct {
|
||||||
|
Mac string `json:"mac"`
|
||||||
|
VuCfg VhostUserConfig `json:"vu_cfg"`
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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 CpuConfig `json:"cpus,omitempty"`
|
||||||
|
Memory MemoryConfig `json:"memory,omitempty"`
|
||||||
|
Kernel KernelConfig `json:"kernel"`
|
||||||
|
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"`
|
||||||
|
VhostUserNet []VhostUserNetConfig `json:"vhost_user_net,omitempty"`
|
||||||
|
VhostUserBlk []VhostUserBlkConfig `json:"vhost_user_blk,omitempty"`
|
||||||
|
Vsock []VsockConfig `json:"vsock,omitempty"`
|
||||||
|
Iommu bool `json:"iommu,omitempty"`
|
||||||
|
}
|
15
virtcontainers/pkg/cloud-hypervisor/client/model_vm_info.go
Normal file
15
virtcontainers/pkg/cloud-hypervisor/client/model_vm_info.go
Normal file
@ -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
|
||||||
|
// 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"`
|
||||||
|
}
|
46
virtcontainers/pkg/cloud-hypervisor/client/response.go
Normal file
46
virtcontainers/pkg/cloud-hypervisor/client/response.go
Normal file
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user