Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 0.3.0
- Package version: 1.0.0
- Generator version: 7.12.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/contextPut the package under your project folder and add the following in import:
import chClient "github.com/Automata-Labs-team/cloud-hypervisor-go-sdk"To use a proxy, set the environment variable HTTP_PROXY:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value chClient.ContextServerIndex of type int.
ctx := context.WithValue(context.Background(), chClient.ContextServerIndex, 1)Templated server URL is formatted using default variables from configuration or from context value chClient.ContextServerVariables of type map[string]string.
ctx := context.WithValue(context.Background(), chClient.ContextServerVariables, map[string]string{
"basePath": "v2",
})Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers map in the Configuration.
An operation is uniquely identified by "{classname}Service.{nickname}" string.
Similar rules for overriding default operation server index and variables applies by using chClient.ContextOperationServerIndices and chClient.ContextOperationServerVariables context maps.
ctx := context.WithValue(context.Background(), chClient.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), chClient.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})All URIs are relative to http://localhost/api/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DefaultAPI | BootVM | Put /vm.boot | Boot the previously created VM instance. |
| DefaultAPI | CreateVM | Put /vm.create | Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created. |
| DefaultAPI | DeleteVM | Put /vm.delete | Delete the cloud-hypervisor Virtual Machine (VM) instance. |
| DefaultAPI | PauseVM | Put /vm.pause | Pause a previously booted VM instance. |
| DefaultAPI | PowerButtonVM | Put /vm.power-button | Trigger a power button in the VM |
| DefaultAPI | RebootVM | Put /vm.reboot | Reboot the VM instance. |
| DefaultAPI | ResumeVM | Put /vm.resume | Resume a previously paused VM instance. |
| DefaultAPI | ShutdownVM | Put /vm.shutdown | Shut the VM instance down. |
| DefaultAPI | ShutdownVMM | Put /vmm.shutdown | Shuts the cloud-hypervisor VMM. |
| DefaultAPI | VmAddDevicePut | Put /vm.add-device | Add a new device to the VM |
| DefaultAPI | VmAddDiskPut | Put /vm.add-disk | Add a new disk to the VM |
| DefaultAPI | VmAddFsPut | Put /vm.add-fs | Add a new virtio-fs device to the VM |
| DefaultAPI | VmAddNetPut | Put /vm.add-net | Add a new network device to the VM |
| DefaultAPI | VmAddPmemPut | Put /vm.add-pmem | Add a new pmem device to the VM |
| DefaultAPI | VmAddUserDevicePut | Put /vm.add-user-device | Add a new userspace device to the VM |
| DefaultAPI | VmAddVdpaPut | Put /vm.add-vdpa | Add a new vDPA device to the VM |
| DefaultAPI | VmAddVsockPut | Put /vm.add-vsock | Add a new vsock device to the VM |
| DefaultAPI | VmCoredumpPut | Put /vm.coredump | Takes a VM coredump. |
| DefaultAPI | VmCountersGet | Get /vm.counters | Get counters from the VM |
| DefaultAPI | VmInfoGet | Get /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. |
| DefaultAPI | VmReceiveMigrationPut | Put /vm.receive-migration | Receive a VM migration from URL |
| DefaultAPI | VmRemoveDevicePut | Put /vm.remove-device | Remove a device from the VM |
| DefaultAPI | VmResizePut | Put /vm.resize | Resize the VM |
| DefaultAPI | VmResizeZonePut | Put /vm.resize-zone | Resize a memory zone |
| DefaultAPI | VmRestorePut | Put /vm.restore | Restore a VM from a snapshot. |
| DefaultAPI | VmSendMigrationPut | Put /vm.send-migration | Send a VM migration to URL |
| DefaultAPI | VmSnapshotPut | Put /vm.snapshot | Returns a VM snapshot. |
| DefaultAPI | VmmNmiPut | Put /vmm.nmi | Inject an NMI. |
| DefaultAPI | VmmPingGet | Get /vmm.ping | Ping the VMM to check for API server availability |
- BalloonConfig
- ConsoleConfig
- CpuAffinity
- CpuFeatures
- CpuTopology
- CpusConfig
- DebugConsoleConfig
- DeviceConfig
- DeviceNode
- DiskConfig
- FsConfig
- LandlockConfig
- MemoryConfig
- MemoryZoneConfig
- NetConfig
- NumaConfig
- NumaDistance
- PayloadConfig
- PciDeviceInfo
- PciSegmentConfig
- PlatformConfig
- PmemConfig
- RateLimitGroupConfig
- RateLimiterConfig
- ReceiveMigrationData
- RestoreConfig
- RngConfig
- SendMigrationData
- SgxEpcConfig
- TokenBucket
- TpmConfig
- VdpaConfig
- VirtQueueAffinity
- VmAddUserDevice
- VmConfig
- VmCoredumpData
- VmInfo
- VmRemoveDevice
- VmResize
- VmResizeZone
- VmSnapshotConfig
- VmmPingResponse
- VsockConfig
Endpoints do not require authorization.
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime