mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
virtcontainers/fc: Upgrade Firecracker to v0.23.1
This patch upgrades Firecracker version from v0.21.1 to v0.23.1 * Generate swagger models for v0.23.1 (from firecracker.yaml) * Change uint64 types in TokenBucket object according to rate-limiter implementation (introduced in commit #cfeb966) * Update Firecracker Logger/Metrics to support the new API * Update payload in fc.vmRunning to support the new API * Add Metrics type to fcConfig Fixes: #1518 Signed-off-by: Orestis Lagkas Nikolos <olagkasn@nubificus.co.uk>
This commit is contained in:
parent
9c8e95c820
commit
6255cc1959
@ -273,20 +273,8 @@ func (fc *firecracker) vmRunning(ctx context.Context) bool {
|
||||
fc.Logger().WithError(err).Error("getting vm status failed")
|
||||
return false
|
||||
}
|
||||
|
||||
// Be explicit
|
||||
switch *resp.Payload.State {
|
||||
case models.InstanceInfoStateStarting:
|
||||
// Unsure what we should do here
|
||||
fc.Logger().WithField("unexpected-state", models.InstanceInfoStateStarting).Debug("vmRunning")
|
||||
return false
|
||||
case models.InstanceInfoStateRunning:
|
||||
return true
|
||||
case models.InstanceInfoStateUninitialized:
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
// The current state of the Firecracker instance (swagger:model InstanceInfo)
|
||||
return resp.Payload.Started
|
||||
}
|
||||
|
||||
func (fc *firecracker) getVersionNumber() (string, error) {
|
||||
@ -302,7 +290,7 @@ func (fc *firecracker) getVersionNumber() (string, error) {
|
||||
fields := strings.Split(string(data), " ")
|
||||
if len(fields) > 1 {
|
||||
// The output format of `Firecracker --verion` is as follows
|
||||
// Firecracker v0.21.1
|
||||
// Firecracker v0.23.1
|
||||
version = strings.TrimPrefix(strings.TrimSpace(fields[1]), "v")
|
||||
return version, nil
|
||||
}
|
||||
@ -612,16 +600,26 @@ func (fc *firecracker) fcSetLogger(ctx context.Context) error {
|
||||
return fmt.Errorf("Failed setting log: %s", err)
|
||||
}
|
||||
|
||||
fc.fcConfig.Logger = &models.Logger{
|
||||
Level: &fcLogLevel,
|
||||
LogPath: &jailedLogFifo,
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (fc *firecracker) fcSetMetrics(ctx context.Context) error {
|
||||
span, _ := fc.trace(ctx, "fcSetMetrics")
|
||||
defer span.End()
|
||||
|
||||
// listen to metrics file and transfer error info
|
||||
jailedMetricsFifo, err := fc.fcListenToFifo(fcMetricsFifo, fc.updateMetrics)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed setting log: %s", err)
|
||||
}
|
||||
|
||||
fc.fcConfig.Logger = &models.Logger{
|
||||
Level: &fcLogLevel,
|
||||
LogFifo: &jailedLogFifo,
|
||||
MetricsFifo: &jailedMetricsFifo,
|
||||
fc.fcConfig.Metrics = &models.Metrics{
|
||||
MetricsPath: &jailedMetricsFifo,
|
||||
}
|
||||
|
||||
return err
|
||||
@ -745,6 +743,10 @@ func (fc *firecracker) fcInitConfiguration(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fc.fcSetMetrics(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fc.state.set(cfReady)
|
||||
for _, d := range fc.pendingDevices {
|
||||
if err := fc.addDevice(ctx, d.dev, d.devType); err != nil {
|
||||
|
@ -20,6 +20,9 @@ type BootSource struct {
|
||||
// Kernel boot arguments
|
||||
BootArgs string `json:"boot_args,omitempty"`
|
||||
|
||||
// Host level path to the initrd image used to boot the guest
|
||||
InitrdPath string `json:"initrd_path,omitempty"`
|
||||
|
||||
// Host level path to the kernel image used to boot the guest
|
||||
// Required: true
|
||||
KernelImagePath *string `json:"kernel_image_path"`
|
||||
|
@ -6,8 +6,6 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@ -19,14 +17,15 @@ import (
|
||||
// swagger:model InstanceInfo
|
||||
type InstanceInfo struct {
|
||||
|
||||
// Application name.
|
||||
AppName string `json:"app_name,omitempty"`
|
||||
|
||||
// MicroVM / instance ID.
|
||||
// Required: true
|
||||
ID *string `json:"id"`
|
||||
|
||||
// The current detailed state of the Firecracker instance. This value is read-only for the control-plane.
|
||||
// Required: true
|
||||
// Enum: [Uninitialized Starting Running]
|
||||
State *string `json:"state"`
|
||||
Started bool `json:"started,omitempty"`
|
||||
|
||||
// MicroVM hypervisor build version.
|
||||
// Required: true
|
||||
@ -41,10 +40,6 @@ func (m *InstanceInfo) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateState(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateVmmVersion(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@ -64,52 +59,6 @@ func (m *InstanceInfo) validateID(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var instanceInfoTypeStatePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["Uninitialized","Starting","Running"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
instanceInfoTypeStatePropEnum = append(instanceInfoTypeStatePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// InstanceInfoStateUninitialized captures enum value "Uninitialized"
|
||||
InstanceInfoStateUninitialized string = "Uninitialized"
|
||||
|
||||
// InstanceInfoStateStarting captures enum value "Starting"
|
||||
InstanceInfoStateStarting string = "Starting"
|
||||
|
||||
// InstanceInfoStateRunning captures enum value "Running"
|
||||
InstanceInfoStateRunning string = "Running"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *InstanceInfo) validateStateEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, instanceInfoTypeStatePropEnum); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *InstanceInfo) validateState(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("state", "body", m.State); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateStateEnum("state", "body", *m.State); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *InstanceInfo) validateVmmVersion(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("vmm_version", "body", m.VmmVersion); err != nil {
|
||||
|
@ -19,17 +19,13 @@ import (
|
||||
// swagger:model Logger
|
||||
type Logger struct {
|
||||
|
||||
// Set the level.
|
||||
// Set the level. The possible values are case-insensitive.
|
||||
// Enum: [Error Warning Info Debug]
|
||||
Level *string `json:"level,omitempty"`
|
||||
|
||||
// The named pipe for the human readable log output.
|
||||
// Path to the named pipe or file for the human readable log output.
|
||||
// Required: true
|
||||
LogFifo *string `json:"log_fifo"`
|
||||
|
||||
// The named pipe where the JSON-formatted metrics will be flushed.
|
||||
// Required: true
|
||||
MetricsFifo *string `json:"metrics_fifo"`
|
||||
LogPath *string `json:"log_path"`
|
||||
|
||||
// Whether or not to output the level in the logs.
|
||||
ShowLevel *bool `json:"show_level,omitempty"`
|
||||
@ -46,11 +42,7 @@ func (m *Logger) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateLogFifo(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMetricsFifo(formats); err != nil {
|
||||
if err := m.validateLogPath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@ -109,18 +101,9 @@ func (m *Logger) validateLevel(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Logger) validateLogFifo(formats strfmt.Registry) error {
|
||||
func (m *Logger) validateLogPath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("log_fifo", "body", m.LogFifo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Logger) validateMetricsFifo(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("metrics_fifo", "body", m.MetricsFifo); err != nil {
|
||||
if err := validate.Required("log_path", "body", m.LogPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ type MachineConfiguration struct {
|
||||
// Required: true
|
||||
MemSizeMib *int64 `json:"mem_size_mib"`
|
||||
|
||||
// Enable dirty page tracking. If this is enabled, then incremental guest memory snapshots can be created. These belong to diff snapshots, which contain, besides the microVM state, only the memory dirtied since a previous snapshot. Full snapshots each contain a full copy of the guest memory.
|
||||
TrackDirtyPages bool `json:"track_dirty_pages,omitempty"`
|
||||
|
||||
// Number of vCPUs (either 1 or an even number)
|
||||
// Required: true
|
||||
// Maximum: 32
|
||||
|
@ -0,0 +1,64 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Metrics Describes the configuration option for the metrics capability.
|
||||
// swagger:model Metrics
|
||||
type Metrics struct {
|
||||
|
||||
// Path to the named pipe or file where the JSON-formatted metrics are flushed.
|
||||
// Required: true
|
||||
MetricsPath *string `json:"metrics_path"`
|
||||
}
|
||||
|
||||
// Validate validates this metrics
|
||||
func (m *Metrics) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMetricsPath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Metrics) validateMetricsPath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("metrics_path", "body", m.MetricsPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Metrics) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Metrics) UnmarshalBinary(b []byte) error {
|
||||
var res Metrics
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// MmdsConfig Defines the MMDS configuration.
|
||||
// swagger:model MmdsConfig
|
||||
type MmdsConfig struct {
|
||||
|
||||
// A valid IPv4 link-local address.
|
||||
IPV4Address *string `json:"ipv4_address,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this mmds config
|
||||
func (m *MmdsConfig) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *MmdsConfig) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *MmdsConfig) UnmarshalBinary(b []byte) error {
|
||||
var res MmdsConfig
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// SnapshotCreateParams snapshot create params
|
||||
// swagger:model SnapshotCreateParams
|
||||
type SnapshotCreateParams struct {
|
||||
|
||||
// Path to the file that will contain the guest memory.
|
||||
// Required: true
|
||||
MemFilePath *string `json:"mem_file_path"`
|
||||
|
||||
// Path to the file that will contain the microVM state.
|
||||
// Required: true
|
||||
SnapshotPath *string `json:"snapshot_path"`
|
||||
|
||||
// Type of snapshot to create. It is optional and by default, a full snapshot is created.
|
||||
// Enum: [Full]
|
||||
SnapshotType string `json:"snapshot_type,omitempty"`
|
||||
|
||||
// The microVM version for which we want to create the snapshot. It is optional and it defaults to the current version.
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this snapshot create params
|
||||
func (m *SnapshotCreateParams) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMemFilePath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSnapshotPath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSnapshotType(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotCreateParams) validateMemFilePath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("mem_file_path", "body", m.MemFilePath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotCreateParams) validateSnapshotPath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("snapshot_path", "body", m.SnapshotPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var snapshotCreateParamsTypeSnapshotTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["Full"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
snapshotCreateParamsTypeSnapshotTypePropEnum = append(snapshotCreateParamsTypeSnapshotTypePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// SnapshotCreateParamsSnapshotTypeFull captures enum value "Full"
|
||||
SnapshotCreateParamsSnapshotTypeFull string = "Full"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *SnapshotCreateParams) validateSnapshotTypeEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, snapshotCreateParamsTypeSnapshotTypePropEnum); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotCreateParams) validateSnapshotType(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.SnapshotType) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateSnapshotTypeEnum("snapshot_type", "body", m.SnapshotType); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SnapshotCreateParams) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SnapshotCreateParams) UnmarshalBinary(b []byte) error {
|
||||
var res SnapshotCreateParams
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// SnapshotLoadParams snapshot load params
|
||||
// swagger:model SnapshotLoadParams
|
||||
type SnapshotLoadParams struct {
|
||||
|
||||
// Enable support for incremental (diff) snapshots by tracking dirty guest pages.
|
||||
EnableDiffSnapshots bool `json:"enable_diff_snapshots,omitempty"`
|
||||
|
||||
// Path to the file that contains the guest memory to be loaded.
|
||||
// Required: true
|
||||
MemFilePath *string `json:"mem_file_path"`
|
||||
|
||||
// Path to the file that contains the microVM state to be loaded.
|
||||
// Required: true
|
||||
SnapshotPath *string `json:"snapshot_path"`
|
||||
}
|
||||
|
||||
// Validate validates this snapshot load params
|
||||
func (m *SnapshotLoadParams) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMemFilePath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSnapshotPath(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotLoadParams) validateMemFilePath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("mem_file_path", "body", m.MemFilePath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotLoadParams) validateSnapshotPath(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("snapshot_path", "body", m.SnapshotPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SnapshotLoadParams) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SnapshotLoadParams) UnmarshalBinary(b []byte) error {
|
||||
var res SnapshotLoadParams
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
101
src/runtime/virtcontainers/pkg/firecracker/client/models/vm.go
Normal file
101
src/runtime/virtcontainers/pkg/firecracker/client/models/vm.go
Normal file
@ -0,0 +1,101 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// VM Defines the microVM running state. It is especially useful in the snapshotting context.
|
||||
// swagger:model Vm
|
||||
type VM struct {
|
||||
|
||||
// state
|
||||
// Required: true
|
||||
// Enum: [Paused Resumed]
|
||||
State *string `json:"state"`
|
||||
}
|
||||
|
||||
// Validate validates this Vm
|
||||
func (m *VM) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateState(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var vmTypeStatePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["Paused","Resumed"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
vmTypeStatePropEnum = append(vmTypeStatePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// VMStatePaused captures enum value "Paused"
|
||||
VMStatePaused string = "Paused"
|
||||
|
||||
// VMStateResumed captures enum value "Resumed"
|
||||
VMStateResumed string = "Resumed"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *VM) validateStateEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, vmTypeStatePropEnum); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *VM) validateState(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("state", "body", m.State); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateStateEnum("state", "body", *m.State); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *VM) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *VM) UnmarshalBinary(b []byte) error {
|
||||
var res VM
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// NewCreateSnapshotParams creates a new CreateSnapshotParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateSnapshotParams() *CreateSnapshotParams {
|
||||
var ()
|
||||
return &CreateSnapshotParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateSnapshotParamsWithTimeout creates a new CreateSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewCreateSnapshotParamsWithTimeout(timeout time.Duration) *CreateSnapshotParams {
|
||||
var ()
|
||||
return &CreateSnapshotParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateSnapshotParamsWithContext creates a new CreateSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewCreateSnapshotParamsWithContext(ctx context.Context) *CreateSnapshotParams {
|
||||
var ()
|
||||
return &CreateSnapshotParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateSnapshotParamsWithHTTPClient creates a new CreateSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewCreateSnapshotParamsWithHTTPClient(client *http.Client) *CreateSnapshotParams {
|
||||
var ()
|
||||
return &CreateSnapshotParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*CreateSnapshotParams contains all the parameters to send to the API endpoint
|
||||
for the create snapshot operation typically these are written to a http.Request
|
||||
*/
|
||||
type CreateSnapshotParams struct {
|
||||
|
||||
/*Body
|
||||
The configuration used for creating a snaphot.
|
||||
|
||||
*/
|
||||
Body *models.SnapshotCreateParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create snapshot params
|
||||
func (o *CreateSnapshotParams) WithTimeout(timeout time.Duration) *CreateSnapshotParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create snapshot params
|
||||
func (o *CreateSnapshotParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create snapshot params
|
||||
func (o *CreateSnapshotParams) WithContext(ctx context.Context) *CreateSnapshotParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create snapshot params
|
||||
func (o *CreateSnapshotParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create snapshot params
|
||||
func (o *CreateSnapshotParams) WithHTTPClient(client *http.Client) *CreateSnapshotParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create snapshot params
|
||||
func (o *CreateSnapshotParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create snapshot params
|
||||
func (o *CreateSnapshotParams) WithBody(body *models.SnapshotCreateParams) *CreateSnapshotParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create snapshot params
|
||||
func (o *CreateSnapshotParams) SetBody(body *models.SnapshotCreateParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// CreateSnapshotReader is a Reader for the CreateSnapshot structure.
|
||||
type CreateSnapshotReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
|
||||
case 204:
|
||||
result := NewCreateSnapshotNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewCreateSnapshotBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
result := NewCreateSnapshotDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateSnapshotNoContent creates a CreateSnapshotNoContent with default headers values
|
||||
func NewCreateSnapshotNoContent() *CreateSnapshotNoContent {
|
||||
return &CreateSnapshotNoContent{}
|
||||
}
|
||||
|
||||
/*CreateSnapshotNoContent handles this case with default header values.
|
||||
|
||||
Snapshot created
|
||||
*/
|
||||
type CreateSnapshotNoContent struct {
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotNoContent) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/create][%d] createSnapshotNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateSnapshotBadRequest creates a CreateSnapshotBadRequest with default headers values
|
||||
func NewCreateSnapshotBadRequest() *CreateSnapshotBadRequest {
|
||||
return &CreateSnapshotBadRequest{}
|
||||
}
|
||||
|
||||
/*CreateSnapshotBadRequest handles this case with default header values.
|
||||
|
||||
Snapshot cannot be created due to bad input
|
||||
*/
|
||||
type CreateSnapshotBadRequest struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/create][%d] createSnapshotBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateSnapshotDefault creates a CreateSnapshotDefault with default headers values
|
||||
func NewCreateSnapshotDefault(code int) *CreateSnapshotDefault {
|
||||
return &CreateSnapshotDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*CreateSnapshotDefault handles this case with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
type CreateSnapshotDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
// Code gets the status code for the create snapshot default response
|
||||
func (o *CreateSnapshotDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/create][%d] createSnapshot default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -32,8 +32,8 @@ func (o *GetMmdsReader) ReadResponse(response runtime.ClientResponse, consumer r
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewGetMmdsBadRequest()
|
||||
case 404:
|
||||
result := NewGetMmdsNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -78,24 +78,24 @@ func (o *GetMmdsOK) readResponse(response runtime.ClientResponse, consumer runti
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetMmdsBadRequest creates a GetMmdsBadRequest with default headers values
|
||||
func NewGetMmdsBadRequest() *GetMmdsBadRequest {
|
||||
return &GetMmdsBadRequest{}
|
||||
// NewGetMmdsNotFound creates a GetMmdsNotFound with default headers values
|
||||
func NewGetMmdsNotFound() *GetMmdsNotFound {
|
||||
return &GetMmdsNotFound{}
|
||||
}
|
||||
|
||||
/*GetMmdsBadRequest handles this case with default header values.
|
||||
/*GetMmdsNotFound handles this case with default header values.
|
||||
|
||||
Cannot get the MMDS data store due to bad input.
|
||||
The MMDS data store content can not be found.
|
||||
*/
|
||||
type GetMmdsBadRequest struct {
|
||||
type GetMmdsNotFound struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *GetMmdsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /mmds][%d] getMmdsBadRequest %+v", 400, o.Payload)
|
||||
func (o *GetMmdsNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /mmds][%d] getMmdsNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetMmdsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
func (o *GetMmdsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
|
@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// NewLoadSnapshotParams creates a new LoadSnapshotParams object
|
||||
// with the default values initialized.
|
||||
func NewLoadSnapshotParams() *LoadSnapshotParams {
|
||||
var ()
|
||||
return &LoadSnapshotParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoadSnapshotParamsWithTimeout creates a new LoadSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewLoadSnapshotParamsWithTimeout(timeout time.Duration) *LoadSnapshotParams {
|
||||
var ()
|
||||
return &LoadSnapshotParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoadSnapshotParamsWithContext creates a new LoadSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewLoadSnapshotParamsWithContext(ctx context.Context) *LoadSnapshotParams {
|
||||
var ()
|
||||
return &LoadSnapshotParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoadSnapshotParamsWithHTTPClient creates a new LoadSnapshotParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewLoadSnapshotParamsWithHTTPClient(client *http.Client) *LoadSnapshotParams {
|
||||
var ()
|
||||
return &LoadSnapshotParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*LoadSnapshotParams contains all the parameters to send to the API endpoint
|
||||
for the load snapshot operation typically these are written to a http.Request
|
||||
*/
|
||||
type LoadSnapshotParams struct {
|
||||
|
||||
/*Body
|
||||
The configuration used for loading a snaphot.
|
||||
|
||||
*/
|
||||
Body *models.SnapshotLoadParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the load snapshot params
|
||||
func (o *LoadSnapshotParams) WithTimeout(timeout time.Duration) *LoadSnapshotParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the load snapshot params
|
||||
func (o *LoadSnapshotParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the load snapshot params
|
||||
func (o *LoadSnapshotParams) WithContext(ctx context.Context) *LoadSnapshotParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the load snapshot params
|
||||
func (o *LoadSnapshotParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the load snapshot params
|
||||
func (o *LoadSnapshotParams) WithHTTPClient(client *http.Client) *LoadSnapshotParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the load snapshot params
|
||||
func (o *LoadSnapshotParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the load snapshot params
|
||||
func (o *LoadSnapshotParams) WithBody(body *models.SnapshotLoadParams) *LoadSnapshotParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the load snapshot params
|
||||
func (o *LoadSnapshotParams) SetBody(body *models.SnapshotLoadParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *LoadSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// LoadSnapshotReader is a Reader for the LoadSnapshot structure.
|
||||
type LoadSnapshotReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *LoadSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
|
||||
case 204:
|
||||
result := NewLoadSnapshotNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewLoadSnapshotBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
result := NewLoadSnapshotDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoadSnapshotNoContent creates a LoadSnapshotNoContent with default headers values
|
||||
func NewLoadSnapshotNoContent() *LoadSnapshotNoContent {
|
||||
return &LoadSnapshotNoContent{}
|
||||
}
|
||||
|
||||
/*LoadSnapshotNoContent handles this case with default header values.
|
||||
|
||||
Snapshot loaded
|
||||
*/
|
||||
type LoadSnapshotNoContent struct {
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotNoContent) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/load][%d] loadSnapshotNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewLoadSnapshotBadRequest creates a LoadSnapshotBadRequest with default headers values
|
||||
func NewLoadSnapshotBadRequest() *LoadSnapshotBadRequest {
|
||||
return &LoadSnapshotBadRequest{}
|
||||
}
|
||||
|
||||
/*LoadSnapshotBadRequest handles this case with default header values.
|
||||
|
||||
Snapshot cannot be loaded due to bad input
|
||||
*/
|
||||
type LoadSnapshotBadRequest struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/load][%d] loadSnapshotBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewLoadSnapshotDefault creates a LoadSnapshotDefault with default headers values
|
||||
func NewLoadSnapshotDefault(code int) *LoadSnapshotDefault {
|
||||
return &LoadSnapshotDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*LoadSnapshotDefault handles this case with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
type LoadSnapshotDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
// Code gets the status code for the load snapshot default response
|
||||
func (o *LoadSnapshotDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /snapshot/load][%d] loadSnapshot default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoadSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -108,6 +108,66 @@ func (a *Client) PutMmds(params *PutMmdsParams) (*PutMmdsNoContent, error) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
PutMmdsConfig sets m m d s configuration pre boot only
|
||||
|
||||
Creates MMDS configuration to be used by the MMDS network stack.
|
||||
*/
|
||||
func (a *Client) PutMmdsConfig(params *PutMmdsConfigParams) (*PutMmdsConfigNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPutMmdsConfigParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "PutMmdsConfig",
|
||||
Method: "PUT",
|
||||
PathPattern: "/mmds/config",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PutMmdsConfigReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*PutMmdsConfigNoContent), nil
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
CreateSnapshot creates a full snapshot post boot only
|
||||
|
||||
Creates a snapshot of the microVM state. The microVM should be in the `Paused` state.
|
||||
*/
|
||||
func (a *Client) CreateSnapshot(params *CreateSnapshotParams) (*CreateSnapshotNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateSnapshotParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "createSnapshot",
|
||||
Method: "PUT",
|
||||
PathPattern: "/snapshot/create",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateSnapshotReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*CreateSnapshotNoContent), nil
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
CreateSyncAction creates a synchronous action
|
||||
*/
|
||||
@ -195,7 +255,37 @@ func (a *Client) GetMachineConfiguration(params *GetMachineConfigurationParams)
|
||||
}
|
||||
|
||||
/*
|
||||
PatchGuestDriveByID updates the properties of a drive
|
||||
LoadSnapshot loads a snapshot pre boot only
|
||||
|
||||
Loads the microVM state from a snapshot. Only accepted on a fresh Firecracker process (before configuring any resource other than the Logger and Metrics).
|
||||
*/
|
||||
func (a *Client) LoadSnapshot(params *LoadSnapshotParams) (*LoadSnapshotNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewLoadSnapshotParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "loadSnapshot",
|
||||
Method: "PUT",
|
||||
PathPattern: "/snapshot/load",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &LoadSnapshotReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*LoadSnapshotNoContent), nil
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
PatchGuestDriveByID updates the properties of a drive post boot only
|
||||
|
||||
Updates the properties of the drive with the ID specified by drive_id path parameter. Will fail if update is not possible.
|
||||
*/
|
||||
@ -225,7 +315,7 @@ func (a *Client) PatchGuestDriveByID(params *PatchGuestDriveByIDParams) (*PatchG
|
||||
}
|
||||
|
||||
/*
|
||||
PatchGuestNetworkInterfaceByID updates the rate limiters applied to a network interface
|
||||
PatchGuestNetworkInterfaceByID updates the rate limiters applied to a network interface post boot only
|
||||
|
||||
Updates the rate limiters applied to a network interface.
|
||||
*/
|
||||
@ -255,7 +345,7 @@ func (a *Client) PatchGuestNetworkInterfaceByID(params *PatchGuestNetworkInterfa
|
||||
}
|
||||
|
||||
/*
|
||||
PatchMachineConfiguration partiallies updates the machine configuration of the VM
|
||||
PatchMachineConfiguration partiallies updates the machine configuration of the VM pre boot only
|
||||
|
||||
Partially updates the Virtual Machine Configuration with the specified input. If any of the parameters has an incorrect value, the whole update fails.
|
||||
*/
|
||||
@ -285,9 +375,39 @@ func (a *Client) PatchMachineConfiguration(params *PatchMachineConfigurationPara
|
||||
}
|
||||
|
||||
/*
|
||||
PutGuestBootSource creates or updates the boot source
|
||||
PatchVM updates the micro VM state
|
||||
|
||||
Creates new boot source if one does not already exist, otherwise updates it. Will fail if update is not possible. Note that the only currently supported boot source is LocalImage.
|
||||
Sets the desired state (Paused or Resumed) for the microVM.
|
||||
*/
|
||||
func (a *Client) PatchVM(params *PatchVMParams) (*PatchVMNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPatchVMParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "patchVm",
|
||||
Method: "PATCH",
|
||||
PathPattern: "/vm",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PatchVMReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*PatchVMNoContent), nil
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
PutGuestBootSource creates or updates the boot source pre boot only
|
||||
|
||||
Creates new boot source if one does not already exist, otherwise updates it. Will fail if update is not possible.
|
||||
*/
|
||||
func (a *Client) PutGuestBootSource(params *PutGuestBootSourceParams) (*PutGuestBootSourceNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@ -315,7 +435,7 @@ func (a *Client) PutGuestBootSource(params *PutGuestBootSourceParams) (*PutGuest
|
||||
}
|
||||
|
||||
/*
|
||||
PutGuestDriveByID creates or updates a drive
|
||||
PutGuestDriveByID creates or updates a drive pre boot only
|
||||
|
||||
Creates new drive with ID specified by drive_id path parameter. If a drive with the specified ID already exists, updates its state based on new input. Will fail if update is not possible.
|
||||
*/
|
||||
@ -345,7 +465,7 @@ func (a *Client) PutGuestDriveByID(params *PutGuestDriveByIDParams) (*PutGuestDr
|
||||
}
|
||||
|
||||
/*
|
||||
PutGuestNetworkInterfaceByID creates a network interface
|
||||
PutGuestNetworkInterfaceByID creates a network interface pre boot only
|
||||
|
||||
Creates new network interface with ID specified by iface_id path parameter.
|
||||
*/
|
||||
@ -375,7 +495,7 @@ func (a *Client) PutGuestNetworkInterfaceByID(params *PutGuestNetworkInterfaceBy
|
||||
}
|
||||
|
||||
/*
|
||||
PutGuestVsock creates updates a vsock device
|
||||
PutGuestVsock creates updates a vsock device pre boot only
|
||||
|
||||
The first call creates the device with the configuration specified in body. Subsequent calls will update the device configuration. May fail if update is not possible.
|
||||
*/
|
||||
@ -405,7 +525,7 @@ func (a *Client) PutGuestVsock(params *PutGuestVsockParams) (*PutGuestVsockNoCon
|
||||
}
|
||||
|
||||
/*
|
||||
PutLogger initializes the logger by specifying two named pipes i e for the logs and metrics output
|
||||
PutLogger initializes the logger by specifying a named pipe or a file for the logs output
|
||||
*/
|
||||
func (a *Client) PutLogger(params *PutLoggerParams) (*PutLoggerNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@ -433,7 +553,7 @@ func (a *Client) PutLogger(params *PutLoggerParams) (*PutLoggerNoContent, error)
|
||||
}
|
||||
|
||||
/*
|
||||
PutMachineConfiguration updates the machine configuration of the VM
|
||||
PutMachineConfiguration updates the machine configuration of the VM pre boot only
|
||||
|
||||
Updates the Virtual Machine Configuration with the specified input. Firecracker starts with default values for vCPU count (=1) and memory size (=128 MiB). With Hyperthreading enabled, the vCPU count is restricted to be 1 or an even number, otherwise there are no restrictions regarding the vCPU count. If any of the parameters has an incorrect value, the whole update fails.
|
||||
*/
|
||||
@ -462,6 +582,34 @@ func (a *Client) PutMachineConfiguration(params *PutMachineConfigurationParams)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
PutMetrics initializes the metrics system by specifying a named pipe or a file for the metrics output
|
||||
*/
|
||||
func (a *Client) PutMetrics(params *PutMetricsParams) (*PutMetricsNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPutMetricsParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
ID: "putMetrics",
|
||||
Method: "PUT",
|
||||
PathPattern: "/metrics",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PutMetricsReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*PutMetricsNoContent), nil
|
||||
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
|
@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// NewPatchVMParams creates a new PatchVMParams object
|
||||
// with the default values initialized.
|
||||
func NewPatchVMParams() *PatchVMParams {
|
||||
var ()
|
||||
return &PatchVMParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchVMParamsWithTimeout creates a new PatchVMParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewPatchVMParamsWithTimeout(timeout time.Duration) *PatchVMParams {
|
||||
var ()
|
||||
return &PatchVMParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchVMParamsWithContext creates a new PatchVMParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewPatchVMParamsWithContext(ctx context.Context) *PatchVMParams {
|
||||
var ()
|
||||
return &PatchVMParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchVMParamsWithHTTPClient creates a new PatchVMParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewPatchVMParamsWithHTTPClient(client *http.Client) *PatchVMParams {
|
||||
var ()
|
||||
return &PatchVMParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PatchVMParams contains all the parameters to send to the API endpoint
|
||||
for the patch Vm operation typically these are written to a http.Request
|
||||
*/
|
||||
type PatchVMParams struct {
|
||||
|
||||
/*Body
|
||||
The microVM state
|
||||
|
||||
*/
|
||||
Body *models.VM
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the patch Vm params
|
||||
func (o *PatchVMParams) WithTimeout(timeout time.Duration) *PatchVMParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the patch Vm params
|
||||
func (o *PatchVMParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the patch Vm params
|
||||
func (o *PatchVMParams) WithContext(ctx context.Context) *PatchVMParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the patch Vm params
|
||||
func (o *PatchVMParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the patch Vm params
|
||||
func (o *PatchVMParams) WithHTTPClient(client *http.Client) *PatchVMParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the patch Vm params
|
||||
func (o *PatchVMParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the patch Vm params
|
||||
func (o *PatchVMParams) WithBody(body *models.VM) *PatchVMParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the patch Vm params
|
||||
func (o *PatchVMParams) SetBody(body *models.VM) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PatchVMParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// PatchVMReader is a Reader for the PatchVM structure.
|
||||
type PatchVMReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PatchVMReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
|
||||
case 204:
|
||||
result := NewPatchVMNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewPatchVMBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
result := NewPatchVMDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchVMNoContent creates a PatchVMNoContent with default headers values
|
||||
func NewPatchVMNoContent() *PatchVMNoContent {
|
||||
return &PatchVMNoContent{}
|
||||
}
|
||||
|
||||
/*PatchVMNoContent handles this case with default header values.
|
||||
|
||||
Vm state updated
|
||||
*/
|
||||
type PatchVMNoContent struct {
|
||||
}
|
||||
|
||||
func (o *PatchVMNoContent) Error() string {
|
||||
return fmt.Sprintf("[PATCH /vm][%d] patchVmNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *PatchVMNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPatchVMBadRequest creates a PatchVMBadRequest with default headers values
|
||||
func NewPatchVMBadRequest() *PatchVMBadRequest {
|
||||
return &PatchVMBadRequest{}
|
||||
}
|
||||
|
||||
/*PatchVMBadRequest handles this case with default header values.
|
||||
|
||||
Vm state cannot be updated due to bad input
|
||||
*/
|
||||
type PatchVMBadRequest struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *PatchVMBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PATCH /vm][%d] patchVmBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchVMBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPatchVMDefault creates a PatchVMDefault with default headers values
|
||||
func NewPatchVMDefault(code int) *PatchVMDefault {
|
||||
return &PatchVMDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*PatchVMDefault handles this case with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
type PatchVMDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
// Code gets the status code for the patch Vm default response
|
||||
func (o *PatchVMDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *PatchVMDefault) Error() string {
|
||||
return fmt.Sprintf("[PATCH /vm][%d] patchVm default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchVMDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// NewPutMetricsParams creates a new PutMetricsParams object
|
||||
// with the default values initialized.
|
||||
func NewPutMetricsParams() *PutMetricsParams {
|
||||
var ()
|
||||
return &PutMetricsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMetricsParamsWithTimeout creates a new PutMetricsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewPutMetricsParamsWithTimeout(timeout time.Duration) *PutMetricsParams {
|
||||
var ()
|
||||
return &PutMetricsParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMetricsParamsWithContext creates a new PutMetricsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewPutMetricsParamsWithContext(ctx context.Context) *PutMetricsParams {
|
||||
var ()
|
||||
return &PutMetricsParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMetricsParamsWithHTTPClient creates a new PutMetricsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewPutMetricsParamsWithHTTPClient(client *http.Client) *PutMetricsParams {
|
||||
var ()
|
||||
return &PutMetricsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PutMetricsParams contains all the parameters to send to the API endpoint
|
||||
for the put metrics operation typically these are written to a http.Request
|
||||
*/
|
||||
type PutMetricsParams struct {
|
||||
|
||||
/*Body
|
||||
Metrics system description
|
||||
|
||||
*/
|
||||
Body *models.Metrics
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the put metrics params
|
||||
func (o *PutMetricsParams) WithTimeout(timeout time.Duration) *PutMetricsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the put metrics params
|
||||
func (o *PutMetricsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the put metrics params
|
||||
func (o *PutMetricsParams) WithContext(ctx context.Context) *PutMetricsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the put metrics params
|
||||
func (o *PutMetricsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the put metrics params
|
||||
func (o *PutMetricsParams) WithHTTPClient(client *http.Client) *PutMetricsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the put metrics params
|
||||
func (o *PutMetricsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the put metrics params
|
||||
func (o *PutMetricsParams) WithBody(body *models.Metrics) *PutMetricsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the put metrics params
|
||||
func (o *PutMetricsParams) SetBody(body *models.Metrics) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PutMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// PutMetricsReader is a Reader for the PutMetrics structure.
|
||||
type PutMetricsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PutMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
|
||||
case 204:
|
||||
result := NewPutMetricsNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewPutMetricsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
result := NewPutMetricsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMetricsNoContent creates a PutMetricsNoContent with default headers values
|
||||
func NewPutMetricsNoContent() *PutMetricsNoContent {
|
||||
return &PutMetricsNoContent{}
|
||||
}
|
||||
|
||||
/*PutMetricsNoContent handles this case with default header values.
|
||||
|
||||
Metrics system created.
|
||||
*/
|
||||
type PutMetricsNoContent struct {
|
||||
}
|
||||
|
||||
func (o *PutMetricsNoContent) Error() string {
|
||||
return fmt.Sprintf("[PUT /metrics][%d] putMetricsNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *PutMetricsNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutMetricsBadRequest creates a PutMetricsBadRequest with default headers values
|
||||
func NewPutMetricsBadRequest() *PutMetricsBadRequest {
|
||||
return &PutMetricsBadRequest{}
|
||||
}
|
||||
|
||||
/*PutMetricsBadRequest handles this case with default header values.
|
||||
|
||||
Metrics system cannot be initialized due to bad input.
|
||||
*/
|
||||
type PutMetricsBadRequest struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *PutMetricsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PUT /metrics][%d] putMetricsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PutMetricsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutMetricsDefault creates a PutMetricsDefault with default headers values
|
||||
func NewPutMetricsDefault(code int) *PutMetricsDefault {
|
||||
return &PutMetricsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*PutMetricsDefault handles this case with default header values.
|
||||
|
||||
Internal server error.
|
||||
*/
|
||||
type PutMetricsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
// Code gets the status code for the put metrics default response
|
||||
func (o *PutMetricsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *PutMetricsDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /metrics][%d] putMetrics default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PutMetricsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// NewPutMmdsConfigParams creates a new PutMmdsConfigParams object
|
||||
// with the default values initialized.
|
||||
func NewPutMmdsConfigParams() *PutMmdsConfigParams {
|
||||
var ()
|
||||
return &PutMmdsConfigParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigParamsWithTimeout creates a new PutMmdsConfigParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewPutMmdsConfigParamsWithTimeout(timeout time.Duration) *PutMmdsConfigParams {
|
||||
var ()
|
||||
return &PutMmdsConfigParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigParamsWithContext creates a new PutMmdsConfigParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewPutMmdsConfigParamsWithContext(ctx context.Context) *PutMmdsConfigParams {
|
||||
var ()
|
||||
return &PutMmdsConfigParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigParamsWithHTTPClient creates a new PutMmdsConfigParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewPutMmdsConfigParamsWithHTTPClient(client *http.Client) *PutMmdsConfigParams {
|
||||
var ()
|
||||
return &PutMmdsConfigParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PutMmdsConfigParams contains all the parameters to send to the API endpoint
|
||||
for the put mmds config operation typically these are written to a http.Request
|
||||
*/
|
||||
type PutMmdsConfigParams struct {
|
||||
|
||||
/*Body
|
||||
The MMDS configuration as JSON.
|
||||
|
||||
*/
|
||||
Body *models.MmdsConfig
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) WithTimeout(timeout time.Duration) *PutMmdsConfigParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) WithContext(ctx context.Context) *PutMmdsConfigParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) WithHTTPClient(client *http.Client) *PutMmdsConfigParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) WithBody(body *models.MmdsConfig) *PutMmdsConfigParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the put mmds config params
|
||||
func (o *PutMmdsConfigParams) SetBody(body *models.MmdsConfig) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PutMmdsConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||
)
|
||||
|
||||
// PutMmdsConfigReader is a Reader for the PutMmdsConfig structure.
|
||||
type PutMmdsConfigReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PutMmdsConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
|
||||
case 204:
|
||||
result := NewPutMmdsConfigNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
case 400:
|
||||
result := NewPutMmdsConfigBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
result := NewPutMmdsConfigDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigNoContent creates a PutMmdsConfigNoContent with default headers values
|
||||
func NewPutMmdsConfigNoContent() *PutMmdsConfigNoContent {
|
||||
return &PutMmdsConfigNoContent{}
|
||||
}
|
||||
|
||||
/*PutMmdsConfigNoContent handles this case with default header values.
|
||||
|
||||
MMDS configuration was created/updated.
|
||||
*/
|
||||
type PutMmdsConfigNoContent struct {
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigNoContent) Error() string {
|
||||
return fmt.Sprintf("[PUT /mmds/config][%d] putMmdsConfigNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigBadRequest creates a PutMmdsConfigBadRequest with default headers values
|
||||
func NewPutMmdsConfigBadRequest() *PutMmdsConfigBadRequest {
|
||||
return &PutMmdsConfigBadRequest{}
|
||||
}
|
||||
|
||||
/*PutMmdsConfigBadRequest handles this case with default header values.
|
||||
|
||||
MMDS configuration cannot be updated due to bad input.
|
||||
*/
|
||||
type PutMmdsConfigBadRequest struct {
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PUT /mmds/config][%d] putMmdsConfigBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPutMmdsConfigDefault creates a PutMmdsConfigDefault with default headers values
|
||||
func NewPutMmdsConfigDefault(code int) *PutMmdsConfigDefault {
|
||||
return &PutMmdsConfigDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*PutMmdsConfigDefault handles this case with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
type PutMmdsConfigDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.Error
|
||||
}
|
||||
|
||||
// Code gets the status code for the put mmds config default response
|
||||
func (o *PutMmdsConfigDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /mmds/config][%d] PutMmdsConfig default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PutMmdsConfigDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Error)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -2,10 +2,10 @@ swagger: "2.0"
|
||||
info:
|
||||
title: Firecracker API
|
||||
description: RESTful public-facing API.
|
||||
The API is accessible through HTTP calls on specific URLs
|
||||
carrying JSON modeled data.
|
||||
The transport medium is a Unix Domain Socket.
|
||||
version: 0.21.1
|
||||
The API is accessible through HTTP calls on specific URLs
|
||||
carrying JSON modeled data.
|
||||
The transport medium is a Unix Domain Socket.
|
||||
version: 0.23.1
|
||||
termsOfService: ""
|
||||
contact:
|
||||
email: "compute-capsule@amazon.com"
|
||||
@ -43,11 +43,11 @@ paths:
|
||||
summary: Creates a synchronous action.
|
||||
operationId: createSyncAction
|
||||
parameters:
|
||||
- name: info
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/InstanceActionInfo"
|
||||
- name: info
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/InstanceActionInfo"
|
||||
responses:
|
||||
204:
|
||||
description: The update was successful
|
||||
@ -62,19 +62,18 @@ paths:
|
||||
|
||||
/boot-source:
|
||||
put:
|
||||
summary: Creates or updates the boot source.
|
||||
summary: Creates or updates the boot source. Pre-boot only.
|
||||
description:
|
||||
Creates new boot source if one does not already exist, otherwise updates it.
|
||||
Will fail if update is not possible.
|
||||
Note that the only currently supported boot source is LocalImage.
|
||||
operationId: putGuestBootSource
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest boot source properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/BootSource"
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest boot source properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/BootSource"
|
||||
responses:
|
||||
204:
|
||||
description: Boot source created/updated
|
||||
@ -89,24 +88,24 @@ paths:
|
||||
|
||||
/drives/{drive_id}:
|
||||
put:
|
||||
summary: Creates or updates a drive.
|
||||
summary: Creates or updates a drive. Pre-boot only.
|
||||
description:
|
||||
Creates new drive with ID specified by drive_id path parameter.
|
||||
If a drive with the specified ID already exists, updates its state based on new input.
|
||||
Will fail if update is not possible.
|
||||
operationId: putGuestDriveByID
|
||||
parameters:
|
||||
- name: drive_id
|
||||
in: path
|
||||
description: The id of the guest drive
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest drive properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Drive"
|
||||
- name: drive_id
|
||||
in: path
|
||||
description: The id of the guest drive
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest drive properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Drive"
|
||||
responses:
|
||||
204:
|
||||
description: Drive created/updated
|
||||
@ -119,23 +118,23 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
patch:
|
||||
summary: Updates the properties of a drive.
|
||||
summary: Updates the properties of a drive. Post-boot only.
|
||||
description:
|
||||
Updates the properties of the drive with the ID specified by drive_id path parameter.
|
||||
Will fail if update is not possible.
|
||||
operationId: patchGuestDriveByID
|
||||
parameters:
|
||||
- name: drive_id
|
||||
in: path
|
||||
description: The id of the guest drive
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest drive properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PartialDrive"
|
||||
- name: drive_id
|
||||
in: path
|
||||
description: The id of the guest drive
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest drive properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/PartialDrive"
|
||||
responses:
|
||||
204:
|
||||
description: Drive updated
|
||||
@ -149,27 +148,27 @@ paths:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/logger:
|
||||
put:
|
||||
summary: Initializes the logger by specifying two named pipes (i.e. for the logs and metrics output).
|
||||
operationId: putLogger
|
||||
parameters:
|
||||
put:
|
||||
summary: Initializes the logger by specifying a named pipe or a file for the logs output.
|
||||
operationId: putLogger
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Logging system description
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Logger"
|
||||
responses:
|
||||
204:
|
||||
description: Logger created.
|
||||
400:
|
||||
description: Logger cannot be initialized due to bad input.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
responses:
|
||||
204:
|
||||
description: Logger created.
|
||||
400:
|
||||
description: Logger cannot be initialized due to bad input.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/machine-config:
|
||||
get:
|
||||
@ -190,7 +189,7 @@ paths:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
put:
|
||||
summary: Updates the Machine Configuration of the VM.
|
||||
summary: Updates the Machine Configuration of the VM. Pre-boot only.
|
||||
description:
|
||||
Updates the Virtual Machine Configuration with the specified input.
|
||||
Firecracker starts with default values for vCPU count (=1) and memory size (=128 MiB).
|
||||
@ -199,11 +198,11 @@ paths:
|
||||
If any of the parameters has an incorrect value, the whole update fails.
|
||||
operationId: putMachineConfiguration
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Machine Configuration Parameters
|
||||
schema:
|
||||
$ref: "#/definitions/MachineConfiguration"
|
||||
- name: body
|
||||
in: body
|
||||
description: Machine Configuration Parameters
|
||||
schema:
|
||||
$ref: "#/definitions/MachineConfiguration"
|
||||
responses:
|
||||
204:
|
||||
description: Machine Configuration created/updated
|
||||
@ -217,17 +216,17 @@ paths:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
patch:
|
||||
summary: Partially updates the Machine Configuration of the VM.
|
||||
summary: Partially updates the Machine Configuration of the VM. Pre-boot only.
|
||||
description:
|
||||
Partially updates the Virtual Machine Configuration with the specified input.
|
||||
If any of the parameters has an incorrect value, the whole update fails.
|
||||
operationId: patchMachineConfiguration
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: A subset of Machine Configuration Parameters
|
||||
schema:
|
||||
$ref: "#/definitions/MachineConfiguration"
|
||||
- name: body
|
||||
in: body
|
||||
description: A subset of Machine Configuration Parameters
|
||||
schema:
|
||||
$ref: "#/definitions/MachineConfiguration"
|
||||
responses:
|
||||
204:
|
||||
description: Machine Configuration created/updated
|
||||
@ -240,6 +239,29 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/metrics:
|
||||
put:
|
||||
summary: Initializes the metrics system by specifying a named pipe or a file for the metrics output.
|
||||
operationId: putMetrics
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Metrics system description
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Metrics"
|
||||
responses:
|
||||
204:
|
||||
description: Metrics system created.
|
||||
400:
|
||||
description: Metrics system cannot be initialized due to bad input.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/mmds:
|
||||
put:
|
||||
summary: Creates a MMDS (Microvm Metadata Service) data store.
|
||||
@ -286,8 +308,32 @@ paths:
|
||||
description: The MMDS data store JSON.
|
||||
schema:
|
||||
type: object
|
||||
404:
|
||||
description: The MMDS data store content can not be found.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/mmds/config:
|
||||
put:
|
||||
summary: Set MMDS configuration. Pre-boot only.
|
||||
description:
|
||||
Creates MMDS configuration to be used by the MMDS network stack.
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: The MMDS configuration as JSON.
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/MmdsConfig"
|
||||
responses:
|
||||
204:
|
||||
description: MMDS configuration was created/updated.
|
||||
400:
|
||||
description: Cannot get the MMDS data store due to bad input.
|
||||
description: MMDS configuration cannot be updated due to bad input.
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
@ -297,22 +343,22 @@ paths:
|
||||
|
||||
/network-interfaces/{iface_id}:
|
||||
put:
|
||||
summary: Creates a network interface.
|
||||
summary: Creates a network interface. Pre-boot only.
|
||||
description:
|
||||
Creates new network interface with ID specified by iface_id path parameter.
|
||||
operationId: putGuestNetworkInterfaceByID
|
||||
parameters:
|
||||
- name: iface_id
|
||||
in: path
|
||||
description: The id of the guest network interface
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest network interface properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/NetworkInterface"
|
||||
- name: iface_id
|
||||
in: path
|
||||
description: The id of the guest network interface
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest network interface properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/NetworkInterface"
|
||||
responses:
|
||||
204:
|
||||
description: Network interface created/updated
|
||||
@ -325,7 +371,7 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
patch:
|
||||
summary: Updates the rate limiters applied to a network interface.
|
||||
summary: Updates the rate limiters applied to a network interface. Post-boot only.
|
||||
description:
|
||||
Updates the rate limiters applied to a network interface.
|
||||
operationId: patchGuestNetworkInterfaceByID
|
||||
@ -353,21 +399,99 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/snapshot/create:
|
||||
put:
|
||||
summary: Creates a full snapshot. Post-boot only.
|
||||
description:
|
||||
Creates a snapshot of the microVM state. The microVM should be
|
||||
in the `Paused` state.
|
||||
operationId: createSnapshot
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: The configuration used for creating a snaphot.
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SnapshotCreateParams"
|
||||
responses:
|
||||
204:
|
||||
description: Snapshot created
|
||||
400:
|
||||
description: Snapshot cannot be created due to bad input
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/snapshot/load:
|
||||
put:
|
||||
summary: Loads a snapshot. Pre-boot only.
|
||||
description:
|
||||
Loads the microVM state from a snapshot.
|
||||
Only accepted on a fresh Firecracker process (before configuring
|
||||
any resource other than the Logger and Metrics).
|
||||
operationId: loadSnapshot
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: The configuration used for loading a snaphot.
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SnapshotLoadParams"
|
||||
responses:
|
||||
204:
|
||||
description: Snapshot loaded
|
||||
400:
|
||||
description: Snapshot cannot be loaded due to bad input
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/vm:
|
||||
patch:
|
||||
summary: Updates the microVM state.
|
||||
description:
|
||||
Sets the desired state (Paused or Resumed) for the microVM.
|
||||
operationId: patchVm
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: The microVM state
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Vm"
|
||||
responses:
|
||||
204:
|
||||
description: Vm state updated
|
||||
400:
|
||||
description: Vm state cannot be updated due to bad input
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
default:
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: "#/definitions/Error"
|
||||
|
||||
/vsock:
|
||||
put:
|
||||
summary: Creates/updates a vsock device.
|
||||
summary: Creates/updates a vsock device. Pre-boot only.
|
||||
description:
|
||||
The first call creates the device with the configuration specified
|
||||
in body. Subsequent calls will update the device configuration.
|
||||
The first call creates the device with the configuration specified
|
||||
in body. Subsequent calls will update the device configuration.
|
||||
May fail if update is not possible.
|
||||
operationId: putGuestVsock
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest vsock properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Vsock"
|
||||
- name: body
|
||||
in: body
|
||||
description: Guest vsock properties
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Vsock"
|
||||
responses:
|
||||
204:
|
||||
description: Vsock created/updated
|
||||
@ -388,12 +512,15 @@ definitions:
|
||||
description:
|
||||
Boot source descriptor.
|
||||
properties:
|
||||
kernel_image_path:
|
||||
type: string
|
||||
description: Host level path to the kernel image used to boot the guest
|
||||
boot_args:
|
||||
type: string
|
||||
description: Kernel boot arguments
|
||||
initrd_path:
|
||||
type: string
|
||||
description: Host level path to the initrd image used to boot the guest
|
||||
kernel_image_path:
|
||||
type: string
|
||||
description: Host level path to the kernel image used to boot the guest
|
||||
|
||||
CpuTemplate:
|
||||
type: string
|
||||
@ -408,15 +535,14 @@ definitions:
|
||||
type: object
|
||||
required:
|
||||
- drive_id
|
||||
- path_on_host
|
||||
- is_root_device
|
||||
- is_read_only
|
||||
- is_root_device
|
||||
- path_on_host
|
||||
properties:
|
||||
drive_id:
|
||||
type: string
|
||||
path_on_host:
|
||||
type: string
|
||||
description: Host level path for the guest drive
|
||||
is_read_only:
|
||||
type: boolean
|
||||
is_root_device:
|
||||
type: boolean
|
||||
partuuid:
|
||||
@ -425,8 +551,9 @@ definitions:
|
||||
Represents the unique id of the boot partition of this device. It is
|
||||
optional and it will be taken into account only if the is_root_device
|
||||
field is true.
|
||||
is_read_only:
|
||||
type: boolean
|
||||
path_on_host:
|
||||
type: string
|
||||
description: Host level path for the guest drive
|
||||
rate_limiter:
|
||||
$ref: "#/definitions/RateLimiter"
|
||||
|
||||
@ -449,9 +576,9 @@ definitions:
|
||||
description: Enumeration indicating what type of action is contained in the payload
|
||||
type: string
|
||||
enum:
|
||||
- FlushMetrics
|
||||
- InstanceStart
|
||||
- SendCtrlAltDel
|
||||
- FlushMetrics
|
||||
- InstanceStart
|
||||
- SendCtrlAltDel
|
||||
|
||||
InstanceInfo:
|
||||
type: object
|
||||
@ -459,21 +586,19 @@ definitions:
|
||||
Describes MicroVM instance information.
|
||||
required:
|
||||
- id
|
||||
- state
|
||||
- vmm_version
|
||||
properties:
|
||||
app_name:
|
||||
description: Application name.
|
||||
type: string
|
||||
id:
|
||||
description: MicroVM / instance ID.
|
||||
type: string
|
||||
state:
|
||||
started:
|
||||
description:
|
||||
The current detailed state of the Firecracker instance.
|
||||
This value is read-only for the control-plane.
|
||||
type: string
|
||||
enum:
|
||||
- Uninitialized
|
||||
- Starting
|
||||
- Running
|
||||
type: boolean
|
||||
vmm_version:
|
||||
description: MicroVM hypervisor build version.
|
||||
type: string
|
||||
@ -483,20 +608,16 @@ definitions:
|
||||
description:
|
||||
Describes the configuration option for the logging capability.
|
||||
required:
|
||||
- log_fifo
|
||||
- metrics_fifo
|
||||
- log_path
|
||||
properties:
|
||||
log_fifo:
|
||||
type: string
|
||||
description: The named pipe for the human readable log output.
|
||||
metrics_fifo:
|
||||
type: string
|
||||
description: The named pipe where the JSON-formatted metrics will be flushed.
|
||||
level:
|
||||
type: string
|
||||
description: Set the level.
|
||||
description: Set the level. The possible values are case-insensitive.
|
||||
enum: [Error, Warning, Info, Debug]
|
||||
default: Warning
|
||||
log_path:
|
||||
type: string
|
||||
description: Path to the named pipe or file for the human readable log output.
|
||||
show_level:
|
||||
type: boolean
|
||||
description: Whether or not to output the level in the logs.
|
||||
@ -512,39 +633,61 @@ definitions:
|
||||
Describes the number of vCPUs, memory size, Hyperthreading capabilities and
|
||||
the CPU template.
|
||||
required:
|
||||
- vcpu_count
|
||||
- mem_size_mib
|
||||
- ht_enabled
|
||||
- mem_size_mib
|
||||
- vcpu_count
|
||||
properties:
|
||||
cpu_template:
|
||||
$ref: "#/definitions/CpuTemplate"
|
||||
ht_enabled:
|
||||
type: boolean
|
||||
description: Flag for enabling/disabling Hyperthreading
|
||||
mem_size_mib:
|
||||
type: integer
|
||||
description: Memory size of VM
|
||||
track_dirty_pages:
|
||||
type: boolean
|
||||
description:
|
||||
Enable dirty page tracking. If this is enabled, then incremental guest memory
|
||||
snapshots can be created. These belong to diff snapshots, which contain, besides
|
||||
the microVM state, only the memory dirtied since a previous snapshot. Full snapshots
|
||||
each contain a full copy of the guest memory.
|
||||
vcpu_count:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 32
|
||||
description: Number of vCPUs (either 1 or an even number)
|
||||
mem_size_mib:
|
||||
type: integer
|
||||
description: Memory size of VM
|
||||
ht_enabled:
|
||||
type: boolean
|
||||
description: Flag for enabling/disabling Hyperthreading
|
||||
cpu_template:
|
||||
$ref: "#/definitions/CpuTemplate"
|
||||
|
||||
Metrics:
|
||||
type: object
|
||||
description:
|
||||
Describes the configuration option for the metrics capability.
|
||||
required:
|
||||
- metrics_path
|
||||
properties:
|
||||
metrics_path:
|
||||
type: string
|
||||
description: Path to the named pipe or file where the JSON-formatted metrics are flushed.
|
||||
|
||||
MmdsConfig:
|
||||
type: object
|
||||
description:
|
||||
Defines the MMDS configuration.
|
||||
properties:
|
||||
ipv4_address:
|
||||
type: string
|
||||
format: "169.254.([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4]).([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
|
||||
default: "169.254.169.254"
|
||||
description: A valid IPv4 link-local address.
|
||||
|
||||
NetworkInterface:
|
||||
type: object
|
||||
description:
|
||||
Defines a network interface.
|
||||
required:
|
||||
- iface_id
|
||||
- host_dev_name
|
||||
- iface_id
|
||||
properties:
|
||||
iface_id:
|
||||
type: string
|
||||
guest_mac:
|
||||
type: string
|
||||
host_dev_name:
|
||||
type: string
|
||||
description: Host level path for the guest network interface
|
||||
allow_mmds_requests:
|
||||
type: boolean
|
||||
description:
|
||||
@ -553,6 +696,13 @@ definitions:
|
||||
both ARP requests for 169.254.169.254 and TCP segments heading to the
|
||||
same address are intercepted by the device model, and do not reach
|
||||
the associated TAP device.
|
||||
guest_mac:
|
||||
type: string
|
||||
host_dev_name:
|
||||
type: string
|
||||
description: Host level path for the guest network interface
|
||||
iface_id:
|
||||
type: string
|
||||
rx_rate_limiter:
|
||||
$ref: "#/definitions/RateLimiter"
|
||||
tx_rate_limiter:
|
||||
@ -598,6 +748,48 @@ definitions:
|
||||
$ref: "#/definitions/TokenBucket"
|
||||
description: Token bucket with operations as tokens
|
||||
|
||||
SnapshotCreateParams:
|
||||
type: object
|
||||
required:
|
||||
- mem_file_path
|
||||
- snapshot_path
|
||||
properties:
|
||||
mem_file_path:
|
||||
type: string
|
||||
description: Path to the file that will contain the guest memory.
|
||||
snapshot_path:
|
||||
type: string
|
||||
description: Path to the file that will contain the microVM state.
|
||||
snapshot_type:
|
||||
type: string
|
||||
enum:
|
||||
- Full
|
||||
description:
|
||||
Type of snapshot to create. It is optional and by default, a full
|
||||
snapshot is created.
|
||||
version:
|
||||
type: string
|
||||
description:
|
||||
The microVM version for which we want to create the snapshot.
|
||||
It is optional and it defaults to the current version.
|
||||
|
||||
SnapshotLoadParams:
|
||||
type: object
|
||||
required:
|
||||
- mem_file_path
|
||||
- snapshot_path
|
||||
properties:
|
||||
enable_diff_snapshots:
|
||||
type: boolean
|
||||
description:
|
||||
Enable support for incremental (diff) snapshots by tracking dirty guest pages.
|
||||
mem_file_path:
|
||||
type: string
|
||||
description: Path to the file that contains the guest memory to be loaded.
|
||||
snapshot_path:
|
||||
type: string
|
||||
description: Path to the file that contains the microVM state to be loaded.
|
||||
|
||||
TokenBucket:
|
||||
type: object
|
||||
description:
|
||||
@ -610,14 +802,9 @@ definitions:
|
||||
bound in size by the amount of tokens available.
|
||||
Once the token bucket is empty, consumption speed is bound by the refill_rate.
|
||||
required:
|
||||
- size
|
||||
- refill_time
|
||||
- size
|
||||
properties:
|
||||
size:
|
||||
type: integer
|
||||
format: uint64
|
||||
description: The total number of tokens this bucket can hold.
|
||||
minimum: 0
|
||||
one_time_burst:
|
||||
type: integer
|
||||
format: uint64
|
||||
@ -628,6 +815,24 @@ definitions:
|
||||
format: uint64
|
||||
description: The amount of milliseconds it takes for the bucket to refill.
|
||||
minimum: 0
|
||||
size:
|
||||
type: integer
|
||||
format: uint64
|
||||
description: The total number of tokens this bucket can hold.
|
||||
minimum: 0
|
||||
|
||||
Vm:
|
||||
type: object
|
||||
description:
|
||||
Defines the microVM running state. It is especially useful in the snapshotting context.
|
||||
required:
|
||||
- state
|
||||
properties:
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- Paused
|
||||
- Resumed
|
||||
|
||||
Vsock:
|
||||
type: object
|
||||
@ -642,12 +847,10 @@ definitions:
|
||||
bound and listening on Unix sockets at `uds_path_<PORT>`.
|
||||
E.g. "/path/to/host_vsock.sock_52" for port number 52.
|
||||
required:
|
||||
- vsock_id
|
||||
- guest_cid
|
||||
- uds_path
|
||||
- vsock_id
|
||||
properties:
|
||||
vsock_id:
|
||||
type: string
|
||||
guest_cid:
|
||||
type: integer
|
||||
minimum: 3
|
||||
@ -655,3 +858,5 @@ definitions:
|
||||
uds_path:
|
||||
type: string
|
||||
description: Path to UNIX domain socket, used to proxy vsock connections.
|
||||
vsock_id:
|
||||
type: string
|
||||
|
@ -21,4 +21,6 @@ type FcConfig struct {
|
||||
NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`
|
||||
|
||||
Logger *models.Logger `json:"logger,omitempty"`
|
||||
|
||||
Metrics *models.Metrics `json:"metrics,omitempty"`
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ assets:
|
||||
uscan-url: >-
|
||||
https://github.com/firecracker-microvm/firecracker/tags
|
||||
.*/v?(\d\S+)\.tar\.gz
|
||||
version: "v0.21.1"
|
||||
version: "v0.23.1"
|
||||
|
||||
qemu:
|
||||
description: "VMM that uses KVM"
|
||||
|
Loading…
Reference in New Issue
Block a user